Exemplo n.º 1
0
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();
}
Exemplo n.º 2
0
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();
}
Exemplo n.º 3
0
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();
}