diff options
Diffstat (limited to 'fluid/panels/widget_panel')
| -rw-r--r-- | fluid/panels/widget_panel/Grid_Child_Tab.cxx | 538 | ||||
| -rw-r--r-- | fluid/panels/widget_panel/Grid_Child_Tab.fl | 397 | ||||
| -rw-r--r-- | fluid/panels/widget_panel/Grid_Child_Tab.h | 79 | ||||
| -rw-r--r-- | fluid/panels/widget_panel/Grid_Tab.cxx | 778 | ||||
| -rw-r--r-- | fluid/panels/widget_panel/Grid_Tab.fl | 515 | ||||
| -rw-r--r-- | fluid/panels/widget_panel/Grid_Tab.h | 90 |
6 files changed, 2397 insertions, 0 deletions
diff --git a/fluid/panels/widget_panel/Grid_Child_Tab.cxx b/fluid/panels/widget_panel/Grid_Child_Tab.cxx new file mode 100644 index 000000000..b0f943803 --- /dev/null +++ b/fluid/panels/widget_panel/Grid_Child_Tab.cxx @@ -0,0 +1,538 @@ +// generated by Fast Light User Interface Designer (fluid) version 1.0500 + +#include "Grid_Child_Tab.h" +#include "Fluid.h" +#include "proj/undo.h" +#include "nodes/Grid_Node.h" +extern Grid_Child_Tab *widget_tab_grid_child; + +void Grid_Child_Tab::cb_widget_grid_row_input_i(fld::widget::Formula_Input* o, void* v) { + grid_child_cb(o, v, 8); + if (v!=LOAD) widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); +} +void Grid_Child_Tab::cb_widget_grid_row_input(fld::widget::Formula_Input* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()))->cb_widget_grid_row_input_i(o,v); +} + +void Grid_Child_Tab::cb__i(Fl_Button*, void* v) { + if (v!=LOAD) { + grid_child_cb(widget_grid_row_input, v, 0x0100 + 8); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + } +} +void Grid_Child_Tab::cb_(Fl_Button* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()->parent()))->cb__i(o,v); +} + +void Grid_Child_Tab::cb_1_i(Fl_Button*, void* v) { + if (v!=LOAD) { + grid_child_cb(widget_grid_row_input, v, 0x0200 + 8); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + } +} +void Grid_Child_Tab::cb_1(Fl_Button* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()->parent()))->cb_1_i(o,v); +} + +void Grid_Child_Tab::cb_widget_grid_col_input_i(fld::widget::Formula_Input* o, void* v) { + grid_child_cb(o, v, 9); + if (v!=LOAD) widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); +} +void Grid_Child_Tab::cb_widget_grid_col_input(fld::widget::Formula_Input* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()))->cb_widget_grid_col_input_i(o,v); +} + +void Grid_Child_Tab::cb_2_i(Fl_Button*, void* v) { + if (v!=LOAD) { + grid_child_cb(widget_grid_col_input, v, 0x0100 + 9); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + } +} +void Grid_Child_Tab::cb_2(Fl_Button* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()->parent()))->cb_2_i(o,v); +} + +void Grid_Child_Tab::cb_3_i(Fl_Button*, void* v) { + if (v!=LOAD) { + grid_child_cb(widget_grid_col_input, v, 0x0200 + 9); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + } +} +void Grid_Child_Tab::cb_3(Fl_Button* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()->parent()))->cb_3_i(o,v); +} + +void Grid_Child_Tab::cb_widget_grid_transient_i(Fl_Box* o, void* v) { + if (v==LOAD) { + Fl_Widget *child = ((Widget_Node*)current_widget)->o; + Fl_Grid_Proxy *g = ((Fl_Grid_Proxy*)((Widget_Node*)current_widget->parent)->o); + // Fl_Grid::Cell *cell = g->cell(child); + // Fl_Grid::Cell *tcell = g->transient_cell(child); + widget_grid_transient->hide(); + widget_grid_unlinked->hide(); + if (g->transient_cell(child)) { + widget_grid_transient->show(); + } else if (!g->cell(child)) { + widget_grid_unlinked->show(); + } + } +} +void Grid_Child_Tab::cb_widget_grid_transient(Fl_Box* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()))->cb_widget_grid_transient_i(o,v); +} + +void Grid_Child_Tab::cb_Horizontal_i(Fl_Choice* o, void* v) { + if ( !current_widget + || !current_widget->parent + || !current_widget->parent->is_a(Type::Grid)) + { + return; + } + int mask = (FL_GRID_LEFT | FL_GRID_RIGHT | FL_GRID_HORIZONTAL); + Fl_Grid *g = ((Fl_Grid*)((Widget_Node*)current_widget->parent)->o); + if (v == LOAD) { + int a = FL_GRID_FILL & mask; + Fl_Grid::Cell *cell = g->cell(current_widget->o); + if (cell) { + a = cell->align() & mask; + } + const Fl_Menu_Item *mi = o->find_item_with_argument(a); + if (mi) o->value(mi); + } else { + Fluid.proj.undo.checkpoint(); + int v = FL_GRID_FILL & mask, old_v = FL_GRID_FILL & mask; + const Fl_Menu_Item *mi = o->mvalue(); + if (mi) v = (int)mi->argument(); + Fl_Grid::Cell *cell = g->cell(current_widget->o); + if (cell) { + old_v = cell->align() & mask; + if (old_v != v) { + cell->align((Fl_Grid_Align)(v | (cell->align() & ~mask))); + g->need_layout(true); + g->redraw(); + Fluid.proj.set_modflag(1); + } + } + } +} +void Grid_Child_Tab::cb_Horizontal(Fl_Choice* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()))->cb_Horizontal_i(o,v); +} + +Fl_Menu_Item Grid_Child_Tab::menu_Horizontal[] = { + {"GRID_LEFT", 0, 0, (void*)((fl_intptr_t)FL_GRID_LEFT), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, + {"GRID_CENTER", 0, 0, (void*)((fl_intptr_t)FL_GRID_CENTER), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, + {"GRID_RIGHT", 0, 0, (void*)((fl_intptr_t)FL_GRID_RIGHT), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, + {"GRID_FILL", 0, 0, (void*)((fl_intptr_t)FL_GRID_HORIZONTAL), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, + {0,0,0,0,0,0,0,0,0} +}; +Fl_Menu_Item* Grid_Child_Tab::GRID_LEFT = Grid_Child_Tab::menu_Horizontal + 0; + +void Grid_Child_Tab::cb_Vertical_i(Fl_Choice* o, void* v) { + if ( !current_widget + || !current_widget->parent + || !current_widget->parent->is_a(Type::Grid)) + { + return; + } + int mask = (FL_GRID_TOP | FL_GRID_BOTTOM | FL_GRID_VERTICAL); + Fl_Grid *g = ((Fl_Grid*)((Widget_Node*)current_widget->parent)->o); + if (v == LOAD) { + int a = FL_GRID_FILL & mask; + Fl_Grid::Cell *cell = g->cell(current_widget->o); + if (cell) { + a = cell->align() & mask; + } + const Fl_Menu_Item *mi = o->find_item_with_argument(a); + if (mi) o->value(mi); + } else { + Fluid.proj.undo.checkpoint(); + int v = FL_GRID_FILL & mask, old_v = FL_GRID_FILL & mask; + const Fl_Menu_Item *mi = o->mvalue(); + if (mi) v = (int)mi->argument(); + Fl_Grid::Cell *cell = g->cell(current_widget->o); + if (cell) { + old_v = cell->align() & mask; + if (old_v != v) { + cell->align((Fl_Grid_Align)(v | (cell->align() & ~mask))); + g->need_layout(true); + g->redraw(); + Fluid.proj.set_modflag(1); + } + } + } +} +void Grid_Child_Tab::cb_Vertical(Fl_Choice* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()))->cb_Vertical_i(o,v); +} + +Fl_Menu_Item Grid_Child_Tab::menu_Vertical[] = { + {"GRID_TOP", 0, 0, (void*)((fl_intptr_t)FL_GRID_TOP), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, + {"GRID_CENTER", 0, 0, (void*)((fl_intptr_t)FL_GRID_CENTER), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, + {"GRID_BOTTOM", 0, 0, (void*)((fl_intptr_t)FL_GRID_BOTTOM), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, + {"GRID_FILL", 0, 0, (void*)((fl_intptr_t)FL_GRID_VERTICAL), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, + {0,0,0,0,0,0,0,0,0} +}; + +void Grid_Child_Tab::cb_Width_i(fld::widget::Formula_Input* o, void* v) { + grid_child_cb(o, v, 12); +} +void Grid_Child_Tab::cb_Width(fld::widget::Formula_Input* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()))->cb_Width_i(o,v); +} + +void Grid_Child_Tab::cb_Height_i(fld::widget::Formula_Input* o, void* v) { + grid_child_cb(o, v, 13); +} +void Grid_Child_Tab::cb_Height(fld::widget::Formula_Input* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()))->cb_Height_i(o,v); +} + +void Grid_Child_Tab::cb_widget_grid_rowspan_input_i(fld::widget::Formula_Input* o, void* v) { + grid_child_cb(o, v, 10); + if (v!=LOAD) widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); +} +void Grid_Child_Tab::cb_widget_grid_rowspan_input(fld::widget::Formula_Input* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()))->cb_widget_grid_rowspan_input_i(o,v); +} + +void Grid_Child_Tab::cb_4_i(Fl_Button*, void* v) { + if (v!=LOAD) { + grid_child_cb(widget_grid_rowspan_input, v, 0x0100 + 10); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + } +} +void Grid_Child_Tab::cb_4(Fl_Button* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()->parent()))->cb_4_i(o,v); +} + +void Grid_Child_Tab::cb_5_i(Fl_Button*, void* v) { + if (v!=LOAD) { + grid_child_cb(widget_grid_rowspan_input, v, 0x0200 + 10); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + } +} +void Grid_Child_Tab::cb_5(Fl_Button* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()->parent()))->cb_5_i(o,v); +} + +void Grid_Child_Tab::cb_widget_grid_colspan_input_i(fld::widget::Formula_Input* o, void* v) { + grid_child_cb(o, v, 11); + if (v!=LOAD) widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); +} +void Grid_Child_Tab::cb_widget_grid_colspan_input(fld::widget::Formula_Input* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()))->cb_widget_grid_colspan_input_i(o,v); +} + +void Grid_Child_Tab::cb_6_i(Fl_Button*, void* v) { + if (v!=LOAD) { + grid_child_cb(widget_grid_colspan_input, v, 0x0100 + 11); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + } +} +void Grid_Child_Tab::cb_6(Fl_Button* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()->parent()))->cb_6_i(o,v); +} + +void Grid_Child_Tab::cb_7_i(Fl_Button*, void* v) { + if (v!=LOAD) { + grid_child_cb(widget_grid_colspan_input, v, 0x0200 + 11); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + } +} +void Grid_Child_Tab::cb_7(Fl_Button* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()->parent()))->cb_7_i(o,v); +} + +Grid_Child_Tab::Grid_Child_Tab(int X, int Y, int W, int H, const char *L) : + Fl_Group(0, 0, 400, 330, L) +{ + this->labelsize(11); + this->callback((Fl_Callback*)propagate_load); + { Fl_Group* o = new Fl_Group(85, 30, 315, 20, "Location:"); + o->box(FL_FLAT_BOX); + o->labelfont(1); + o->labelsize(11); + o->callback((Fl_Callback*)propagate_load); + o->align(Fl_Align(FL_ALIGN_LEFT)); + { widget_grid_row_input = new fld::widget::Formula_Input(85, 30, 40, 20, "Row:"); + widget_grid_row_input->box(FL_DOWN_BOX); + widget_grid_row_input->color(FL_BACKGROUND2_COLOR); + widget_grid_row_input->selection_color(FL_SELECTION_COLOR); + widget_grid_row_input->labeltype(FL_NORMAL_LABEL); + widget_grid_row_input->labelfont(0); + widget_grid_row_input->labelsize(11); + widget_grid_row_input->labelcolor(FL_FOREGROUND_COLOR); + widget_grid_row_input->textsize(11); + widget_grid_row_input->callback((Fl_Callback*)cb_widget_grid_row_input); + widget_grid_row_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + widget_grid_row_input->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* widget_grid_row_input + { Fl_Group* o = new Fl_Group(125, 30, 30, 20); + { Fl_Button* o = new Fl_Button(125, 30, 15, 20, "-"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_); + o->clear_visible_focus(); + } // Fl_Button* o + { Fl_Button* o = new Fl_Button(140, 30, 15, 20, "+"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_1); + o->clear_visible_focus(); + } // Fl_Button* o + o->end(); + } // Fl_Group* o + { widget_grid_col_input = new fld::widget::Formula_Input(165, 30, 40, 20, "Column:"); + widget_grid_col_input->box(FL_DOWN_BOX); + widget_grid_col_input->color(FL_BACKGROUND2_COLOR); + widget_grid_col_input->selection_color(FL_SELECTION_COLOR); + widget_grid_col_input->labeltype(FL_NORMAL_LABEL); + widget_grid_col_input->labelfont(0); + widget_grid_col_input->labelsize(11); + widget_grid_col_input->labelcolor(FL_FOREGROUND_COLOR); + widget_grid_col_input->textsize(11); + widget_grid_col_input->callback((Fl_Callback*)cb_widget_grid_col_input); + widget_grid_col_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + widget_grid_col_input->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* widget_grid_col_input + { Fl_Group* o = new Fl_Group(205, 30, 30, 20); + { Fl_Button* o = new Fl_Button(205, 30, 15, 20, "-"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_2); + o->clear_visible_focus(); + } // Fl_Button* o + { Fl_Button* o = new Fl_Button(220, 30, 15, 20, "+"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_3); + o->clear_visible_focus(); + } // Fl_Button* o + o->end(); + } // Fl_Group* o + { Fl_Box* o = new Fl_Box(385, 30, 1, 20); + o->hide(); + Fl_Group::current()->resizable(o); + } // Fl_Box* o + { widget_grid_transient = new Fl_Box(240, 30, 80, 20, "TRANSIENT"); + widget_grid_transient->labelsize(11); + widget_grid_transient->labelcolor((Fl_Color)1); + widget_grid_transient->callback((Fl_Callback*)cb_widget_grid_transient); + } // Fl_Box* widget_grid_transient + { widget_grid_unlinked = new Fl_Box(240, 30, 80, 20, "UNLINKED"); + widget_grid_unlinked->labelsize(11); + widget_grid_unlinked->labelcolor((Fl_Color)1); + widget_grid_unlinked->hide(); + } // Fl_Box* widget_grid_unlinked + o->end(); + } // Fl_Group* o + { wp_gridc_align = new Fl_Group(85, 70, 315, 20, "Align:"); + wp_gridc_align->labelfont(1); + wp_gridc_align->labelsize(11); + wp_gridc_align->callback((Fl_Callback*)propagate_load); + wp_gridc_align->align(Fl_Align(FL_ALIGN_LEFT)); + { Fl_Choice* o = new Fl_Choice(85, 70, 115, 20, "Horizontal"); + o->down_box(FL_BORDER_BOX); + o->labelsize(11); + o->textsize(11); + o->callback((Fl_Callback*)cb_Horizontal); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + o->menu(menu_Horizontal); + } // Fl_Choice* o + { Fl_Choice* o = new Fl_Choice(205, 70, 115, 20, "Vertical"); + o->down_box(FL_BORDER_BOX); + o->labelsize(11); + o->textsize(11); + o->callback((Fl_Callback*)cb_Vertical); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + o->menu(menu_Vertical); + } // Fl_Choice* o + { Fl_Box* o = new Fl_Box(385, 70, 1, 20); + o->hide(); + Fl_Group::current()->resizable(o); + } // Fl_Box* o + wp_gridc_align->end(); + } // Fl_Group* wp_gridc_align + { wp_gridc_size = new Fl_Group(85, 105, 315, 20, "Min. Size:"); + wp_gridc_size->labelfont(1); + wp_gridc_size->labelsize(11); + wp_gridc_size->callback((Fl_Callback*)propagate_load); + wp_gridc_size->align(Fl_Align(FL_ALIGN_LEFT)); + { fld::widget::Formula_Input* o = new fld::widget::Formula_Input(85, 105, 55, 20, "Width:"); + o->box(FL_DOWN_BOX); + o->color(FL_BACKGROUND2_COLOR); + o->selection_color(FL_SELECTION_COLOR); + o->labeltype(FL_NORMAL_LABEL); + o->labelfont(0); + o->labelsize(11); + o->labelcolor(FL_FOREGROUND_COLOR); + o->textsize(11); + o->callback((Fl_Callback*)cb_Width); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + o->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* o + { fld::widget::Formula_Input* o = new fld::widget::Formula_Input(145, 105, 55, 20, "Height:"); + o->box(FL_DOWN_BOX); + o->color(FL_BACKGROUND2_COLOR); + o->selection_color(FL_SELECTION_COLOR); + o->labeltype(FL_NORMAL_LABEL); + o->labelfont(0); + o->labelsize(11); + o->labelcolor(FL_FOREGROUND_COLOR); + o->textsize(11); + o->callback((Fl_Callback*)cb_Height); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + o->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* o + { Fl_Box* o = new Fl_Box(385, 105, 1, 20); + o->hide(); + Fl_Group::current()->resizable(o); + } // Fl_Box* o + wp_gridc_size->end(); + } // Fl_Group* wp_gridc_size + { Fl_Group* o = new Fl_Group(85, 140, 315, 20, "Span:"); + o->labelfont(1); + o->labelsize(11); + o->callback((Fl_Callback*)propagate_load); + o->align(Fl_Align(FL_ALIGN_LEFT)); + { widget_grid_rowspan_input = new fld::widget::Formula_Input(85, 140, 40, 20, "Row Span:"); + widget_grid_rowspan_input->box(FL_DOWN_BOX); + widget_grid_rowspan_input->color(FL_BACKGROUND2_COLOR); + widget_grid_rowspan_input->selection_color(FL_SELECTION_COLOR); + widget_grid_rowspan_input->labeltype(FL_NORMAL_LABEL); + widget_grid_rowspan_input->labelfont(0); + widget_grid_rowspan_input->labelsize(11); + widget_grid_rowspan_input->labelcolor(FL_FOREGROUND_COLOR); + widget_grid_rowspan_input->textsize(11); + widget_grid_rowspan_input->callback((Fl_Callback*)cb_widget_grid_rowspan_input); + widget_grid_rowspan_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + widget_grid_rowspan_input->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* widget_grid_rowspan_input + { Fl_Group* o = new Fl_Group(125, 140, 30, 20); + { Fl_Button* o = new Fl_Button(125, 140, 15, 20, "-"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_4); + o->clear_visible_focus(); + } // Fl_Button* o + { Fl_Button* o = new Fl_Button(140, 140, 15, 20, "+"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_5); + o->clear_visible_focus(); + } // Fl_Button* o + o->end(); + } // Fl_Group* o + { widget_grid_colspan_input = new fld::widget::Formula_Input(165, 140, 40, 20, "Col. Span:"); + widget_grid_colspan_input->box(FL_DOWN_BOX); + widget_grid_colspan_input->color(FL_BACKGROUND2_COLOR); + widget_grid_colspan_input->selection_color(FL_SELECTION_COLOR); + widget_grid_colspan_input->labeltype(FL_NORMAL_LABEL); + widget_grid_colspan_input->labelfont(0); + widget_grid_colspan_input->labelsize(11); + widget_grid_colspan_input->labelcolor(FL_FOREGROUND_COLOR); + widget_grid_colspan_input->textsize(11); + widget_grid_colspan_input->callback((Fl_Callback*)cb_widget_grid_colspan_input); + widget_grid_colspan_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + widget_grid_colspan_input->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* widget_grid_colspan_input + { Fl_Group* o = new Fl_Group(205, 140, 30, 20); + { Fl_Button* o = new Fl_Button(205, 140, 15, 20, "-"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_6); + o->clear_visible_focus(); + } // Fl_Button* o + { Fl_Button* o = new Fl_Button(220, 140, 15, 20, "+"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_7); + o->clear_visible_focus(); + } // Fl_Button* o + o->end(); + } // Fl_Group* o + { Fl_Box* o = new Fl_Box(385, 140, 1, 20); + o->hide(); + Fl_Group::current()->resizable(o); + } // Fl_Box* o + o->end(); + } // Fl_Group* o + { Fl_Box* o = new Fl_Box(85, 320, 300, 5); + o->labelsize(11); + o->hide(); + Fl_Group::current()->resizable(o); + } // Fl_Box* o + end(); + resize(X, Y, W, H); +} + +void Grid_Child_Tab::grid_child_cb(fld::widget::Formula_Input* i, void* v, int what) { + if ( !current_widget + || !current_widget->parent + || !current_widget->parent->is_a(Type::Grid)) + { + return; + } + Fl_Widget *child = ((Widget_Node*)current_widget)->o; + Fl_Grid_Proxy *g = ((Fl_Grid_Proxy*)((Widget_Node*)current_widget->parent)->o); + Fl_Grid::Cell *cell = g->any_cell(child); + if (v == LOAD) { + int v = -1; + if (cell) { + switch (what & 0x00ff) { + case 8: v = cell->row(); break; + case 9: v = cell->col(); break; + case 10: v = cell->rowspan(); break; + case 11: v = cell->colspan(); break; + case 12: cell->minimum_size(&v, nullptr); break; + case 13: cell->minimum_size(nullptr, &v); break; + } + } + i->value(v); + } else { + Fluid.proj.undo.checkpoint(); + int v2 = -2, old_v = -2, v = i->value(); + if (i==widget_grid_row_input) v2 = widget_grid_col_input->value(); + if (i==widget_grid_col_input) v2 = widget_grid_row_input->value(); + Fl_Grid::Cell *new_cell = nullptr; + if (cell) { + switch (what & 0x00ff) { + case 8: old_v = cell->row(); v2 = cell->col(); break; + case 9: old_v = cell->col(); v2 = cell->row(); break; + case 10: old_v = cell->rowspan(); break; + case 11: old_v = cell->colspan(); break; + case 12: cell->minimum_size(&old_v, &v2); break; + case 13: cell->minimum_size(&v2, &old_v); break; + } + } + switch (what & 0xff00) { + case 0x0100: v--; break; + case 0x0200: v++; break; + } + if (old_v != v) { + switch (what & 0x00ff) { + case 8: + if (v2 == -1 && v >= 0) v2 = 0; + g->move_cell(current_widget->o, v, v2, 2); i->value(v); + break; + case 9: + if (v2 == -1 && v >= 0) v2 = 0; + g->move_cell(current_widget->o, v2, v, 2); i->value(v); + break; + case 10: if (cell && cell->row()+v<=g->rows() && v>0) cell->rowspan(v); + break; + case 11: if (cell && cell->col()+v<=g->cols() && v>0) cell->colspan(v); + break; + case 12: if (cell && v>=0) cell->minimum_size(v, v2); + break; + case 13: if (cell && v>=0) cell->minimum_size(v2, v); + break; + } + if (!cell && new_cell) + new_cell->minimum_size(20, 20); + g->need_layout(true); + Fluid.proj.set_modflag(1); + } + } +} diff --git a/fluid/panels/widget_panel/Grid_Child_Tab.fl b/fluid/panels/widget_panel/Grid_Child_Tab.fl new file mode 100644 index 000000000..161eab696 --- /dev/null +++ b/fluid/panels/widget_panel/Grid_Child_Tab.fl @@ -0,0 +1,397 @@ +# data file for the Fltk User Interface Designer (fluid) +version 1.0500 +header_name {.h} +code_name {.cxx} +decl {\#include "widgets/Formula_Input.h"} {public global +} + +decl {\#include "Fluid.h"} {private global +} + +decl {\#include "proj/undo.h"} {private global +} + +decl {\#include "nodes/Grid_Node.h"} {private global +} + +decl {extern Grid_Child_Tab *widget_tab_grid_child;} {private global +} + +widget_class Grid_Child_Tab { + label Grid + callback propagate_load open + xywh {480 287 400 330} labelsize 11 resizable visible position_relative_rescale +} { + Fl_Group {} { + label {Location:} + callback propagate_load open + xywh {85 30 315 20} box FLAT_BOX labelfont 1 labelsize 11 align 4 + } { + Fl_Input widget_grid_row_input { + label {Row:} + callback {grid_child_cb(o, v, 8); + if (v!=LOAD) widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD);} + xywh {85 30 40 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Group {} {open + xywh {125 30 30 20} + } { + Fl_Button {} { + label {-} + callback {if (v!=LOAD) { + grid_child_cb(widget_grid_row_input, v, 0x0100 + 8); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + }} + xywh {125 30 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + Fl_Button {} { + label {+} + callback {if (v!=LOAD) { + grid_child_cb(widget_grid_row_input, v, 0x0200 + 8); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + }} + xywh {140 30 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + } + Fl_Input widget_grid_col_input { + label {Column:} + callback {grid_child_cb(o, v, 9); + if (v!=LOAD) widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD);} + xywh {165 30 40 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Group {} {open + xywh {205 30 30 20} + } { + Fl_Button {} { + label {-} + callback {if (v!=LOAD) { + grid_child_cb(widget_grid_col_input, v, 0x0100 + 9); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + }} + xywh {205 30 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + Fl_Button {} { + label {+} + callback {if (v!=LOAD) { + grid_child_cb(widget_grid_col_input, v, 0x0200 + 9); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + }} + xywh {220 30 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + } + Fl_Box {} { + xywh {385 30 1 20} hide resizable + } + Fl_Box widget_grid_transient { + label TRANSIENT + callback {if (v==LOAD) { + Fl_Widget *child = ((Widget_Node*)current_widget)->o; + Fl_Grid_Proxy *g = ((Fl_Grid_Proxy*)((Widget_Node*)current_widget->parent)->o); +// Fl_Grid::Cell *cell = g->cell(child); +// Fl_Grid::Cell *tcell = g->transient_cell(child); + widget_grid_transient->hide(); + widget_grid_unlinked->hide(); + if (g->transient_cell(child)) { + widget_grid_transient->show(); + } else if (!g->cell(child)) { + widget_grid_unlinked->show(); + } +}} + xywh {240 30 80 20} labelsize 11 labelcolor 1 + } + Fl_Box widget_grid_unlinked { + label UNLINKED + xywh {240 30 80 20} labelsize 11 labelcolor 1 hide + } + } + Fl_Group wp_gridc_align { + label {Align:} + callback propagate_load + xywh {85 70 315 20} labelfont 1 labelsize 11 align 4 + } { + Fl_Choice {} { + label Horizontal + callback {if ( !current_widget + || !current_widget->parent + || !current_widget->parent->is_a(Type::Grid)) + { + return; + } + int mask = (FL_GRID_LEFT | FL_GRID_RIGHT | FL_GRID_HORIZONTAL); + Fl_Grid *g = ((Fl_Grid*)((Widget_Node*)current_widget->parent)->o); + if (v == LOAD) { + int a = FL_GRID_FILL & mask; + Fl_Grid::Cell *cell = g->cell(current_widget->o); + if (cell) { + a = cell->align() & mask; + } + const Fl_Menu_Item *mi = o->find_item_with_argument(a); + if (mi) o->value(mi); + } else { + Fluid.proj.undo.checkpoint(); + int v = FL_GRID_FILL & mask, old_v = FL_GRID_FILL & mask; + const Fl_Menu_Item *mi = o->mvalue(); + if (mi) v = (int)mi->argument(); + Fl_Grid::Cell *cell = g->cell(current_widget->o); + if (cell) { + old_v = cell->align() & mask; + if (old_v != v) { + cell->align((Fl_Grid_Align)(v | (cell->align() & ~mask))); + g->need_layout(true); + g->redraw(); + Fluid.proj.set_modflag(1); + } + } + }} open + xywh {85 70 115 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11 + } { + MenuItem GRID_LEFT { + label GRID_LEFT + user_data {(fl_intptr_t)FL_GRID_LEFT} user_data_type long + xywh {20 20 31 20} labelsize 11 + } + MenuItem {} { + label GRID_CENTER + user_data {(fl_intptr_t)FL_GRID_CENTER} user_data_type long + xywh {20 20 31 20} labelsize 11 + } + MenuItem {} { + label GRID_RIGHT + user_data {(fl_intptr_t)FL_GRID_RIGHT} user_data_type long + xywh {20 20 31 20} labelsize 11 + } + MenuItem {} { + label GRID_FILL + user_data {(fl_intptr_t)FL_GRID_HORIZONTAL} user_data_type long + xywh {20 20 31 20} labelsize 11 + } + } + Fl_Choice {} { + label Vertical + callback {if ( !current_widget + || !current_widget->parent + || !current_widget->parent->is_a(Type::Grid)) + { + return; + } + int mask = (FL_GRID_TOP | FL_GRID_BOTTOM | FL_GRID_VERTICAL); + Fl_Grid *g = ((Fl_Grid*)((Widget_Node*)current_widget->parent)->o); + if (v == LOAD) { + int a = FL_GRID_FILL & mask; + Fl_Grid::Cell *cell = g->cell(current_widget->o); + if (cell) { + a = cell->align() & mask; + } + const Fl_Menu_Item *mi = o->find_item_with_argument(a); + if (mi) o->value(mi); + } else { + Fluid.proj.undo.checkpoint(); + int v = FL_GRID_FILL & mask, old_v = FL_GRID_FILL & mask; + const Fl_Menu_Item *mi = o->mvalue(); + if (mi) v = (int)mi->argument(); + Fl_Grid::Cell *cell = g->cell(current_widget->o); + if (cell) { + old_v = cell->align() & mask; + if (old_v != v) { + cell->align((Fl_Grid_Align)(v | (cell->align() & ~mask))); + g->need_layout(true); + g->redraw(); + Fluid.proj.set_modflag(1); + } + } + }} open selected + xywh {205 70 115 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11 + } { + MenuItem {} { + label GRID_TOP + user_data {(fl_intptr_t)FL_GRID_TOP} user_data_type long + xywh {20 20 31 20} labelsize 11 + } + MenuItem {} { + label GRID_CENTER + user_data {(fl_intptr_t)FL_GRID_CENTER} user_data_type long + xywh {20 20 31 20} labelsize 11 + } + MenuItem {} { + label GRID_BOTTOM + user_data {(fl_intptr_t)FL_GRID_BOTTOM} user_data_type long + xywh {20 20 31 20} labelsize 11 + } + MenuItem {} { + label GRID_FILL + user_data {(fl_intptr_t)FL_GRID_VERTICAL} user_data_type long + xywh {20 20 31 20} labelsize 11 + } + } + Fl_Box {} { + xywh {385 70 1 20} hide resizable + } + } + Fl_Group wp_gridc_size { + label {Min. Size:} + callback propagate_load + xywh {85 105 315 20} labelfont 1 labelsize 11 align 4 + } { + Fl_Input {} { + label {Width:} + callback {grid_child_cb(o, v, 12);} + xywh {85 105 55 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Input {} { + label {Height:} + callback {grid_child_cb(o, v, 13);} + xywh {145 105 55 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Box {} { + xywh {385 105 1 20} hide resizable + } + } + Fl_Group {} { + label {Span:} + callback propagate_load + xywh {85 140 315 20} labelfont 1 labelsize 11 align 4 + } { + Fl_Input widget_grid_rowspan_input { + label {Row Span:} + callback {grid_child_cb(o, v, 10); + if (v!=LOAD) widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD);} + xywh {85 140 40 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Group {} {open + xywh {125 140 30 20} + } { + Fl_Button {} { + label {-} + callback {if (v!=LOAD) { + grid_child_cb(widget_grid_rowspan_input, v, 0x0100 + 10); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + }} + xywh {125 140 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + Fl_Button {} { + label {+} + callback {if (v!=LOAD) { + grid_child_cb(widget_grid_rowspan_input, v, 0x0200 + 10); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + }} + xywh {140 140 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + } + Fl_Input widget_grid_colspan_input { + label {Col. Span:} + callback {grid_child_cb(o, v, 11); + if (v!=LOAD) widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD);} + xywh {165 140 40 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Group {} {open + xywh {205 140 30 20} + } { + Fl_Button {} { + label {-} + callback {if (v!=LOAD) { + grid_child_cb(widget_grid_colspan_input, v, 0x0100 + 11); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + }} + xywh {205 140 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + Fl_Button {} { + label {+} + callback {if (v!=LOAD) { + grid_child_cb(widget_grid_colspan_input, v, 0x0200 + 11); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + }} + xywh {220 140 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + } + Fl_Box {} { + xywh {385 140 1 20} hide resizable + } + } + Fl_Box {} { + xywh {85 320 300 5} labelsize 11 hide resizable + } + Function {grid_child_cb(fld::widget::Formula_Input* i, void* v, int what)} {open return_type void + } { + code {if ( !current_widget + || !current_widget->parent + || !current_widget->parent->is_a(Type::Grid)) + { + return; + } + Fl_Widget *child = ((Widget_Node*)current_widget)->o; + Fl_Grid_Proxy *g = ((Fl_Grid_Proxy*)((Widget_Node*)current_widget->parent)->o); + Fl_Grid::Cell *cell = g->any_cell(child); + if (v == LOAD) { + int v = -1; + if (cell) { + switch (what & 0x00ff) { + case 8: v = cell->row(); break; + case 9: v = cell->col(); break; + case 10: v = cell->rowspan(); break; + case 11: v = cell->colspan(); break; + case 12: cell->minimum_size(&v, nullptr); break; + case 13: cell->minimum_size(nullptr, &v); break; + } + } + i->value(v); + } else { + Fluid.proj.undo.checkpoint(); + int v2 = -2, old_v = -2, v = i->value(); + if (i==widget_grid_row_input) v2 = widget_grid_col_input->value(); + if (i==widget_grid_col_input) v2 = widget_grid_row_input->value(); + Fl_Grid::Cell *new_cell = nullptr; + if (cell) { + switch (what & 0x00ff) { + case 8: old_v = cell->row(); v2 = cell->col(); break; + case 9: old_v = cell->col(); v2 = cell->row(); break; + case 10: old_v = cell->rowspan(); break; + case 11: old_v = cell->colspan(); break; + case 12: cell->minimum_size(&old_v, &v2); break; + case 13: cell->minimum_size(&v2, &old_v); break; + } + } + switch (what & 0xff00) { + case 0x0100: v--; break; + case 0x0200: v++; break; + } + if (old_v != v) { + switch (what & 0x00ff) { + case 8: + if (v2 == -1 && v >= 0) v2 = 0; + g->move_cell(current_widget->o, v, v2, 2); i->value(v); + break; + case 9: + if (v2 == -1 && v >= 0) v2 = 0; + g->move_cell(current_widget->o, v2, v, 2); i->value(v); + break; + case 10: if (cell && cell->row()+v<=g->rows() && v>0) cell->rowspan(v); + break; + case 11: if (cell && cell->col()+v<=g->cols() && v>0) cell->colspan(v); + break; + case 12: if (cell && v>=0) cell->minimum_size(v, v2); + break; + case 13: if (cell && v>=0) cell->minimum_size(v2, v); + break; + } + if (!cell && new_cell) + new_cell->minimum_size(20, 20); + g->need_layout(true); + Fluid.proj.set_modflag(1); + } + }} {} + } +} diff --git a/fluid/panels/widget_panel/Grid_Child_Tab.h b/fluid/panels/widget_panel/Grid_Child_Tab.h new file mode 100644 index 000000000..93cfda78b --- /dev/null +++ b/fluid/panels/widget_panel/Grid_Child_Tab.h @@ -0,0 +1,79 @@ +// generated by Fast Light User Interface Designer (fluid) version 1.0500 + +#ifndef Grid_Child_Tab_h +#define Grid_Child_Tab_h +#include <FL/Fl.H> +#include "widgets/Formula_Input.h" +#include <FL/Fl_Group.H> +extern void propagate_load(Fl_Group*, void*); +#include <FL/Fl_Button.H> +#include <FL/Fl_Box.H> +#include <FL/Fl_Choice.H> + +class Grid_Child_Tab : public Fl_Group { +public: + Grid_Child_Tab(int X, int Y, int W, int H, const char *L = 0); + fld::widget::Formula_Input *widget_grid_row_input; +private: + inline void cb_widget_grid_row_input_i(fld::widget::Formula_Input*, void*); + static void cb_widget_grid_row_input(fld::widget::Formula_Input*, void*); + inline void cb__i(Fl_Button*, void*); + static void cb_(Fl_Button*, void*); + inline void cb_1_i(Fl_Button*, void*); + static void cb_1(Fl_Button*, void*); +public: + fld::widget::Formula_Input *widget_grid_col_input; +private: + inline void cb_widget_grid_col_input_i(fld::widget::Formula_Input*, void*); + static void cb_widget_grid_col_input(fld::widget::Formula_Input*, void*); + inline void cb_2_i(Fl_Button*, void*); + static void cb_2(Fl_Button*, void*); + inline void cb_3_i(Fl_Button*, void*); + static void cb_3(Fl_Button*, void*); +public: + Fl_Box *widget_grid_transient; +private: + inline void cb_widget_grid_transient_i(Fl_Box*, void*); + static void cb_widget_grid_transient(Fl_Box*, void*); +public: + Fl_Box *widget_grid_unlinked; + Fl_Group *wp_gridc_align; +private: + inline void cb_Horizontal_i(Fl_Choice*, void*); + static void cb_Horizontal(Fl_Choice*, void*); + static Fl_Menu_Item menu_Horizontal[]; +public: + static Fl_Menu_Item *GRID_LEFT; +private: + inline void cb_Vertical_i(Fl_Choice*, void*); + static void cb_Vertical(Fl_Choice*, void*); + static Fl_Menu_Item menu_Vertical[]; +public: + Fl_Group *wp_gridc_size; +private: + inline void cb_Width_i(fld::widget::Formula_Input*, void*); + static void cb_Width(fld::widget::Formula_Input*, void*); + inline void cb_Height_i(fld::widget::Formula_Input*, void*); + static void cb_Height(fld::widget::Formula_Input*, void*); +public: + fld::widget::Formula_Input *widget_grid_rowspan_input; +private: + inline void cb_widget_grid_rowspan_input_i(fld::widget::Formula_Input*, void*); + static void cb_widget_grid_rowspan_input(fld::widget::Formula_Input*, void*); + inline void cb_4_i(Fl_Button*, void*); + static void cb_4(Fl_Button*, void*); + inline void cb_5_i(Fl_Button*, void*); + static void cb_5(Fl_Button*, void*); +public: + fld::widget::Formula_Input *widget_grid_colspan_input; +private: + inline void cb_widget_grid_colspan_input_i(fld::widget::Formula_Input*, void*); + static void cb_widget_grid_colspan_input(fld::widget::Formula_Input*, void*); + inline void cb_6_i(Fl_Button*, void*); + static void cb_6(Fl_Button*, void*); + inline void cb_7_i(Fl_Button*, void*); + static void cb_7(Fl_Button*, void*); +public: + void grid_child_cb(fld::widget::Formula_Input* i, void* v, int what); +}; +#endif diff --git a/fluid/panels/widget_panel/Grid_Tab.cxx b/fluid/panels/widget_panel/Grid_Tab.cxx new file mode 100644 index 000000000..756d957ac --- /dev/null +++ b/fluid/panels/widget_panel/Grid_Tab.cxx @@ -0,0 +1,778 @@ +// generated by Fast Light User Interface Designer (fluid) version 1.0500 + +#include "Grid_Tab.h" +#include "Fluid.h" +#include "proj/undo.h" +#include "nodes/Grid_Node.h" +extern Grid_Tab *widget_tab_grid; + +void Grid_Tab::cb_widget_grid_rows_i(fld::widget::Formula_Input* o, void* v) { + // grid_rows_cb + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + if (v == LOAD) { + o->value(grid->rows()); + } else { + int m = o->value(), old_m = grid->rows(); + if (m < 1) { + m = 1; + o->value(m); + } + if (m < old_m) { + // TODO: verify that this will not unlink existings cells + // Offer a dialog with "delete children", "unlink cells", "cancel" + } + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->layout(m, grid->cols()); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + widget_tab_grid->do_callback(widget_tab_grid, LOAD); + } + } +} +void Grid_Tab::cb_widget_grid_rows(fld::widget::Formula_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()))->cb_widget_grid_rows_i(o,v); +} + +void Grid_Tab::cb__i(Fl_Button*, void* v) { + if (v != LOAD) { + widget_grid_rows->value( widget_grid_rows->value()-1 ); + widget_grid_rows->do_callback(); + } +} +void Grid_Tab::cb_(Fl_Button* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb__i(o,v); +} + +void Grid_Tab::cb_1_i(Fl_Button*, void* v) { + if (v != LOAD) { + widget_grid_rows->value( widget_grid_rows->value()+1 ); + widget_grid_rows->do_callback(); + } +} +void Grid_Tab::cb_1(Fl_Button* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb_1_i(o,v); +} + +void Grid_Tab::cb_widget_grid_cols_i(fld::widget::Formula_Input* o, void* v) { + // grid_rows_cb + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + if (v == LOAD) { + o->value(grid->cols()); + } else { + int m = o->value(), old_m = grid->cols(); + if (m < 1) { + m = 1; + o->value(m); + } + if (m < old_m) { + // TODO: verify that this will not unlink existings cells + // Offer a dialog with "delete children", "unlink cells", "cancel" + } + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->layout(grid->rows(), m); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + widget_tab_grid->do_callback(widget_tab_grid, LOAD); + } + } +} +void Grid_Tab::cb_widget_grid_cols(fld::widget::Formula_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()))->cb_widget_grid_cols_i(o,v); +} + +void Grid_Tab::cb_2_i(Fl_Button*, void* v) { + if (v != LOAD) { + widget_grid_cols->value( widget_grid_cols->value()-1 ); + widget_grid_cols->do_callback(); + } +} +void Grid_Tab::cb_2(Fl_Button* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb_2_i(o,v); +} + +void Grid_Tab::cb_3_i(Fl_Button*, void* v) { + if (v != LOAD) { + widget_grid_cols->value( widget_grid_cols->value()+1 ); + widget_grid_cols->do_callback(); + } +} +void Grid_Tab::cb_3(Fl_Button* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb_3_i(o,v); +} + +void Grid_Tab::cb_Left_i(Fl_Value_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + int m = 0; + if (v == LOAD) { + grid->margin(&m, nullptr, nullptr, nullptr); + o->value(m); + } else { + int m = (int)o->value(), old_m; + grid->margin(&old_m, nullptr, nullptr, nullptr); + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->margin(m, -1, -1, -1); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } + } +} +void Grid_Tab::cb_Left(Fl_Value_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()))->cb_Left_i(o,v); +} + +void Grid_Tab::cb_Top_i(Fl_Value_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + int m = 0; + if (v == LOAD) { + grid->margin(nullptr, &m, nullptr, nullptr); + o->value(m); + } else { + int m = (int)o->value(), old_m; + grid->margin(nullptr, &old_m, nullptr, nullptr); + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->margin(-1, m, -1, -1); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } + } +} +void Grid_Tab::cb_Top(Fl_Value_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()))->cb_Top_i(o,v); +} + +void Grid_Tab::cb_Right_i(Fl_Value_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + int m = 0; + if (v == LOAD) { + grid->margin(nullptr, nullptr, &m, nullptr); + o->value(m); + } else { + int m = (int)o->value(), old_m; + grid->margin(nullptr, nullptr, &old_m, nullptr); + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->margin(-1, -1, m, -1); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } + } +} +void Grid_Tab::cb_Right(Fl_Value_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()))->cb_Right_i(o,v); +} + +void Grid_Tab::cb_Bottom_i(Fl_Value_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + int m = 0; + if (v == LOAD) { + grid->margin(nullptr, nullptr, nullptr, &m); + o->value(m); + } else { + int m = (int)o->value(), old_m; + grid->margin(nullptr, nullptr, nullptr, &old_m); + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->margin(-1, -1, -1, m); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } + } +} +void Grid_Tab::cb_Bottom(Fl_Value_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()))->cb_Bottom_i(o,v); +} + +void Grid_Tab::cb_Row_i(Fl_Value_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + if (v == LOAD) { + int m = 0; + grid->gap(&m, nullptr); + o->value(m); + } else { + int m = (int)o->value(), old_m, m2; + grid->gap(&old_m, &m2); + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->gap(m, m2); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } + } +} +void Grid_Tab::cb_Row(Fl_Value_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()))->cb_Row_i(o,v); +} + +void Grid_Tab::cb_Col_i(Fl_Value_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + if (v == LOAD) { + int m = 0; + grid->gap(nullptr, &m); + o->value(m); + } else { + int m = (int)o->value(), old_m, m2; + grid->gap(&m2, &old_m); + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->gap(m2, m); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } + } +} +void Grid_Tab::cb_Col(Fl_Value_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()))->cb_Col_i(o,v); +} + +void Grid_Tab::cb_Row1_i(Fl_Group* o, void* v) { + if (v == LOAD) { + Fl_Grid *grid = Grid_Node::selected(); + if (grid) + o->activate(); + else + o->deactivate(); + propagate_load(o, v); + } +} +void Grid_Tab::cb_Row1(Fl_Group* o, void* v) { + ((Grid_Tab*)(o->parent()))->cb_Row1_i(o,v); +} + +void Grid_Tab::cb_widget_grid_curr_row_i(fld::widget::Formula_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + int r = o->value(), old_r = r; + if (r < 0) r = 0; + if (r >= grid->rows()) r = grid->rows()-1; + if (r != old_r) o->value(r); + if (v == LOAD) { + // will automatically propagate + } else { + widget_grid_curr_row_attributes->do_callback(widget_grid_curr_row_attributes, LOAD); + } +} +void Grid_Tab::cb_widget_grid_curr_row(fld::widget::Formula_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()))->cb_widget_grid_curr_row_i(o,v); +} + +void Grid_Tab::cb_4_i(Fl_Button*, void* v) { + if (v != LOAD) { + widget_grid_curr_row->value( widget_grid_curr_row->value()-1 ); + widget_grid_curr_row->do_callback(); + } +} +void Grid_Tab::cb_4(Fl_Button* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb_4_i(o,v); +} + +void Grid_Tab::cb_5_i(Fl_Button*, void* v) { + if (v != LOAD) { + widget_grid_curr_row->value( widget_grid_curr_row->value()+1 ); + widget_grid_curr_row->do_callback(); + } +} +void Grid_Tab::cb_5(Fl_Button* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb_5_i(o,v); +} + +void Grid_Tab::cb_Height_i(fld::widget::Formula_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + int r = widget_grid_curr_row->value(); + if (v == LOAD) { + o->value(grid->row_height(r)); + } else { + int h = o->value(), old_h = grid->row_height(r); + if (h < 0) h = 0; + if (h != old_h) { + Fluid.proj.undo.checkpoint(); + grid->row_height(r, h); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } + } +} +void Grid_Tab::cb_Height(fld::widget::Formula_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb_Height_i(o,v); +} + +void Grid_Tab::cb_Weight_i(fld::widget::Formula_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + int r = widget_grid_curr_row->value(); + if (v == LOAD) { + o->value(grid->row_weight(r)); + } else { + int h = o->value(), old_h = grid->row_weight(r); + if (h < 0) h = 0; + if (h != old_h) { + Fluid.proj.undo.checkpoint(); + grid->row_weight(r, h); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } + } +} +void Grid_Tab::cb_Weight(fld::widget::Formula_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb_Weight_i(o,v); +} + +void Grid_Tab::cb_Gap_i(fld::widget::Formula_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + int r = widget_grid_curr_row->value(); + if (v == LOAD) { + o->value(grid->row_gap(r)); + } else { + int h = o->value(), old_h = grid->row_gap(r); + if (h < -1) h = -1; + if (h != old_h) { + Fluid.proj.undo.checkpoint(); + grid->row_gap(r, h); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } + } +} +void Grid_Tab::cb_Gap(fld::widget::Formula_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb_Gap_i(o,v); +} + +void Grid_Tab::cb_widget_grid_curr_col_i(fld::widget::Formula_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + int c = o->value(), old_c = c; + if (c < 0) c = 0; + if (c >= grid->cols()) c = grid->cols()-1; + if (c != old_c) o->value(c); + if (v == LOAD) { + // will automatically propagate + } else { + widget_grid_curr_col_attributes->do_callback(widget_grid_curr_col_attributes, LOAD); + } +} +void Grid_Tab::cb_widget_grid_curr_col(fld::widget::Formula_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()))->cb_widget_grid_curr_col_i(o,v); +} + +void Grid_Tab::cb_6_i(Fl_Button*, void* v) { + if (v != LOAD) { + widget_grid_curr_col->value( widget_grid_curr_col->value()-1 ); + widget_grid_curr_col->do_callback(); + } +} +void Grid_Tab::cb_6(Fl_Button* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb_6_i(o,v); +} + +void Grid_Tab::cb_7_i(Fl_Button*, void* v) { + if (v != LOAD) { + widget_grid_curr_col->value( widget_grid_curr_col->value()+1 ); + widget_grid_curr_col->do_callback(); + } +} +void Grid_Tab::cb_7(Fl_Button* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb_7_i(o,v); +} + +void Grid_Tab::cb_Width_i(fld::widget::Formula_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + int c = widget_grid_curr_col->value(); + if (v == LOAD) { + o->value(grid->col_width(c)); + } else { + int h = o->value(), old_h = grid->col_width(c); + if (h < 0) h = 0; + if (h != old_h) { + Fluid.proj.undo.checkpoint(); + grid->col_width(c, h); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } + } +} +void Grid_Tab::cb_Width(fld::widget::Formula_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb_Width_i(o,v); +} + +void Grid_Tab::cb_Weight1_i(fld::widget::Formula_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + int c = widget_grid_curr_col->value(); + if (v == LOAD) { + o->value(grid->col_weight(c)); + } else { + int h = o->value(), old_h = grid->col_weight(c); + if (h < 0) h = 0; + if (h != old_h) { + Fluid.proj.undo.checkpoint(); + grid->col_weight(c, h); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } + } +} +void Grid_Tab::cb_Weight1(fld::widget::Formula_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb_Weight1_i(o,v); +} + +void Grid_Tab::cb_Gap1_i(fld::widget::Formula_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + int c = widget_grid_curr_col->value(); + if (v == LOAD) { + o->value(grid->col_gap(c)); + } else { + int h = o->value(), old_h = grid->col_gap(c); + if (h < -1) h = -1; + if (h != old_h) { + Fluid.proj.undo.checkpoint(); + grid->col_gap(c, h); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } + } +} +void Grid_Tab::cb_Gap1(fld::widget::Formula_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb_Gap1_i(o,v); +} + +Grid_Tab::Grid_Tab(int X, int Y, int W, int H, const char *L) : + Fl_Group(0, 0, 400, 330, L) +{ + this->labelsize(11); + this->callback((Fl_Callback*)propagate_load); + { Fl_Group* o = new Fl_Group(85, 30, 315, 20, "Grid Layout:"); + o->labelfont(1); + o->labelsize(11); + o->callback((Fl_Callback*)propagate_load); + o->align(Fl_Align(FL_ALIGN_LEFT)); + { widget_grid_rows = new fld::widget::Formula_Input(85, 30, 40, 20, "Rows:"); + widget_grid_rows->tooltip("Number of horizontal rows in the Grid group"); + widget_grid_rows->box(FL_DOWN_BOX); + widget_grid_rows->color(FL_BACKGROUND2_COLOR); + widget_grid_rows->selection_color(FL_SELECTION_COLOR); + widget_grid_rows->labeltype(FL_NORMAL_LABEL); + widget_grid_rows->labelfont(0); + widget_grid_rows->labelsize(11); + widget_grid_rows->labelcolor(FL_FOREGROUND_COLOR); + widget_grid_rows->textsize(11); + widget_grid_rows->callback((Fl_Callback*)cb_widget_grid_rows); + widget_grid_rows->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + widget_grid_rows->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* widget_grid_rows + { Fl_Group* o = new Fl_Group(125, 30, 30, 20); + { Fl_Button* o = new Fl_Button(125, 30, 15, 20, "-"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_); + o->clear_visible_focus(); + } // Fl_Button* o + { Fl_Button* o = new Fl_Button(140, 30, 15, 20, "+"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_1); + o->clear_visible_focus(); + } // Fl_Button* o + o->end(); + } // Fl_Group* o + { widget_grid_cols = new fld::widget::Formula_Input(165, 30, 40, 20, "Columns:"); + widget_grid_cols->tooltip("Number of vertical columns in the Grid group"); + widget_grid_cols->box(FL_DOWN_BOX); + widget_grid_cols->color(FL_BACKGROUND2_COLOR); + widget_grid_cols->selection_color(FL_SELECTION_COLOR); + widget_grid_cols->labeltype(FL_NORMAL_LABEL); + widget_grid_cols->labelfont(0); + widget_grid_cols->labelsize(11); + widget_grid_cols->labelcolor(FL_FOREGROUND_COLOR); + widget_grid_cols->textsize(11); + widget_grid_cols->callback((Fl_Callback*)cb_widget_grid_cols); + widget_grid_cols->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + widget_grid_cols->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* widget_grid_cols + { Fl_Group* o = new Fl_Group(205, 30, 30, 20); + { Fl_Button* o = new Fl_Button(205, 30, 15, 20, "-"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_2); + o->clear_visible_focus(); + } // Fl_Button* o + { Fl_Button* o = new Fl_Button(220, 30, 15, 20, "+"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_3); + o->clear_visible_focus(); + } // Fl_Button* o + o->end(); + } // Fl_Group* o + { Fl_Box* o = new Fl_Box(386, 30, 0, 20); + Fl_Group::current()->resizable(o); + } // Fl_Box* o + o->end(); + } // Fl_Group* o + { wp_grid_margin = new Fl_Group(85, 70, 315, 20, "Margins:"); + wp_grid_margin->labelfont(1); + wp_grid_margin->labelsize(11); + wp_grid_margin->callback((Fl_Callback*)propagate_load); + wp_grid_margin->align(Fl_Align(FL_ALIGN_LEFT)); + { Fl_Value_Input* o = new Fl_Value_Input(85, 70, 55, 20, "Left:"); + o->tooltip("Left margin in group."); + o->labelsize(11); + o->maximum(1000); + o->step(1); + o->textsize(11); + o->callback((Fl_Callback*)cb_Left); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + } // Fl_Value_Input* o + { Fl_Value_Input* o = new Fl_Value_Input(145, 70, 55, 20, "Top:"); + o->tooltip("Top margin in group."); + o->labelsize(11); + o->maximum(1000); + o->step(1); + o->textsize(11); + o->callback((Fl_Callback*)cb_Top); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + } // Fl_Value_Input* o + { Fl_Value_Input* o = new Fl_Value_Input(205, 70, 55, 20, "Right:"); + o->tooltip("Right margin in group."); + o->labelsize(11); + o->maximum(1000); + o->step(1); + o->textsize(11); + o->callback((Fl_Callback*)cb_Right); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + } // Fl_Value_Input* o + { Fl_Value_Input* o = new Fl_Value_Input(265, 70, 55, 20, "Bottom:"); + o->tooltip("Bottom margin in group."); + o->labelsize(11); + o->maximum(1000); + o->step(1); + o->textsize(11); + o->callback((Fl_Callback*)cb_Bottom); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + } // Fl_Value_Input* o + { Fl_Box* o = new Fl_Box(386, 70, 0, 20); + Fl_Group::current()->resizable(o); + } // Fl_Box* o + wp_grid_margin->end(); + } // Fl_Group* wp_grid_margin + { wp_grid_gaps = new Fl_Group(85, 105, 315, 20, "Gaps:"); + wp_grid_gaps->labelfont(1); + wp_grid_gaps->labelsize(11); + wp_grid_gaps->callback((Fl_Callback*)propagate_load); + wp_grid_gaps->align(Fl_Align(FL_ALIGN_LEFT)); + { Fl_Value_Input* o = new Fl_Value_Input(85, 105, 55, 20, "Row:"); + o->tooltip("Gap between children."); + o->labelsize(11); + o->maximum(1000); + o->step(1); + o->textsize(11); + o->callback((Fl_Callback*)cb_Row); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + } // Fl_Value_Input* o + { Fl_Value_Input* o = new Fl_Value_Input(145, 105, 55, 20, "Col:"); + o->tooltip("Gap between children."); + o->labelsize(11); + o->maximum(1000); + o->step(1); + o->textsize(11); + o->callback((Fl_Callback*)cb_Col); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + } // Fl_Value_Input* o + { Fl_Box* o = new Fl_Box(386, 105, 0, 20); + Fl_Group::current()->resizable(o); + } // Fl_Box* o + wp_grid_gaps->end(); + } // Fl_Group* wp_grid_gaps + { Fl_Group* o = new Fl_Group(85, 145, 315, 20, "Row:"); + o->labelfont(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_Row1); + o->align(Fl_Align(FL_ALIGN_LEFT)); + { widget_grid_curr_row = new fld::widget::Formula_Input(85, 145, 40, 20, "Index"); + widget_grid_curr_row->box(FL_DOWN_BOX); + widget_grid_curr_row->color(FL_BACKGROUND2_COLOR); + widget_grid_curr_row->selection_color(FL_SELECTION_COLOR); + widget_grid_curr_row->labeltype(FL_NORMAL_LABEL); + widget_grid_curr_row->labelfont(0); + widget_grid_curr_row->labelsize(11); + widget_grid_curr_row->labelcolor(FL_FOREGROUND_COLOR); + widget_grid_curr_row->textsize(11); + widget_grid_curr_row->callback((Fl_Callback*)cb_widget_grid_curr_row); + widget_grid_curr_row->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + widget_grid_curr_row->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* widget_grid_curr_row + { Fl_Group* o = new Fl_Group(125, 145, 30, 20); + o->callback((Fl_Callback*)propagate_load); + { Fl_Button* o = new Fl_Button(125, 145, 15, 20, "-"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_4); + o->clear_visible_focus(); + } // Fl_Button* o + { Fl_Button* o = new Fl_Button(140, 145, 15, 20, "+"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_5); + o->clear_visible_focus(); + } // Fl_Button* o + o->end(); + } // Fl_Group* o + { Fl_Box* o = new Fl_Box(155, 145, 15, 20, ":"); + o->labelsize(11); + } // Fl_Box* o + { widget_grid_curr_row_attributes = new Fl_Group(170, 145, 175, 20); + widget_grid_curr_row_attributes->callback((Fl_Callback*)propagate_load); + { fld::widget::Formula_Input* o = new fld::widget::Formula_Input(170, 145, 55, 20, "Height:"); + o->box(FL_DOWN_BOX); + o->color(FL_BACKGROUND2_COLOR); + o->selection_color(FL_SELECTION_COLOR); + o->labeltype(FL_NORMAL_LABEL); + o->labelfont(0); + o->labelsize(11); + o->labelcolor(FL_FOREGROUND_COLOR); + o->textsize(11); + o->callback((Fl_Callback*)cb_Height); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + o->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* o + { fld::widget::Formula_Input* o = new fld::widget::Formula_Input(230, 145, 55, 20, "Weight:"); + o->box(FL_DOWN_BOX); + o->color(FL_BACKGROUND2_COLOR); + o->selection_color(FL_SELECTION_COLOR); + o->labeltype(FL_NORMAL_LABEL); + o->labelfont(0); + o->labelsize(11); + o->labelcolor(FL_FOREGROUND_COLOR); + o->textsize(11); + o->callback((Fl_Callback*)cb_Weight); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + o->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* o + { fld::widget::Formula_Input* o = new fld::widget::Formula_Input(290, 145, 55, 20, "Gap:"); + o->box(FL_DOWN_BOX); + o->color(FL_BACKGROUND2_COLOR); + o->selection_color(FL_SELECTION_COLOR); + o->labeltype(FL_NORMAL_LABEL); + o->labelfont(0); + o->labelsize(11); + o->labelcolor(FL_FOREGROUND_COLOR); + o->textsize(11); + o->callback((Fl_Callback*)cb_Gap); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + o->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* o + widget_grid_curr_row_attributes->end(); + } // Fl_Group* widget_grid_curr_row_attributes + { Fl_Box* o = new Fl_Box(390, 145, 1, 20); + o->hide(); + Fl_Group::current()->resizable(o); + } // Fl_Box* o + o->end(); + } // Fl_Group* o + { Fl_Group* o = new Fl_Group(85, 180, 315, 20, "Column:"); + o->labelfont(1); + o->labelsize(11); + o->callback((Fl_Callback*)propagate_load); + o->align(Fl_Align(FL_ALIGN_LEFT)); + { widget_grid_curr_col = new fld::widget::Formula_Input(85, 180, 40, 20, "Index"); + widget_grid_curr_col->box(FL_DOWN_BOX); + widget_grid_curr_col->color(FL_BACKGROUND2_COLOR); + widget_grid_curr_col->selection_color(FL_SELECTION_COLOR); + widget_grid_curr_col->labeltype(FL_NORMAL_LABEL); + widget_grid_curr_col->labelfont(0); + widget_grid_curr_col->labelsize(11); + widget_grid_curr_col->labelcolor(FL_FOREGROUND_COLOR); + widget_grid_curr_col->textsize(11); + widget_grid_curr_col->callback((Fl_Callback*)cb_widget_grid_curr_col); + widget_grid_curr_col->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + widget_grid_curr_col->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* widget_grid_curr_col + { Fl_Group* o = new Fl_Group(125, 180, 30, 20); + { Fl_Button* o = new Fl_Button(125, 180, 15, 20, "-"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_6); + o->clear_visible_focus(); + } // Fl_Button* o + { Fl_Button* o = new Fl_Button(140, 180, 15, 20, "+"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_7); + o->clear_visible_focus(); + } // Fl_Button* o + o->end(); + } // Fl_Group* o + { Fl_Box* o = new Fl_Box(155, 180, 15, 20, ":"); + o->labelsize(11); + } // Fl_Box* o + { widget_grid_curr_col_attributes = new Fl_Group(170, 180, 175, 20); + widget_grid_curr_col_attributes->callback((Fl_Callback*)propagate_load); + { fld::widget::Formula_Input* o = new fld::widget::Formula_Input(170, 180, 55, 20, "Width:"); + o->box(FL_DOWN_BOX); + o->color(FL_BACKGROUND2_COLOR); + o->selection_color(FL_SELECTION_COLOR); + o->labeltype(FL_NORMAL_LABEL); + o->labelfont(0); + o->labelsize(11); + o->labelcolor(FL_FOREGROUND_COLOR); + o->textsize(11); + o->callback((Fl_Callback*)cb_Width); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + o->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* o + { fld::widget::Formula_Input* o = new fld::widget::Formula_Input(230, 180, 55, 20, "Weight:"); + o->box(FL_DOWN_BOX); + o->color(FL_BACKGROUND2_COLOR); + o->selection_color(FL_SELECTION_COLOR); + o->labeltype(FL_NORMAL_LABEL); + o->labelfont(0); + o->labelsize(11); + o->labelcolor(FL_FOREGROUND_COLOR); + o->textsize(11); + o->callback((Fl_Callback*)cb_Weight1); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + o->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* o + { fld::widget::Formula_Input* o = new fld::widget::Formula_Input(290, 180, 55, 20, "Gap:"); + o->box(FL_DOWN_BOX); + o->color(FL_BACKGROUND2_COLOR); + o->selection_color(FL_SELECTION_COLOR); + o->labeltype(FL_NORMAL_LABEL); + o->labelfont(0); + o->labelsize(11); + o->labelcolor(FL_FOREGROUND_COLOR); + o->textsize(11); + o->callback((Fl_Callback*)cb_Gap1); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + o->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* o + widget_grid_curr_col_attributes->end(); + } // Fl_Group* widget_grid_curr_col_attributes + { Fl_Box* o = new Fl_Box(390, 180, 1, 20); + o->hide(); + Fl_Group::current()->resizable(o); + } // Fl_Box* o + o->end(); + } // Fl_Group* o + { Fl_Box* o = new Fl_Box(85, 320, 300, 5); + o->labelsize(11); + o->hide(); + Fl_Group::current()->resizable(o); + } // Fl_Box* o + end(); + resize(X, Y, W, H); +} diff --git a/fluid/panels/widget_panel/Grid_Tab.fl b/fluid/panels/widget_panel/Grid_Tab.fl new file mode 100644 index 000000000..e37610ca5 --- /dev/null +++ b/fluid/panels/widget_panel/Grid_Tab.fl @@ -0,0 +1,515 @@ +# data file for the Fltk User Interface Designer (fluid) +version 1.0500 +header_name {.h} +code_name {.cxx} +decl {\#include "widgets/Formula_Input.h"} {public global +} + +decl {\#include "Fluid.h"} {private global +} + +decl {\#include "proj/undo.h"} {private global +} + +decl {\#include "nodes/Grid_Node.h"} {private global +} + +decl {extern Grid_Tab *widget_tab_grid;} {selected private global +} + +widget_class Grid_Tab { + label Grid + callback propagate_load open + xywh {480 287 400 330} labelsize 11 resizable visible position_relative_rescale +} { + Fl_Group {} { + label {Grid Layout:} + callback propagate_load open + xywh {85 30 315 20} labelfont 1 labelsize 11 align 4 + } { + Fl_Input widget_grid_rows { + label {Rows:} + callback {// grid_rows_cb +Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +if (v == LOAD) { + o->value(grid->rows()); +} else { + int m = o->value(), old_m = grid->rows(); + if (m < 1) { + m = 1; + o->value(m); + } + if (m < old_m) { + // TODO: verify that this will not unlink existings cells + // Offer a dialog with "delete children", "unlink cells", "cancel" + } + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->layout(m, grid->cols()); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + widget_tab_grid->do_callback(widget_tab_grid, LOAD); + } +}} + tooltip {Number of horizontal rows in the Grid group} xywh {85 30 40 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Group {} {open + xywh {125 30 30 20} + } { + Fl_Button {} { + label {-} + callback {if (v != LOAD) { + widget_grid_rows->value( widget_grid_rows->value()-1 ); + widget_grid_rows->do_callback(); +}} + xywh {125 30 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + Fl_Button {} { + label {+} + callback {if (v != LOAD) { + widget_grid_rows->value( widget_grid_rows->value()+1 ); + widget_grid_rows->do_callback(); +}} + xywh {140 30 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + } + Fl_Input widget_grid_cols { + label {Columns:} + callback {// grid_rows_cb +Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +if (v == LOAD) { + o->value(grid->cols()); +} else { + int m = o->value(), old_m = grid->cols(); + if (m < 1) { + m = 1; + o->value(m); + } + if (m < old_m) { + // TODO: verify that this will not unlink existings cells + // Offer a dialog with "delete children", "unlink cells", "cancel" + } + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->layout(grid->rows(), m); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + widget_tab_grid->do_callback(widget_tab_grid, LOAD); + } +}} + tooltip {Number of vertical columns in the Grid group} xywh {165 30 40 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Group {} {open + xywh {205 30 30 20} + } { + Fl_Button {} { + label {-} + callback {if (v != LOAD) { + widget_grid_cols->value( widget_grid_cols->value()-1 ); + widget_grid_cols->do_callback(); +}} + xywh {205 30 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + Fl_Button {} { + label {+} + callback {if (v != LOAD) { + widget_grid_cols->value( widget_grid_cols->value()+1 ); + widget_grid_cols->do_callback(); +}} + xywh {220 30 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + } + Fl_Box {} { + xywh {386 30 0 20} resizable + } + } + Fl_Group wp_grid_margin { + label {Margins:} + callback propagate_load open + xywh {85 70 315 20} labelfont 1 labelsize 11 align 4 + } { + Fl_Value_Input {} { + label {Left:} + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +int m = 0; +if (v == LOAD) { + grid->margin(&m, nullptr, nullptr, nullptr); + o->value(m); +} else { + int m = (int)o->value(), old_m; + grid->margin(&old_m, nullptr, nullptr, nullptr); + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->margin(m, -1, -1, -1); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } +}} + tooltip {Left margin in group.} xywh {85 70 55 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11 + } + Fl_Value_Input {} { + label {Top:} + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +int m = 0; +if (v == LOAD) { + grid->margin(nullptr, &m, nullptr, nullptr); + o->value(m); +} else { + int m = (int)o->value(), old_m; + grid->margin(nullptr, &old_m, nullptr, nullptr); + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->margin(-1, m, -1, -1); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } +}} + tooltip {Top margin in group.} xywh {145 70 55 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11 + } + Fl_Value_Input {} { + label {Right:} + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +int m = 0; +if (v == LOAD) { + grid->margin(nullptr, nullptr, &m, nullptr); + o->value(m); +} else { + int m = (int)o->value(), old_m; + grid->margin(nullptr, nullptr, &old_m, nullptr); + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->margin(-1, -1, m, -1); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } +}} + tooltip {Right margin in group.} xywh {205 70 55 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11 + } + Fl_Value_Input {} { + label {Bottom:} + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +int m = 0; +if (v == LOAD) { + grid->margin(nullptr, nullptr, nullptr, &m); + o->value(m); +} else { + int m = (int)o->value(), old_m; + grid->margin(nullptr, nullptr, nullptr, &old_m); + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->margin(-1, -1, -1, m); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } +}} + tooltip {Bottom margin in group.} xywh {265 70 55 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11 + } + Fl_Box {} { + xywh {386 70 0 20} resizable + } + } + Fl_Group wp_grid_gaps { + label {Gaps:} + callback propagate_load open + xywh {85 105 315 20} labelfont 1 labelsize 11 align 4 + } { + Fl_Value_Input {} { + label {Row:} + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +if (v == LOAD) { + int m = 0; + grid->gap(&m, nullptr); + o->value(m); +} else { + int m = (int)o->value(), old_m, m2; + grid->gap(&old_m, &m2); + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->gap(m, m2); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } +}} + tooltip {Gap between children.} xywh {85 105 55 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11 + } + Fl_Value_Input {} { + label {Col:} + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +if (v == LOAD) { + int m = 0; + grid->gap(nullptr, &m); + o->value(m); +} else { + int m = (int)o->value(), old_m, m2; + grid->gap(&m2, &old_m); + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->gap(m2, m); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } +}} + tooltip {Gap between children.} xywh {145 105 55 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11 + } + Fl_Box {} { + xywh {386 105 0 20} resizable + } + } + Fl_Group {} { + label {Row:} + callback {if (v == LOAD) { + Fl_Grid *grid = Grid_Node::selected(); + if (grid) + o->activate(); + else + o->deactivate(); + propagate_load(o, v); +}} open + xywh {85 145 315 20} labelfont 1 labelsize 11 align 4 + } { + Fl_Input widget_grid_curr_row { + label Index + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +int r = o->value(), old_r = r; +if (r < 0) r = 0; +if (r >= grid->rows()) r = grid->rows()-1; +if (r != old_r) o->value(r); +if (v == LOAD) { + // will automatically propagate +} else { + widget_grid_curr_row_attributes->do_callback(widget_grid_curr_row_attributes, LOAD); +}} + xywh {85 145 40 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Group {} { + callback propagate_load open + xywh {125 145 30 20} + } { + Fl_Button {} { + label {-} + callback {if (v != LOAD) { + widget_grid_curr_row->value( widget_grid_curr_row->value()-1 ); + widget_grid_curr_row->do_callback(); +}} + xywh {125 145 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + Fl_Button {} { + label {+} + callback {if (v != LOAD) { + widget_grid_curr_row->value( widget_grid_curr_row->value()+1 ); + widget_grid_curr_row->do_callback(); +}} + xywh {140 145 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + } + Fl_Box {} { + label {:} + xywh {155 145 15 20} labelsize 11 + } + Fl_Group widget_grid_curr_row_attributes { + callback propagate_load open + xywh {170 145 175 20} + } { + Fl_Input {} { + label {Height:} + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +int r = widget_grid_curr_row->value(); +if (v == LOAD) { + o->value(grid->row_height(r)); +} else { + int h = o->value(), old_h = grid->row_height(r); + if (h < 0) h = 0; + if (h != old_h) { + Fluid.proj.undo.checkpoint(); + grid->row_height(r, h); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } +}} + xywh {170 145 55 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Input {} { + label {Weight:} + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +int r = widget_grid_curr_row->value(); +if (v == LOAD) { + o->value(grid->row_weight(r)); +} else { + int h = o->value(), old_h = grid->row_weight(r); + if (h < 0) h = 0; + if (h != old_h) { + Fluid.proj.undo.checkpoint(); + grid->row_weight(r, h); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } +}} + xywh {230 145 55 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Input {} { + label {Gap:} + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +int r = widget_grid_curr_row->value(); +if (v == LOAD) { + o->value(grid->row_gap(r)); +} else { + int h = o->value(), old_h = grid->row_gap(r); + if (h < -1) h = -1; + if (h != old_h) { + Fluid.proj.undo.checkpoint(); + grid->row_gap(r, h); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } +}} + xywh {290 145 55 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + } + Fl_Box {} { + xywh {390 145 1 20} hide resizable + } + } + Fl_Group {} { + label {Column:} + callback propagate_load open + xywh {85 180 315 20} labelfont 1 labelsize 11 align 4 + } { + Fl_Input widget_grid_curr_col { + label Index + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +int c = o->value(), old_c = c; +if (c < 0) c = 0; +if (c >= grid->cols()) c = grid->cols()-1; +if (c != old_c) o->value(c); +if (v == LOAD) { + // will automatically propagate +} else { + widget_grid_curr_col_attributes->do_callback(widget_grid_curr_col_attributes, LOAD); +}} + xywh {85 180 40 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Group {} {open + xywh {125 180 30 20} + } { + Fl_Button {} { + label {-} + callback {if (v != LOAD) { + widget_grid_curr_col->value( widget_grid_curr_col->value()-1 ); + widget_grid_curr_col->do_callback(); +}} + xywh {125 180 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + Fl_Button {} { + label {+} + callback {if (v != LOAD) { + widget_grid_curr_col->value( widget_grid_curr_col->value()+1 ); + widget_grid_curr_col->do_callback(); +}} + xywh {140 180 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + } + Fl_Box {} { + label {:} + xywh {155 180 15 20} labelsize 11 + } + Fl_Group widget_grid_curr_col_attributes { + callback propagate_load open + xywh {170 180 175 20} + } { + Fl_Input {} { + label {Width:} + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +int c = widget_grid_curr_col->value(); +if (v == LOAD) { + o->value(grid->col_width(c)); +} else { + int h = o->value(), old_h = grid->col_width(c); + if (h < 0) h = 0; + if (h != old_h) { + Fluid.proj.undo.checkpoint(); + grid->col_width(c, h); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } +}} + xywh {170 180 55 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Input {} { + label {Weight:} + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +int c = widget_grid_curr_col->value(); +if (v == LOAD) { + o->value(grid->col_weight(c)); +} else { + int h = o->value(), old_h = grid->col_weight(c); + if (h < 0) h = 0; + if (h != old_h) { + Fluid.proj.undo.checkpoint(); + grid->col_weight(c, h); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } +}} + xywh {230 180 55 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Input {} { + label {Gap:} + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +int c = widget_grid_curr_col->value(); +if (v == LOAD) { + o->value(grid->col_gap(c)); +} else { + int h = o->value(), old_h = grid->col_gap(c); + if (h < -1) h = -1; + if (h != old_h) { + Fluid.proj.undo.checkpoint(); + grid->col_gap(c, h); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } +}} + xywh {290 180 55 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + } + Fl_Box {} { + xywh {390 180 1 20} hide resizable + } + } + Fl_Box {} { + xywh {85 320 300 5} labelsize 11 hide resizable + } +} diff --git a/fluid/panels/widget_panel/Grid_Tab.h b/fluid/panels/widget_panel/Grid_Tab.h new file mode 100644 index 000000000..4b06a9e43 --- /dev/null +++ b/fluid/panels/widget_panel/Grid_Tab.h @@ -0,0 +1,90 @@ +// generated by Fast Light User Interface Designer (fluid) version 1.0500 + +#ifndef Grid_Tab_h +#define Grid_Tab_h +#include <FL/Fl.H> +#include "widgets/Formula_Input.h" +#include <FL/Fl_Group.H> +extern void propagate_load(Fl_Group*, void*); +#include <FL/Fl_Button.H> +#include <FL/Fl_Box.H> +#include <FL/Fl_Value_Input.H> + +class Grid_Tab : public Fl_Group { +public: + Grid_Tab(int X, int Y, int W, int H, const char *L = 0); + fld::widget::Formula_Input *widget_grid_rows; +private: + inline void cb_widget_grid_rows_i(fld::widget::Formula_Input*, void*); + static void cb_widget_grid_rows(fld::widget::Formula_Input*, void*); + inline void cb__i(Fl_Button*, void*); + static void cb_(Fl_Button*, void*); + inline void cb_1_i(Fl_Button*, void*); + static void cb_1(Fl_Button*, void*); +public: + fld::widget::Formula_Input *widget_grid_cols; +private: + inline void cb_widget_grid_cols_i(fld::widget::Formula_Input*, void*); + static void cb_widget_grid_cols(fld::widget::Formula_Input*, void*); + inline void cb_2_i(Fl_Button*, void*); + static void cb_2(Fl_Button*, void*); + inline void cb_3_i(Fl_Button*, void*); + static void cb_3(Fl_Button*, void*); +public: + Fl_Group *wp_grid_margin; +private: + inline void cb_Left_i(Fl_Value_Input*, void*); + static void cb_Left(Fl_Value_Input*, void*); + inline void cb_Top_i(Fl_Value_Input*, void*); + static void cb_Top(Fl_Value_Input*, void*); + inline void cb_Right_i(Fl_Value_Input*, void*); + static void cb_Right(Fl_Value_Input*, void*); + inline void cb_Bottom_i(Fl_Value_Input*, void*); + static void cb_Bottom(Fl_Value_Input*, void*); +public: + Fl_Group *wp_grid_gaps; +private: + inline void cb_Row_i(Fl_Value_Input*, void*); + static void cb_Row(Fl_Value_Input*, void*); + inline void cb_Col_i(Fl_Value_Input*, void*); + static void cb_Col(Fl_Value_Input*, void*); + inline void cb_Row1_i(Fl_Group*, void*); + static void cb_Row1(Fl_Group*, void*); +public: + fld::widget::Formula_Input *widget_grid_curr_row; +private: + inline void cb_widget_grid_curr_row_i(fld::widget::Formula_Input*, void*); + static void cb_widget_grid_curr_row(fld::widget::Formula_Input*, void*); + inline void cb_4_i(Fl_Button*, void*); + static void cb_4(Fl_Button*, void*); + inline void cb_5_i(Fl_Button*, void*); + static void cb_5(Fl_Button*, void*); +public: + Fl_Group *widget_grid_curr_row_attributes; +private: + inline void cb_Height_i(fld::widget::Formula_Input*, void*); + static void cb_Height(fld::widget::Formula_Input*, void*); + inline void cb_Weight_i(fld::widget::Formula_Input*, void*); + static void cb_Weight(fld::widget::Formula_Input*, void*); + inline void cb_Gap_i(fld::widget::Formula_Input*, void*); + static void cb_Gap(fld::widget::Formula_Input*, void*); +public: + fld::widget::Formula_Input *widget_grid_curr_col; +private: + inline void cb_widget_grid_curr_col_i(fld::widget::Formula_Input*, void*); + static void cb_widget_grid_curr_col(fld::widget::Formula_Input*, void*); + inline void cb_6_i(Fl_Button*, void*); + static void cb_6(Fl_Button*, void*); + inline void cb_7_i(Fl_Button*, void*); + static void cb_7(Fl_Button*, void*); +public: + Fl_Group *widget_grid_curr_col_attributes; +private: + inline void cb_Width_i(fld::widget::Formula_Input*, void*); + static void cb_Width(fld::widget::Formula_Input*, void*); + inline void cb_Weight1_i(fld::widget::Formula_Input*, void*); + static void cb_Weight1(fld::widget::Formula_Input*, void*); + inline void cb_Gap1_i(fld::widget::Formula_Input*, void*); + static void cb_Gap1(fld::widget::Formula_Input*, void*); +}; +#endif |
