/*
    Copyright 2005-2007 Adobe Systems Incorporated
    Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
    or a copy at http://stlab.adobe.com/licenses.html)
*/

layout editor
{
    interface:
        source_tab_group : @adam;
        editor_tab_group : @sources;

    view dialog(name: "Editor", size: @size_small, placement: place_column,
                grow: true, horizontal: align_fill, vertical: align_fill)
    {
        tab_group(bind: @editor_tab_group, vertical: align_fill, horizontal: align_fill,
                  items: [
                      { name: "Sources", value: @sources },
                      { name: "Property Model", value: @model_inspector },
                      { name: "Layout Sheet", value: @layout_inspector },
                      { name: "Results", value: @results },
                      { name: "Errors", value: @errors }
                  ])
        {
            panel(bind: @editor_tab_group, value: @sources)
            {
                tab_group(bind: @source_tab_group, vertical: align_fill, horizontal: align_fill,
                          items: [
                              { name: "Adam", value: @adam },
                              { name: "Eve", value: @eve }
                          ])
                {
                    panel(bind: @source_tab_group, value: @adam)
                    {
                        edit_text(bind: @adam_source, characters: 50, lines: 10, scrollable: true,
                                  monospaced: true, horizontal: align_fill, vertical: align_fill);
        
                        row(vertical: align_bottom)
                        {
                            button(name: "Update", bind: @adam_source, action: @update_adam);
                            button(name: "Save", bind: @adam_source, action: @save_adam);
                        }
                    }
        
                    panel(bind: @source_tab_group, value: @eve)
                    {
                        edit_text(bind: @eve_source, characters: 50, lines: 10, scrollable: true,
                                  monospaced: true, horizontal: align_fill, vertical: align_fill);
        
                        row(vertical: align_bottom)
                        {
                            button(name: "Update", bind: @eve_source, action: @update_eve);
                            button(name: "Save", bind: @eve_source, action: @save_eve);
                        }
                    }
                }
            }

            panel(bind: @editor_tab_group, value: @model_inspector, child_horizontal: align_fill)
            {
                row(vertical: align_top, child_horizontal: align_fill)
                {
                    edit_text(name: "Expression:", bind: @pm_expression, characters: 10);

                    button(horizontal: align_right, vertical: align_bottom,
                           name: "Evaluate", bind: @result, action: @pm_evaluate);
                }

                row(vertical: align_top, child_horizontal: align_fill)
                {
                    edit_text(name: "...To Cell:", bind: @pm_to_cell, characters: 10);

                    button(horizontal: align_right, name: "Set", bind: @result, action: @pm_set);
                }

                column(vertical: align_fill, spacing: 5)
                {
                    static_text(name: "Results:");

                    edit_text(bind: @pm_results, lines: 10, characters: 1, scrollable: true,
                              monospaced: true, vertical: align_fill, horizontal: align_fill);
                }
            }

            panel(bind: @editor_tab_group, value: @layout_inspector, child_horizontal: align_fill)
            {
                static_text(name: "Note: You can only tweak the topmost dialog", characters: 1);

                row(vertical: align_top, child_horizontal: align_fill)
                {
                    edit_text(name: "Cell:", horizontal: align_fill, vertical: align_center, bind: @ls_to_cell, characters: 10);

                    button(horizontal: align_right, name: "Inspect", bind: @result, action: @ls_inspect);
                }

                row(vertical: align_top, child_horizontal: align_fill)
                {
                    edit_text(name: "Expression:", bind: @ls_expression, characters: 10);

                    button(horizontal: align_right, name: "Set", bind: @result, action: @ls_set);
                }

                column(vertical: align_fill, spacing: 5)
                {
                    static_text(name: "Results:");

                    edit_text(bind: @ls_results, lines: 10, characters: 1, scrollable: true,
                              monospaced: true, vertical: align_fill, horizontal: align_fill);
                }
            }

            panel(bind: @editor_tab_group, value: @results, child_horizontal: align_fill)
            {
                edit_text(bind: @results, characters: 50, lines: 10, scrollable: true,
                          monospaced: true, vertical: align_fill);
            }

            panel(bind: @editor_tab_group, value: @errors)
            {
                edit_text(bind: @errors, characters: 50, lines: 10, scrollable: true,
                          monospaced: true, horizontal: align_fill, vertical: align_fill);
            }
        }
    }
}
