ApplicationInfo::ApplicationInfo(QObject *parent): QObject(parent)
{

    m_isMobile = false;
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) || defined(Q_OS_BLACKBERRY)
    m_isMobile = true;
#endif

#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
    m_platform = Linux;
#elif defined(Q_OS_WIN)
    m_platform = Windows;
#elif defined(Q_OS_MAC)
    m_platform = MacOSX;
#elif defined(Q_OS_ANDROID)
    m_platform = Android;
#elif defined(Q_OS_IOS)
    m_platform = Ios;
#elif defined(Q_OS_BLACKBERRY)
    m_platform = Blackberry;
#endif

    QRect rect = qApp->primaryScreen()->geometry();
    m_ratio = m_isMobile ? qMin(qMax(rect.width(), rect.height())/800. , qMin(rect.width(), rect.height())/520.) : 1;
    m_sliderHandleWidth = getSizeWithRatio(70);
    m_sliderHandleHeight = getSizeWithRatio(87);
    m_sliderGapWidth = getSizeWithRatio(100);
    m_isPortraitMode = m_isMobile ? rect.height() > rect.width() : false;
    m_hMargin =  m_isPortraitMode ? 20 * ratio() : 50 * ratio();
    m_applicationWidth = m_isMobile ? rect.width() : 1120;

    if (m_isMobile)
        connect(qApp->primaryScreen(), SIGNAL(physicalSizeChanged(QSizeF)), this, SLOT(notifyPortraitMode()));
}
void ApplicationInfo::setIsPortraitMode(const bool newMode)
{
    if (m_isPortraitMode != newMode) {
        m_isPortraitMode = newMode;
        m_hMargin = m_isPortraitMode ? 20 * ratio() : 50 * ratio();
        emit portraitModeChanged();
        emit hMarginChanged();
    }
}
Beispiel #3
0
  void InlineCacheRegistry::print_stats(STATE) {
    SYNC(state);
    int total = 0;
    std::vector<int> sizes(cTrackedICHits + 1);

    int overflow = 0;

    for(CacheHash::iterator hi = caches_.begin();
        hi != caches_.end();
        ++hi) {
      for(CacheVector::iterator vi = hi->second.begin();
          vi != hi->second.end();
          ++vi) {
        InlineCache* ic = *vi;
        int seen = ic->classes_seen();
        if(ic->seen_classes_overflow() > 0) {
          total++;
          overflow++;
        } else if(seen > 0) {
          total++;
          sizes[seen]++;
        }
      }
    }

    std::cerr << "IC Stats:\n";
    for(int i = 1; i < cTrackedICHits + 1; i++) {
      std::cerr << " " << i << ": " << sizes[i] << " "
                << ratio(sizes[i], total) << "%\n";
    }

    std::cerr << cTrackedICHits << "+: " << overflow << " "
              << ratio(overflow, total) << "%\n";

    // print out the mega-morphic ones
    std::cerr << "\nMegamorphic call sites:\n";

    for(CacheHash::iterator hi = caches_.begin();
        hi != caches_.end();
        ++hi) {
      for(CacheVector::iterator vi = hi->second.begin();
          vi != hi->second.end();
          ++vi) {
        InlineCache* ic = *vi;
        if(ic->seen_classes_overflow() > 0) {
          ic->print(state, std::cerr);
          std::cerr << "location: ";
          ic->print_location(state, std::cerr);
          std::cerr << "\n\n";
        }
      }
    }
  }
Beispiel #4
0
int results_compare(struct ts_results *tsr1, struct ts_results *tsr2)
{
	int i;
	struct ts_plugin_results *tspr1, *tspr2;

	if (!tsr1 || !tsr2) {
		CRITICAL("Null energy result list\n");
		return -1;
	}

	if (tsr1->nr_results != tsr2->nr_results)
		WARNING("There is a different number of results\n");

	tspr1 = tsr1->tspr;
	tspr2 = tsr2->tspr;

	if (!tspr1 || !tspr2) {
		CRITICAL("No plugin results !\n");
		return -1;
	}

	for (i = 0; i < tsr1->nr_results; i++) {

		struct ts_plugin_results *tspr;
		char *name = basename(tsr1->tspr[i].path);

		tspr = results_find(tspr1[i].path, tsr2);
		if (!tspr) {
			WARNING("Failed to find plugin '%s' result to compare\n", name);
			continue;
		}

		DEBUG("'%s': %.0lf / %.0lf usecs\n",
		      name, tspr1[i].duration, tspr->duration);
		DEBUG("'%s': %lf / %lf uJ\n", name, tspr1[i].energy, tspr->energy);

		NOTICE("'%s': %+.2lf%% usecs / %+.2lf%% uJ\n",
		       name, ratio(tspr1[i].duration, tspr->duration),
		       ratio(tspr1[i].energy, tspr->energy));
	}

	DEBUG("Overall time: %.0lf / %.0lf usecs\n",
	      tsr1->duration, tsr2->duration);
	DEBUG("Overall energy: %lf / %lf uJ\n", tsr1->energy, tsr2->energy);

	NOTICE("Overall: %+.2lf%% usecs / %+.2lf%% uJ\n",
	       ratio(tsr1->duration, tsr2->duration),
	       ratio(tsr1->energy, tsr2->energy));

	return 0;
}
Beispiel #5
0
/**
 * parameter:
 * @lp1 the left bound of the first bucket
 * @rp1	the right bound of the first bucket
 * @d1 	the distinct value in the first bucket
 * @lp2 the left bound of the second bucket
 * @rp2 the right bound of the second bucket
 * @d2 	the distinct value in the second bucket
 */
unsigned long product(const void *lp1, const void *rp1, const int d1,
		const int c1, const void *lp2, const void *rp2, const int d2,
		const int c2, const column_type *type) {

	double r1 = ratio(lp1, rp1, lp2, rp2, type);
	double r2 = ratio(lp2, rp2, lp1, rp1, type);

	int numDistinctValue1 = d1 * r1;
	int numDistinctValue2 = d2 * r2;

	int numCombination =
			numDistinctValue1 < numDistinctValue2 ?
					numDistinctValue1 : numDistinctValue2;

	return c1 / d1 * c2 / d2 * numCombination;
}
Beispiel #6
0
/**
 * assume both lowPara and upperPara is legal
 * lowPara:
 * upperPara:
 * range is used with < and >, instead of =
 * for <=, it decomposed into < and =
 */
unsigned long Estimation::estRangeOper(AttributeID attrID, void *lowPara,
		void *upperPara) {
	unsigned long ret = 0;

	const Histogram *stat = StatManager::getInstance()->getHistogram(attrID);

	Attribute attr =
			Catalog::getInstance()->getTable(attrID.table_id)->getAttribute(
					attrID.offset);
	Operate *op = attr.attrType->operate;

//	column_type* type =
//			Catalog::getInstance()->getTable(attrID.table_id)->getAttribute(
//					attrID.offset).attrType;
//	Operate *op = type->operate;

	double sel = 0;
	for (unsigned i = 0; i < stat->m_bucketCnt - 1; ++i) {

		if ((op->Compare(lowPara, stat->m_staValues1[i]) <= 0)
				&& (op->Compare(stat->m_staValues1[i + 1], upperPara) <= 0)) {
			sel += 1;
			//the lowest value of the bucket is unreachable
			if (op->Equal(lowPara, stat->m_staValues1[i]))
				sel -= 1.0 / stat->m_staNumbers1[i];
		} else {	//intersect
			double r = ratio(stat->m_staValues1[i], stat->m_staValues1[i + 1],
					lowPara, upperPara, attr.attrType);
			sel += r;
		}
	}
	sel = sel / (stat->m_bucketCnt - 1);
	ret = sel * stat->m_staCount;
	return ret;
}
Beispiel #7
0
MyWidget::MyWidget(QGLWidget *parent)
  : QGLWidget(QGLFormat(), parent)
{

  setMouseTracking(true);

  setPaletteBackgroundColor(QColor(255,255,255));

  setstatus();

  menu = new QMenuBar(this, "Menu bar");
  file = new QPopupMenu( this , "file");
  save = new QPopupMenu( this , "save");
  placement = new QPopupMenu( this , "placement");
  options = new QPopupMenu( this , "options");
  view = new QPopupMenu( this , "viewing");
  save->insertItem( "Save &eps file", this, SLOT(savedepsfile()), CTRL+Key_E );
  save->insertItem( "Save &stl file", this, SLOT(savedstlfile()), CTRL+Key_S );
  file->insertItem( "&Load", this, SLOT(openedfile()), CTRL+Key_L );
  generate_id = placement->insertItem( "&Generate", &p, SLOT(generate()), CTRL+Key_G );
  generatefirst_id = placement->insertItem( "Generate &First", &p, SLOT(generateFirst()), CTRL+Key_F );
  generatenext_id = placement->insertItem( "Generate &Next", &p, SLOT(generateNext()), CTRL+Key_N );
  generateten_id = placement->insertItem( "Next &ten streamlines", &p, SLOT(generateTen()), CTRL+Key_T );
  generateresume_id = placement->insertItem( "&Resume the placement", &p, SLOT(generateAll()), CTRL+Key_C );
  clear_id = placement->insertItem( "&Clear", &p, SLOT(purge()), CTRL+Key_M );
  drawstl_id = view->insertItem( "&Draw streamlines", &p, SLOT(draw_stl()), CTRL+Key_D );
  drawpq_id = view->insertItem( "Draw &queue elements", &p, SLOT(draw_pq()), CTRL+Key_Q );
  drawtr_id = view->insertItem( "Draw t&riangulation", &p, SLOT(draw_tr()), CTRL+Key_R );
  drawbc_id = view->insertItem( "Draw &biggest circle", &p, SLOT(draw_bc()), CTRL+Key_B );
  addimage_id = placement->insertItem( "&Image", this, SLOT(openedimage()), CTRL+Key_I );
  options->insertItem( "Density...", &p, SLOT(density()));
  options->insertItem( "Saturation ration...", &p, SLOT(ratio()));
  options->insertItem( "Sampling step...", &p, SLOT(sampling()));
  options->insertItem( "Integrating step...", &p, SLOT(integrating()));
  placement->insertItem( "&Options ", options );
  save_id = file->insertItem( "&Save", save );
  menu->insertItem( "&File", file );
  menu->insertItem( "&Placement", placement );
  view_id = menu->insertItem( "&View ", view );
  file->insertItem( "&Quit", qApp, SLOT(quit()), ALT+Key_F4 );

  // desable all generator menu items
  placement->setItemEnabled(generate_id, false);
  placement->setItemEnabled(generatefirst_id, false);
  placement->setItemEnabled(generatenext_id, false);
  placement->setItemEnabled(generateten_id, false);
  placement->setItemEnabled(generateresume_id, false);
  placement->setItemEnabled(clear_id, false);

  menu->setItemEnabled(view_id, false);

  placement->setItemEnabled(addimage_id, false);
  file->setItemEnabled(save_id, false);


  connect(this, SIGNAL(fileloaded(const QString &)), &p, SLOT(load(const QString &)));
  connect(this, SIGNAL(imageloaded(const QString &)), &p, SLOT(image(const QString &)));
  connect(&p, SIGNAL(optionschanged()), this, SLOT(updatestatus()));

}
Beispiel #8
0
void RELabel::renderAtWithShadow(const REFloat32 x, const REFloat32 y)
{
	if (_font) 
	{
		RERenderDevice * device = RERenderDevice::defaultDevice();
		RESize ratio(_font->getCharsScaleRatio());
		if (_frame.height != 0.0f) 
		{
			ratio.height *= (_textInsets.adjustedRect(_frame).height / _frame.height);
		}
		REFloat32 penX = x;
		const REFloat32 bottomY = y + _font->getHeight() - _textInsets.bottom - _textInsets.top;
		for (REUInt32 i = 0; i < _chars.count(); i++) 
		{
			RETTFFontChar * fontChar = _chars[i];
			penX += ((ratio.width * fontChar->offsetX) * _charsSpaceRatio);
			const REFloat32 penY = bottomY - (ratio.height * fontChar->offsetY);
			const REFloat32 width = (ratio.width * fontChar->width);
			const REFloat32 height = (ratio.height * fontChar->height);
			device->renderRect(RERect(penX + _shadowOffset.x, penY + _shadowOffset.y, width, height),
							   _shadowColor, 
							   fontChar->textureFrame, 
							   fontChar->texture);
			device->renderRect(RERect(penX, penY, width, height),
							   _textColor, 
							   fontChar->textureFrame, 
							   fontChar->texture);
			penX += (ratio.width * fontChar->advanceX);
		}
	}
}
Beispiel #9
0
void doTask5B()
{
	int a;
	int b;
	int x;
	int y;
	scanf("%d %d %d %d", &a, &b, &x, &y);

	Fraction monitor(a, b);
	//monitor.reduce();

	Fraction ratio(x, y);
	//ratio.reduce();

	while (monitor != ratio && !monitor.isEmpty()) {
		if (monitor.getValue() > ratio.getValue()) {
			monitor.setNumerator(ratio.getValue() * monitor.getDenominator());
			//monitor.reduce();
		} else {
			monitor.setDenominator(monitor.getNumerator() / ratio.getValue());
			//monitor.reduce();
		}
	}

	if (monitor.isEmpty()) {
		printf("0 0\n");
	} else {
		printf("%d %d\n", monitor.getNumerator(), monitor.getDenominator());
	}

	//auto stop = 0;
	//scanf("%d", &stop);
}
Beispiel #10
0
// drives wheels with differential based on angle
void wheels::drive(int angle, int speed) {
    int left;
    int right;
    
    if (angle > 0) {
        right  = speed;
        left   = speed * ratio(angle); //max angle here is +45 left goes 1/4 as fast
    } else {
        left   = speed;
        right  = speed * ratio(angle); //"max" angle here is -45 _CHANGE
    }

    driveWheels(left, right);
    
    return;
}
Beispiel #11
0
void REGUIApplication::onClickOnScreenEnd(const REFloat32 screenX, const REFloat32 screenY)
{
	if (_userActionViews.count() && _renderDevice) 
	{
		RESize ratio(_renderDevice->screenToRenderSizeRatio());
		
		const REFloat32 x = ratio.width * screenX;
		const REFloat32 y = ratio.height * screenY;
		
		for (REUInt32 i = 0; i < _userActionViews.count(); i++) 
		{
			_userActionViews[i]->userActionClickDidEnd(_lastUserClickPos.x, _lastUserClickPos.y, x, y);
		}
		
		if (_isLastUserClickMoving)
		{
			_isLastUserClickMoving = 0;
			
			if ((fabs(_lastUserClickPos.x - x) > 0.0) || (fabs(_lastUserClickPos.y - y) > 0.0))
			{
				for (REUInt32 i = 0; i < _userActionViews.count(); i++) 
				{
					_userActionViews[i]->userActionClickMovingDidEnd(_lastUserClickPos.x, _lastUserClickPos.y, x, y);
				}
			}
		}
	}
}
Beispiel #12
0
void steering::drive(int angle, int speed) {
    int left;
    int right;
    if (angle > 0) {
        left  = speed;
        right = speed * ratio(angle);
    } else {
        right = speed;
        left  = speed/ratio(angle);
    }

    analogWrite(PWMR, right);
    analogWrite(PWML, left);

    return;
}
Beispiel #13
0
int main(int argc, char ** argv) {
  char buffer[BUFFER_SIZE] = { 0 };
  char comp[BUFFER_SIZE] = { 0 };
  char out[BUFFER_SIZE] = { 0 };
  int count = 0;
  double ratios = 0;
  double rat = 0;
  int inlen, complen, outlen;

  while (fgets(buffer, BUFFER_SIZE, stdin) != NULL) {
    char *end = strchr(buffer, '\n');
    if (end != NULL)
      *end = '\0';
    else
      break;

    inlen = strlen(buffer);
    complen = shoco_compress(buffer, 0, comp, BUFFER_SIZE);
    outlen = shoco_decompress(comp, complen, out, BUFFER_SIZE);
    rat = ratio(inlen, complen);
    if (complen != 0) {
      ++count;
      ratios += rat;
    }
    if ((argc > 1) && ((strcmp(argv[1], "-v") == 0) || (strcmp(argv[1], "--verbose") == 0))) {
      print(buffer, rat);
    }
    assert(inlen == outlen);
    assert(strcmp(buffer, out) == 0);
  }
  printf("Number of compressed strings: %d, average compression ratio: %d%%\n", count, percent(ratios / count));
  return 0;
}
 DiracDeterminantBase::ValueType DiracDeterminantBase::logRatio(ParticleSet& P, int iat,
     ParticleSet::ParticleGradient_t& dG, 
     ParticleSet::ParticleLaplacian_t& dL) {
   //THIS SHOULD NOT BE CALLED
   ValueType r=ratio(P,iat,dG,dL);
   return LogValue = evaluateLogAndPhase(r,PhaseValue);
 }
Beispiel #15
0
int64_t decode(void *buffer, size_t size, int64_t sum)
{
    unsigned int i;
    C(table_t) foobarcontainer;
    FooBar(vec_t) list;
    FooBar(table_t) foobar;
    Bar(struct_t) bar;
    Foo(struct_t) foo;

    foobarcontainer = C(as_root(buffer));
    sum += C(initialized(foobarcontainer));
    sum += StringLen(C(location(foobarcontainer)));
    sum += C(fruit(foobarcontainer));
    list = C(list(foobarcontainer));
    for (i = 0; i < FooBar(vec_len(list)); ++i) {
        foobar = FooBar(vec_at(list, i));
        sum += StringLen(FooBar(name(foobar)));
        sum += FooBar(postfix(foobar));
        sum += (int64_t)FooBar(rating(foobar));
        bar = FooBar(sibling(foobar));
        sum += (int64_t)Bar(ratio(bar));
        sum += Bar(size(bar));
        sum += Bar(time(bar));
        foo = Bar(parent(bar));
        sum += Foo(count(foo));
        sum += Foo(id(foo));
        sum += Foo(length(foo));
        sum += Foo(prefix(foo));
    }
    return sum + 2 * sum;
}
void Box2DGearJoint::setRatio(float _ratio)
{
    if (qFuzzyCompare(_ratio,ratio()))
        return;
    mGearJointDef.ratio = _ratio;
    if (mGearJoint)
        mGearJoint->SetRatio(_ratio);
    emit ratioChanged();
}
Beispiel #17
0
ApplicationInfo::ApplicationInfo(QObject *parent): QObject(parent)
{

    m_isMobile = false;
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) || defined(Q_OS_BLACKBERRY)
    m_isMobile = true;
#endif

#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
    m_platform = Linux;
#elif defined(Q_OS_WIN)
    m_platform = Windows;
#elif defined(Q_OS_MAC)
    m_platform = MacOSX;
#elif defined(Q_OS_ANDROID)
    m_platform = Android;
#elif defined(Q_OS_IOS)
    m_platform = Ios;
#elif defined(Q_OS_BLACKBERRY)
    m_platform = Blackberry;
#endif

    QRect rect = qApp->primaryScreen()->geometry();
//    m_ratio = 2;
//    m_ratio = 2.56;
    m_ratio = m_isMobile ? qMin(qMax(rect.width(), rect.height())/800. , qMin(rect.width(), rect.height())/520.) : 1;
    m_sliderHandleWidth = getSizeWithRatio(70);
    m_sliderHandleHeight = getSizeWithRatio(87);
    m_sliderGapWidth = getSizeWithRatio(100);
    m_isPortraitMode = m_isMobile ? rect.height() > rect.width() : false;
    m_hMargin =  m_isPortraitMode ? 20 * ratio() : 50 * ratio();
    m_applicationWidth = m_isMobile ? rect.width() : 1120;

    if (m_isMobile)
        connect(qApp->primaryScreen(), SIGNAL(physicalSizeChanged(QSizeF)), this, SLOT(notifyPortraitMode()));

    // Get all symbol fonts to remove them
    QFontDatabase database;
    m_excludedFonts = database.families(QFontDatabase::Symbol);

    // Get fonts from rcc
    const QStringList fontFilters = {"*.otf", "*.ttf"};
    m_fontsFromRcc = QDir(":/gcompris/src/core/resource/fonts").entryList(fontFilters);
}
Beispiel #18
0
        void Dial::paintEvent(QPaintEvent *e)
        {
            auto && _rect = rect();
            QPointF _center = _rect.center();

            double   _r = radius() - radius() / 50.0;
            QPainter _p(this);
            _p.setRenderHint(QPainter::Antialiasing);
            _p.setBrush(colorSet().button());
            _p.setPen(hasFocus() ? QPen(colorSet().dark(),
                                        radius() / 50.0) : Qt::NoPen);

            _p.drawEllipse(_center, _r, _r);

            QPainterPath _ellipsePath, _piePath;
            _ellipsePath.addEllipse(_center, _r,        _r);
            _ellipsePath.addEllipse(_center, _r * 0.75, _r * 0.75);
            auto && _pieRect = _ellipsePath.boundingRect().adjusted(-2, -2, 2, 2);

            _p.setBrush(
                hasFocus() ?
                colorSet().highlight() :
                colorSet().dark());

            QPainterPath _arc(_center);
            _arc.arcTo(_pieRect, -90, -ratio() * 360);
            _arc.lineTo(_center);
            _arc.closeSubpath();

            _piePath = _arc & _ellipsePath;
            _p.drawPath(_piePath);

            if (showTicks())
            {
                mixin_range_type::for_each_step([&](int _step, double i,
                                                    bool _isPage)
                {
                    _p.setPen(QPen(i >= mixin_range_type::value() ?
                                   colorSet().shadow() :
                                   colorSet().windowText(), 1));
                    paintTick(_p, i, _isPage ? 0.25 : 0.125);
                });
            }

            _p.setPen(QPen(colorSet().shadow(), _r / 50.0));
            paintTick(_p, mixin_range_type::value(), 0.333);
            paintTick(_p, 0.0,                       0.25);


            // Draw big letter in the middle
            _p.setPen(QPen(QColor("#3d3d3d"), 2));
            QFont _font = font();
            _font.setPixelSize(_r);
            _p.setFont(_font);
            _p.drawText(_rect, Qt::AlignCenter, letter_);
        }
Beispiel #19
0
void steering::drive(int angle, int speed) {
  int left;
  int right;
  if (angle > 0) {
    left  = speed;
    right = speed * ratio(angle);
  } else {
    right = speed;
    left  = speed/ratio(angle);
  }

  analogWrite(PWMR, right);
  analogWrite(PWML, left);

        if (millis()%1000 == 0) {
  Serial.println(right);
  Serial.println(left);
        }
}
Beispiel #20
0
	//------------------------------------------------------------------------------------
	void D3D11RenderSystem::AddResizableTexture( D3D11Texture* pTexture )
	{
		assert(m_mapTexNeedResize.find(pTexture) == m_mapTexNeedResize.end() && "This texture already added!");

		VEC2 ratio(pTexture->GetWidth() / (float)m_wndWidth, pTexture->GetHeight() / (float)m_wndHeight);

		m_mapTexNeedResize.insert(std::make_pair(pTexture, ratio));

		pTexture->AddRef();
	}
Beispiel #21
0
void ratio (float a, float b, int iterations) {
    if(iterations == 0) {
        return;
    } else {
        float error = a/b - sqrt(3);
        printf("%d\t %d\t %f\t %f\n",(int)a,(int)b,a/b, error);
        ratio(a+3*b,a+b,iterations-1);
    }

}
Beispiel #22
0
// Called from ../audio/Juce_plugins.cpp
//
Ratio RT_Signature_get_current_Signature(const struct SeqTrack *seqtrack){
  if (is_playing())
    return seqtrack->signature_iterator.signature_value;
  else {
    if (root==NULL) // When does this happen?
      return ratio(4,4);
    else
      return root->signature;
  }
}
Beispiel #23
0
Ratio RT_Signature_get_current_Signature(void){
  if (pc->isplaying)
    return g_signature_value;
  else {
    if (root==NULL || root->song==NULL || root->song->tracker_windows==NULL || root->song->tracker_windows->wblock==NULL || root->song->tracker_windows->wblock->block==NULL)
      return ratio(4,4);
    else
      return root->signature;
  }
}
int MesaMobile::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 4)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 4;
    } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
        if (_id < 4)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 4;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< int*>(_v) = applicationWidth(); break;
        case 1: *reinterpret_cast< bool*>(_v) = isPortraitMode(); break;
        case 2: *reinterpret_cast< qreal*>(_v) = ratio(); break;
        case 3: *reinterpret_cast< qreal*>(_v) = hMargin(); break;
        case 4: *reinterpret_cast< qreal*>(_v) = sliderHandleWidth(); break;
        case 5: *reinterpret_cast< qreal*>(_v) = sliderHandleHeight(); break;
        case 6: *reinterpret_cast< qreal*>(_v) = sliderGapWidth(); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setApplicationWidth(*reinterpret_cast< int*>(_v)); break;
        case 1: setIsPortraitMode(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 7;
    } else if (_c == QMetaObject::RegisterPropertyMetaType) {
        if (_id < 7)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 7;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Beispiel #25
0
/* Function which returns the ratio between the number of sliding contacts to the total number at a given time */
Real Law2_ScGeom_MindlinPhys_Mindlin::ratioSlidingContacts()
{
	Real ratio(0); int count(0);
	FOREACH(const shared_ptr<Interaction>& I, *scene->interactions){
		if(!I->isReal()) continue;
		MindlinPhys* phys = dynamic_cast<MindlinPhys*>(I->phys.get());
		if (phys->isSliding) {ratio+=1;}
		count++;
	}  
	ratio/=count;
	return ratio;
}
Beispiel #26
0
double Monitor::getresult()const{
  switch (type){
    case 0:
    return difference();
    case 1:
    return sum();
    case 2:
    return ratio();
    case 3:
    return value;
    default:
    return 0.0;
  }
}
Beispiel #27
0
double Compressor::nvalue(int idx) const
      {
      double v = 0.0;
      switch (idx) {
            case RMS_PEAK:  v = rmsPeak();    break;
            case ATTACK:    v = attack();     break;
            case RELEASE:   v = release();    break;
            case THRESHOLD: v = threshold();  break;
            case RATIO:     v = ratio();      break;
            case KNEE:      v = knee();       break;
            case GAIN:      v = makeupGain(); break;
            }
      return v;
      }
Beispiel #28
0
// Return is actually the fraction cx/cy. Simply using CSize for convenience
CSize CPreviewView::CalcScaleRatio(CSize screenSize, CSize actualSize)
{
	// Test ratio based on vertical dimension to see if it is the one to use
	int nNum = screenSize.cy;
	int nDen = actualSize.cy;

	// If scaled width too large, choose width as primary dimension
	if (MulDiv(actualSize.cx, nNum, nDen) > screenSize.cx)
	{
		// wrong ratio--base on width
		nNum = screenSize.cx;
		nDen = actualSize.cx;
	}
	CSize ratio(nNum, nDen);
	return ratio;
}
Beispiel #29
0
void REGUIApplication::OnMouseMoveOnScreen(const REFloat32 screenX, const REFloat32 screenY)
{
	RESize ratio( _renderDevice->GetScreenToRenderSizeRatio() );
	const REFloat32 x = ratio.width * screenX;
	const REFloat32 y = ratio.height * screenY;
	
    /*
	this->FindSubViewForCoords(_rootViewController, x, y);
	for (REUInt32 i = 0; i < _userActionViews.Count(); i++) 
	{
		_userActionViews[i]->userCursorMoved(x, y);
	}
    */
	/*
	 if ( _renderDevice && _rootViewController ) 
	 {
	 if (_rootViewController->IsHasSubViews()) 
	 {
	 RESize ratio( _renderDevice->GetScreenToRenderSizeRatio() );
	 
	 const REFloat32 x = ratio.width * screenX;
	 const REFloat32 y = ratio.height * screenY;
	 
	 REView * v = this->FindSubViewLastViewForCoords(_rootViewController, x, y);
	 if (v)
	 {
	 v->userCursorMoved(x, y);
	 }
	 }
	 }
	 */
	
	/*
	 if (_isOK) 
	 {
	 RESize ratio(_defaultRenderDevice->GetScreenToRenderSizeRatio());
	 
	 const REFloat32 x = ratio.width * screenX;
	 const REFloat32 y = ratio.height * screenY;
	 
	 GameController * contr = (GameController*)_appController;
	 contr->UserActionMouseMove(x, y);
	 }
	 */
}
Beispiel #30
0
bool NewSong(void) {

    root->tempo=128;
    root->lpb=4;
    root->signature = ratio(4,4);
    pc->initplaying=false;
    pc->isplaying=false;

    AppendBlock();

    BL_init();


    if(OpenTrackerWindow(20,20,00,00)==-1) return false;


    return true;
}