static void ClickedAddWP(Fl_Widget * w, void * userdata) { WaypointClient* anInstance = (WaypointClient*) userdata; Fl_Input_Choice * fromWPChoice = anInstance->frWps; Fl_Input_Choice * toWPChoice = anInstance->toWps; Fl_Input * theLat = anInstance->latIn; Fl_Input * theLon = anInstance->lonIn; Fl_Input * theEle = anInstance->eleIn; Fl_Input * theName = anInstance->nameIn; string lat(theLat->value()); string lon(theLon->value()); string ele(theEle->value()); string name(theName->value()); Json::Value wp; wp["name"] = name; wp["lat"] = atof(lat.c_str()); wp["lon"] = atof(lon.c_str()); wp["ele"] = atof(ele.c_str()); if (anInstance->addWaypoint(wp) == true) { cout << "Added: Waypoint(" << name << "); \n" << endl; } else { cout << "Error: Waypoint(" << name << ") could not be added! \n" << endl; } buildWaypointList(anInstance); }
static void ClickedModifyWP(Fl_Widget * w, void * userdata) { WaypointClient* anInstance = (WaypointClient*) userdata; Fl_Input * theLat = anInstance->latIn; Fl_Input * theLon = anInstance->lonIn; Fl_Input * theEle = anInstance->eleIn; Fl_Input * theName = anInstance->nameIn; string lat(theLat->value()); string lon(theLon->value()); string ele(theEle->value()); string name(theName->value()); Json::Value wp; wp["name"] = name.c_str(); wp["lat"] = atof(lat.c_str()); wp["lon"] = atof(lon.c_str()); wp["ele"] = atof(ele.c_str()); anInstance->removeWaypoint(name); anInstance->addWaypoint(wp); cout << "Modified: " << name << "(" << lat << ", " << lon << ", " << ele << ", " << name << "); \n" << endl; buildWaypointList(anInstance); }
static void BrowseColors(Fl_Widget *wdg, void *arg) { ProjectOptionsDlg* dlg = (ProjectOptionsDlg*)arg; Fl_Input *inp = dlg->GetColors(); const char *dir = fl_file_chooser("Colors File", NULL, inp->value()); if (dir) inp->value(dir); }
static void field_select_file_cb(Fl_Widget *w, void *data) { Fl_Input *input = (Fl_Input*)data; int ret = fileChooser(FILE_CHOOSER_SINGLE, "Choose", "", input->value()); if(ret){ input->value(fileChooserGetName(0).c_str()); input->set_changed(); } }
void button_callback(Fl_Widget* widget, void* data) { Pair* pair = (Pair *)data; Fl_Button* button = pair->button; Fl_Input* input = pair->input; button->label(input->value()); printf(input->value()); }
void DirectoryChooser(Fl_Widget *widget, void *text){ Fl_Input *dirfield = (Fl_Input *)text; char *dir = fl_dir_chooser("Select a directory to use as the startup directory", dirfield->value(), 1); if(dir==NULL){ return; } dirfield->value(dir); dirfield->do_callback(); }
void ImpressionistUI::cb_setFilterKernalSize(Fl_Widget *o, void *v) { ImpressionistUI *pUI = (ImpressionistUI*)o->user_data(); int width = atoi(pUI->m_filterWidthInput->value()); int height = atoi(pUI->m_filterHeightInput->value()); if (width <= 0 || height <= 0) { fl_message("Width or Height cannot be less than 0"); return; } else { pUI->m_filterSizeDialog->hide(); pUI->m_nFilterWidth = width; pUI->m_nFilterHeight = height; pUI->m_filterKernalDialog = new Fl_Window(60 + 30 * width + 10 * (width - 1), 60 + 30 * width + 10 * (width - 1) + 50, "Filter Kernal"); pUI->m_filterKernalEntries.clear(); for (int j = 0; j < height; j++) { for (int i = 0; i < width; i++) { Fl_Input *filterEntry = new Fl_Input(60 + 30 * i + 10 * i, 30 * j + 10 * j, 30, 30, ""); filterEntry->value("1.0"); pUI->m_filterKernalEntries.push_back(filterEntry); } } pUI->m_applyFilterKernalButton = new Fl_Button(0, 60 + 30 * width + 10 * (width - 1) + 20, 50, 20, "Apply"); pUI->m_applyFilterKernalButton->user_data((void *)(pUI)); pUI->m_applyFilterKernalButton->callback(cb_applyFilterKernal); pUI->m_filterKernalDialog->end(); pUI->m_filterKernalDialog->show(); } }
void onelabGroup::updateParameter(onelab::string &p) { Fl_Tree_Item *n = _tree->find_item(p.getName().c_str()); if(!n) { addParameter(p); return; } Fl_Group *grp = (Fl_Group *)n->widget(); // macro button if(p.getAttribute("Macro") == "Gmsh"){ return; } // non-editable value FIXME if(p.getReadOnly()){ Fl_Output *but = (Fl_Output *)grp->child(0); but->value(p.getValue().c_str()); return; } // simple string (no menu) if(p.getChoices().empty() && p.getKind() != "file"){ Fl_Input *but = (Fl_Input *)grp->child(0); but->value(p.getValue().c_str()); return; } // general string input TODO Fl_Input_Choice *but = (Fl_Input_Choice *)grp->child(0); but->value(p.getValue().c_str()); }
void WidgetTable::button_cb(Fl_Widget *w, void * p) { fprintf(stderr, "BUTTON: %s\n", (const char*)w->label()); WidgetTable * myTable = static_cast<WidgetTable*>(p); //WidgetTable * myTable = (WidgetTable*)(p); UserInterface * myUserInterface = static_cast<UserInterface*>(myTable->ptr_to_UserInterface); //UserInterface * myUserInterface = (UserInterface*)(myTable->ptr_to_UserInterface); int myRow = 8, myColumn = 8; //std::stringstream buffer; Fl_Widget * myWidget = myTable->GetElement(myRow, myColumn); Fl_Input * myCell = dynamic_cast<Fl_Input*>(myWidget); myWidget = myTable->GetElement(myRow, myColumn); My_fl_button * myFlButton = (My_fl_button*)w; std::cout << std::endl << myFlButton->x_pos << std::endl; std::cout << myFlButton->y_pos << std::endl; myCell = dynamic_cast<Fl_Input*>(myWidget); myCell->value("try"); myUserInterface->textDisplayString << "button pressed" << std::endl; myUserInterface->textBuffer->text((myUserInterface->textDisplayString).str().c_str()); myTable->printInTable(6, 6, "text", myTable); }
static void curframe_cb(Fl_Widget *w, void *v) { Fl_Input *inp = (Fl_Input *)w; VMDApp *app = (VMDApp *)v; int val = atoi(inp->value()); int max = app->molecule_numframes(app->molecule_top()); if (val < 0) val = 0; if (val >= max) val = max-1; app->animation_set_frame(val); }
void WidgetTable::printInTable(int row, int col, std::string text, WidgetTable * myWidgetPointer)//this causes trouble { WidgetTable * myTable = myWidgetPointer; Fl_Widget * myWidget = (Fl_Widget*) (myTable->GetElement(row, col)); Fl_Input * myCell = (Fl_Input*)(myWidget); std::stringstream buffer; buffer << text; myCell->value(buffer.str().c_str()); }
void IconChooser::load(const char* dir) { /* copy directory name to input box and internal String so it can be reused later */ path->value(dir); start = dir; list<String> lst; if(!dir_list(dir, lst, true)) return; load_from_list(lst); }
uiBasis:: uiBasis( Fl_Group &tabs, const BasisInfo &bi ) : name( bi.name ), group( new Fl_Group( tabs.x(), tabs.y()+24, tabs.w(), tabs.h()-24, bi.name.c_str() ) ), input() { //-------------------------------------------------------------------------- // record the new tab //-------------------------------------------------------------------------- tabs.add(group); group->labelfont( FL_COURIER ); group->labelsize( 14 ); static const int bh = 23; //-------------------------------------------------------------------------- // create the parameters //-------------------------------------------------------------------------- const int h = group->h(); const size_t nb = bi.param.size(); const int hfree = h - nb * bh; const int hskip = hfree/(nb+1); int y = group->y(); const int x = group->x() + 8; for( size_t i=1; i <= nb; ++i ) { y += hskip; const string ¶m = bi.param[i]; Fl_Input *box = new Fl_Input(x,y,100,bh,param.c_str()); box->input_type(FL_FLOAT_INPUT); box->labeltype( FL_NORMAL_LABEL ); box->align(FL_ALIGN_RIGHT); box->labelfont(FL_HELVETICA); box->labelsize(12); box->textsize(12); box->textfont(FL_HELVETICA); group->add(box); box->value("0.0"); y += bh; input.push_back(box); box->callback(ChangeCB); box->when(FL_WHEN_RELEASE); } }
void onelab_connect_remote_server_cb(Fl_Widget *w, void *data) { Fl_Input *serverAddr = (Fl_Input *)data; std::string address = serverAddr->value(); std::size_t colon = address.find(":"); GmshNetworkClient *c = OnelabDatabase::instance()->useAsNetworkClient( ip4_inet_pton(address.substr(0, colon).c_str()), atoi(address.substr(colon+1, address.size()-colon-1).c_str()), "GUI"); if(c == NULL) { Msg::Error("Unable to connect ONELAB server (%s)", address.c_str()); Msg::Exit(1); } else if(FlGui::available()) // FIXME c->setCallback(FlGui::instance()->onelab); }
void onelab_listen_unix_cb(Fl_Widget *w, void *data) { Fl_Check_Button *checkbutton = (Fl_Check_Button *)w; Fl_Input *sockUNIX = (Fl_Input *)data; if(checkbutton->value() == 1) { sockUNIX->deactivate(); CTX::instance()->onelab.unixSock = sockUNIX->value(); std::size_t colon = CTX::instance()->onelab.unixSock.find(":"); std::ostringstream tmp; tmp << CTX::instance()->homeDir << CTX::instance()->onelab.unixSock; OnelabServer::instance()->listenOnUnix(tmp.str().c_str()); } else { sockUNIX->activate(); OnelabServer::instance()->stopUnix(); } }
void onelab_listen_udt_cb(Fl_Widget *w, void *data) { Fl_Check_Button *checkbutton = (Fl_Check_Button *)w; Fl_Input *sockUDT = (Fl_Input *)data; if(checkbutton->value() == 1) { sockUDT->deactivate(); CTX::instance()->onelab.udtSock = sockUDT->value(); std::size_t colon = CTX::instance()->onelab.udtSock.find(":"); OnelabServer::instance()->listenOnTcp( ip4_inet_pton(CTX::instance()->onelab.udtSock.substr(0, colon).c_str()), atoi(CTX::instance()->onelab.udtSock.substr(colon+1, CTX::instance()->onelab.udtSock.size()-colon-1).c_str())); } else { sockUDT->activate(); OnelabServer::instance()->stopUdt(); } }
static void ClickedDistBear(Fl_Widget * w, void * userdata) { WaypointClient* anInstance = (WaypointClient*) userdata; Fl_Input_Choice * fromWPChoice = anInstance->frWps; Fl_Input_Choice * toWPChoice = anInstance->toWps; Fl_Input * distBearOutput = anInstance->distBearIn; double dist = anInstance->getDistanceGCTo(fromWPChoice->value(), toWPChoice->value()); double bear = anInstance->getBearingGCInitTo(fromWPChoice->value(), toWPChoice->value()); stringstream ss; ss.precision(5); ss << dist << "/" << bear; string result = ss.str(); distBearOutput->value(result.c_str()); cout << "Calculated distance/bearing: " << result << "; \n"<< endl; buildWaypointList(anInstance); }
double numberOrStringOptionChooser(const std::string &category, int index, const std::string &name, bool isNumber, const std::string &title, bool isInteractive, double minimum, double maximum, double step) { double valn = 0.; std::string vals = ""; if(isNumber) NumberOption(GMSH_GET, category.c_str(), index, name.c_str(), valn); else StringOption(GMSH_GET, category.c_str(), index, name.c_str(), vals); int nn = (isInteractive ? 2 : 3); int width = nn * BB + (nn + 1) * WB, height = 2 * BH + 3 * WB; std::string t = title; if(t.empty()) t = (isNumber ? "Number Chooser" : "String Chooser"); Fl_Window *win = new paletteWindow(width, height, false, t.c_str()); win->set_modal(); win->hotspot(win); inputValueFloat *number = 0; Fl_Input *string = 0; if(isNumber){ number = new inputValueFloat(WB, WB, width - 2 * WB, BH); number->value(valn); if(isInteractive){ static opt_data d; d.category = category; d.index = index; d.name = name; number->minimum(minimum); number->maximum(maximum); number->step(step, 1); number->callback(interactive_cb, (void*)&d); number->when(FL_WHEN_RELEASE); } } else{ string = new Fl_Input(WB, WB, width - 2 * WB, BH); string->value(vals.c_str()); } Fl_Button *ok = new Fl_Return_Button (width - nn * BB - nn * WB, 2 * WB + BH, BB, BH, "OK"); Fl_Button *def = new Fl_Button (width - (nn - 1) * BB - (nn - 1) * WB, 2 * WB + BH, BB, BH, "Default"); Fl_Button *cancel = 0; if(!isInteractive) cancel = new Fl_Button (width - BB - WB, 2 * WB + BH, BB, BH, "Cancel"); win->end(); win->show(); if(number) number->take_focus(); if(string) string->take_focus(); bool done = false; while(win->shown()){ if(done) break; Fl::wait(); for (;;) { Fl_Widget* o = Fl::readqueue(); if (!o) break; if (o == win || o == cancel) { done = true; break; } if(o == ok){ if(isNumber){ valn = number->value(); NumberOption(GMSH_SET|GMSH_GUI, category.c_str(), index, name.c_str(), valn); } else{ vals = string->value(); StringOption(GMSH_SET|GMSH_GUI, category.c_str(), index, name.c_str(), vals); } done = true; break; } if(o == def){ if(isNumber){ NumberOption(GMSH_GET_DEFAULT, category.c_str(), index, name.c_str(), valn); number->value(valn); if(isInteractive) number->do_callback(); } else{ StringOption(GMSH_GET_DEFAULT, category.c_str(), index, name.c_str(), vals); string->value(vals.c_str()); } break; } } } delete win; if(isNumber){ NumberOption(GMSH_GET, category.c_str(), index, name.c_str(), valn); return valn; } else return 0.; }
void TextCallback(Fl_Widget *widget, void *toSet){ Fl_Input *inp = (Fl_Input *)widget; void **val = (void **)toSet; *val = (void *)inp->value(); }
// add parameter string to tree Fl_Widget *onelabGroup::_addParameterWidget(onelab::string &p, int ww, int hh, Fl_Tree_Item *n, bool highlight, Fl_Color c) { char *path = strdup(getPath(n).c_str()); _treeStrings.push_back(path); // macro button if(p.getAttribute("Macro") == "Gmsh"){ Fl_Button *but = new Fl_Button(1, 1, ww / _widgetLabelRatio, hh); but->box(FL_FLAT_BOX); but->color(_tree->color()); but->selection_color(_tree->color()); but->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE | FL_ALIGN_CLIP); //TODO but->callback(onelab_string_button_cb, (void*)path); if(highlight) but->color(c); return but; } // non-editable value if(p.getReadOnly()){ Fl_Output *but = new Fl_Output(1, 1, ww, hh); but->value(p.getValue().c_str()); but->align(FL_ALIGN_RIGHT); if(highlight) but->color(c); return but; } // simple string (no menu) if(p.getChoices().empty() && p.getKind() != "file"){ Fl_Input *but = new Fl_Input(1, 1, ww, hh); but->value(p.getValue().c_str()); //TODO but->callback(onelab_string_input_cb, (void*)path); but->when(FL_WHEN_ENTER_KEY); but->align(FL_ALIGN_RIGHT); if(highlight) but->color(c); return but; } // general string input Fl_Input_Choice *but = new Fl_Input_Choice(1, 1, ww, hh); std::string multipleSelection = p.getAttribute("MultipleSelection"); if(multipleSelection.size()) ;//but->menubutton()->callback(multiple_selection_menu_cb, but); std::vector<Fl_Menu_Item> menu; for(unsigned int j = 0; j < p.getChoices().size(); j++){ char *str = strdup(p.getChoices()[j].c_str()); _treeStrings.push_back(str); bool divider = (p.getKind() == "file" && j == p.getChoices().size() - 1); int choice = multipleSelection.size() ? FL_MENU_TOGGLE : 0; if(multipleSelection.size() > j && multipleSelection[j] == '1') choice |= FL_MENU_VALUE; Fl_Menu_Item it = {str, 0, 0, 0, divider ? FL_MENU_DIVIDER : choice}; menu.push_back(it); } //if(p.getKind() == "file"){ // Fl_Menu_Item it = {"Choose...", 0, onelab_input_choice_file_chooser_cb, (void*)n}; // menu.push_back(it); // Fl_Menu_Item it2 = {"Edit...", 0, onelab_input_choice_file_edit_cb, (void*)n}; // menu.push_back(it2); // if(GuessFileFormatFromFileName(p.getValue()) >= 0){ // Fl_Menu_Item it3 = {"Merge...", 0, onelab_input_choice_file_merge_cb, (void*)n}; // menu.push_back(it3); // } //} Fl_Menu_Item it = {0}; menu.push_back(it); but->menubutton()->copy(&menu[0]); but->value(p.getValue().c_str()); but->callback(onelab_string_input_choice_cb, (void*)path); but->input()->when(FL_WHEN_ENTER_KEY); but->align(FL_ALIGN_RIGHT); if(highlight) but->input()->color(c); return but; }
void startupCallback(Fl_Widget *widget, void *unused){ Fl_Input *inp = (Fl_Input *)widget; tsconf::GetGameConfig()->startupdir = inp->value(); }
void createSystemArea(int32_t x, int32_t y, int32_t w, int32_t h){ tsconf::GameConfig *conf = tsconf::GetGameConfig(); int curH_L = y; if((x+(tsconf::smallPadding<<1)+tsconf::largeWidgetWidth)>w){ //Enter no-space mode } else{ //We got space. curH_L+=tsconf::smallPadding; Fl_Group *startupGroup = new Fl_Group(x+tsconf::smallPadding, curH_L, w-(tsconf::smallPadding*2), tsconf::largeWidgetHeight, "Startup Directory"); startupGroup->box(FL_EMBOSSED_BOX); startupGroup->begin(); Fl_Input *startupInput = new Fl_Input(x+tsconf::smallPadding+12, curH_L+12, (w-(tsconf::smallPadding*2))-76, tsconf::smallWidgetHeight); startupInput->value(conf->startupdir); startupInput->when(FL_WHEN_CHANGED); startupInput->callback(startupCallback); int newX = static_cast<Fl_Widget *>(startupInput)->x()+static_cast<Fl_Widget *>(startupInput)->w(); Fl_Button *chooseStartupButton = new Fl_Button(newX+12, curH_L+12, 40, tsconf::smallWidgetHeight, "..."); chooseStartupButton->callback(DirectoryChooser, startupInput); startupGroup->end(); curH_L+=tsconf::smallPadding+tsconf::largeWidgetHeight; Fl_Group *sgmnameGroup = new Fl_Group(x+tsconf::smallPadding, curH_L, w-(tsconf::smallPadding*2), tsconf::largeWidgetHeight, "SGM File Name"); sgmnameGroup->box(FL_EMBOSSED_BOX); sgmnameGroup->begin(); Fl_Input *sgmnameInput = new Fl_Input(x+tsconf::smallPadding+12, curH_L+12, (w-(tsconf::smallPadding*2))-24, tsconf::smallWidgetHeight); sgmnameInput->value(conf->sgmname); sgmnameInput->when(FL_WHEN_CHANGED); sgmnameInput->callback(sgmnameCallback); sgmnameGroup->end(); curH_L+=tsconf::smallPadding+tsconf::largeWidgetHeight; Fl_Group *tsgmnameGroup = new Fl_Group(x+tsconf::smallPadding, curH_L, w-(tsconf::smallPadding*2), tsconf::largeWidgetHeight, "TSGM File Name"); tsgmnameGroup->box(FL_EMBOSSED_BOX); tsgmnameGroup->begin(); Fl_Input *tsgmnameInput = new Fl_Input(x+tsconf::smallPadding+12, curH_L+12, (w-(tsconf::smallPadding*2))-24, tsconf::smallWidgetHeight); tsgmnameInput->value(conf->tsgmname); tsgmnameInput->when(FL_WHEN_CHANGED); tsgmnameInput->callback(tsgmnameCallback); tsgmnameGroup->end(); curH_L+=tsconf::smallPadding+tsconf::largeWidgetHeight; Fl_Group *mainfuncGroup = new Fl_Group(x+tsconf::smallPadding, curH_L, w-(tsconf::smallPadding*2), tsconf::largeWidgetHeight, "Main Function"); mainfuncGroup->box(FL_EMBOSSED_BOX); mainfuncGroup->begin(); Fl_Input *mainfuncInput = new Fl_Input(x+tsconf::smallPadding+12, curH_L+12, (w-(tsconf::smallPadding*2))-24, tsconf::smallWidgetHeight); mainfuncInput->value(conf->gamefunc); mainfuncInput->when(FL_WHEN_CHANGED); mainfuncInput->callback(mainfuncCallback); mainfuncGroup->end(); } }
void mainfuncCallback(Fl_Widget *widget, void *unused){ Fl_Input *inp = (Fl_Input *)widget; tsconf::GetGameConfig()->gamefunc = inp->value(); }
void tsgmnameCallback(Fl_Widget *widget, void *unused){ Fl_Input *inp = (Fl_Input *)widget; tsconf::GetGameConfig()->tsgmname = inp->value(); }
void edit_formula_cb( Fl_Widget* w, void* ) { const int heightInput = 28; const int heightText = 18; const int wideLabel = 50; const int wideInput = 450; const int Ybetween = 3; const int YbetweenMore = 6; const int alignStyle = FL_ALIGN_INSIDE | FL_ALIGN_RIGHT; const int textStyle = FL_ALIGN_INSIDE | FL_ALIGN_LEFT; const Fl_Boxtype inputStyle = FL_PLASTIC_DOWN_BOX; int x = 10; int y = 10; const int wide = x+wideLabel+wideInput+x; const int height = y + 3*heightText + Ybetween + 3*(heightInput+Ybetween) - Ybetween + YbetweenMore + y; Fl_Window* win = new Fl_Window( wide, height, _("Formulas editor") ); Fl_Group* win2 = new Fl_Group( 0, 0, wide, height ); win->resizable(win2); { Fl_Box* o = new Fl_Box( x, y, wideLabel+wideInput, heightText, _("Enter the formulas of x(n+1) and y(n+1) using prefix notation.") ); o->align( textStyle ); } y += heightText; { Fl_Box* o = new Fl_Box( x, y, wideLabel+wideInput, heightText, _("Variables: x y x1 x2 y1 y2 xc yc rand, and any number.") ); o->align( textStyle ); } y += heightText; { Fl_Box* o = new Fl_Box( x, y, wideLabel+wideInput, heightText, _("Functions: ") ); o->align( textStyle ); } { Fl_Box* o = new Fl_Box( x + (int)( fl_width(_("Functions: ")) ), y, wideLabel+wideInput, heightText, "+ - * / < pow abs atan2 sin cos tan atan ln sign square sqrt." ); o->align( textStyle ); } y += heightText + Ybetween; { Fl_Box* o = new Fl_Box( x, y, wideLabel, heightInput, "x <- " ); o->align( alignStyle ); } { Fl_Input* o = new Fl_Input( x+wideLabel, y, wideInput, heightInput ); o->box(inputStyle); o->value( Function::formulaPoint.getStringX().c_str() ); } y += heightInput + Ybetween; { Fl_Box* o = new Fl_Box( x, y, wideLabel, heightInput, "y <- " ); o->align( alignStyle ); } { Fl_Input* o = new Fl_Input( x+wideLabel, y, wideInput, heightInput ); o->box(inputStyle); o->value( Function::formulaPoint.getStringY().c_str() ); } y += heightInput + Ybetween + YbetweenMore; { Fl_Return_Button* o = new Fl_Return_Button( wide - x - 150, y, 150, heightInput, _("Set formulas") ); o->box(FL_PLASTIC_UP_BOX); o->callback( (Fl_Callback*)set_formula, glito ); } win2->end(); win->end(); win->show(); }
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(); }