Esempio n. 1
0
//==== Create & Init Gui Slider Adjustable Range  ====//
void GroupLayout::AddSlider( SliderAdjRangeInput& slid_adj_input,
                             const char* label, double range, const char* format )
{
    assert( m_Group && m_Screen );

    int init_used_w = m_X - m_Group->x();

    //==== Parm Button ====//
    VspButton* button = AddParmButton( label );

    //==== Range Button ====//
    Fl_Repeat_Button* lbutton = new Fl_Repeat_Button( m_X, m_Y, m_RangeButtonWidth, m_StdHeight, "<" );
    lbutton->box( FL_THIN_UP_BOX );
    lbutton->labelcolor( ( Fl_Color )4 );
    m_Group->add( lbutton );
    AddX( m_RangeButtonWidth );

    //==== Slider ====//
    int sw = FitWidth( m_ButtonWidth + 2 * m_RangeButtonWidth + m_InputWidth + init_used_w, m_SliderWidth );
    Fl_Slider* slider = new Fl_Slider( m_X, m_Y, sw, m_StdHeight );
    slider->type( 5 );
    slider->box( FL_THIN_DOWN_BOX );
    slider->color( FL_BACKGROUND2_COLOR );
    slider->selection_color( FL_SELECTION_COLOR );
    m_Group->add( slider );
    AddX( sw );

    //==== Range Button ====//
    Fl_Repeat_Button* rbutton = new Fl_Repeat_Button( m_X, m_Y,  m_RangeButtonWidth, m_StdHeight, "<" );
    rbutton->box( FL_THIN_UP_BOX );
    rbutton->labelcolor( ( Fl_Color )4 );
    m_Group->add( rbutton );
    AddX( m_RangeButtonWidth );

    //==== Input ====//
    Fl_Float_Input* input = new Fl_Float_Input( m_X, m_Y, m_InputWidth, m_StdHeight );
    input->type( 1 );
    input->box( FL_THIN_DOWN_BOX );
    input->textsize( 12 );
    input->when( FL_WHEN_ENTER_KEY | FL_WHEN_RELEASE );
    m_Group->add( input );
    AddX( m_InputWidth );

    AddY( m_StdHeight );
    NewLineX();

    slid_adj_input.Init( m_Screen, slider, lbutton, rbutton, input, range, format, button );

    if( strcmp( label, "AUTO_UPDATE" ) == 0 || strcmp( label, "" ) == 0 )
    {
        slid_adj_input.SetButtonNameUpdate( true );
    }
}
Esempio n. 2
0
    Tempo_Point_Editor ( float *tempo ) : Fl_Menu_Window(  75, 58, "Edit Tempo" )
        {
            _sucess = false;
            _tempo = tempo;

            set_modal();

            Fl_Float_Input *fi = _fi = new Fl_Float_Input( 12, 0 + 24, 50, 24, "Tempo:" );
            fi->align( FL_ALIGN_TOP );
            fi->when( FL_WHEN_NOT_CHANGED | FL_WHEN_ENTER_KEY );
            fi->callback( &Tempo_Point_Editor::enter_cb, (void*)this );

            char pat[10];
            snprintf( pat, sizeof( pat ), "%.1f", *tempo );

            fi->value( pat );

            end();

            show();

            while ( shown() )
                Fl::wait();
        }
Esempio n. 3
0
Fl_Parameters_Manager::Fl_Parameters_Manager(int x, int y, int width, int height, Fl_MDI_Viewport *s, const char *name)
{
	Fl::lock();

	s->begin();
	Fl_MDI_Window *w = PWin = 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();

	Parameters_Tabs = new Fl_Tabs*[Num_Tunable_Blocks];
	Input_Blocks = new Param_Input_Block_T [Num_Tunable_Parameters];

	for (int i = 0; i < Num_Tunable_Blocks; i++) {
		{ Fl_Tabs *o = Parameters_Tabs[i] = new Fl_Tabs(160, 5, width-165, height-70);
		  o->new_page("Block Parameters");
		  int tot_rows = 0;
		  if (i == Num_Tunable_Blocks - 1) {
		  	for (int j = 0; j < Num_Tunable_Parameters - Tunable_Blocks[i].offset; j++) {
				char scalar_val[20];
				char param_label[MAX_NAMES_SIZE + 10];
				int val_idx;
				unsigned int ncols = Tunable_Parameters[Tunable_Blocks[i].offset+j].n_cols;
				unsigned int nrows = Tunable_Parameters[Tunable_Blocks[i].offset+j].n_rows;
				Input_Blocks[Tunable_Blocks[i].offset+j].inputW = new Fl_Float_Input*[nrows*ncols];

				sprintf(param_label, "%s", Tunable_Parameters[Tunable_Blocks[i].offset+j].param_name);
				for (unsigned int nr = 0; nr < nrows; nr++) {
					for (unsigned int nc = 0; nc < ncols; nc++) {
		  				{ Fl_Float_Input *o = new Fl_Float_Input(10 + nc*110, 30 + (j+nr+tot_rows)*40, 100, 20, strdup(param_label));
						  param_label[0] = '\0';
			    	  		  o->align(FL_ALIGN_LEFT|FL_ALIGN_TOP);
				  		  o->when(FL_WHEN_ENTER_KEY);
						  sprintf(scalar_val, "%G", get_parameter(Tunable_Parameters[Tunable_Blocks[i].offset+j], nr, nc, &val_idx));
			    	  		  o->value(strdup(scalar_val));
						  p_idx_T *idx = new p_idx_T;
						  idx->block_idx = i;
						  idx->param_idx = j;
						  idx->val_idx = val_idx;
				  		  o->callback((Fl_Callback *)rlg_update_parameters_cb, (void *)idx);
						  Input_Blocks[Tunable_Blocks[i].offset+j].inputW[val_idx]=o;
						}
					}
				}
				tot_rows = tot_rows + nrows - 1;
			}
		  } else {
		  	for (int j = 0; j < Tunable_Blocks[i+1].offset-Tunable_Blocks[i].offset; j++) {
				char scalar_val[20];
				char param_label[MAX_NAMES_SIZE + 10];
				int val_idx;
				unsigned int ncols = Tunable_Parameters[Tunable_Blocks[i].offset+j].n_cols;
				unsigned int nrows = Tunable_Parameters[Tunable_Blocks[i].offset+j].n_rows;
				Input_Blocks[Tunable_Blocks[i].offset+j].inputW = new Fl_Float_Input*[nrows*ncols];
				sprintf(param_label, "%s", Tunable_Parameters[Tunable_Blocks[i].offset+j].param_name);
				for (unsigned int nr = 0; nr < nrows; nr++) {
					for (unsigned int nc = 0; nc < ncols; nc++) {
		  				{ Fl_Float_Input *o = new Fl_Float_Input(10 + nc*110, 30 + (j+nr+tot_rows)*40, 100, 20, strdup(param_label));
						  param_label[0] = '\0';
			    	  		  o->align(FL_ALIGN_LEFT|FL_ALIGN_TOP);
				  		  o->when(FL_WHEN_ENTER_KEY);
						  sprintf(scalar_val, "%G", get_parameter(Tunable_Parameters[Tunable_Blocks[i].offset+j], nr, nc, &val_idx));
			    	  		  o->value(strdup(scalar_val));
						  p_idx_T *idx = new p_idx_T;
						  idx->block_idx = i;
						  idx->param_idx = j;
						  idx->val_idx = val_idx;
						  o->callback((Fl_Callback *)rlg_update_parameters_cb, (void *)idx);
						  Input_Blocks[Tunable_Blocks[i].offset+j].inputW[val_idx]=o;
						}
					}
				}
				tot_rows = tot_rows + nrows - 1;
			}
		  }
		  o->end();
		  Fl_Group::current()->resizable(w);
		}
	}
	for (int i = 1; i < Num_Tunable_Blocks; i++) {
		Parameters_Tabs[i]->hide();
	}
	Parameters_Tabs[0]->show();

	Batch_Download = new Fl_Check_Button(width-270, height-60, 120, 25, "Batch Download");
	Batch_Download->callback((Fl_Callback *)batch_download_cb);
	Download = new Fl_Button(width-150, height-60, 70, 25, "Download");
	Download->callback((Fl_Callback *)rlg_batch_update_parameters_cb);
	Download->deactivate();
	Upload = new Fl_Button(width-75, height-60, 70, 25, "Upload");
	Upload->callback((Fl_Callback *)rlg_upload_parameters_cb);
//	Upload->deactivate();
	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 = Parameters_Tree = new Fl_Browser(5, 5, 150, height-10);
	o->indented(1);
	o->callback((Fl_Callback *)select_block);
	for (int i = 0; i < Num_Tunable_Blocks; i++) {
		add_paper(Parameters_Tree, Tunable_Blocks[i].name, Fl_Image::read_xpm(0, block_icon));
	}

	w->view()->end();

	s->end();

	w->titlebar()->h(15);
	w->titlebar()->color(FL_BLACK);
	w->position(x, y);

	Fl::unlock();
}
Esempio n. 4
0
//==== Add Fuselage Skin Control Group ====//
void GroupLayout::AddSkinControl( SkinControl & skin_control, const char* label, double range, const char* format )
{
    assert( m_Group && m_Screen );

    int sw = FitWidth( 3 * m_StdHeight + m_ButtonWidth + 2 * m_InputWidth + 4 * m_RangeButtonWidth, 2 * m_SliderWidth )/2;

    //==== Left Min Range Button ====//
    Fl_Repeat_Button* minbuttonL = new Fl_Repeat_Button( m_X, m_Y, m_RangeButtonWidth, m_StdHeight, "<" );
    minbuttonL->box( FL_THIN_UP_BOX );
    minbuttonL->labelcolor( ( Fl_Color )4 );
    m_Group->add( minbuttonL );
    AddX( m_RangeButtonWidth );

    //==== Left Slider ====//
    Fl_Slider* sliderL = new Fl_Slider( m_X, m_Y, sw, m_StdHeight );
    sliderL->type( 5 );
    sliderL->box( FL_THIN_DOWN_BOX );
    sliderL->color( FL_BACKGROUND2_COLOR );
    sliderL->selection_color( FL_SELECTION_COLOR );
    m_Group->add( sliderL );
    AddX( sw );

    //==== Left Max Range Button ====//
    Fl_Repeat_Button* maxbuttonL = new Fl_Repeat_Button( m_X, m_Y, m_RangeButtonWidth, m_StdHeight, ">" );
    maxbuttonL->box( FL_THIN_UP_BOX );
    maxbuttonL->labelcolor( ( Fl_Color )4 );
    m_Group->add( maxbuttonL );
    AddX( m_RangeButtonWidth );

    //==== Left Input ====//
    Fl_Float_Input* inputL = new Fl_Float_Input( m_X, m_Y,  m_InputWidth, m_StdHeight );
    inputL->type( 1 );
    inputL->box( FL_THIN_DOWN_BOX );
    inputL->textsize( 12 );
    inputL->when( FL_WHEN_ENTER_KEY | FL_WHEN_RELEASE );
    m_Group->add( inputL );
    AddX( m_InputWidth );

    //==== Left Set Check Button ====//
    Fl_Check_Button* setButtonL = new Fl_Check_Button( m_X, m_Y, m_StdHeight, m_StdHeight );
    m_Group->add( setButtonL );
    AddX( m_StdHeight );

    //==== Parm Button ====//
    VspButton* parm_button = AddParmButton( label );

    //==== Set Equality Check Button ====//
    Fl_Check_Button* setButtonEqual = new Fl_Check_Button( m_X, m_Y, m_StdHeight, m_StdHeight );
    m_Group->add( setButtonEqual );
    AddX( m_StdHeight );

    //==== Right Set Check Button ====//
    Fl_Check_Button* setButtonR = new Fl_Check_Button( m_X, m_Y, m_StdHeight, m_StdHeight );
    m_Group->add( setButtonR );
    AddX( m_StdHeight );

    //==== Right Min Range Button ====//
    Fl_Repeat_Button* minbuttonR = new Fl_Repeat_Button( m_X, m_Y, m_RangeButtonWidth, m_StdHeight, "<" );
    minbuttonR->box( FL_THIN_UP_BOX );
    minbuttonR->labelcolor( ( Fl_Color )4 );
    m_Group->add( minbuttonR );
    AddX( m_RangeButtonWidth );

    //==== Right Slider ====//
    Fl_Slider* sliderR = new Fl_Slider( m_X, m_Y, sw, m_StdHeight );
    sliderR->type( 5 );
    sliderR->box( FL_THIN_DOWN_BOX );
    sliderR->color( FL_BACKGROUND2_COLOR );
    sliderR->selection_color( FL_SELECTION_COLOR );
    m_Group->add( sliderR );
    AddX( sw );

    //==== Right Max Range Button ====//
    Fl_Repeat_Button* maxbuttonR = new Fl_Repeat_Button( m_X, m_Y, m_RangeButtonWidth, m_StdHeight, ">" );
    maxbuttonR->box( FL_THIN_UP_BOX );
    maxbuttonR->labelcolor( ( Fl_Color )4 );
    m_Group->add( maxbuttonR );
    AddX( m_RangeButtonWidth );

    //==== Right Input ====//
    Fl_Float_Input* inputR = new Fl_Float_Input( m_X, m_Y,  m_InputWidth, m_StdHeight );
    inputR->type( 1 );
    inputR->box( FL_THIN_DOWN_BOX );
    inputR->textsize( 12 );
    inputR->when( FL_WHEN_ENTER_KEY | FL_WHEN_RELEASE );
    m_Group->add( inputR );
    AddX( m_InputWidth );

    AddY( m_StdHeight );
    NewLineX();

    skin_control.Init( m_Screen,
        setButtonL,
        setButtonEqual,
        setButtonR,
        sliderL,
        minbuttonL,
        maxbuttonL,
        sliderR,
        minbuttonR,
        maxbuttonR,
        inputL,
        inputR,
        parm_button,
        range, format);
}