// 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);
      }
    }
}
