//---------------------------------------------------- // 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(); //FilterKernel fltDesignUI = new FltDesignUI; fltDesignUI->impUI = this; for (int i=0;i<FLT_HEIGHT*FLT_WIDTH;i++) { fltKernel[i] = 0; //配列 fltKernel [] } fltKernel[(FLT_HEIGHT/2)*FLT_WIDTH+(FLT_HEIGHT/2)]=1; scale = 1; offset = 0; initFltDesignUI(); m_nSize = 10; //実習 // 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); // Add brush size slider to the dialog m_BrushSizeSlider = new Fl_Value_Slider(10, 80, 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); //実習 //傾きスライダー m_nAngle=0; // スライダー初期値 m_BrushAngleSlider = new Fl_Value_Slider(10, 120, 300, 20, "Angle"); // スライダー m_BrushAngleSlider->user_data((void*)(this)); m_BrushAngleSlider->type(FL_HOR_NICE_SLIDER); m_BrushAngleSlider->labelfont(FL_COURIER); m_BrushAngleSlider->labelsize(12); m_BrushAngleSlider->minimum(0); // スライダー最小値 m_BrushAngleSlider->maximum(360); // スライダー最大値 m_BrushAngleSlider->step(1); m_BrushAngleSlider->value(m_nAngle); // スライダー値の格納場所 m_BrushAngleSlider->align(FL_ALIGN_RIGHT); m_BrushAngleSlider->callback(cb_angleSlides); //Widthスライダー m_nWidth=5; // スライダー初期値 m_BrushWidthSlider = new Fl_Value_Slider(10, 160, 300, 20, "Width"); // スライダー m_BrushWidthSlider->user_data((void*)(this)); m_BrushWidthSlider->type(FL_HOR_NICE_SLIDER); m_BrushWidthSlider->labelfont(FL_COURIER); m_BrushWidthSlider->labelsize(12); m_BrushWidthSlider->minimum(0); // スライダー最小値 m_BrushWidthSlider->maximum(360); // スライダー最大値 m_BrushWidthSlider->step(1); m_BrushWidthSlider->value(m_nWidth); // スライダー値の格納場所 m_BrushWidthSlider->align(FL_ALIGN_RIGHT); m_BrushWidthSlider->callback(cb_widthSlides); //α値スライダー m_nAlpha=80; // スライダー初期値 m_BrushAlphaSlider = new Fl_Value_Slider(10, 200, 300, 20, "Alpha"); // スライダー m_BrushAlphaSlider->user_data((void*)(this)); m_BrushAlphaSlider->type(FL_HOR_NICE_SLIDER); m_BrushAlphaSlider->labelfont(FL_COURIER); m_BrushAlphaSlider->labelsize(12); m_BrushAlphaSlider->minimum(0); // スライダー最小値 m_BrushAlphaSlider->maximum(100); // スライダー最大値 m_BrushAlphaSlider->step(1); m_BrushAlphaSlider->value(m_nAlpha); // スライダー値の格納場所 m_BrushAlphaSlider->align(FL_ALIGN_RIGHT); m_BrushAlphaSlider->callback(cb_alphaSlides); m_brushDialog->end(); }
//---------------------------------------------------- // Constructor. Creates all of the widgets. // Add new widgets here //---------------------------------------------------- ImpressionistUI::ImpressionistUI() : m_nativeChooser(NULL) { // 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(); // Create the filter kernel UI fltDesignUI = new FltDesignUI; fltDesignUI->impUI = this; // initialize the filter kernel for (int i=0;i<FLT_HEIGHT*FLT_WIDTH;i++) { fltKernel[i] = 0; } fltKernel[(FLT_HEIGHT/2)*FLT_WIDTH+(FLT_HEIGHT/2)]=1; scale = 1; offset = 0; initFltDesignUI(); // // init starting brush values // m_nSize = 10; m_lSize = 1; m_lAngle = 0; m_nAlpha = 1.0; // 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); // Add a stroke direction choice to the dialog m_StrokeDirectionChoice = new Fl_Choice(114,40,150,25,"&Stroke Direction"); m_StrokeDirectionChoice->user_data((void*)(this)); // record self to be used by static callback functions m_StrokeDirectionChoice->menu(strokeDirectionMenu); m_StrokeDirectionChoice->callback(cb_strokeDirection); m_StrokeDirectionChoice->deactivate(); m_ClearCanvasButton = new Fl_Button(240,10,150,25,"&Clear Canvas"); m_ClearCanvasButton->user_data((void*)(this)); m_ClearCanvasButton->callback(cb_clear_canvas_button); // // Add brush size slider to the dialog // m_BrushSizeSlider = new Fl_Value_Slider(10, 80, 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 line width slider to the dialog // m_LineSizeSlider = new Fl_Value_Slider(10, 100, 300, 20, "Line Width"); m_LineSizeSlider->deactivate(); m_LineSizeSlider->user_data((void*)(this)); // record self to be used by static callback functions m_LineSizeSlider->type(FL_HOR_NICE_SLIDER); m_LineSizeSlider->labelfont(FL_COURIER); m_LineSizeSlider->labelsize(12); m_LineSizeSlider->minimum(1); m_LineSizeSlider->maximum(40); m_LineSizeSlider->step(1); m_LineSizeSlider->value(m_lSize); m_LineSizeSlider->align(FL_ALIGN_RIGHT); m_LineSizeSlider->callback(cb_lineSizeSlides); // // Add line angle slider to the dialog // m_LineAngleSlider = new Fl_Value_Slider(10, 120, 300, 20, "Line Angle"); m_LineAngleSlider->deactivate(); m_LineAngleSlider->user_data((void*)(this)); // record self to be used by static callback functions m_LineAngleSlider->type(FL_HOR_NICE_SLIDER); m_LineAngleSlider->labelfont(FL_COURIER); m_LineAngleSlider->labelsize(12); m_LineAngleSlider->minimum(0); m_LineAngleSlider->maximum(360); m_LineAngleSlider->step(1); m_LineAngleSlider->value(m_lAngle); m_LineAngleSlider->align(FL_ALIGN_RIGHT); m_LineAngleSlider->callback(cb_lineAngleSlides); // // Add an Alpha slider to the dialog // m_AlphaSlider = new Fl_Value_Slider(10, 140, 300, 20, "Alpha"); m_AlphaSlider->user_data((void*)(this)); // record self to be used by static callback functions m_AlphaSlider->type(FL_HOR_NICE_SLIDER); m_AlphaSlider->labelfont(FL_COURIER); m_AlphaSlider->labelsize(12); m_AlphaSlider->minimum(0); m_AlphaSlider->maximum(1); m_AlphaSlider->step(0.01); m_AlphaSlider->value(m_nAlpha); m_AlphaSlider->align(FL_ALIGN_RIGHT); m_AlphaSlider->callback(cb_alphaSlides); m_brushDialog->end(); }