GLMotif::PopupWindow* DotSpreaderOptionsDialog::createDialog() { WidgetFactory factory; // create popup-shell GLMotif::PopupWindow* parameterDialogPopup=factory.createPopupWindow("ParameterDialogPopup", "Dot Spreader Options"); // create the main layout GLMotif::RowColumn* parameterDialog=factory.createRowColumn("ParameterDialog", 3); factory.setLayout(parameterDialog); factory.createLabel("", "NumberOfParticles"); // create text field numberOfParticlesValue=factory.createTextField("NumberOfParticlesTextField", 10); numberOfParticlesValue->setString("10000"); // create and initialize slider object numberOfParticlesSlider=factory.createSlider("NumberOfParticlesSlider", 15.0); numberOfParticlesSlider->setValueRange(1000.0, 250000.0, 1000.0); numberOfParticlesSlider->setValue(10000.0); // set the slider callback numberOfParticlesSlider->getValueChangedCallbacks().add(this, &DotSpreaderOptionsDialog::sliderCallback); factory.createLabel("ParticleSizeLabel", "Particle Size"); pointSizeValue=factory.createTextField("PointSizeTextField", 10); pointSizeValue->setString("0.05"); pointSizeSlider=factory.createSlider("PointSizeSlider", 15.0); pointSizeSlider->setValueRange(0.01, 1.0, 0.05); pointSizeSlider->setValue(0.05); pointSizeSlider->getValueChangedCallbacks().add(this, &DotSpreaderOptionsDialog::sliderCallback); // create distribution check boxes GLMotif::ToggleButton* surfaceDistributionToggle=factory.createCheckBox("SurfaceDistributionToggle", "Surface", true); GLMotif::ToggleButton* volumeDistributionToggle=factory.createCheckBox("VolumeDistributionToggle", "Volume"); // set callbacks for toggle buttons (check boxes) surfaceDistributionToggle->getValueChangedCallbacks().add(this, &DotSpreaderOptionsDialog::distributionTogglesCallback); volumeDistributionToggle->getValueChangedCallbacks().add(this, &DotSpreaderOptionsDialog::distributionTogglesCallback); // add toggle buttons to array for radio-button behavior distributionToggles.push_back(surfaceDistributionToggle); distributionToggles.push_back(volumeDistributionToggle); // create push buttons clearParticles = factory.createButton("ClearParticles", "Clear Particles"); // assign callbacks for buttons clearParticles->getSelectCallbacks().add(this, &DotSpreaderOptionsDialog::buttonCallback); parameterDialog->manageChild(); return parameterDialogPopup; }
GLMotif::PopupWindow* CartesianGrid3DParameterDialog::createDialog() { WidgetFactory factory; GLMotif::PopupWindow* parameterDialogPopup=factory.createPopupWindow("ParameterDialogPopup", "CartesianGrid3D Parameters"); GLMotif::RowColumn* parameterDialog=factory.createRowColumn("ParameterDialog", 3); factory.setLayout(parameterDialog); openFileButton = factory.createButton("OpenFileButton", "Load Data"); openFileStatusA = factory.createLabel("OpenFileStatusA", ""); openFileStatusB = factory.createLabel("OpenFileStatusB", ""); openFileButton->getSelectCallbacks().add(this, &CartesianGrid3DParameterDialog::openFileCallback); char cwd[512]; getcwd(cwd, 512); std::string dataDirectory(cwd); IO::DirectoryPtr dirptr = IO::openDirectory(dataDirectory.c_str()); fileDialog = new GLMotif::FileSelectionDialog(Vrui::getWidgetManager(), "Open file...", dirptr, ".grid"); // Need to modify FileSelectionDialog to accept filterDescriptions. For ex: "Simple Grid (.grid)" // fileDialog->addFileNameFilters("Numpy Array (.npy)"); fileDialog->getOKCallbacks().add(this, &CartesianGrid3DParameterDialog::fileOpenAction); fileDialog->getCancelCallbacks().add(this, &CartesianGrid3DParameterDialog::fileCancelAction); /* factory.createLabel("Dummy3", ""); openFileStatusC = factory.createLabel("OpenFileStatusC", ""); factory.createLabel("Dummy4", ""); */ factory.createLabel("Dummy3b", ""); shapeLabel = factory.createLabel("ShapeLabel", ""); shapeValue = factory.createLabel("ShapeValue", ""); factory.createLabel("Dummy5", ""); factory.createLabel("Dummy6", ""); factory.createLabel("Dummy7", ""); factory.createLabel("StepSizeLabel", "step size"); stepSizeValue=factory.createTextField("StepSizeValue", 10); double step_size = IntegrationStepSize::instance()->getSavedValue("CartesianGrid3D"); if (step_size > 0.0) stepSizeValue->setString(toString(step_size).c_str()); else stepSizeValue->setString("0.01"); stepSizeSlider=factory.createSlider("StepSizeSlider", 15.0); stepSizeSlider->setValueRange(0.0001, 0.05, 0.0001); if (step_size > 0.0) stepSizeSlider->setValue(step_size); else stepSizeSlider->setValue(0.01); stepSizeSlider->getValueChangedCallbacks().add(this, &CartesianGrid3DParameterDialog::sliderCallback); parameterDialog->manageChild(); return parameterDialogPopup; }
GLMotif::PopupWindow* DynamicSolverOptionsDialog::createDialog() { WidgetFactory factory; // create the popup-shell GLMotif::PopupWindow* parameterDialogPopup=factory.createPopupWindow("ParameterDialogPopup", " Dynamic Solver Options"); // create the main layout GLMotif::RowColumn* parameterDialog=factory.createRowColumn("ParameterDialog", 1); factory.setLayout(parameterDialog); // create a layout for check boxes (toggle buttons) GLMotif::RowColumn* checkBoxLayout=factory.createRowColumn("CheckBoxLayout", 4); factory.setLayout(checkBoxLayout); // create line style toggle buttons (check boxes) factory.createLabel("", "Line Style"); GLMotif::ToggleButton* noneLineToggle= factory.createCheckBox("NoneLineToggle", "None"); GLMotif::ToggleButton* basicLineToggle= factory.createCheckBox("BasicLineToggle", "2D"); GLMotif::ToggleButton* polyLineToggle= factory.createCheckBox("PolyLineToggle", "3D", true); // assign callbacks for line style toggle buttons noneLineToggle->getValueChangedCallbacks().add(this, &DynamicSolverOptionsDialog::lineStyleTogglesCallback); basicLineToggle->getValueChangedCallbacks().add(this, &DynamicSolverOptionsDialog::lineStyleTogglesCallback); polyLineToggle->getValueChangedCallbacks().add(this, &DynamicSolverOptionsDialog::lineStyleTogglesCallback); // add line style toggles to array for radio-button behavior lineStyleToggles.push_back(noneLineToggle); lineStyleToggles.push_back(basicLineToggle); lineStyleToggles.push_back(polyLineToggle); // create head style toggle buttons (check boxes) factory.createLabel("", "Head Style"); GLMotif::ToggleButton* noneHeadToggle=factory.createCheckBox("NoneHeadToggle", "None"); GLMotif::ToggleButton* pointHeadToggle=factory.createCheckBox("PointHeadToggle", "Point", true); GLMotif::ToggleButton* sphereHeadToggle=factory.createCheckBox("SphereHeadToggle", "Sphere"); // assign callbacks for head style toggle buttons noneHeadToggle->getValueChangedCallbacks().add(this, &DynamicSolverOptionsDialog::headStyleTogglesCallback); pointHeadToggle->getValueChangedCallbacks().add(this, &DynamicSolverOptionsDialog::headStyleTogglesCallback); sphereHeadToggle->getValueChangedCallbacks().add(this, &DynamicSolverOptionsDialog::headStyleTogglesCallback); // add head style toggles to array for radio-button behavior headStyleToggles.push_back(noneHeadToggle); headStyleToggles.push_back(pointHeadToggle); headStyleToggles.push_back(sphereHeadToggle); // create color style toggle buttons (check boxes) factory.createLabel("", "Color Map"); GLMotif::ToggleButton* solidColorToggle=factory.createCheckBox("SolidColorToggle", "Solid", true); GLMotif::ToggleButton* gradientColorToggle=factory.createCheckBox("GradientColorToggle", "Gradient"); // assign callbacks for color style toggle buttons solidColorToggle->getValueChangedCallbacks().add(this, &DynamicSolverOptionsDialog::colorStyleTogglesCallback); gradientColorToggle->getValueChangedCallbacks().add(this, &DynamicSolverOptionsDialog::colorStyleTogglesCallback); // add color style toggles to array for radio-button behavior colorMapToggles.push_back(solidColorToggle); colorMapToggles.push_back(gradientColorToggle); // create spacer (newline) factory.createLabel("Spacer", ""); checkBoxLayout->manageChild(); factory.setLayout(parameterDialog); // create layout for sliders GLMotif::RowColumn* sliderLayout=factory.createRowColumn("SliderLayout", 3); factory.setLayout(sliderLayout); factory.createLabel("ReleaseSizeLabel", "Number of Particles"); releaseSizeValue=factory.createTextField("ReleaseSizeTextField", 10); releaseSizeValue->setString("1"); releaseSizeSlider=factory.createSlider("ReleaseSizeSlider", 15.0); releaseSizeSlider->setValueRange(1, 250, 1); releaseSizeSlider->setValue(1); releaseSizeSlider->getValueChangedCallbacks().add(this, &DynamicSolverOptionsDialog::sliderCallback); factory.createLabel("ParticleSizeLabel", "Particle Size"); pointSizeValue=factory.createTextField("PointSizeTextField", 10); pointSizeValue->setString("0.25"); pointSizeSlider=factory.createSlider("PointSizeSlider", 15.0); pointSizeSlider->setValueRange(0.01, 0.25, 0.01); pointSizeSlider->setValue(0.25); pointSizeSlider->getValueChangedCallbacks().add(this, &DynamicSolverOptionsDialog::sliderCallback); // create a push button for clearing particles and assign callback GLMotif::Button* clearButton=factory.createButton("ClearButton", "Clear"); clearButton->getSelectCallbacks().add(this, &DynamicSolverOptionsDialog::clearPointsCallback); sliderLayout->manageChild(); parameterDialog->manageChild(); return parameterDialogPopup; }
GLMotif::PopupWindow* RikitakeDynamoParameterDialog::createDialog() { WidgetFactory factory; GLMotif::PopupWindow* parameterDialogPopup=factory.createPopupWindow("ParameterDialogPopup", "RikitakeDynamo Parameters"); GLMotif::RowColumn* parameterDialog=factory.createRowColumn("ParameterDialog", 3); factory.setLayout(parameterDialog); factory.createLabel("NuParameterLabel", "nu"); currentNuValue=factory.createTextField("CurrentNuValue", 10); currentNuValue->setString("0.2"); nuParameterSlider=factory.createSlider("NuParameterSlider", 15.0); nuParameterSlider->setValueRange(0.0, 10.0, 0.01); nuParameterSlider->setValue(0.2); nuParameterSlider->getValueChangedCallbacks().add(this, &RikitakeDynamoParameterDialog::sliderCallback); factory.createLabel("AParameterLabel", "a"); currentAValue=factory.createTextField("CurrentAValue", 10); currentAValue->setString("5.0"); aParameterSlider=factory.createSlider("AParameterSlider", 15.0); aParameterSlider->setValueRange(0.0, 10.0, 0.01); aParameterSlider->setValue(5.0); aParameterSlider->getValueChangedCallbacks().add(this, &RikitakeDynamoParameterDialog::sliderCallback); factory.createLabel("StepSizeLabel", "step size"); stepSizeValue=factory.createTextField("StepSizeValue", 10); double step_size = IntegrationStepSize::instance()->getSavedValue("Rikitake Dynamo"); if (step_size > 0.0) stepSizeValue->setString(toString(step_size).c_str()); else stepSizeValue->setString("0.01"); stepSizeSlider=factory.createSlider("StepSizeSlider", 15.0); stepSizeSlider->setValueRange(0.0001, 0.05, 0.0001); if (step_size > 0.0) stepSizeSlider->setValue(step_size); else stepSizeSlider->setValue(0.01); stepSizeSlider->getValueChangedCallbacks().add(this, &RikitakeDynamoParameterDialog::sliderCallback); factory.createLabel("EvaluationLabel", "Evaluation Method"); GLMotif::ToggleButton* exactEvalToggle=factory.createCheckBox("ExactEvalToggle", "Exact", true); GLMotif::ToggleButton* gridEvalToggle=factory.createCheckBox("GridEvalToggle", "Interpolated Grid"); // assign line style toggle callbacks exactEvalToggle->getValueChangedCallbacks().add(this, &RikitakeDynamoParameterDialog::evalTogglesCallback); gridEvalToggle->getValueChangedCallbacks().add(this, &RikitakeDynamoParameterDialog::evalTogglesCallback); factory.createLabel("xSpacingLabel", "x-Grid Spacing"); currentXValue=factory.createTextField("xTextField", 12); currentXValue->setString("1.0"); currentXValue->setCharWidth(5); currentXValue->setPrecision(5); xSpacingSlider=factory.createSlider("XSpacingSlider", 15.0); xSpacingSlider->setValueRange(.001, 2.0, 0.001); xSpacingSlider->setValue(1.0); xSpacingSlider->getValueChangedCallbacks().add(this, &RikitakeDynamoParameterDialog::sliderCallback); factory.createLabel("ySpacingLabel", "y-Grid Spacing"); currentYValue=factory.createTextField("yTextField", 12); currentYValue->setString("1.0"); currentYValue->setCharWidth(5); currentYValue->setPrecision(5); ySpacingSlider=factory.createSlider("YSpacingSlider", 15.0); ySpacingSlider->setValueRange(.001, 2.0, 0.001); ySpacingSlider->setValue(1.0); ySpacingSlider->getValueChangedCallbacks().add(this, &RikitakeDynamoParameterDialog::sliderCallback); factory.createLabel("zSpacingLabel", "z-Grid Spacing"); currentZValue=factory.createTextField("zTextField", 12); currentZValue->setString("1.0"); currentZValue->setCharWidth(5); currentZValue->setPrecision(5); zSpacingSlider=factory.createSlider("ZSpacingSlider", 15.0); zSpacingSlider->setValueRange(.001, 2.0, 0.001); zSpacingSlider->setValue(1.0); zSpacingSlider->getValueChangedCallbacks().add(this, &RikitakeDynamoParameterDialog::sliderCallback); // add toggles to array for radio-button behavior evalToggles.push_back(exactEvalToggle); evalToggles.push_back(gridEvalToggle); parameterDialog->manageChild(); return parameterDialogPopup; }