Beispiel #1
0
int main(int argc, char **argv) {
  window = new Fl_Double_Window(400,400);

  input = new Fl_Input(25,375,350,25);
  input->static_value("The quick brown fox jumps over the lazy dog.");
  input->when(FL_WHEN_CHANGED);
  input->callback(input_cb);

  sizes= new Fl_Value_Slider(50,350,350,25,"Size:");
  sizes->type(Fl_Slider::HORIZONTAL);
  sizes->clear_flag(FL_ALIGN_MASK);
  sizes->set_flag(FL_ALIGN_LEFT);
  sizes->range(1,64);
  sizes->step(1);
  sizes->value(14);
  sizes->callback(size_cb);

  fonts=new Fl_Value_Slider(50,325,350,25,"Font:");
  fonts->type(Fl_Slider::HORIZONTAL);
  fonts->clear_flag(FL_ALIGN_MASK);
  fonts->set_flag(FL_ALIGN_LEFT);
  fonts->range(0,15);
  fonts->step(1);
  fonts->value(0);
  fonts->callback(font_cb);

  Fl_Group *g = new Fl_Group(25,300,350,25);

  leftb = new Fl_Toggle_Button(0,0,50,25,"left");
  leftb->callback(button_cb);
  rightb = new Fl_Toggle_Button(50,0,50,25,"right");
  rightb->callback(button_cb);
  topb = new Fl_Toggle_Button(100,0,50,25,"top");
  topb->callback(button_cb);
  bottomb = new Fl_Toggle_Button(150,0,50,25,"bottom");
  bottomb->callback(button_cb);
  insideb = new Fl_Toggle_Button(200,0,50,25,"inside");
  insideb->callback(button_cb);
  wrapb = new Fl_Toggle_Button(250,0,50,25,"wrap");
  wrapb->callback(button_cb);
  clipb = new Fl_Toggle_Button(300,0,50,25,"clip");
  clipb->callback(button_cb);
  g->end();

  Fl_Choice *c = new Fl_Choice(100,250,200,25);
  c->menu(choices);

  text= new Fl_Box(100,75,200,100,input->value());
  text->box(FL_ENGRAVED_BOX);
  text->clear_flag(FL_ALIGN_MASK);
  text->set_flag(FL_ALIGN_CENTER);
  window->resizable(text);
  window->end();
  window->show(argc,argv);
  return Fl::run();
}
//----------------------------------------------------
// Constructor.  Creates all of the widgets.
// Add new widgets here
//----------------------------------------------------
ImpressionistUI::ImpressionistUI() {
	// Create the main window
	m_mainWindow = new Fl_Window(600, 300, "Impressionist");
		m_mainWindow->user_data((void*)(this));	// record self to be used by static callback functions
		// install menu bar
		m_menubar = new Fl_Menu_Bar(0, 0, 600, 25);
		m_menubar->menu(menuitems);

		// Create a group that will hold two sub windows inside the main
		// window
		Fl_Group* group = new Fl_Group(0, 25, 600, 275);

			// install paint view window
			m_paintView = new PaintView(300, 25, 300, 275, "This is the paint view");//0jon
			m_paintView->box(FL_DOWN_FRAME);

			// install original view window
			m_origView = new OriginalView(0, 25, 300, 275, "This is the orig view");//300jon
			m_origView->box(FL_DOWN_FRAME);
			// m_origView->deactivate();

		group->end();
		Fl_Group::current()->resizable(group);
    m_mainWindow->end();

	// init values

	m_nSize = 10;
	m_nAngle = 45;
	m_nAlpha = 255;
	m_nBackgroundAlpha = 100;

	// brush dialog definition
	m_brushDialog = new Fl_Window(400, 325, "Brush Dialog");
		// Add a brush type choice to the dialog
		m_BrushTypeChoice = new Fl_Choice(50,10,150,25,"&Brush");
		m_BrushTypeChoice->user_data((void*)(this));	// record self to be used by static callback functions
		m_BrushTypeChoice->menu(brushTypeMenu);
		m_BrushTypeChoice->callback(cb_brushChoice);

		m_ClearCanvasButton = new Fl_Button(240,10,150,25,"&Clear Canvas");
		m_ClearCanvasButton->user_data((void*)(this));
		m_ClearCanvasButton->callback(cb_clear_canvas_button);

		m_transparentBackgroundButton = new Fl_Button(130,280,150,25,"&Show Background");
		m_transparentBackgroundButton->user_data((void*)(this));
		m_transparentBackgroundButton->callback(cb_transparentBackground);

		m_edgeImageButton = new Fl_Button(130,180,150,25,"&Toggle Edge Image");
		m_edgeImageButton->user_data((void*)(this));
		m_edgeImageButton->callback(cb_edgeImage);

		//Add angle choice menu
		Fl_Choice * myChoice = new Fl_Choice(95,60,150,25,"&Angle Choice");
		myChoice->user_data((void*)(this));	 // record self to be used by static callback functions
		myChoice->menu(angleChoiceMenu);
		myChoice->callback(cb_angleChoice);

		// Add brush size slider to the dialog 
		m_BrushSizeSlider = new Fl_Value_Slider(10, 100, 300, 20, "Size");
		m_BrushSizeSlider->user_data((void*)(this));	// record self to be used by static callback functions
		m_BrushSizeSlider->type(FL_HOR_NICE_SLIDER);
        m_BrushSizeSlider->labelfont(FL_COURIER);
        m_BrushSizeSlider->labelsize(12);
		m_BrushSizeSlider->minimum(1);
		m_BrushSizeSlider->maximum(40);
		m_BrushSizeSlider->step(1);
		m_BrushSizeSlider->value(m_nSize);
		m_BrushSizeSlider->align(FL_ALIGN_RIGHT);
		m_BrushSizeSlider->callback(cb_sizeSlides);

		// Add brush angle slider to the dialog 
		m_BrushSizeSlider = new Fl_Value_Slider(10, 120, 300, 20, "Angle");
		m_BrushSizeSlider->user_data((void*)(this));	// record self to be used by static callback functions
		m_BrushSizeSlider->type(FL_HOR_NICE_SLIDER);
        m_BrushSizeSlider->labelfont(FL_COURIER);
        m_BrushSizeSlider->labelsize(12);
		m_BrushSizeSlider->minimum(0);
		m_BrushSizeSlider->maximum(180);
		m_BrushSizeSlider->step(1);
		m_BrushSizeSlider->value(m_nAngle);
		m_BrushSizeSlider->align(FL_ALIGN_RIGHT);
		m_BrushSizeSlider->callback(cb_angleSlides);

		// Add brush angle slider to the dialog 
		m_BrushSizeSlider = new Fl_Value_Slider(10, 140, 300, 20, "Opacity");
		m_BrushSizeSlider->user_data((void*)(this));	// record self to be used by static callback functions
		m_BrushSizeSlider->type(FL_HOR_NICE_SLIDER);
        m_BrushSizeSlider->labelfont(FL_COURIER);
        m_BrushSizeSlider->labelsize(12);
		m_BrushSizeSlider->minimum(0);
		m_BrushSizeSlider->maximum(255);
		m_BrushSizeSlider->step(1);
		m_BrushSizeSlider->value(m_nAlpha);
		m_BrushSizeSlider->align(FL_ALIGN_RIGHT);
		m_BrushSizeSlider->callback(cb_alphaSlides);

		// Add brush angle slider to the dialog 
		m_BrushSizeSlider = new Fl_Value_Slider(10, 250, 300, 20, "Background\nOpacity");
		m_BrushSizeSlider->user_data((void*)(this));	// record self to be used by static callback functions
		m_BrushSizeSlider->type(FL_HOR_NICE_SLIDER);
        m_BrushSizeSlider->labelfont(FL_COURIER);
        m_BrushSizeSlider->labelsize(12);
		m_BrushSizeSlider->minimum(0);
		m_BrushSizeSlider->maximum(255);
		m_BrushSizeSlider->step(1);
		m_BrushSizeSlider->value(m_nBackgroundAlpha);
		m_BrushSizeSlider->align(FL_ALIGN_RIGHT);
		m_BrushSizeSlider->callback(cb_backgroundAlphaSlides);

    m_brushDialog->end();	

    // filter dialog definition 
    std::fill(fltKernel,fltKernel+(FLT_WIDTH*FLT_HEIGHT)-1,0.0f);
    // m_nScale = 1.0f;
    // m_nOffset = 0.0f;
    m_filterDialog = new Fl_Window(400, 200, "Filter Dialog");

    	m_BrushTypeChoice = new Fl_Choice(150,10,150,25,"&Select Source");
		m_BrushTypeChoice->user_data((void*)(this));	// record self to be used by static callback functions
		m_BrushTypeChoice->menu(filterChoiceMenu);
		m_BrushTypeChoice->callback(cb_filterChoice);

    	m_ApplyFilterButton = new Fl_Button(30,170,100,25,"&Apply Filter");
		m_ApplyFilterButton->user_data((void*)(this));
		m_ApplyFilterButton->callback(cb_apply_filter_button);

		m_PreviewFilterButton = new Fl_Button(150,170,100,25,"&Preview Filter");
		m_PreviewFilterButton->user_data((void*)(this));
		m_PreviewFilterButton->callback(cb_preview_filter_button);

		m_CancelFilterButton = new Fl_Button(270,170,100,25,"&Cancel");
		m_CancelFilterButton->user_data((void*)(this));
		m_CancelFilterButton->callback(cb_cancel_filter_button);

		Fl_Float_Input* scaleInput = new Fl_Float_Input(50, 80, 40, 20,"&Scale");
		scaleInput->user_data((void*)(this)); 
		scaleInput->callback(cb_scaleInput);
		
		Fl_Float_Input* offsetInput = new Fl_Float_Input(50, 100, 40, 20,"&Offset");
		offsetInput->user_data((void*)(this)); 
		offsetInput->callback(cb_offsetInput);

    	Fl_Float_Input* filterInput_00 = new Fl_Float_Input(100, 50, 50, 20);
		filterInput_00->user_data((void*)(this)); 
		filterInput_00->callback(cb_filterInput_00);

		Fl_Float_Input* filterInput_01 = new Fl_Float_Input(150, 50, 50, 20);
		filterInput_01->user_data((void*)(this)); 
		filterInput_01->callback(cb_filterInput_01);

		Fl_Float_Input* filterInput_02 = new Fl_Float_Input(200, 50, 50, 20);
		filterInput_02->user_data((void*)(this)); 
		filterInput_02->callback(cb_filterInput_02);

		Fl_Float_Input* filterInput_03 = new Fl_Float_Input(250, 50, 50, 20);
		filterInput_03->user_data((void*)(this)); 
		filterInput_03->callback(cb_filterInput_03);

		Fl_Float_Input* filterInput_04 = new Fl_Float_Input(300, 50, 50, 20);
		filterInput_04->user_data((void*)(this)); 
		filterInput_04->callback(cb_filterInput_04);

		Fl_Float_Input* filterInput_10 = new Fl_Float_Input(100, 70, 50, 20);
		filterInput_10->user_data((void*)(this)); 
		filterInput_10->callback(cb_filterInput_10);

		Fl_Float_Input* filterInput_11 = new Fl_Float_Input(150, 70, 50, 20);
		filterInput_11->user_data((void*)(this)); 
		filterInput_11->callback(cb_filterInput_11);

		Fl_Float_Input* filterInput_12 = new Fl_Float_Input(200, 70, 50, 20);
		filterInput_12->user_data((void*)(this)); 
		filterInput_12->callback(cb_filterInput_12);

		Fl_Float_Input* filterInput_13 = new Fl_Float_Input(250, 70, 50, 20);
		filterInput_13->user_data((void*)(this)); 
		filterInput_13->callback(cb_filterInput_13);

		Fl_Float_Input* filterInput_14 = new Fl_Float_Input(300, 70, 50, 20);
		filterInput_14->user_data((void*)(this)); 
		filterInput_14->callback(cb_filterInput_14);

		Fl_Float_Input* filterInput_20 = new Fl_Float_Input(100, 90, 50, 20);
		filterInput_20->user_data((void*)(this)); 
		filterInput_20->callback(cb_filterInput_20);

		Fl_Float_Input* filterInput_21 = new Fl_Float_Input(150, 90, 50, 20);
		filterInput_21->user_data((void*)(this)); 
		filterInput_21->callback(cb_filterInput_21);

		Fl_Float_Input* filterInput_22 = new Fl_Float_Input(200, 90, 50, 20);
		filterInput_22->user_data((void*)(this)); 
		filterInput_22->callback(cb_filterInput_22);

		Fl_Float_Input* filterInput_23 = new Fl_Float_Input(250, 90, 50, 20);
		filterInput_23->user_data((void*)(this)); 
		filterInput_23->callback(cb_filterInput_23);

		Fl_Float_Input* filterInput_24 = new Fl_Float_Input(300, 90, 50, 20);
		filterInput_24->user_data((void*)(this)); 
		filterInput_24->callback(cb_filterInput_24);

		Fl_Float_Input* filterInput_30 = new Fl_Float_Input(100, 110, 50, 20);
		filterInput_30->user_data((void*)(this)); 
		filterInput_30->callback(cb_filterInput_30);

		Fl_Float_Input* filterInput_31 = new Fl_Float_Input(150, 110, 50, 20);
		filterInput_31->user_data((void*)(this)); 
		filterInput_31->callback(cb_filterInput_31);

		Fl_Float_Input* filterInput_32 = new Fl_Float_Input(200, 110, 50, 20);
		filterInput_32->user_data((void*)(this)); 
		filterInput_32->callback(cb_filterInput_32);

		Fl_Float_Input* filterInput_33 = new Fl_Float_Input(250, 110, 50, 20);
		filterInput_33->user_data((void*)(this)); 
		filterInput_33->callback(cb_filterInput_33);

		Fl_Float_Input* filterInput_34 = new Fl_Float_Input(300, 110, 50, 20);
		filterInput_34->user_data((void*)(this)); 
		filterInput_34->callback(cb_filterInput_34);

		Fl_Float_Input* filterInput_40 = new Fl_Float_Input(100, 130, 50, 20);
		filterInput_40->user_data((void*)(this)); 
		filterInput_40->callback(cb_filterInput_40);

		Fl_Float_Input* filterInput_41 = new Fl_Float_Input(150, 130, 50, 20);
		filterInput_41->user_data((void*)(this)); 
		filterInput_41->callback(cb_filterInput_41);

		Fl_Float_Input* filterInput_42 = new Fl_Float_Input(200, 130, 50, 20);
		filterInput_42->user_data((void*)(this)); 
		filterInput_42->callback(cb_filterInput_42);

		Fl_Float_Input* filterInput_43 = new Fl_Float_Input(250, 130, 50, 20);
		filterInput_43->user_data((void*)(this)); 
		filterInput_43->callback(cb_filterInput_43);

		Fl_Float_Input* filterInput_44 = new Fl_Float_Input(300, 130, 50, 20);
		filterInput_44->user_data((void*)(this)); 
		filterInput_44->callback(cb_filterInput_44);


    m_filterDialog->end();	


}
Fl_Double_Window* IntersectionInterface::make_window() {
  Fl_Double_Window* w;
  { Fl_Double_Window* o = m_intersectionWindow = new Fl_Double_Window(420, 265, "Intersection UI");
    w = o;
    o->user_data((void*)(this));
    { Fl_Group* o = new Fl_Group(5, 25, 145, 30);
      o->end();
    }
    { Fl_Choice* o = m_iShapeType = new Fl_Choice(5, 25, 145, 30, "Object type");
      o->down_box(FL_BORDER_BOX);
      o->align(FL_ALIGN_TOP_LEFT);
      o->menu(menu_m_iShapeType);
    }
    { Fl_Value_Slider* o = m_dXAt = new Fl_Value_Slider(5, 75, 200, 25, "At x pos");
      o->type(5);
      o->minimum(-1.5);
      o->maximum(1.5);
      o->callback((Fl_Callback*)cb_m_dXAt);
      o->align(FL_ALIGN_TOP_LEFT);
    }
    { Fl_Value_Slider* o = m_dYAt = new Fl_Value_Slider(5, 115, 200, 25, "At y pos");
      o->type(5);
      o->minimum(-1.5);
      o->maximum(1.5);
      o->callback((Fl_Callback*)cb_m_dYAt);
      o->align(FL_ALIGN_TOP_LEFT);
    }
    { Fl_Value_Slider* o = m_dZAt = new Fl_Value_Slider(5, 155, 200, 25, "At z pos");
      o->type(5);
      o->minimum(-1.5);
      o->maximum(1.5);
      o->callback((Fl_Callback*)cb_m_dZAt);
      o->align(FL_ALIGN_TOP_LEFT);
    }
    { Fl_Value_Slider* o = m_dTheta = new Fl_Value_Slider(5, 195, 200, 25, "Vec theta");
      o->type(5);
      o->maximum(360);
      o->step(1);
      o->callback((Fl_Callback*)cb_m_dTheta);
      o->align(FL_ALIGN_TOP_LEFT);
    }
    { Fl_Value_Slider* o = m_dPhi = new Fl_Value_Slider(5, 235, 200, 25, "Vec phi");
      o->type(5);
      o->minimum(-90);
      o->maximum(90);
      o->step(1);
      o->value(45);
      o->callback((Fl_Callback*)cb_m_dPhi);
      o->align(FL_ALIGN_TOP_LEFT);
    }
    { Fl_Button* o = new Fl_Button(330, 25, 85, 25, "Write test");
      o->callback((Fl_Callback*)cb_Write);
    }
    { Fl_Value_Slider* o = m_dXRot = new Fl_Value_Slider(215, 75, 200, 25, "View rotation");
      o->type(5);
      o->maximum(360);
      o->step(1);
      o->callback((Fl_Callback*)cb_m_dXRot);
      o->align(FL_ALIGN_TOP_LEFT);
    }
    { Fl_Value_Slider* o = m_dYRot = new Fl_Value_Slider(215, 115, 200, 25, "View height");
      o->type(5);
      o->minimum(-90);
      o->maximum(90);
      o->step(1);
      o->callback((Fl_Callback*)cb_m_dYRot);
      o->align(FL_ALIGN_TOP_LEFT);
    }
    { Fl_Check_Button* o = m_bGrid = new Fl_Check_Button(215, 155, 25, 25, "Show grid");
      o->down_box(FL_DOWN_BOX);
      o->value(1);
      o->callback((Fl_Callback*)cb_m_bGrid);
    }
    { Fl_Check_Button* o = m_bRay = new Fl_Check_Button(215, 195, 25, 25, "Show ray");
      o->down_box(FL_DOWN_BOX);
      o->value(1);
      o->callback((Fl_Callback*)cb_m_bRay);
    }
    { Fl_Check_Button* o = m_bRayShadow = new Fl_Check_Button(215, 235, 25, 25, "Show ray shadow");
      o->down_box(FL_DOWN_BOX);
      o->value(1);
      o->callback((Fl_Callback*)cb_m_bRayShadow);
    }
    m_iSeed = new Fl_Value_Input(240, 30, 85, 20, "Seed");
    o->end();
    o->resizable(o);
  }
  return w;
}