MixerCurve::MixerCurve(QWidget *parent) : QFrame(parent), m_mixerUI(new Ui::MixerCurve) { m_mixerUI->setupUi(this); // setup some convienence pointers m_curve = m_mixerUI->CurveWidget; m_settings = m_mixerUI->CurveSettings; m_mixerUI->SettingsGroup->hide(); // create our spin delegate m_spinDelegate = new DoubleSpinDelegate(); // set the default mixer type setMixerType(MixerCurve::MIXERCURVE_THROTTLE); // paint the ui UpdateCurveUI(); // wire up our signals connect(m_mixerUI->CurveType, SIGNAL(currentIndexChanged(int)), this, SLOT(CurveTypeChanged())); connect(m_mixerUI->ResetCurve, SIGNAL(clicked()), this, SLOT(ResetCurve())); connect(m_mixerUI->PopupCurve, SIGNAL(clicked()), this, SLOT(PopupCurve())); connect(m_mixerUI->GenerateCurve, SIGNAL(clicked()), this, SLOT(GenerateCurve())); connect(m_curve, SIGNAL(curveUpdated()), this, SLOT(UpdateSettingsTable())); connect(m_settings, SIGNAL(cellChanged(int, int)), this, SLOT(SettingsTableChanged())); connect(m_mixerUI->CurveMin, SIGNAL(valueChanged(double)), this, SLOT(CurveMinChanged(double))); connect(m_mixerUI->CurveMax, SIGNAL(valueChanged(double)), this, SLOT(CurveMaxChanged(double))); connect(m_mixerUI->CurveStep, SIGNAL(valueChanged(double)), this, SLOT(GenerateCurve())); }
// generate the cylinder, it's made by a stack of circles void GenerateSurface() { GenerateCurve(); glNewList(CYLINDER, GL_COMPILE); for (int i = 0; i < CIRCLENUM; i++) { DrawCurve(i/4.0f); } glEndList(); }
void MixerCurve::CommandActivated(MixerNode* node) { QString name = (node) ? node->getName() : "Reset"; if (name == "Reset") { ResetCurve(); m_curve->showCommands(false); } else if (name == "Commands") { } else if (name == "Popup" ) { PopupCurve(); } else if (name == "Linear") { m_mixerUI->CurveType->setCurrentIndex(m_mixerUI->CurveType->findText("Linear")); } else if (name == "Log") { m_mixerUI->CurveType->setCurrentIndex(m_mixerUI->CurveType->findText("Log")); } else if (name == "Exp") { m_mixerUI->CurveType->setCurrentIndex(m_mixerUI->CurveType->findText("Exp")); } else if (name == "Flat") { m_mixerUI->CurveType->setCurrentIndex(m_mixerUI->CurveType->findText("Flat")); } else if (name == "Step") { m_mixerUI->CurveType->setCurrentIndex(m_mixerUI->CurveType->findText("Step")); } else if (name == "MinPlus") { m_mixerUI->CurveMin->stepUp(); } else if (name == "MinMinus") { m_mixerUI->CurveMin->stepDown(); } else if (name == "MaxPlus") { m_mixerUI->CurveMax->stepUp(); } else if (name == "MaxMinus"){ m_mixerUI->CurveMax->stepDown(); } else if (name == "StepPlus") { m_mixerUI->CurveStep->stepUp(); m_curve->setCommandText("StepValue", QString("%0").arg(getCurveStep())); } else if (name == "StepMinus") { m_mixerUI->CurveStep->stepDown(); m_curve->setCommandText("StepValue", QString("%0").arg(getCurveStep())); } GenerateCurve(); }
MixerCurve::MixerCurve(QWidget *parent) : QFrame(parent), m_mixerUI(new Ui::MixerCurvePlot) { m_mixerUI->setupUi(this); // setup some convienence pointers m_curve = m_mixerUI->CurveWidget; m_settings = m_mixerUI->CurveSettings; // by default mixcurve isn't used for curve2source m_mixerUI->CBCurve2Source->hide(); m_mixerUI->SettingsGroup->hide(); m_curve->showCommands(false); m_curve->showCommand("Reset", false); m_curve->showCommand("Popup", false); m_curve->showCommand("Commands", false); // create our spin delegate m_spinDelegate = new DoubleSpinDelegate(); // set the default mixer type setMixerType(MixerCurve::MIXERCURVE_THROTTLE); // setup and turn off advanced mode CommandActivated(); // paint the ui UpdateCurveUI(); // wire up our signals connect(m_mixerUI->CurveType, SIGNAL(currentIndexChanged(int)), this, SLOT(CurveTypeChanged())); connect(m_mixerUI->ResetCurve, SIGNAL(clicked()), this, SLOT(ResetCurve())); connect(m_mixerUI->PopupCurve, SIGNAL(clicked()),this,SLOT(PopupCurve())); connect(m_mixerUI->GenerateCurve, SIGNAL(clicked()), this, SLOT(GenerateCurve())); connect(m_curve, SIGNAL(curveUpdated()), this, SLOT(UpdateSettingsTable())); connect(m_curve, SIGNAL(commandActivated(MixerNode*)),this, SLOT(CommandActivated(MixerNode*))); connect(m_settings, SIGNAL(cellChanged(int,int)), this, SLOT(SettingsTableChanged())); connect(m_mixerUI->CurveMin, SIGNAL(valueChanged(double)), this, SLOT(CurveMinChanged(double))); connect(m_mixerUI->CurveMax, SIGNAL(valueChanged(double)), this, SLOT(CurveMaxChanged(double))); connect(m_mixerUI->CurveStep, SIGNAL(valueChanged(double)), this, SLOT(GenerateCurve())); }
void MixerCurve::UpdateCurveUI() { // get the user settings QString curveType = m_mixerUI->CurveType->currentText(); m_mixerUI->CurveStep->setMinimum(0.0); m_mixerUI->CurveStep->setMaximum(100.0); m_mixerUI->CurveStep->setSingleStep(1.00); // set default visible m_mixerUI->minLabel->setVisible(true); m_mixerUI->CurveMin->setVisible(true); m_mixerUI->maxLabel->setVisible(false); m_mixerUI->CurveMax->setVisible(false); m_mixerUI->stepLabel->setVisible(false); m_mixerUI->CurveStep->setVisible(false); if (curveType.compare("Flat") == 0) { m_mixerUI->minLabel->setVisible(false); m_mixerUI->CurveMin->setVisible(false); m_mixerUI->stepLabel->setVisible(true); m_mixerUI->CurveStep->setVisible(true); m_mixerUI->CurveStep->setMinimum(m_mixerUI->CurveMin->minimum()); m_mixerUI->CurveStep->setMaximum(m_mixerUI->CurveMax->maximum()); m_mixerUI->CurveStep->setSingleStep(0.01); m_mixerUI->CurveStep->setValue(m_mixerUI->CurveMax->value() / 2); } if (curveType.compare("Linear") == 0) { m_mixerUI->maxLabel->setVisible(true); m_mixerUI->CurveMax->setVisible(true); } if (curveType.compare("Step") == 0) { m_mixerUI->maxLabel->setVisible(true); m_mixerUI->CurveMax->setVisible(true); m_mixerUI->stepLabel->setText("Step at"); m_mixerUI->stepLabel->setVisible(true); m_mixerUI->CurveStep->setVisible(true); m_mixerUI->CurveStep->setMinimum(1.0); } if (curveType.compare("Exp") == 0) { m_mixerUI->maxLabel->setVisible(true); m_mixerUI->CurveMax->setVisible(true); m_mixerUI->stepLabel->setText("Power"); m_mixerUI->stepLabel->setVisible(true); m_mixerUI->CurveStep->setVisible(true); m_mixerUI->CurveStep->setMinimum(1.0); } if (curveType.compare("Log") == 0) { m_mixerUI->maxLabel->setVisible(true); m_mixerUI->CurveMax->setVisible(true); m_mixerUI->stepLabel->setText("Power"); m_mixerUI->stepLabel->setVisible(true); m_mixerUI->CurveStep->setVisible(true); m_mixerUI->CurveStep->setMinimum(1.0); } GenerateCurve(); }
void MixerCurve::UpdateCurveUI() { //get the user settings QString curveType = m_mixerUI->CurveType->currentText(); m_curve->activateCommand(curveType); bool cmdsActive = m_curve->isCommandActive("Commands"); m_curve->showCommand("StepPlus", cmdsActive && curveType != "Linear"); m_curve->showCommand("StepMinus", cmdsActive && curveType != "Linear"); m_curve->showCommand("StepValue", cmdsActive && curveType != "Linear"); m_mixerUI->CurveStep->setMinimum(0.0); m_mixerUI->CurveStep->setMaximum(100.0); m_mixerUI->CurveStep->setSingleStep(1.00); //set default visible m_mixerUI->minLabel->setVisible(true); m_mixerUI->CurveMin->setVisible(true); m_mixerUI->maxLabel->setVisible(false); m_mixerUI->CurveMax->setVisible(false); m_mixerUI->stepLabel->setVisible(false); m_mixerUI->CurveStep->setVisible(false); if ( curveType.compare("Flat")==0) { m_mixerUI->minLabel->setVisible(false); m_mixerUI->CurveMin->setVisible(false); m_mixerUI->stepLabel->setVisible(true); m_mixerUI->CurveStep->setVisible(true); m_mixerUI->CurveStep->setMinimum(m_mixerUI->CurveMin->minimum()); m_mixerUI->CurveStep->setMaximum(m_mixerUI->CurveMax->maximum()); m_mixerUI->CurveStep->setSingleStep(0.01); m_mixerUI->CurveStep->setValue(m_mixerUI->CurveMax->value() / 2); } if ( curveType.compare("Linear")==0) { m_mixerUI->maxLabel->setVisible(true); m_mixerUI->CurveMax->setVisible(true); } if ( curveType.compare("Step")==0) { m_mixerUI->maxLabel->setVisible(true); m_mixerUI->CurveMax->setVisible(true); m_mixerUI->stepLabel->setText("Step at"); m_mixerUI->stepLabel->setVisible(true); m_mixerUI->CurveStep->setVisible(true); m_mixerUI->CurveStep->setMinimum(1.0); } if ( curveType.compare("Exp")==0) { m_mixerUI->maxLabel->setVisible(true); m_mixerUI->CurveMax->setVisible(true); m_mixerUI->stepLabel->setText("Power"); m_mixerUI->stepLabel->setVisible(true); m_mixerUI->CurveStep->setVisible(true); m_mixerUI->CurveStep->setMinimum(1.0); } if ( curveType.compare("Log")==0) { m_mixerUI->maxLabel->setVisible(true); m_mixerUI->CurveMax->setVisible(true); m_mixerUI->stepLabel->setText("Power"); m_mixerUI->stepLabel->setVisible(true); m_mixerUI->CurveStep->setVisible(true); m_mixerUI->CurveStep->setMinimum(1.0); } GenerateCurve(); }