//==== Add Sub Group Layout At Current Position  ====//
void GroupLayout::AddCounter( Counter & count, const char* label )
{
    assert( m_Group && m_Screen );

    //==== Counter Button ====//
    VspButton* button = NULL;
    if ( strcmp( label, "" ) != 0 )
    {
        VspButton* button = AddParmButton( label );
        button->align( Fl_Align( FL_ALIGN_CLIP ) );
    }

    //==== Counter ====//
    int counter_w = FitWidth( m_ButtonWidth, m_SliderWidth );
    Fl_Counter* fl_counter = new Fl_Counter( m_X, m_Y, counter_w, m_StdHeight );
    fl_counter->type( FL_SIMPLE_COUNTER );
    fl_counter->minimum( 0 );
    fl_counter->maximum( 10000 );
    fl_counter->step( 1 );
    m_Group->add( fl_counter );

    AddX( counter_w );

    count.Init( m_Screen, fl_counter, button );

    AddY( m_StdHeight );
    NewLineX();

}
//==== Add Geom Picker ====//
void GroupLayout::AddGeomPicker( GeomPicker & geom_picker )
{

    assert( m_Group && m_Screen );

    //==== Geom Button ====//
    Fl_Button* button = new Fl_Button( m_X, m_Y, m_ChoiceButtonWidth, m_StdHeight, "Geom" );
    button->box( FL_THIN_UP_BOX );
    button->labelfont( 1 );
    button->labelsize( 12 );
    button->labelcolor( FL_BLACK );
    m_Group->add( button );
    AddX( m_ChoiceButtonWidth );

    //==== Geom Picker ====//
    int choice_w = FitWidth( m_ChoiceButtonWidth, m_SliderWidth );
    Fl_Choice* geom_choice = new Fl_Choice( m_X, m_Y, choice_w, m_StdHeight );
    geom_choice->down_box( FL_BORDER_BOX );
    geom_choice->textfont( 1 );
    geom_choice->textsize( 12 );
    geom_choice->textcolor( FL_DARK_BLUE );
    m_Group->add( geom_choice );
    AddX( choice_w );

    AddY( m_StdHeight );
    NewLineX();

    geom_picker.Init( m_Screen, geom_choice );
}
//==== Create & Init Index Selector  ====//
void GroupLayout::AddIndexSelector( IndexSelector& selector )
{
    assert( m_Group && m_Screen );

    int butw = 5 * m_ButtonWidth / 6;

    Fl_Button* but_ll = new Fl_Button( m_X, m_Y, butw, m_StdHeight, "<<" );
    but_ll->box( FL_THIN_UP_BOX );
    but_ll->labelfont( 1 );
    but_ll->labelsize( 20 );
    but_ll->labelcolor( ( Fl_Color )4 );
    but_ll->align( Fl_Align( FL_ALIGN_CLIP ) );

    AddX( butw );

    Fl_Button* but_l = new Fl_Button( m_X, m_Y, butw, m_StdHeight, "<" );
    but_l->box( FL_THIN_UP_BOX );
    but_l->labelfont( 1 );
    but_l->labelsize( 20 );
    but_l->labelcolor( ( Fl_Color )4 );
    but_l->align( Fl_Align( FL_ALIGN_CLIP ) );

    AddX( butw );

    int iw = FitWidth( 4 * butw, m_InputWidth );

    Fl_Int_Input* int_inp = new Fl_Int_Input( m_X + 4, m_Y, iw - 8, m_StdHeight );
    int_inp->type( 2 );
    int_inp->box( FL_THIN_DOWN_BOX );
    int_inp->labelfont( 1 );
    int_inp->textsize( 14 );
    int_inp->align( Fl_Align( FL_ALIGN_CENTER ) );
    int_inp->when( FL_WHEN_ENTER_KEY | FL_WHEN_RELEASE );

    AddX( iw );

    Fl_Button* but_r = new Fl_Button( m_X, m_Y, butw, m_StdHeight, ">" );
    but_r->box( FL_THIN_UP_BOX );
    but_r->labelfont( 1 );
    but_r->labelsize( 20 );
    but_r->labelcolor( ( Fl_Color )4 );
    but_r->align( Fl_Align( FL_ALIGN_CLIP ) );

    AddX( butw );

    Fl_Button* but_rr = new Fl_Button( m_X, m_Y, butw, m_StdHeight, ">>" );
    but_rr->box( FL_THIN_UP_BOX );
    but_rr->labelfont( 1 );
    but_rr->labelsize( 20 );
    but_rr->labelcolor( ( Fl_Color )4 );
    but_rr->align( Fl_Align( FL_ALIGN_CLIP ) );

    AddX( butw );

    selector.Init( m_Screen, but_ll, but_l, int_inp, but_r, but_rr );

    AddY( m_StdHeight );
    NewLineX();
}
//==== Add Parameter Tree Picker ====//
void GroupLayout::AddParmTreePicker( ParmTreePicker & parm_tree_picker, int w, int h )
{
    assert( m_Group && m_Screen );

    Fl_Tree* parm_tree = new Fl_Tree( m_X, m_Y, w, h );
    m_Group->add( parm_tree );
    AddY( h );
    NewLineX();

    parm_tree_picker.Init( m_Screen, parm_tree );
}
//==== 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 );
    }
}
//==== Add Fl Text Display ====//
Fl_Text_Display* GroupLayout::AddFlTextDisplay( int height )
{
    assert( m_Group && m_Screen );

    Fl_Text_Display* text_display = new Fl_Text_Display (m_X, m_Y, m_W, height, "");

    m_Group->add( text_display );

    AddY( height );
    NewLineX();

    return text_display;
}
//==== Add Fl Text Editor ====//
Fl_Text_Editor* GroupLayout::AddFlTextEditor( int height )
{
    assert( m_Group && m_Screen );

    Fl_Text_Editor* text_editor = new Fl_Text_Editor (m_X, m_Y, m_W, height, "");

    m_Group->add( text_editor );

    AddY( height );
    NewLineX();

    return text_editor;
}
//==== Add Fl Browser ====//
Fl_Browser* GroupLayout::AddFlBrowser( int height )
{
    assert( m_Group && m_Screen );

    Fl_Browser* browser = new Fl_Browser( m_X, m_Y, m_W, height);
    browser->type(2);
    browser->textsize(12);
    m_Group->add( browser );

    AddY( height );
    NewLineX();

    return browser;
}
//==== Add Fl_CheckBrowser ====//
Fl_Check_Browser* GroupLayout::AddCheckBrowser( int h )
{
    int w = FitWidth( 0, m_DividerHeight );

    Fl_Check_Browser* check_browser = new Fl_Check_Browser( m_X, m_Y, w, h );
    check_browser->labelfont( 1 );
    check_browser->textsize( 12 );
    check_browser->when( FL_WHEN_RELEASE );
    m_Group->add( check_browser );
    AddX( w );

    AddY( m_StdHeight );
    NewLineX();

    return check_browser;
}
//==== Create & Init Box Divider  ====//
void GroupLayout::AddDividerBox( const string& text, int used_w )
{
    assert( m_Group && m_Screen );

    //==== Add Divider Box ====//
    int dw = FitWidth( used_w, m_ButtonWidth );

    Fl_Box* flbox = new Fl_Box( m_X, m_Y, dw, m_DividerHeight );
    flbox->box( FL_BORDER_BOX );
    flbox->color( ( Fl_Color )12 );
    flbox->labelfont( 1 );
    flbox->labelcolor( FL_BACKGROUND2_COLOR );
    flbox->copy_label( text.c_str() );
    m_Group->add( flbox );
    AddX( dw );

    AddY( m_DividerHeight );
    NewLineX();
}
//==== Create & Init Gui ParmButton  ====//
void GroupLayout::AddButton( ParmButton& pbutton, const char* label )
{
    assert( m_Group && m_Screen );

    //==== Add Parm Button ====//
    int bw = FitWidth( 0, m_ButtonWidth );
    VspButton* flbutton = new VspButton( m_X, m_Y, bw, m_StdHeight, label );
    flbutton->copy_label( label );
    flbutton->labelfont( 1 );
    flbutton->labelsize( 12 );
    flbutton->labelcolor( FL_DARK_BLUE );
    m_Group->add( flbutton );

    AddX( bw );
    AddY( m_StdHeight );
    NewLineX();

    pbutton.Init( m_Screen, flbutton );
}
//==== Create & Init Choice  ====//
void GroupLayout::AddChoice( Choice & choice, const char* label, int used_w )
{
    assert( m_Group && m_Screen );

    //==== Choice Button ====//
    VspButton* button = new VspButton( m_X, m_Y, m_ChoiceButtonWidth, m_StdHeight, label );
    button->box( FL_THIN_UP_BOX );
    button->labelfont( 1 );
    button->labelsize( 12 );
    button->labelcolor( FL_BLACK );
    button->copy_label( label );
    m_Group->add( button );
    AddX( m_ChoiceButtonWidth );

    //==== Choice Picker ====//
    int choice_w = FitWidth( m_ChoiceButtonWidth + used_w, m_SliderWidth );
    Fl_Choice* fl_choice = new Fl_Choice( m_X, m_Y, choice_w, m_StdHeight );
    fl_choice->down_box( FL_BORDER_BOX );
    fl_choice->textfont( 1 );
    fl_choice->textsize( 12 );
    fl_choice->textcolor( FL_DARK_BLUE );
    m_Group->add( fl_choice );
    AddX( choice_w );

    //==== Add Choice Text ===//
    vector< string > choice_vec = choice.GetItems();
    for ( int i = 0 ; i < ( int )choice_vec.size() ; i++ )
    {
        fl_choice->add( choice_vec[i].c_str() );
    }
    fl_choice->value( 0 );

    choice.Init( m_Screen, fl_choice, button );

    if( strcmp( label, "AUTO_UPDATE" ) == 0 || strcmp( label, "" ) == 0 )
    {
        choice.SetButtonNameUpdate( true );
    }

    AddY( m_StdHeight );
    NewLineX();

}
//==== Create & Init Gui ToggleButton  ====//
void GroupLayout::AddButton( CheckButtonBit& cbutton, const char* label, int value )
{
    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, label );
    flbutton->labelfont( 1 );
    flbutton->labelsize( 12 );
    flbutton->align( Fl_Align( 132 | FL_ALIGN_INSIDE ) );
    flbutton->labelcolor( FL_DARK_BLUE );
    flbutton->copy_label( label );
    m_Group->add( flbutton );
    AddX( bw );

    AddY( m_StdHeight );
    NewLineX();

    cbutton.Init( m_Screen, flbutton, value );
}
//==== Create & Init Gui CheckButton  ====//
void GroupLayout::AddButton( CheckButton& cbutton, const char* label )
{
    assert( m_Group && m_Screen );

    //==== Add Check Button ====//
    int bw = FitWidth( 0, m_ButtonWidth );
    Fl_Check_Button* flbutton = new Fl_Check_Button( m_X, m_Y, bw, m_StdHeight, label );
    flbutton->box( FL_DOWN_BOX );
    flbutton->down_box( FL_DOWN_BOX );
    flbutton->labelfont( 1 );
    flbutton->labelsize( 12 );
    flbutton->labelcolor( FL_DARK_BLUE );
    flbutton->copy_label( label );
    m_Group->add( flbutton );
    AddX( bw );

    AddY( m_StdHeight );
    NewLineX();

    cbutton.Init( m_Screen, flbutton );
}
//==== 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 );
}
Beispiel #16
0
void AmControlChangePrefView::AddViews()
{
	inherited::AddViews();
	/* Run Report control
	 */
	float				y = AddY();

	const char*			label = "Run report";
	float				lW = StringWidth(label);
	BRect				f(0, y, lW + Prefs().Size(CHECK_BOX_X) + 10, y + Prefs().Size(CHECK_BOX_Y));
	mRunReport = new BCheckBox(f, "rr", label, new BMessage(CHANGE_FAC_VIEW_REPORT_MSG) );
	if (!mRunReport) return;

	int32				i32;
	if (mPrefs.GetInt32Preference(mFacSig.String(), mFacKey.String(), RUN_REPORT_PREF, &i32) != B_OK)
		i32 = 0;
	mRunReport->SetValue(i32);

	AddChild(mRunReport);

}
//==== 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 );
}
//==== Create & Init Text Output  ====//
void GroupLayout::AddOutput( StringOutput& string_output, const char* label )
{
    assert( m_Group && m_Screen );

    //==== Button ====//
    AddParmButton( label );

    //==== Add Text Input ====//
    int iw = FitWidth( m_ButtonWidth, m_InputWidth );
    Fl_Output* output = new Fl_Output( m_X, m_Y, iw, m_StdHeight );
    output->color( ( Fl_Color )23 );
    output->labelfont( 1 );
    output->labelsize( 12 );
    output->textfont( 1 );
    output->textsize( 12 );
    m_Group->add( output );
    AddX( iw );

    AddY( m_StdHeight );
    NewLineX();

    string_output.Init( m_Screen, output );
}
Beispiel #19
0
    // work as control unit in CPU
    void CPU::Decode()
    {
        if (CPU_Status==CPU_End) return;
        switch(Reg_IR)
        {
                //load value load the value into the AC
            case 1:
                Load_Value();
                break;
                //load addr load the value at the address into the AC
            case 2:
                Load_addr();
                break;
                //LoadInd addr
            case 3:
                LoadInd_addr();
                break;
                //loadIdxX addr
            case 4:
                LoadIdxX_addr();
                break;
                //LoadIdxY addr
            case 5:
                LoadIdxY_addr();
                break;
                //LoadSpX
            case 6:
                LoadSpX();
                break;
                //Store addr
            case 7:
                Store_addr();
                break;
                // get a random int from 1 to 100 into AC
            case 8:
                Get();
                break;
                //Put port
            case 9:
                Put_Port();
                break;
                //addX
            case 10:
                AddX();
                break;
                //add Y
            case 11:
                AddY();
                break;
                //Sub X
            case 12:
                SubX();
                break;
                //Sub y
            case 13:
                SubY();
                break;
                //copy the value in the AC to X
            case 14:
                CopyToX();
                break;
                //copy the value in X to the AC
            case 15:
                CopyFromX();
                break;
                //copy the value in the AC to Y
            case 16:
                CopyToY();
                break;
                //copy the value in Y to the AC
            case 17:
                CopyFromY();
                break;
                //copy the value in SP to the AC
            case 18:
                CopyToSp();
                break;
                // Copy From Sp
            case 19:
                CopyFromSp();
                break;
                //Jump addr
            case 20:
                Jump_addr();
                break;
                //Jump If equal addr
            case 21:
                JumpIfEqual_addr();
                break;
                //Jump If not equal addr
            case 22:
                JumpIfNotEqual_addr();
                break;
                //call addr
            case 23:
                Call_addr();
                break;
                //ret
            case 24:
                Ret();
                break;
                //inc X
            case 25:
                IncX();
                break;
                //Dec X
            case 26:
                DecX();
                break;
                //Push AC onto Stack
            case 27:
                Push();
                //push();
                break;
                //Pop from stack into AC
            case 28:
                Pop();
                //pop();
                break;
                //Int
            case 29:
                Int(Sys_Interrupt_Start, Reg_PC, CPU_KernelMode);
                break;
                //IRet
            case 30:
                IRet();
                break;
                //End Execution
            case 50:
                End();
                break;
        }
        if (CPU_Status==CPU_End) {
            return;
        }
        ++Instruction_Counter;
        //std::cout<<"Decode Complete: PC "<<Reg_PC<<" IR: "<<Reg_IR<<" AC: "<<Reg_AC<<" sp: "<<Reg_SP<<" x: "<<Reg_X<<" y: "<<Reg_Y<<std::endl;
        //std::cout<<std::endl;

    }
	/** Subtract nDistance to or from the Y coordinate.*/
	void		SubtractY(VLONG nDistance)
		{ AddY(-nDistance); }
//==== 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);
}
//==== Add Parameter Picker ====//
void GroupLayout::AddParmPicker( ParmPicker & parm_picker )
{

    assert( m_Group && m_Screen );

    //==== Container Button ====//
    Fl_Button* button = new Fl_Button( m_X, m_Y, m_ChoiceButtonWidth, m_StdHeight, "Container" );
    button->box( FL_THIN_UP_BOX );
    button->labelfont( 1 );
    button->labelsize( 12 );
    button->labelcolor( FL_BLACK );
    m_Group->add( button );
    AddX( m_ChoiceButtonWidth );

    //==== Container Picker ====//
    int choice_w = FitWidth( m_ChoiceButtonWidth, m_SliderWidth );
    Fl_Choice* container_choice = new Fl_Choice( m_X, m_Y, choice_w, m_StdHeight );
    container_choice->down_box( FL_BORDER_BOX );
    container_choice->textfont( 1 );
    container_choice->textsize( 12 );
    container_choice->textcolor( FL_DARK_BLUE );
    m_Group->add( container_choice );
    AddX( choice_w );

    AddY( m_StdHeight );
    NewLineX();

    //==== Group Button ====//
    button = new Fl_Button( m_X, m_Y, m_ChoiceButtonWidth, m_StdHeight, "Group" );
    button->box( FL_THIN_UP_BOX );
    button->labelfont( 1 );
    button->labelsize( 12 );
    button->labelcolor( FL_BLACK );
    m_Group->add( button );
    AddX( m_ChoiceButtonWidth );

    //==== Group Picker ====//
    choice_w = FitWidth( m_ChoiceButtonWidth, m_SliderWidth );
    Fl_Choice* group_choice = new Fl_Choice( m_X, m_Y, choice_w, m_StdHeight );
    group_choice->down_box( FL_BORDER_BOX );
    group_choice->textfont( 1 );
    group_choice->textsize( 12 );
    group_choice->textcolor( FL_DARK_BLUE );
    m_Group->add( group_choice );
    AddX( choice_w );

    AddY( m_StdHeight );
    NewLineX();

    //==== Parm Button ====//
    button = new Fl_Button( m_X, m_Y, m_ChoiceButtonWidth, m_StdHeight, "Parm" );
    button->box( FL_THIN_UP_BOX );
    button->labelfont( 1 );
    button->labelsize( 12 );
    button->labelcolor( FL_BLACK );
    m_Group->add( button );
    AddX( m_ChoiceButtonWidth );

    //==== Parm Picker ====//
    choice_w = FitWidth( m_ChoiceButtonWidth, m_SliderWidth );
    Fl_Choice* parm_choice = new Fl_Choice( m_X, m_Y, choice_w, m_StdHeight );
    parm_choice->down_box( FL_BORDER_BOX );
    parm_choice->textfont( 1 );
    parm_choice->textsize( 12 );
    parm_choice->textcolor( FL_DARK_BLUE );
    m_Group->add( parm_choice );
    AddX( choice_w );

    AddY( m_StdHeight );
    NewLineX();

    parm_picker.Init( m_Screen, container_choice, group_choice, parm_choice );

}
//==== Add Color Picker ====//
void GroupLayout::AddColorPicker( ColorPicker& picker )
{
    assert( m_Group && m_Screen );

    //==== Button ====//
    Fl_Button* colorButton = new Fl_Button( m_X, m_Y, m_ButtonWidth, m_StdHeight * 2, "Color:" );
    colorButton->box( FL_THIN_UP_BOX );
    colorButton->labelfont( 1 );
    colorButton->labelsize( 12 );
    colorButton->labelcolor( FL_BLACK );
    m_Group->add( colorButton );
    AddX( m_ButtonWidth );

    //==== Current Color Button ====//
    Fl_Button* primColorButton = new Fl_Button( m_X, m_Y, m_ButtonWidth / 2, m_StdHeight * 2 );
    primColorButton->box( FL_THIN_DOWN_BOX );
    primColorButton->color( ( Fl_Color )2 );
    m_Group->add( primColorButton );
    AddX( m_ButtonWidth / 2 + 2 );

    //==== Sliders ====//
    int ch = 2 * m_StdHeight / 3;
    int cw = m_StdHeight;

    int sw = FitWidth( m_ButtonWidth + m_ButtonWidth / 2 + 2 + 4 * cw, m_SliderWidth );
    Fl_Slider* sliders[3];
    for ( int i = 0 ; i < 3 ; i++ )
    {
        sliders[i] = new Fl_Value_Slider( m_X, m_Y + i * ch, sw, ch );
        sliders[i]->type( 5 );
        sliders[i]->color( FL_BACKGROUND2_COLOR );
        sliders[i]->selection_color( ( Fl_Color )1 );
        sliders[i]->maximum( 255 );
        sliders[i]->step( 1 );
        m_Group->add( sliders[i] );
    }
    sliders[0]->selection_color( ( Fl_Color )1 );
    sliders[1]->selection_color( ( Fl_Color )2 );
    sliders[2]->selection_color( ( Fl_Color )4 );
    AddX( sw + 2 );

    //==== Color Buttons ====//
    vector< Fl_Button* > cvec;
    int color_index = 0;
    for ( int i = 0 ; i < 4 ; i++ )
    {
        for ( int j = 0 ; j < 3 ; j++ )
        {
            Fl_Button* b = new Fl_Button( m_X + i * cw, m_Y + j * ch, cw, ch );
            vec3d rgb = picker.GetIndexRGB( color_index );
            Fl_Color c = fl_rgb_color( ( int )rgb[0], ( int )rgb[1], ( int )rgb[2] );
            b->color( c );
            m_Group->add( b );
            cvec.push_back( b );
            color_index++;
        }
    }
    AddX( 3 * cw );

    picker.Init( m_Screen, colorButton, primColorButton, cvec, sliders );

    AddY( m_StdHeight * 2 );
    NewLineX();
}