void main()
{
	int a;
	while(1)
	{		
		menu();//菜单
		printf("请选择:");
		scanf("%d",&a);
		switch(a)
		{
		case 1:
			printf("初始值为:\n");
			show();
			break;
		case 2:
			show();
			run();
			handle_count=0;
			break;
		case 3:
			valueChange();
			break;
		case 4:exit(0);
		default:printf("输入有误!\n");
		}
		system("pause");
		system("cls");
	}
}
Exemple #2
0
/*!
  \brief No docs

  Description
  \param x ???
  \param align
  \todo Documentation
*/
void QwtDoubleRange::setNewValue(double x, bool align)
{
    double vmin,vmax;

    d_prevValue = d_value;

    vmin = qwtMin(d_minValue, d_maxValue);
    vmax = qwtMax(d_minValue, d_maxValue);

    //
    // Range check
    //
    if (x < vmin)
    {
        if ((d_periodic) && (vmin != vmax))
            d_value = x + ::ceil( (vmin - x) / (vmax - vmin ) )
                      * (vmax - vmin);
        else
            d_value = vmin;
    }
    else if (x > vmax)
    {
        if ((d_periodic) && (vmin != vmax))
            d_value = x - ::ceil( ( x - vmax) / (vmax - vmin ))
                      * (vmax - vmin);
        else
            d_value = vmax;
    }
    else
        d_value = x;

    d_exactPrevValue = d_exactValue;
    d_exactValue = d_value;

    // align to grid
    if (align)
    {
        if (d_step != 0.0)
        {
            d_value = d_minValue +
                      qwtRound((d_value - d_minValue) / d_step) * d_step;
        }
        else
            d_value = d_minValue;

        // correct rounding error at the border
        if (fabs(d_value - d_maxValue) < MinEps * qwtAbs(d_step))
            d_value = d_maxValue;

        // correct rounding error if value = 0
        if (::fabs(d_value) < MinEps * qwtAbs(d_step))
            d_value = 0.0;
    }

    if (!d_isValid || d_prevValue != d_value)
    {
        d_isValid = true;
        valueChange();
    }
}
    void checkStatusPropertyUpdate()
    {
        // GIVEN
        qRegisterMetaType<Qt3DAnimation::QAnimationClipLoader::Status>("Status");
        TestArbiter arbiter;
        arbiter.setArbiterOnNode(this);
        QSignalSpy spy(this, SIGNAL(statusChanged(Status)));
        const Qt3DAnimation::QAnimationClipLoader::Status newStatus = Qt3DAnimation::QAnimationClipLoader::Error;

        // THEN
        QVERIFY(spy.isValid());

        // WHEN
        Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
        valueChange->setPropertyName("status");
        valueChange->setValue(QVariant::fromValue(newStatus));
        sceneChangeEvent(valueChange);

        // THEN
        QCOMPARE(spy.count(), 1);
        QCOMPARE(arbiter.events.size(), 0);
        QCOMPARE(status(), newStatus);

        // WHEN
        spy.clear();
        sceneChangeEvent(valueChange);

        // THEN
        QCOMPARE(spy.count(), 0);
        QCOMPARE(arbiter.events.size(), 0);
        QCOMPARE(status(), newStatus);
    }
Exemple #4
0
void pdsp::ValueSequencer::process (int bufferSize) noexcept {
        //std::cout<<"valuesequencer slewLastValue = "<<slewLastValue<<"\n";
        if(messageBuffer!=nullptr){
                //updateBuffer(messageBuffer, bufferSize);
                 
                if( messageBuffer->empty() ){
                        //std::cout<<"message queue empty, broadcasting last value\n";
                        if(slewRun){
                                float* outputBuffer = getOutputBufferToFill(output);
                                runSlewBlock( outputBuffer, 0, bufferSize);
                        }else{
                                setControlRateOutput(output, slewLastValue);
                        }
                } else {

                        float* outputBuffer = getOutputBufferToFill(output);
                        
                        int n=0;
                        int k=0;
                        int imax = messageBuffer->size();
                        for( int i=0; i<imax; ++i){
                                ControlMessage &msg = messageBuffer->messages[i];
                                //std::cout<<"broadcast message value = "<<messageBuffer->messages[i].value<<"\n";
                                if(slewRun){
                                         runSlewBlock(outputBuffer, n, msg.sample * getOversampleLevel());
                                }else{
                                         ofx_Aeq_S_range(outputBuffer, slewLastValue, n, msg.sample * getOversampleLevel());
                                }
                                
                                if( slewControl != nullptr && 
                                   (k < slewControl->messages.size()) && 
                                   (slewControl->messages[k].sample <= msg.sample))
                                {
                                        //std::cout<<"got slew message, value "<<slewControl->messages[k].value<<"\n";
                                        slewTimeMod = slewControl->messages[k].value;
                                        k++; 
                                }
                                
                                valueChange(msg.value);
                                
                                n = msg.sample * getOversampleLevel();
                                
                        }

                        if(slewRun){
                                 runSlewBlock(outputBuffer, n, bufferSize );
                        }else{
                                 ofx_Aeq_S_range(outputBuffer, slewLastValue, n, bufferSize);
                        }               
                        //std::cout<<"last message value = "<<slewLastValue<<"\n";
                }
        }else{
                setControlRateOutput(output, slewLastValue);
        }
        
        if(slewControl != nullptr && !slewControl->empty() ){ //we set the slew control with the last of the buffer
                slewTimeMod = slewControl->messages[ slewControl->messages.size() - 1 ].value;
        }

}
void QRangeControl::setValue( int value )
{
    int lprevVal = prevVal;
    directSetValue( value );
    if ( lprevVal != val || prevVal != val )
	valueChange();
}
Exemple #6
0
//! Set the value to be valid/invalid
void QwtDoubleRange::setValid(bool isValid)
{
    if ( isValid != d_isValid )
    {
        d_isValid = isValid;
        valueChange();
    }
}
Exemple #7
0
void VolSlider::mouseDoubleClickEvent(QMouseEvent* ev)
      {
      if (ev->button() == Qt::RightButton)
      	_value = 0.0;
      else
      	_value = _minValue;
      valueChange();
      }
Exemple #8
0
	void FloatEntry::incValue(double)
	{
		if (_value + 1.0 < _maxValue)
		{
			_value = _value + 1.0;
			updateValue();
			valueChange();
		}
	}
Exemple #9
0
	void FloatEntry::decValue(double)
	{
		if (_value - 1.0 > _minValue)
		{
			_value = _value - 1.0;
			updateValue();
			valueChange();
		}
	}
AutoDialog::AutoDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::AutoDialog)
{
    ui->setupUi(this);
    this->setGeometry(0 ,390 ,width() ,height());
    this->setWindowFlags(Qt::FramelessWindowHint);

    flag = 0x00;
    deep = 0x00;
    current = 0x00;
    area = 0x00;
    effect = 0x00;

    QPixmap a_pix = QPixmap(":/selected.png");
    a_icon = QIcon(a_pix);
    QPixmap b_pix = QPixmap(":/unselected.png");
    b_icon = QIcon(b_pix);

    QPixmap c_pix = QPixmap(":/auto.png");

    QPixmap ok_pix = QPixmap(":/ok.png");
    ok_icon = QIcon(ok_pix);
    QPixmap cancel_pix = QPixmap(":/cancel.png");
    cancel_icon = QIcon(cancel_pix);

    connect(ui->lineEdit ,SIGNAL(textChanged(QString)) ,this ,SLOT(valueChange(QString)));
    connect(ui->lineEdit_2 ,SIGNAL(textChanged(QString)) ,this ,SLOT(valueChange(QString)));
    connect(ui->lineEdit_3 ,SIGNAL(textChanged(QString)) ,this ,SLOT(valueChange(QString)));
    connect(ui->lineEdit_4 ,SIGNAL(textChanged(QString)) ,this ,SLOT(valueChange(QString)));

    ui->lineEdit->clear();
    ui->lineEdit_2->clear();
    ui->lineEdit_3->clear();
    ui->lineEdit_4->clear();

    ui->label->setPixmap(c_pix);
    ui->buttonBox->button(ui->buttonBox->Ok)->setText(tr("确定(O)"));
    ui->buttonBox->button(ui->buttonBox->Ok)->setIcon(ok_icon);
    ui->buttonBox->button(ui->buttonBox->Ok)->setIconSize(QSize(32,32));
    ui->buttonBox->button(ui->buttonBox->Cancel)->setText(tr("取消(C)"));
    ui->buttonBox->button(ui->buttonBox->Cancel)->setIcon(cancel_icon);
    ui->buttonBox->button(ui->buttonBox->Cancel)->setIconSize(QSize(32,32));
}
void CSliderMultiPos::setValue(int posIndex,int value){

    if( posIndex>=0 && posIndex<nbValues() ){
        if( handles.at(posIndex).getValue()!=value ){
            handles[posIndex].setValue(value);
            emit valueChange(posIndex,value);
            repaint();
        }
    }
}
Exemple #12
0
void DoubleRange::setNewValue(double x, bool align)
      {
      DEBUG_DRANGE(stderr, "DoubleRange::setNewValue TOP val:%.20f d_value:%.20f\n", x, d_value);
        
      if(x == d_value)
        return;
      
      const double vmin = MusECore::qwtMin(d_minValue, d_maxValue);
      const double vmax = MusECore::qwtMax(d_minValue, d_maxValue);
      const double prevValue = d_value;

      // Range check

      if (x < vmin) {
            if ((d_periodic) && (vmin != vmax))
                  d_value = x + ceil((vmin - x) / (vmax - vmin))
                     * (vmax - vmin);
            else
                  d_value = vmin;
            }
      else if (x > vmax) {
            if ((d_periodic) && (vmin != vmax))
                  d_value = x - ceil( ( x - vmax) / (vmax - vmin ))
                     * (vmax - vmin);
            else
                  d_value = vmax;
            }
      else
            d_value = x;

      d_exactPrevValue = d_exactValue;
      d_exactValue = d_value;

      // align to grid
      if (align) {
            if (d_step != 0.0)
                  d_value = d_minValue + rint((d_value - d_minValue) / d_step ) * d_step;
            else
                  d_value = d_minValue;
	
            // correct rounding error at the border
            if (fabs(d_value - d_maxValue) < MinEps * MusECore::qwtAbs(d_step))
                  d_value = d_maxValue;

            // correct rounding error if value = 0
            if (fabs(d_value) < MinEps * MusECore::qwtAbs(d_step))
                  d_value = 0.0;
            }
      DEBUG_DRANGE(stderr, "                         BOTTOM val:%.20f d_value:%.20f\n", x, d_value);
      if (prevValue != d_value)
      {
            DEBUG_DRANGE(stderr, "  not equal, calling valueChange\n");
            valueChange();
      }
      }
Exemple #13
0
void MSTypeEntryField<Type>::decrement(void)
{
  if (MSView::model()!=0)
   {
     if (minimumValue().isSet()==MSTrue)
      {
	Type aType=value();
	aType-=incrementValue();
	if (aType>=minimumValue())
	 {
	   value()=aType;
	   valueChange();
	 }
      }
     else
      {
	value()-=incrementValue();
	valueChange();
      }
   }
}
Exemple #14
0
void Knob::mousePressEvent(QMouseEvent* ev)
      {
      startY = ev->y();
      emit sliderPressed(_id);
      if (_center) {
            QRect r(points->boundingRect().toRect());
            if (r.contains(ev->pos())) {
                  setValue(.0f);
                  valueChange();
                  }
            }
      }
Exemple #15
0
void AbstractSlider::wheelEvent(QWheelEvent* ev)
      {
      int div = 50;
      if (ev->modifiers() & Qt::ShiftModifier)
            div = 15;
      _value += (ev->delta() * lineStep()) / div;
      if (_value < _minValue)
            _value = _minValue;
      else if (_value > _maxValue)
            _value = _maxValue;
      valueChange();
      }
Exemple #16
0
void Knob::mouseMoveEvent(QMouseEvent* ev)
      {
      int y       = ev->y();
      double delta = (maxValue() - minValue()) / 100.0f;
      if (delta == 0)
            delta = 1;
      _value  += (startY - y) * delta;
      if (_value < minValue())
            _value = _minValue;
      else if (_value > maxValue())
            _value = _maxValue;
      startY    = y;
      valueChange();
      }
Exemple #17
0
void MSIntEntryField::increment(void)
{
  if (MSView::model()!=0)
   {
     if (value() <= INT_MAX - incrementValue())   // prevent overflow
      {
       if (maximumValue().isSet()==MSTrue)
        {
          int anInt=value();
          anInt+=(int)incrementValue();
          if (anInt<=maximumValue())
           {
             value()=anInt;
             valueChange();
           }
        }
       else
        {
          value()+=incrementValue();
          valueChange();
        }
     }
   }
}
Exemple #18
0
void MSIntEntryField::decrement(void)
{
  if (MSView::model()!=0)
   {
     if (value() >= INT_MIN + incrementValue())   // prevent underflow
      {
       if (minimumValue().isSet()==MSTrue)
        {
          int anInt=value();
          anInt-=(int)incrementValue();
          if (anInt>=minimumValue())
           {
             value()=anInt;
             valueChange();
           }
        }
       else
        {
          value()-=incrementValue();
          valueChange();
        }
      }
   }
}
void RKSpinBox::interpretText () {
	if (updating) return;
	updating = true;

	if (mode == Real) {
		bool ok;
		double new_value = text ().toFloat (&ok);
		if (ok) real_value = new_value;
		valueChange ();
	} else {
		QSpinBox::interpretText ();
	}

	updating = false;
}
Exemple #20
0
void MSFloatEntryField::decrement(void)
{
  if (MSView::model()!=0)
   {
     if (value() >= -DBL_MAX + incrementValue())   // prevent underflow
      {
       if (minimumValue().isSet()==MSTrue)
        {
          double anFloat=value();
          anFloat-=incrementValue();
          if (anFloat>=minimumValue())
           {
             value()=anFloat;
             valueChange();
           }
        }
       else
        {
          value()-=incrementValue();
          valueChange();
        }
      }
   }
}
Exemple #21
0
	void FloatEntry::setSValue(const QString& s)
	{
		bool ok;
		double v = s.toFloat(&ok);
		if (ok && (v != _value))
		{
			if (v < _minValue)
				v = _minValue;
			if (v > _maxValue)
				v = _maxValue;
			_value = v;
			updateValue();
			valueChange();
		}
	}
Exemple #22
0
void MSFloatEntryField::increment(void)
{
  if (MSView::model()!=0)
   {
     if (value() <= DBL_MAX - incrementValue())   // prevent overflow
      {
       if (maximumValue().isSet()==MSTrue)
        {
          double anFloat=value();
          anFloat+=incrementValue();
          if (anFloat<=maximumValue())
           {
             value()=anFloat;
             valueChange();
           }
        }
       else
        {
          value()+=incrementValue();
          valueChange();
        }
     }
   }
}
Exemple #23
0
void ofxPDSPValue::process (int bufferSize) noexcept {

    float newValue = value;
    
    if(newValue!=lastValue){
            valueChange(newValue);
    }
    if(slewRun){
        float* outputBuffer = getOutputBufferToFill(output);
        runSlewBlock(outputBuffer, 0, bufferSize);         
    }else{
        setControlRateOutput(output, slewLastValue);
    }

    
    lastValue = newValue;
}
void QRangeControl::setRange( int minValue, int maxValue )
{
    if ( minValue > maxValue ) {
#if defined(QT_CHECK_RANGE)
	qWarning( "QRangeControl::setRange: minValue %d > maxValue %d",
		  minValue, maxValue );
#endif
	maxValue = minValue;
    }
    if ( minValue == minVal && maxValue == maxVal )
	return;
    minVal = minValue;
    maxVal = maxValue;
    int tmp = bound( val );
    rangeChange();
    if ( tmp != val ) {
	prevVal = val;
	val = tmp;
	valueChange();
    }
}
Exemple #25
0
void Slider::mouseMoveEvent(QMouseEvent* ev)
      {
      if (!dragMode)
            return;
      int delta = orient == Qt::Horizontal ? (startDrag.x() - ev->x()) : (startDrag.y() - ev->y());

//      if (_invert)
//            delta = -delta;
      if (orient == Qt::Horizontal)
            delta = -delta;
      int ppos = dragppos + delta;
      if (ppos < 0)
            ppos = 0;

      int pixel = (orient == Qt::Vertical) ? height() - _sliderSize.height() : width() - _sliderSize.width();
      if (ppos > pixel)
            ppos = pixel;
      int pos = _invert ? (pixel - ppos) : ppos;
      _value  = (pos * (maxValue() - minValue()) / pixel) + minValue() - 0.000001;
      valueChange();
      }
Exemple #26
0
void AbstractSlider::keyPressEvent(QKeyEvent* ev)
      {
      double oval = _value;

      switch (ev->key()) {
            case Qt::Key_Home:    _value = _minValue; break;
            case Qt::Key_End:     _value = _maxValue; break;
            case Qt::Key_Up:
            case Qt::Key_Left:    _value += lineStep(); break;
            case Qt::Key_Down:
            case Qt::Key_Right:   _value -= lineStep(); break;
            case Qt::Key_PageDown: _value -= pageStep(); break;
            case Qt::Key_PageUp:   _value += pageStep(); break;
            default:
                  break;
            }
      if (_value < _minValue)
            _value = _minValue;
      else if (_value > _maxValue)
            _value = _maxValue;
      if (oval != _value)
            valueChange();
      }
void QRangeControl::setValue( int value )
{
    directSetValue( value );
    if ( prevVal != val )
	valueChange();
}