int main(int argc, char **argv) { Fl_Window *w; {Fl_Window* o = new Fl_Window(365, 525); w = o; scroll = new Fl_Scroll(10,10,345,285); {Fl_Pack* o = new Fl_Pack(10, 10, 345, 285); pack = o; o->box(FL_DOWN_BOX); //o->box(FL_ENGRAVED_FRAME); (void) new Fl_Button(35, 35, 25, 25, "b1"); (void) new Fl_Button(45, 45, 25, 25, "b2"); (void) new Fl_Button(55, 55, 25, 25, "b3"); (void) new Fl_Button(65, 65, 25, 25, "b4"); (void) new Fl_Button(75, 75, 25, 25, "b5"); (void) new Fl_Button(85, 85, 25, 25, "b6"); (void) new Fl_Button(95, 95, 25, 25, "b7"); (void) new Fl_Button(105, 105, 25, 25, "b8"); (void) new Fl_Button(115, 115, 25, 25, "b9"); (void) new Fl_Button(125, 125, 25, 25, "b10"); (void) new Fl_Button(135, 135, 25, 25, "b11"); (void) new Fl_Button(145, 145, 25, 25, "b12"); (void) new Fl_Button(155, 155, 25, 25, "b13"); (void) new Fl_Button(165, 165, 25, 25, "b14"); (void) new Fl_Button(175, 175, 25, 25, "b15"); (void) new Fl_Button(185, 185, 25, 25, "b16"); (void) new Fl_Button(195, 195, 25, 25, "b17"); (void) new Fl_Button(205, 205, 25, 25, "b18"); (void) new Fl_Button(215, 215, 25, 25, "b19"); (void) new Fl_Button(225, 225, 25, 25, "b20"); (void) new Fl_Button(235, 235, 25, 25, "b21"); (void) new Fl_Button(245, 245, 25, 25, "b22"); (void) new Fl_Button(255, 255, 25, 25, "b23"); (void) new Fl_Button(265, 265, 25, 25, "b24"); o->end(); w->resizable(o); } scroll->end(); {Fl_Light_Button* o = new Fl_Light_Button(10, 325, 175, 25, "HORIZONTAL"); o->type(FL_RADIO_BUTTON); o->callback((Fl_Callback*)type_cb, (void*)(Fl_Pack::HORIZONTAL)); } {Fl_Light_Button* o = new Fl_Light_Button(10, 350, 175, 25, "VERTICAL"); o->type(FL_RADIO_BUTTON); o->value(1); o->callback((Fl_Callback*)type_cb, (void*)(Fl_Pack::VERTICAL)); } {Fl_Value_Slider* o = new Fl_Value_Slider(50,375, 295,25,"spacing:"); o->clear_flag(FL_ALIGN_MASK); o->set_flag(FL_ALIGN_LEFT); o->type(Fl_Slider::HORIZONTAL); o->range(0,30); o->step(1); o->callback((Fl_Callback*)spacing_cb); } w->end(); } w->show(argc, argv); return Fl::run(); }
//==== Create & Init Gui ToggleButton ====// void GroupLayout::AddButton( ToggleButton& tbutton, const char* label ) { assert( m_Group && m_Screen ); //==== Add Check Button ====// int bw = FitWidth( 0, m_ButtonWidth ); Fl_Light_Button* flbutton = new Fl_Light_Button( m_X, m_Y, bw, m_StdHeight ); flbutton->labelfont( 1 ); flbutton->labelsize( 12 ); flbutton->align( Fl_Align( 132 | FL_ALIGN_INSIDE ) ); flbutton->copy_label( label ); flbutton->labelcolor( FL_DARK_BLUE ); flbutton->copy_label( label ); m_Group->add( flbutton ); AddX( bw ); AddY( m_StdHeight ); NewLineX(); tbutton.Init( m_Screen, flbutton ); }
void Controller_Module::connect_to ( Port *p ) { control_output[0].connect_to( p ); clear(); Fl_Widget *w; if ( p->hints.type == Module::Port::Hints::BOOLEAN ) { Fl_Light_Button *o = new Fl_Light_Button( 0, 0, 40, 40, p->name() ); w = o; o->value( p->control_value() ); _type = TOGGLE; /* FIXME: hack */ control = (Fl_Valuator*)o; } else if ( p->hints.type == Module::Port::Hints::INTEGER ) { Fl_Counter *o = new Fl_Counter(0, 0, 58, 24, p->name() ); control = o; w = o; o->type(1); o->step(1); if ( p->hints.ranged ) { o->minimum( p->hints.minimum ); o->maximum( p->hints.maximum ); } _type = SPINNER; o->value( p->control_value() ); } else if ( p->hints.type == Module::Port::Hints::LOGARITHMIC ) { Fl_Value_SliderX *o = new Fl_Value_SliderX(0, 0, 30, 250, p->name() ); control = o; w = o; o->type(4); o->color( FL_DARK1 ); o->selection_color( fl_color_average( FL_GRAY, FL_CYAN, 0.5 ) ); o->minimum(1.5); o->maximum(0); o->value(1); o->textsize(9); if ( p->hints.ranged ) { o->minimum( p->hints.maximum ); o->maximum( p->hints.minimum ); } o->value( p->control_value() ); _type = SLIDER; } else { { Fl_DialX *o = new Fl_DialX( 0, 0, 50, 50, p->name() ); w = o; control = o; if ( p->hints.ranged ) { DMESSAGE( "Min: %f, max: %f", p->hints.minimum, p->hints.maximum ); o->minimum( p->hints.minimum ); o->maximum( p->hints.maximum ); } o->color( fl_darker( FL_GRAY ) ); o->selection_color( FL_WHITE ); o->value( p->control_value() ); } _type = KNOB; } control_value = p->control_value(); w->set_visible_focus(); w->align(FL_ALIGN_TOP); w->labelsize( 10 ); w->callback( cb_handle, this ); if ( _pad ) { Fl_Labelpad_Group *flg = new Fl_Labelpad_Group( w ); flg->set_visible_focus(); size( flg->w(), flg->h() ); flg->position( x(), y() ); add( flg ); } else { /* HACK: hide label */ w->labeltype( FL_NO_LABEL ); w->resize( x(), y(), this->w(), h() ); add( w ); resizable( w ); // init_sizes(); } }
int main( int argc, char **argv ) { // I18N #ifdef HAVE_SETLOCALE setlocale( LC_MESSAGES, "" ); // with glibc read LC_ALL first setlocale( LC_NUMERIC, "POSIX" ); // to avoid incompatibility between ifs files. #endif #ifdef ENABLE_NLS #ifdef WIN32 bindtextdomain( PACKAGE, "locale" ); #else bindtextdomain( PACKAGE, LOCALEDIR ); #endif textdomain( PACKAGE ); #endif // localization of some strings of FLTK: fl_no = _("No"); fl_yes = _("Yes"); fl_ok = _("OK"); fl_cancel = _("Cancel"); fl_close = _("Close"); Fl_File_Chooser::add_favorites_label = _("Add to Favorites"); Fl_File_Chooser::all_files_label = _("All Files (*)"); Fl_File_Chooser::custom_filter_label = _("Custom Filter"); Fl_File_Chooser::existing_file_label = _("Please choose an existing file!"); Fl_File_Chooser::favorites_label = _("Favorites"); Fl_File_Chooser::filename_label = _("Filename:"); #ifdef WIN32 Fl_File_Chooser::filesystems_label = _("My Computer"); #else Fl_File_Chooser::filesystems_label = _("File Systems"); #endif Fl_File_Chooser::manage_favorites_label = _("Manage Favorites"); Fl_File_Chooser::preview_label = _("Preview"); Fl_File_Chooser::show_label = _("Show:"); string skeletonToOpen; #ifdef HAVE_UNISTD_H while ( true ) { int c = getopt( argc, argv, "vhp:" ); if ( c == -1 ) { break; } switch ( c ) { case 'p': paramFile = optarg; break; case 'v': cerr << "Glito v" << VERSION << "\nCopyright (C) 2002-2003 Emmanuel Debanne\n" << _("Glito is distributed under the terms of the GNU General Public License.\n"); return 0; default: case 'h': usage(); return 0; } } if ( optind < argc ) { skeletonToOpen = argv[optind]; ++optind; if ( optind < argc ) { usage(); return 0; } } #endif // default size of the window int width = 600; int height = 450; const int menuHeight = 30; const int toolbarHeight = 27; const int toolHeight = 25; const string paramXML( IS::readStringInFile(paramFile) ); if ( !paramXML.empty() ) { if ( !IS::ToXML::extractFirst( paramXML, "parameters" ).empty() ) { width = atoi( IS::ToXML::extractFirst( paramXML, "frameWidth" ).c_str() ); height = atoi( IS::ToXML::extractFirst( paramXML, "frameHeight" ).c_str() ); } else { cerr << _("Failed to open: ") << paramFile << '\n'; } } Fl_Window window( width, height + menuHeight + toolbarHeight ); // if the window is closed, the application exits: window.callback(quit_cb); Fl_Menu_Bar menubar( 0, 0, width, menuHeight ); menubar.box(FL_PLASTIC_UP_BOX); // in the main to allow gettext to do its job. #ifdef WIN32 manualFile = ""; #else manualFile = DOCDIR; #endif manualFile += _("manual_en.html"); static Fl_Menu_Item menutable[] = { {_("&File"), 0, 0, 0, FL_SUBMENU}, //0 {_("&Open"), FL_CTRL+'O', skeleton_open_cb}, {_("&Save"), FL_CTRL+'S', skeleton_save_cb}, {_("&Export to Fractint"), 0, export_fractint_cb, 0, FL_MENU_DIVIDER}, #ifdef HAVE_LIBPNG {_("Set Fast Save Directory"), 0, set_snapshotPath_cb}, {_("Fast Save"), 'f', saveSnapshot_cb, NULL, FL_MENU_DIVIDER}, {_("Save PNG"), 0, saveImage_cb, (void*)Image::PNG}, #endif {_("Save PGM"), 0, saveImage_cb, (void*)Image::PGM}, {_("Save BMP bitmap"), 0, saveImage_cb, (void*)Image::BMPB}, {_("Save BMP gray"), 0, saveImage_cb, (void*)Image::BMPG, FL_MENU_DIVIDER}, {_("Edit &Paramaters"), 'p', parameters_cb}, {_("Open Paramaters"), 0, open_parameters_cb}, {_("Sa&ve parameters"), 0, save_parameters_cb, 0, FL_MENU_DIVIDER}, {_("&Quit"), FL_CTRL+'Q', quit_cb}, //10 {0}, {_("&Skeleton"), 0, 0, 0, FL_SUBMENU}, {_("&New"), FL_CTRL+'N', skeleton_new_cb}, {_("&Random"), 'h', skeleton_random_cb, 0, FL_MENU_DIVIDER}, {_("&Dimension"), FL_CTRL+'D', skeleton_dimension_cb}, {_("&Coordinates"), 0, skeleton_coordinates_cb, 0, FL_MENU_DIVIDER}, {_("out Memory1"), '1', outMemory_cb, (void*)1}, {_("out Memory2"), '2', outMemory_cb, (void*)2}, {_("out Memory3"), '3', outMemory_cb, (void*)3}, {_("out Memory4"), '4', outMemory_cb, (void*)4, FL_MENU_DIVIDER},//20 {_("in Memory1"), '5', inMemory_cb, (void*)1}, {_("in Memory2"), '6', inMemory_cb, (void*)2}, {_("in Memory3"), '7', inMemory_cb, (void*)3}, {_("in Memory4"), '8', inMemory_cb, (void*)4}, {0}, {_("&Function"), 0, 0, 0, FL_SUBMENU}, {_("Pre&vious"), 'v', function_previous_cb}, {_("&Next"), 'n', function_next_cb, 0, FL_MENU_DIVIDER}, {_("&Cut"), FL_CTRL+'X', function_cut_cb}, {_("C&opy"), FL_CTRL+'C', function_copy_cb}, {_("&Paste"), FL_CTRL+'V', function_paste_cb, 0, FL_MENU_DIVIDER}, {_("&Reshape"), 's', function_reshape_cb, 0, FL_MENU_DIVIDER}, //32 // the following items are modified by Glito::setSystemType() {_("&Linear"), 0, systemType_cb, (void *)LINEAR, FL_MENU_RADIO|FL_MENU_VALUE}, //33 {_("&Sinusoidal"), 0, systemType_cb, (void *)SINUSOIDAL, FL_MENU_RADIO}, //34 {_("&Julia"), 0, systemType_cb, (void *)JULIA, FL_MENU_RADIO}, //35 {_("&Formulas"), 0, systemType_cb, (void *)FORMULA, FL_MENU_RADIO|FL_MENU_DIVIDER}, //36 {_("&Edit Formulas"), 0, edit_formula_cb}, {0}, {_("&Color"), 0, 0, 0, FL_SUBMENU}, {_("Open Color Map"), 0, readColorMap_cb}, {_("Color / B&W"), 0, colorBW_cb, 0, FL_MENU_DIVIDER}, {_("Maps:")}, {_("Autumn"), 0, readDefinedMap_cb, (void*)0}, {_("Fast"), 0, readDefinedMap_cb, (void*)-1}, {_("CMY"), 0, readDefinedMap_cb, (void*)1}, {_("RGB"), 0, readDefinedMap_cb, (void*)2}, {_("Light CMY"), 0, readDefinedMap_cb, (void*)3}, {_("Dark"), 0, readDefinedMap_cb, (void*)4}, {_("Rich"), 0, readDefinedMap_cb, (void*)5}, {0}, {_("&Animation"), 0, 0, 0, FL_SUBMENU}, {_("&Zoom"), 'z', animation_zoom_cb}, {_("&Transition: Mem1 <-> Mem2"), 't', animation_transition_cb}, {_("&Rotation"), 'r', animation_rotation_cb}, {_("&Stop"), ' ', animation_stop_cb, 0, FL_MENU_DIVIDER}, #ifdef HAVE_LIBMNG {_("Save Zoom as MNG"), 0, saveAnimation_cb, (void*)0}, {_("Save Transition as MNG"), 0, saveAnimation_cb, (void*)1}, {_("Save Rotation as MNG"), 0, saveAnimation_cb, (void*)2}, #endif {0}, {_("&Help"), 0, 0, 0, FL_SUBMENU}, {_("Docu&mentation"), FL_F+1, documentation_cb}, {_("&Demo"), 0, demo_cb}, {_("&About"), 0, about_cb}, {0}, {0} }; menubar.menu(menutable); // the shortcuts are handled by the menu everywhere: //menubar.global(); glito = new Glito( 0, menuHeight + toolbarHeight, width, height ); if ( !IS::ToXML::extractFirst( paramXML, "parameters" ).empty() ) { glito->readParameters( paramXML ); } if ( !skeletonToOpen.empty() ) { if ( !glito->skel.fromXML( IS::readStringInFile(skeletonToOpen) ) ) { cerr << _("Failed to open: ") << skeletonToOpen << '\n'; } glito->setSystemType(); } Fl::visual( FL_DOUBLE | FL_INDEX ); // to allow the preview of PNG files in the file chooser: Fl_File_Icon::load_system_icons(); // the size of glito is changed when the size of the window is changed: window.add_resizable(*glito); // ********* toolbar *********** { Fl_Group* o = new Fl_Group( 0, menuHeight, width, toolbarHeight ); o->resizable(NULL); // not resizable int x = 0; const int toolSpace = 9; const int toolInter = 1; { Fl_Button* o = new Fl_Button( x, menuHeight+1, toolHeight, toolHeight ); prepareButton(o); o->tooltip( _("Open") ); o->image( icon_file_open ); o->callback( (Fl_Callback*)skeleton_open_cb ); x += toolHeight + toolInter; } #ifdef HAVE_LIBPNG { Fl_Button* o = new Fl_Button( x, menuHeight+1, toolHeight, toolHeight ); prepareButton(o); o->tooltip( _("Save PNG") ); o->image( icon_save_file ); o->callback( (Fl_Callback*)saveImage_cb, (void*)Image::PNG ); x += toolHeight + toolInter; } { Fl_Button* o = new Fl_Button( x, menuHeight+1, toolHeight, toolHeight ); prepareButton(o); o->tooltip( _("Fast save") ); o->image( icon_save_fast ); o->callback( (Fl_Callback*)saveSnapshot_cb ); x += toolHeight + toolInter; } #endif x += toolSpace; { Fl_Button* o = new Fl_Button( x, menuHeight+1, toolHeight, toolHeight ); prepareButton(o); o->tooltip( _("Parameters") ); o->image( icon_param ); o->callback( (Fl_Callback*)parameters_cb ); x += toolHeight + toolInter; } x += toolSpace; { Fl_Button* o = new Fl_Button( x, menuHeight+1, toolHeight, toolHeight ); prepareButton(o); o->tooltip( _("Color / B&W") ); o->image( icon_colorbw ); o->callback( (Fl_Callback*)colorBW_cb ); x += toolHeight + toolInter; } { Fl_Button* o = new Fl_Button( x, menuHeight+1, toolHeight, toolHeight ); prepareButton(o); o->tooltip( _("Open Color Map") ); o->image( icon_colormap ); o->callback( (Fl_Callback*)readColorMap_cb ); x += toolHeight + toolInter; } x += toolSpace; { Fl_Button* o = new Fl_Button( x, menuHeight+1, toolHeight, toolHeight ); prepareButton(o); o->tooltip( _("Random") ); o->image( icon_hazard ); o->callback( (Fl_Callback*)skeleton_random_cb ); x += toolHeight + toolInter; } x += toolSpace; { Fl_Button* o = new Fl_Button( x, menuHeight+1, toolHeight, toolHeight ); prepareButton(o); o->tooltip( _("Previous function") ); o->image( icon_previous ); o->callback( (Fl_Callback*)function_previous_cb ); x += toolHeight + toolInter; } { Fl_Button* o = new Fl_Button( x, menuHeight+1, toolHeight, toolHeight ); prepareButton(o); o->tooltip( _("Next function") ); o->image( icon_next ); o->callback( (Fl_Callback*)function_next_cb ); x += toolHeight + toolInter; } x += toolSpace; { Fl_Button* o = new Fl_Button( x, menuHeight+1, toolHeight, toolHeight ); prepareButton(o); o->tooltip( _("Enlarge") ); o->image( icon_larger ); o->callback( (Fl_Callback*)view_large_cb ); x += toolHeight + toolInter; } x += toolSpace; { Fl_Light_Button* o = new Fl_Light_Button( x, menuHeight+1, toolHeight+20, toolHeight ); prepareButton(o); o->tooltip( _("Rot/Dil") ); o->image( icon_rotdil ); o->callback( (Fl_Callback*)mouse_cb ); x += toolHeight + toolInter; } o->end(); } window.end(); window.show(argc,argv); /* Pixmap p = XCreateBitmapFromData( fl_display, DefaultRootWindow(fl_display), icon_bits, icon_width, icon_height ); window.icon((char *)p); */ glito->show(); menubar.show(); { // seed for the random generator: time_t t; time(&t); srand( (unsigned int)t ); } return Fl::run(); }
Fl_Window * make_window() { Fl_Window * w; { Fl_Window * o = main_window = new Fl_Window(741, 622, "ASF/AMC Motion Capture Player"); w = o; { Fl_Group * o = new Fl_Group(10, 485, 615, 140); { Fl_Button * o = loadSkeleton_button = new Fl_Button(10, 495, 120, 40, "Load Skeleton");//*** o->callback((Fl_Callback *)load_callback); } { Fl_Button * o = loadMotion_button = new Fl_Button(140, 495, 120, 40, "Load Motion"); //*** o->callback((Fl_Callback *)load_callback); } // "Reload motion" always reload the last skeleton loaded { Fl_Button * o = reloadMotion_button = new Fl_Button(270, 495, 120, 40, "Reload Motion");//*** o->callback((Fl_Callback *)reload_callback); } { Fl_Button * o = resetScene_button = new Fl_Button(400, 495, 120, 40, "Reset Scene"); o->callback((Fl_Callback *)resetScene_callback); } { Fl_Light_Button* o = record_button = new Fl_Light_Button(380, 575, 40, 25, "R"); o->callback((Fl_Callback *)record_callback, (void*)(0)); } { Fl_Button * o = screenShot_button = new Fl_Button(280, 575, 90, 25, "ScreenShot"); o->callback((Fl_Callback *)saveScreenToFile_callback); } { Fl_Button * o = pause_button = new Fl_Button(430, 575, 35, 25, "@||"); o->labeltype(FL_SYMBOL_LABEL); o->labelsize(12); o->callback((Fl_Callback *)play_callback); } { Fl_Button* o = rewind_button = new Fl_Button(465, 575, 35, 25, "@|<"); o->labeltype(FL_SYMBOL_LABEL); o->labelsize(12); o->callback((Fl_Callback *)play_callback); } { Fl_Button* o = play_button = new Fl_Button(500, 575, 35, 25, "@>"); o->labeltype(FL_SYMBOL_LABEL); o->labelsize(12); o->callback((Fl_Callback *)play_callback, (void*)(0)); } { Fl_Button* o = minusOne_button = new Fl_Button(535, 575, 35, 25, "-1"); o->labeltype(FL_SYMBOL_LABEL); o->labelsize(12); o->callback((Fl_Callback *)play_callback, (void*)(0)); } { Fl_Button* o = plusOne_button = new Fl_Button(570, 575, 35, 25, "+1"); o->labeltype(FL_SYMBOL_LABEL); o->labelsize(12); o->callback((Fl_Callback *)play_callback, (void*)(0)); } { Fl_Button* o = repeat_button = new Fl_Button(605, 575, 35, 25, "@<->"); o->labeltype(FL_SYMBOL_LABEL); o->labelsize(12); o->callback((Fl_Callback *)play_callback, (void*)(0)); } o->end(); } // FL_group { Player_Gl_Window * o = glwindow = new Player_Gl_Window(5, 5, 640, 480, "label"); o->box(FL_DOWN_FRAME); o->labeltype(FL_NO_LABEL); } { Fl_Value_Slider* o = frame_slider = new Fl_Value_Slider(10, 545, 630, 20); // slider o->type(5); o->labelsize(18); o->minimum(1); o->maximum(60000); o->step(1); o->callback((Fl_Callback*)fslider_callback, (void*)(0)); o->align(197); } { Fl_Value_Input* o = speedUp = new Fl_Value_Input(65, 575, 40, 25, "Speed"); o->minimum(0); o->value(1); o->callback((Fl_Callback*)playSpeed_callback); } { Fl_Value_Input * o = sub_input = new Fl_Value_Input(690, 55, 45, 25, "Skeleton ID:"); o->callback((Fl_Callback*)skeletonID_callback); sub_input->align(Fl_Align(FL_ALIGN_TOP_RIGHT)); } { Fl_Value_Input * o = tx_input = new Fl_Value_Input(690, 95, 45, 25, "tx:"); o->callback((Fl_Callback*)tx_callback); } { Fl_Value_Input * o = ty_input = new Fl_Value_Input(690, 122, 45, 25, "ty:"); o->callback((Fl_Callback*)ty_callback); } { Fl_Value_Input * o = tz_input = new Fl_Value_Input(690, 152, 45, 25, "tz:"); o->callback((Fl_Callback*)tz_callback); } { Fl_Value_Input * o = rx_input = new Fl_Value_Input(690, 190, 45, 25, "rx:"); o->callback((Fl_Callback*)rx_callback); } { Fl_Value_Input * o = ry_input = new Fl_Value_Input(690, 217, 45, 25, "ry:"); o->callback((Fl_Callback*)ry_callback); } { Fl_Value_Input * o = rz_input = new Fl_Value_Input(690, 247, 45, 25, "rz:"); o->callback((Fl_Callback*)rz_callback); } { Fl_Value_Input * o = joint_idx = new Fl_Value_Input(195, 575, 45, 25, "Show Joint"); o->maximum(30); o->step(1); o->value(-1); o->callback((Fl_Callback*)spotJoint_callback); } { Fl_Light_Button * o = groundPlane_button = new Fl_Light_Button(650, 315, 85, 25, "Ground"); o->callback((Fl_Callback*)renderGroundPlane_callback, (void*)(0)); o->align(FL_ALIGN_INSIDE); } { Fl_Light_Button * o = fog_button = new Fl_Light_Button(650, 345, 85, 25, "Fog"); o->callback((Fl_Callback*)useFog_callback, (void*)(0)); o->align(FL_ALIGN_INSIDE); } { Fl_Light_Button * o = worldAxes_button = new Fl_Light_Button(650, 375, 85, 25, "Axes"); o->callback((Fl_Callback*)renderWorldAxes_callback, (void*)(0)); o->align(FL_ALIGN_INSIDE); } { Fl_Button * o = aboutPlayer_button = new Fl_Button(650, 420, 85, 25, "About"); o->callback((Fl_Callback *)aboutPlayer_callback); o->align(FL_ALIGN_INSIDE); } o->end(); } return w; }
Fl_Scopes_Manager::Fl_Scopes_Manager(int x, int y, int width, int height, Fl_MDI_Viewport *s, const char *name) { Fl::lock(); s->begin(); Fl_MDI_Window *w = SWin = new Fl_MDI_Window(0, 0, width, height, name); w->user_data((void *)this); w->resizable(w->view()); w->titlebar()->close_button()->hide(); w->view()->begin(); Scopes_Tabs = new Fl_Tabs*[Num_Scopes]; Scope_Show = new Fl_Check_Button*[Num_Scopes]; Scope_Pause = new Fl_Button*[Num_Scopes]; Scope_OneShot = new Fl_Check_Button*[Num_Scopes]; Scope_Options = new Fl_Menu_Button*[Num_Scopes]; Grid_Color = new Fl_Button*[Num_Scopes]; Bg_Color = new Fl_Button*[Num_Scopes]; Sec_Div = new Fl_Input_Browser*[Num_Scopes]; Save_Type = new Fl_Check_Button*[Num_Scopes]; Save_Points = new Fl_Int_Input*[Num_Scopes]; Save_Time = new Fl_Float_Input*[Num_Scopes]; Save_File = new Fl_Input*[Num_Scopes]; Save = new Fl_Light_Button*[Num_Scopes]; Save_Flag = new int[Num_Scopes]; Save_File_Pointer = new FILE*[Num_Scopes]; Trace_Page = new Fl_Group**[Num_Scopes]; Trace_Show = new Fl_Check_Button**[Num_Scopes]; Units_Div = new Fl_Input_Browser**[Num_Scopes]; Trace_Color = new Fl_Button**[Num_Scopes]; Trace_Pos = new Fl_Dial**[Num_Scopes]; Trace_Width = new Fl_Dial**[Num_Scopes]; Trigger_Mode = new Fl_Choice*[Num_Scopes]; Trace_Options = new Fl_Menu_Button**[Num_Scopes]; Scope_Windows = new Fl_Scope_Window*[Num_Scopes]; for (int i = 0; i < Num_Scopes; i++) { Save_Flag[i] = false; { Fl_Tabs *o = Scopes_Tabs[i] = new Fl_Tabs(160, 5, width-165, height-40); o->new_page("General"); { Fl_Check_Button *o = Scope_Show[i] = new Fl_Check_Button(10, 25, 100, 20, "Show/Hide"); o->callback((Fl_Callback *)show_scope, (void *)i); } { Fl_Button *o = Scope_Pause[i] = new Fl_Button(10, 75, 90, 25, "Trigger"); o->value(0); o->deactivate(); o->when(FL_WHEN_CHANGED); o->callback((Fl_Callback *)pause_scope, (void *)i); } { Fl_Check_Button *o = Scope_OneShot[i] = new Fl_Check_Button(10, 50, 100, 20, "OneShot/Run"); o->deactivate(); o->callback((Fl_Callback *)oneshot_scope, (void *)i); } { Fl_Menu_Button *o = Scope_Options[i] = new Fl_Menu_Button(10, 105, 90, 25, "Options"); o->menu(Scope_Opts); o->when(FL_WHEN_ENTER_KEY); o->child(0)->set_value(); o->callback((Fl_Callback *)enter_options, (void *)i); } { Fl_Button *o = Grid_Color[i] = new Fl_Button(10, 135, 90, 25, "Grid Color"); o->callback((Fl_Callback *)select_grid_color, (void *)i); } { Fl_Button *o = Bg_Color[i] = new Fl_Button(10, 165, 90, 25, "Bg Color"); o->callback((Fl_Callback *)select_bg_color, (void *)i); } { Fl_Input_Browser *o = Sec_Div[i] = new Fl_Input_Browser(200, 25, 60, 20, "Sec/Div: "); o->add("0.001|0.005|0.01|0.05|0.1|0.5|1"); o->align(FL_ALIGN_LEFT); o->value("0.1"); o->when(FL_WHEN_ENTER_KEY); o->callback((Fl_Callback *)enter_secdiv, (void *)i); } { Fl_Check_Button *o = Save_Type[i] = new Fl_Check_Button(140, 50, 100, 20, "Points/Time"); o->value(1); o->callback((Fl_Callback *)select_save, (void *)i); } { Fl_Int_Input *o = Save_Points[i] = new Fl_Int_Input(200, 75, 60, 20, "N Points: "); o->align(FL_ALIGN_LEFT); o->value("1000"); } { Fl_Float_Input *o = Save_Time[i] = new Fl_Float_Input(200, 105, 60, 20, "Time [s]: "); o->align(FL_ALIGN_LEFT); o->value("1.0"); o->deactivate(); } { Fl_Input *o = Save_File[i] = new Fl_Input(200, 135, 100, 20, "Filename:"); char buf[100]; o->align(FL_ALIGN_LEFT); sprintf(buf, "%s", Scopes[i].name); o->value(buf); } { Fl_Light_Button *o = Save[i] = new Fl_Light_Button(140, 165, 90, 25, "Save"); o->selection_color(FL_BLACK); o->callback((Fl_Callback *)enable_saving, (void *)i); } { Fl_Choice *o = Trigger_Mode[i] = new Fl_Choice(60, 200, 170, 25, "Trigger:"); o->add("Continuous Roling|Continuous Overwrite|Rising (-to+) CH1|Falling (+to-) CH1|Hold"); o->align(FL_ALIGN_LEFT); o->value(0); o->when(FL_WHEN_ENTER_KEY); o->callback((Fl_Callback *)enter_trigger_mode, (void *)i); } Trace_Page[i] = new Fl_Group*[Scopes[i].ntraces]; Trace_Show[i] = new Fl_Check_Button*[Scopes[i].ntraces]; Units_Div[i] = new Fl_Input_Browser*[Scopes[i].ntraces]; Trace_Color[i] = new Fl_Button*[Scopes[i].ntraces]; Trace_Pos[i] = new Fl_Dial*[Scopes[i].ntraces]; Trace_Width[i] = new Fl_Dial*[Scopes[i].ntraces]; Trace_Options[i] = new Fl_Menu_Button*[Scopes[i].ntraces]; for (int j = 0; j < Scopes[i].ntraces; j++) { s_idx_T *idx = new s_idx_T; idx->scope_idx = i; idx->trace_idx = j; Trace_Page[i][j] = o->new_page(Scopes[i].traceName[j]); Trace_Page[i][j]->label_color(FL_WHITE); { Fl_Check_Button *o = Trace_Show[i][j] = new Fl_Check_Button(10, 25, 100, 20, "Show/Hide"); o->value(1); o->callback((Fl_Callback *)show_trace, (void *)idx); } { Fl_Input_Browser *o = Units_Div[i][j] = new Fl_Input_Browser(77, 55, 60, 20, "Units/Div: "); o->align(FL_ALIGN_LEFT); o->value("2.5"); o->add("0.001|0.002|0.005|0.01|0.02|0.05|0.1|0.2|0.5|1|2|5|10|50|100|1000"); o->when(FL_WHEN_ENTER_KEY); o->callback((Fl_Callback *)enter_unitsdiv, (void *)idx); } { Fl_Button *o = Trace_Color[i][j] = new Fl_Button(10, 90, 90, 25, "Trace Color"); o->callback((Fl_Callback *)select_trace_color, (void *)idx); } { Fl_Dial *o = Trace_Pos[i][j] = new Fl_Dial(170, 40, 50, 50, "Trace Offset"); o->type(Fl_Dial::LINE); o->minimum(0.0); o->maximum(2.0); o->value(1); o->callback((Fl_Callback *)change_trace_pos, (void *)idx); } { Fl_Dial *o = Trace_Width[i][j] = new Fl_Dial(250, 40, 50, 50, "Trace Width"); o->type(Fl_Dial::LINE); o->minimum(0.1); o->maximum(40.0); o->value(0.1); o->callback((Fl_Callback *)change_trace_width, (void *)idx); } { Fl_Menu_Button *o = Trace_Options[i][j] = new Fl_Menu_Button(10, 130, 90, 25, "Options "); int i; o->menu(Trace_Opts); o->when(FL_WHEN_ENTER_KEY); o->callback((Fl_Callback *)enter_options, (void *)idx); // for(i=0;i<o->children();i++) { // loop through all menu items, and add checked items to the value // o->child(i)->set_value(); // } } } o->end(); Fl_Group::current()->resizable(w); } } for (int i = 1; i < Num_Scopes; i++) { Scopes_Tabs[i]->hide(); } Scopes_Tabs[0]->show(); Help = new Fl_Button(width-150, height-30, 70, 25, "Help"); Close = new Fl_Button(width-75, height-30, 70, 25, "Close"); Close->callback((Fl_Callback *)close); Fl_Browser *o = Scopes_Tree = new Fl_Browser(5, 5, 150, height-10); o->indented(1); o->callback((Fl_Callback *)select_scope); for (int i = 0; i < Num_Scopes; i++) { add_paper(Scopes_Tree, Scopes[i].name, Fl_Image::read_xpm(0, scope_icon)); } w->view()->end(); s->end(); w->titlebar()->h(15); w->titlebar()->color(FL_BLACK); w->position(x, y); Fl::unlock(); }