//==== Create & Init Text Input ====// void GroupLayout::AddInput( StringInput& text_input, const char* label ) { assert( m_Group && m_Screen ); //==== Button ====// AddParmButton( label ); //==== Add Text Input ====// int iw = FitWidth( m_ButtonWidth, m_InputWidth ); Fl_Input* input = new Fl_Input( m_X, m_Y, iw, m_StdHeight ); input->box( FL_THIN_DOWN_BOX ); input->textsize( 12 ); input->when( FL_WHEN_ENTER_KEY | FL_WHEN_RELEASE ); m_Group->add( input ); AddX( iw ); AddY( m_StdHeight ); NewLineX(); text_input.Init( m_Screen, input ); }
//==== Create & Init Float Input ====// void GroupLayout::AddInput( Input& input, const char* label, const char* format ) { assert( m_Group && m_Screen ); //==== Parm Button ====// VspButton* button = AddParmButton( label ); //==== Add Text Input ====// int iw = FitWidth( m_ButtonWidth, m_InputWidth ); Fl_Input* flinput = new Fl_Input( m_X, m_Y, iw, m_StdHeight ); flinput->type( 1 ); flinput->box( FL_THIN_DOWN_BOX ); flinput->textsize( 12 ); flinput->when( FL_WHEN_ENTER_KEY | FL_WHEN_RELEASE ); m_Group->add( flinput ); AddX( iw ); AddY( m_StdHeight ); NewLineX(); input.Init( m_Screen, flinput, format, button ); }
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(); }