DispButtons::DispButtons( int mainWindowID) { GLOW_DEBUGSCOPE("DispButtons::DispButtons"); _mainWindowID = mainWindowID; new MandelGizmoWindow(_image1, _image2, width, height); //Glow::SetIdleFunc(GlowSubwindow::Refresh); // Create a control panel window _controlWindow = new GlowQuickPaletteWindow("Controls"); _controlWindow->GlowSubwindow::SetEventMask(Glow::mouseEvents | Glow::keyboardEvents | Glow::dragEvents); // Add controls // First, we'll put a little blurb at the top of the window _controlWindow->AddLabel( "Button Control of Displayer"); // The rest of the window appears in panels. The panels are arranged // vertically, but widgets are arranged horizontally within each panel GlowQuickPanelWidget* vpanel = _controlWindow->AddArrangingPanel( GlowQuickPanelWidget::vertical); // First we have a few general controls GlowQuickPanelWidget* panel = vpanel->AddPanel( GlowQuickPanelWidget::loweredStyle, "", GlowQuickPanelWidget::horizontal); // GlowQuickPalette* panel = _controlWindow->AddPanel( // GlowQuickPanelWidget::etchedStyle, "Main"); // Quit button - could also use AddDismissPushButton? _quitButton = panel->AddPushButton("Quit", this); // A separator panel->AddSeparator(); // _controlWindow->Pack(); // Print button // Separate panel for print button, commented out. // panel = hpanel->AddPanel( //GlowQuickPanelWidget::loweredStyle, "", //GlowQuickPanelWidget::vertical); _printButton = panel->AddPushButton("Print", this); // new panel for show grid checkbox panel = vpanel->AddPanel( GlowQuickPanelWidget::loweredStyle, "", GlowQuickPanelWidget::horizontal); // show grid checkbox _gridCheckBox = panel->AddCheckBox( "Show Grid", GlowCheckBoxWidget::off, this); // new panel for next/previous buttons panel = vpanel->AddPanel( GlowQuickPanelWidget::loweredStyle, "", GlowQuickPanelWidget::horizontal); // next/previous buttons _previousButton = panel->AddPushButton("Previous",this); // A separator panel->AddSeparator(); _nextButton = panel->AddPushButton("Next",this); // Input window, for jump to numbered frame panel = vpanel->AddPanel( GlowQuickPanelWidget::loweredStyle, "", GlowQuickPanelWidget::horizontal); char* initmsg; sprintf(initmsg,"%d", picturecounter); _jumptoframe = panel->GlowQuickPalette::AddTextField(50, initmsg, "Go to Frame"); panel->AddSeparator(); _goButton = panel->AddPushButton("Go",this); //_jumptoframe->GlowWidget::SetRefreshEnabled(false); _jumptoframe->GlowTextFieldWidget::SetBlinkInterval(50000); // new panel for X/Y/A display panel = vpanel->AddPanel( GlowQuickPanelWidget::loweredStyle, "", GlowQuickPanelWidget::horizontal); GlowLabeledPopupMenuWidget* popup = panel->AddPopupMenu( "Morphogen:", this); popup->AddItem("X"); popup->AddItem("Y"); popup->AddItem("A"); // new panel for scale up/scale down buttons panel = vpanel->AddPanel( GlowQuickPanelWidget::loweredStyle, "", GlowQuickPanelWidget::vertical); _scaleslider = panel->AddSlider(0.1, 10.0, 1.0, GlowSliderWidget::logarithmic, 2, "%.1f", "SCALE: \n%.2f", this); GlowQuickPanelWidget* subpanel = panel->AddPanel( GlowQuickPanelWidget::transparentStyle, "", GlowQuickPanelWidget::horizontal); _scaledownButton = subpanel->AddPushButton("<-Down",this); subpanel->AddSeparator(GlowSeparatorWidget::transparentStyle); subpanel->AddSeparator(GlowSeparatorWidget::transparentStyle); subpanel->AddSeparator(GlowSeparatorWidget::transparentStyle); _scaleupButton = subpanel->AddPushButton(" Up-> ",this); panel->AddSeparator(); _resetButton = panel->AddPushButton("Reset",this); panel = vpanel->AddPanel( GlowQuickPanelWidget::loweredStyle, "", GlowQuickPanelWidget::vertical); _gizmoButton = panel->AddPushButton("New Glow Window", this); _controlWindow->Pack(); }
MandelWind::MandelWind( MandelData* data) : GlowWindow("Mandelglow", GlowWindow::autoPosition, GlowWindow::autoPosition, data->Width(), data->Height(), Glow::rgbBuffer | Glow::doubleBuffer, Glow::mouseEvents | Glow::dragEvents | Glow::menuEvents) { GLOW_DEBUGSCOPE("MandelWind::MandelWind"); // Get data data->SetThreshhold(1000); data_ = data; image_ = 0; dragType_ = NO_DRAG; r_ = 255; g_ = 0; b_ = 0; imageValid_ = false; updateInBackground_ = true; multiCycleRate_ = 1.0f; multiCycleOffset_ = 0.0f; // Create a control panel window to go along with this window controlWindow_ = new GlowQuickPaletteWindow("Controls"); // Add controls // First, we'll put a little blurb at the top of the window controlWindow_->AddLabel( "Mandelglow (lesson 5)\nby Daniel Azuma"); // The next set of controls will be within a panel called "calculation" GlowQuickPanelWidget* panel = controlWindow_->AddPanel( GlowQuickPanelWidget::etchedStyle, "Calculation"); // Checkbox for background calculation. // Put it within the calculation panel. // Initial value is on (checked), and bind notifier to this MandelWind. panel->AddCheckBox("Background calcuation", GlowCheckBoxWidget::on, this); // Create a slider for the number of iterations // Min iterations = 100, max = 2000, initial value = 1000. // Specify the syntax for the value labels and the main label. // Bind notifier to this MandelWind. iterationSlider_ = panel->AddSlider(100, 2000, 1000, GlowSliderWidget::defaultOptions, 2, "%.0f", "Iterations:\n%.0f", this); // Create another panel called "view" panel = controlWindow_->AddPanel( GlowQuickPanelWidget::etchedStyle, "View"); // Color scheme popup menu put it within the view panel GlowLabeledPopupMenuWidget* popup = panel->AddPopupMenu( "Color scheme:", this); popup->AddItem("Red"); popup->AddItem("Green"); popup->AddItem("Blue"); popup->AddItem("Multi"); // Create a nested panel. multiColorControlsPanel_ = panel->AddPanel( GlowQuickPanelWidget::etchedStyle, "Multicolor settings"); // Slider giving the rate of cycling for "multi" coloring style multiCycleRateSlider_ = multiColorControlsPanel_->AddSlider(0.2, 20.0, 1.0, GlowSliderWidget::logarithmic, 2, "%.2f", "Cycle rate:\n%.2f", this); multiCycleOffsetSlider_ = multiColorControlsPanel_->AddSlider(0.0, 3.0, 0.0, GlowSliderWidget::defaultOptions, 2, "%.2f", "Cycle offset:\n%.2f", this); // The panel starts off inactive because the initial color scheme is // plain red (not multicolor). Note that this also deactivates both // sliders that are within the panel multiColorControlsPanel_->Deactivate(); // Reset view button. resetButton_ = panel->AddPushButton("Reset View", this); // Quit button and save button. Use an arranging panel to cause // the buttons to be laid out horizontally panel = controlWindow_->AddArrangingPanel( GlowQuickPanelWidget::horizontal); quitButton_ = panel->AddPushButton("Quit", this); saveButton_ = panel->AddPushButton("Save Image", this); // New button for lesson 5 gizmoButton_ = panel->AddPushButton("Open Gizmo", this); // Arrange controls and show the control panel window controlWindow_->Pack(); }
MandelGizmoWindow::MandelGizmoWindow( const unsigned char* image1, const unsigned char* image2, int width, int height) { GLOW_DEBUGSCOPE("MandelGizmoWindow::MandelGizmoWindow"); // Initialize window // char dumpmsg[80]; if(gizmocounter==0) { width = 500; height = 500; Init("Growth: 1st Glow Window", 250, 200, width, height, Glow::rgbBuffer, Glow::allEvents); gizmowindname=GlutWindowNum(); cout << "gizmowindname is " << gizmowindname << "\n"; Refresh(); // Glow::SetIdleFunc(&MandelGizmoWindow::Refresh); } else { width=400; height=400; Init("Growth: Popup Glow Window", GlowWindow::autoPosition, GlowWindow::autoPosition, width, height, Glow::rgbBuffer, Glow::allEvents); } // Create widget panel with close button and frame rate indicator. // Note that we use a margin of 0 _widgetsPanel = new GlowQuickPaletteSubwindow(this, 0, 0, width, 25, GlowQuickPalette::horizontal, GlowQuickPalette::alignLeft, 10, 5, 5); GlowQuickPanelWidget* vpanel1 = _widgetsPanel->AddArrangingPanel( GlowQuickPanelWidget::vertical); vpanel1->SetBackColor(GlowColor::white); vpanel1->AddDismissPushButton("Close", this); // Note that we provide initial text for the label widget so its // computed width is wide enough to display any fps we want. GlowLabelWidget* fpsIndicator = vpanel1->AddLabel("00.00 fps"); GlowLabelWidget* xaxisIndicator = vpanel1->AddLabel("X-axis: Red"); xaxisIndicator->SetTextColor(GlowColor::red); GlowLabelWidget* yaxisIndicator = vpanel1->AddLabel("Y-axis: Green"); yaxisIndicator->SetTextColor(GlowColor::green); GlowLabelWidget* zaxisIndicator = vpanel1->AddLabel("Z-axis: Blue"); zaxisIndicator->SetTextColor(GlowColor::blue); GlowQuickPanelWidget* vpanel2 = _widgetsPanel->AddArrangingPanel( GlowQuickPanelWidget::vertical); // First we have a few general controls GlowQuickPanelWidget* panel = vpanel2->AddPanel( GlowQuickPanelWidget::loweredStyle, "", GlowQuickPanelWidget::horizontal); // Add a new panel that will contain text - Glow seems easier for // text than straight OpenGl. GlowLabelWidget* dumpID = panel->AddLabel("Frame 000"); panel->AddSeparator(); GlowLabelWidget* ctime = panel->AddLabel("Time is 00.0"); // Another panel for zmax, nodes, etc. /* _textPanel = new GlowQuickPaletteSubwindow(this, 0, 25, width, 25, GlowQuickPalette::horizontal, GlowQuickPalette::alignCenter, 10, 0, 0); */ // panel->AddSeparator(); panel = vpanel2->AddPanel( GlowQuickPanelWidget::loweredStyle, "", GlowQuickPanelWidget::horizontal); GlowLabelWidget* zmax = panel->AddLabel("Max Height is 00.000"); // _widgetsPanel->AddSeparator(); // _widgetsPanel->AddLabel(dumpmsg); panel->AddSeparator(); GlowLabelWidget* nodes = panel->AddLabel("000,000 Nodes"); panel->AddSeparator(); GlowLabelWidget* area = panel->AddLabel("Area is 00.000"); // new sub-panel for Xmin, Xmax panel = vpanel2->AddPanel( GlowQuickPanelWidget::loweredStyle, "", GlowQuickPanelWidget::horizontal); GlowLabelWidget* morphmin = panel->AddLabel("X Minimum is 0.000"); // _widgetsPanel->AddSeparator(); // _widgetsPanel->AddLabel(dumpmsg); panel->AddSeparator(); GlowLabelWidget* morphmax = panel->AddLabel("X Maximum is 0.000"); _widgetsPanel->Pack(true); /*_colourPanel = new GlowSubwindow(this, 0, _widgetsPanel->Height(), width, 200, Glow::rgbBuffer, Glow::noEvents); glClearColor(1.0, 1.0, 1.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); // give_color_bar(common_rgbmap); // Flush the pipeline glFlush(); // Glow::SwapBuffers(); Refresh();*/ //_colourPanel = new MandelGizmoSubwindow(this, width, _widgetsPanel->Height(), image1, width, height, fpsIndicator, dumpID, area, nodes, zmax, ctime, morphmin, morphmax); //Reshape(width, height+_widgetsPanel->Height()); // Create the subwindow that will contain the main plant image _gizmoPanel = new MandelGizmoSubwindow(this, width, _widgetsPanel->Height()+height, image2, width, height, fpsIndicator, dumpID, area, nodes, zmax, ctime, morphmin, morphmax); Reshape(width, height+_widgetsPanel->Height()); gizmosubwindname=GlutWindowNum(); cout << "subwindname is" << gizmosubwindname << "\n"; }
MandelWind::MandelWind( MandelData* data) : GlowWindow("Mandelglow", GlowWindow::autoPosition, GlowWindow::autoPosition, data->Width(), data->Height(), Glow::rgbBuffer | Glow::doubleBuffer, Glow::mouseEvents | Glow::dragEvents | Glow::menuEvents) { // Get data data->SetThreshhold(1000); data_ = data; image_ = 0; dragType_ = NO_DRAG; r_ = 255; g_ = 0; b_ = 0; imageValid_ = false; updateInBackground_ = true; multiCycleRate_ = 1.0f; multiCycleOffset_ = 0.0f; // We removed the menu material because we aren't using menus anymore /* // Create new menu GlowMenu* menu = new GlowMenu; // Add entries to the menu. Give each item an identifying constant menu->AddEntry("Reset zoom", RESETZOOM_ITEM); menu->AddEntry("Quit", QUIT_ITEM); // Create a submenu GlowMenu* colorMenu = new GlowMenu; colorMenu->AddEntry("Red", RED_ITEM); colorMenu->AddEntry("Green", GREEN_ITEM); colorMenu->AddEntry("Blue", BLUE_ITEM); colorMenu->AddEntry("Multi", MULTI_ITEM); // Attach this submenu to the first menu menu->AddSubmenu("Color", colorMenu); // Mark the first item in the submenu colorMenu->SetItemMark(0, "=> "); // Bind the menu to the right mouse button on our window SetMenu(Glow::rightButton, menu); // Set both menus to notify our receiver when it gets a hit menu->Notifier().Bind(this); colorMenu->Notifier().Bind(this); */ // The following is new with lesson 4: // Create a control panel window to go along with this window controlWindow_ = new GlowQuickPaletteWindow("Controls"); // Add controls // First, we'll put a little blurb at the top of the window controlWindow_->AddLabel( "Mandelglow (lesson 4)\nby Daniel Azuma"); // The next set of controls will be within a panel called "calculation" GlowQuickPanelWidget* panel = controlWindow_->AddPanel( GlowQuickPanelWidget::etchedStyle, "Calculation"); // Checkbox for background calculation. // Put it within the calculation panel. // Initial value is on (checked), and bind notifier to this MandelWind. panel->AddCheckBox("Background calcuation", GlowCheckBoxWidget::on, this); // Create a slider for the number of iterations // Min iterations = 100, max = 2000, initial value = 1000. // Specify the syntax for the value labels and the main label. // Bind notifier to this MandelWind. iterationSlider_ = panel->AddSlider(100, 2000, 1000, GlowSliderWidget::defaultOptions, 2, "%.0f", "Iterations:\n%.0f", this); // Create another panel called "view" panel = controlWindow_->AddPanel( GlowQuickPanelWidget::etchedStyle, "View"); // Color scheme popup menu put it within the view panel GlowLabeledPopupMenuWidget* popup = panel->AddPopupMenu( "Color scheme:", this); popup->AddItem("Red"); popup->AddItem("Green"); popup->AddItem("Blue"); popup->AddItem("Multi"); // Create a nested panel. multiColorControlsPanel_ = panel->AddPanel( GlowQuickPanelWidget::etchedStyle, "Multicolor settings"); // Slider giving the rate of cycling for "multi" coloring style multiCycleRateSlider_ = multiColorControlsPanel_->AddSlider(0.2, 20.0, 1.0, GlowSliderWidget::logarithmic, 2, "%.2f", "Cycle rate:\n%.2f", this); multiCycleOffsetSlider_ = multiColorControlsPanel_->AddSlider(0.0, 3.0, 0.0, GlowSliderWidget::defaultOptions, 2, "%.2f", "Cycle offset:\n%.2f", this); // The panel starts off inactive because the initial color scheme is // plain red (not multicolor). Note that this also deactivates both // sliders that are within the panel multiColorControlsPanel_->Deactivate(); // Reset view button. resetButton_ = panel->AddPushButton("Reset View", this); // Quit button and save button. Use an arranging panel to cause // the buttons to be laid out horizontally panel = controlWindow_->AddArrangingPanel( GlowQuickPanelWidget::horizontal); quitButton_ = panel->AddPushButton("Quit", this); saveButton_ = panel->AddPushButton("Save Image", this); // Arrange controls and show the control panel window controlWindow_->Pack(); }