+ if (closing_)
+ return;
+
+ LyXTabular const & tabular = controller().tabular();
+
+ int align;
+ LyXLength pwidth;
+ string special;
+
+ LyXTabular::idx_type const cell = controller().getActiveCell();
+ actCell_ = cell;
+ LyXTabular::col_type column = tabular.column_of_cell(cell) + 1;
+ clearMessage();
+ fl_activate_object(column_options_->input_special_alignment);
+ fl_activate_object(cell_options_->input_special_multialign);
+ fl_activate_object(column_options_->input_column_width);
+ fl_activate_object(column_options_->choice_value_column_width);
+ fl_set_input(dialog_->input_tabular_column,
+ convert<string>(column).c_str());
+ fl_deactivate_object(dialog_->input_tabular_column);
+ LyXTabular::row_type row = tabular.row_of_cell(cell);
+ fl_set_input(dialog_->input_tabular_row,
+ convert<string>(row + 1).c_str());
+ fl_deactivate_object(dialog_->input_tabular_row);
+ if (tabular.isMultiColumn(cell)) {
+ fl_set_button(cell_options_->check_multicolumn, 1);
+ fl_set_button(cell_options_->check_border_top,
+ tabular.topLine(cell)?1:0);
+ setEnabled(cell_options_->check_border_top, true);
+ fl_set_button(cell_options_->check_border_bottom,
+ tabular.bottomLine(cell)?1:0);
+ setEnabled(cell_options_->check_border_bottom, true);
+ // pay attention to left/right lines they are only allowed
+ // to set if we are in first/last cell of row or if the left/right
+ // cell is also a multicolumn.
+ if (tabular.isFirstCellInRow(cell) ||
+ tabular.isMultiColumn(cell-1)) {
+ fl_set_button(cell_options_->check_border_left,
+ tabular.leftLine(cell)?1:0);
+ setEnabled(cell_options_->check_border_left, true);
+ } else {
+ fl_set_button(cell_options_->check_border_left, 0);
+ setEnabled(cell_options_->check_border_left, false);
+ }
+ if (tabular.isLastCellInRow(cell) ||
+ tabular.isMultiColumn(cell+1)) {
+ fl_set_button(cell_options_->check_border_right,
+ tabular.rightLine(cell)?1:0);
+ setEnabled(cell_options_->check_border_right, true);
+ } else {
+ fl_set_button(cell_options_->check_border_right, 0);
+ setEnabled(cell_options_->check_border_right, false);
+ }
+ pwidth = tabular.getMColumnPWidth(cell);
+ align = tabular.getAlignment(cell);
+ // set the horiz. alignment, default is left here
+ fl_set_button(cell_options_->radio_align_left, 0);
+ fl_set_button(cell_options_->radio_align_right, 0);
+ fl_set_button(cell_options_->radio_align_center, 0);
+ if (align == LYX_ALIGN_RIGHT)
+ fl_set_button(cell_options_->radio_align_right, 1);
+ else if (align == LYX_ALIGN_CENTER)
+ fl_set_button(cell_options_->radio_align_center, 1);
+ else
+ fl_set_button(cell_options_->radio_align_left, 1);
+
+ align = tabular.getVAlignment(cell);
+ fl_set_button(cell_options_->radio_valign_top, 0);
+ fl_set_button(cell_options_->radio_valign_bottom, 0);
+ fl_set_button(cell_options_->radio_valign_middle, 0);
+ if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_MIDDLE))
+ fl_set_button(cell_options_->radio_valign_middle, 1);
+ else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
+ fl_set_button(cell_options_->radio_valign_bottom, 1);
+ else
+ fl_set_button(cell_options_->radio_valign_top, 1);
+
+ special = tabular.getAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
+ fl_set_input(cell_options_->input_special_multialign, special.c_str());
+ bool const metric(controller().useMetricUnits());
+ string const default_unit = metric ? "cm" : "in";
+ updateWidgetsFromLength(cell_options_->input_mcolumn_width,
+ cell_options_->choice_value_mcolumn_width,
+ pwidth, default_unit);
+
+ if (!bc().bp().isReadOnly()) {
+ setEnabled(cell_options_->input_special_multialign, true);
+ setEnabled(cell_options_->input_mcolumn_width, true);
+ setEnabled(cell_options_->choice_value_mcolumn_width, true);
+ }
+
+ setEnabled(cell_options_->radio_valign_top, !pwidth.zero());
+ setEnabled(cell_options_->radio_valign_bottom, !pwidth.zero());
+ setEnabled(cell_options_->radio_valign_middle, !pwidth.zero());
+
+ setEnabled(cell_options_->radio_align_left, true);
+ setEnabled(cell_options_->radio_align_right, true);
+ setEnabled(cell_options_->radio_align_center, true);
+ } else {
+ fl_set_button(cell_options_->check_multicolumn, 0);
+
+ fl_set_button(cell_options_->check_border_top, 0);
+ setEnabled(cell_options_->check_border_top, false);
+
+ fl_set_button(cell_options_->check_border_bottom, 0);
+ setEnabled(cell_options_->check_border_bottom, false);
+
+ fl_set_button(cell_options_->check_border_left, 0);
+ setEnabled(cell_options_->check_border_left, false);
+
+ fl_set_button(cell_options_->check_border_right, 0);
+ setEnabled(cell_options_->check_border_right, false);
+
+ fl_set_button(cell_options_->radio_align_left, 0);
+ setEnabled(cell_options_->radio_align_left, false);
+
+ fl_set_button(cell_options_->radio_align_right, 0);
+ setEnabled(cell_options_->radio_align_right, false);
+
+ fl_set_button(cell_options_->radio_align_center, 0);
+ setEnabled(cell_options_->radio_align_center, false);
+
+ fl_set_button(cell_options_->radio_valign_top, 0);
+ setEnabled(cell_options_->radio_valign_top, false);
+
+ fl_set_button(cell_options_->radio_valign_bottom, 0);
+ setEnabled(cell_options_->radio_valign_bottom, false);
+
+ fl_set_button(cell_options_->radio_valign_middle, 0);
+ setEnabled(cell_options_->radio_valign_middle, false);
+
+ fl_set_input(cell_options_->input_special_multialign, "");
+ setEnabled(cell_options_->input_special_multialign, false);
+
+ fl_set_input(cell_options_->input_mcolumn_width, "");
+ setEnabled(cell_options_->input_mcolumn_width, false);
+ setEnabled(cell_options_->choice_value_mcolumn_width, false);
+ }
+ if (tabular.getRotateCell(cell))
+ fl_set_button(cell_options_->check_rotate_cell, 1);
+ else
+ fl_set_button(cell_options_->check_rotate_cell, 0);
+ if (tabular.topLine(cell, true))
+ fl_set_button(column_options_->check_border_top, 1);
+ else
+ fl_set_button(column_options_->check_border_top, 0);
+ if (tabular.bottomLine(cell, true))
+ fl_set_button(column_options_->check_border_bottom, 1);
+ else
+ fl_set_button(column_options_->check_border_bottom, 0);
+ if (tabular.leftLine(cell, true))
+ fl_set_button(column_options_->check_border_left, 1);
+ else
+ fl_set_button(column_options_->check_border_left, 0);
+ if (tabular.rightLine(cell, true))
+ fl_set_button(column_options_->check_border_right, 1);
+ else
+ fl_set_button(column_options_->check_border_right, 0);
+ special = tabular.getAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
+ fl_set_input(column_options_->input_special_alignment, special.c_str());
+
+ bool const isReadonly = bc().bp().isReadOnly();
+ setEnabled(column_options_->input_special_alignment, !isReadonly);
+
+ pwidth = tabular.getColumnPWidth(cell);
+ bool const metric = controller().useMetricUnits();
+ string const default_unit = metric ? "cm" : "in";
+ updateWidgetsFromLength(column_options_->input_column_width,
+ column_options_->choice_value_column_width,
+ pwidth, default_unit);
+ setEnabled(column_options_->input_column_width, !isReadonly);
+ setEnabled(column_options_->choice_value_column_width, !isReadonly);
+
+ setEnabled(cell_options_->check_useminipage, !pwidth.zero());
+ if (!pwidth.zero()) {
+ if (tabular.getUsebox(cell) == 2)
+ fl_set_button(cell_options_->check_useminipage, 1);
+ else
+ fl_set_button(cell_options_->check_useminipage, 0);
+ } else {
+ fl_set_button(cell_options_->check_useminipage, 0);
+ }
+ align = tabular.getAlignment(cell, true);
+ fl_set_button(column_options_->radio_align_left, 0);
+ fl_set_button(column_options_->radio_align_right, 0);
+ fl_set_button(column_options_->radio_align_center, 0);
+ fl_set_button(column_options_->radio_align_block, 0);
+ if (align == LYX_ALIGN_LEFT)
+ fl_set_button(column_options_->radio_align_left, 1);
+ else if (align == LYX_ALIGN_RIGHT)
+ fl_set_button(column_options_->radio_align_right, 1);
+ else if (align == LYX_ALIGN_CENTER)
+ fl_set_button(column_options_->radio_align_center, 1);
+ else
+ fl_set_button(column_options_->radio_align_block, 1);
+ align = tabular.getVAlignment(cell, true);
+ fl_set_button(column_options_->radio_valign_top, 0);
+ fl_set_button(column_options_->radio_valign_bottom, 0);
+ fl_set_button(column_options_->radio_valign_middle, 0);
+ if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_MIDDLE))
+ fl_set_button(column_options_->radio_valign_middle, 1);
+ else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
+ fl_set_button(column_options_->radio_valign_bottom, 1);
+ else
+ fl_set_button(column_options_->radio_valign_top, 1);
+
+ setEnabled(column_options_->radio_align_left, true);
+ setEnabled(column_options_->radio_align_right, true);
+ setEnabled(column_options_->radio_align_center, true);
+ setEnabled(column_options_->radio_align_block, !pwidth.zero());
+ setEnabled(column_options_->radio_valign_top, !pwidth.zero());
+ setEnabled(column_options_->radio_valign_bottom, !pwidth.zero());
+ setEnabled(column_options_->radio_valign_middle, !pwidth.zero());
+
+ fl_set_button(tabular_options_->check_longtable,
+ tabular.isLongTabular());
+
+ bool const enable = tabular.isLongTabular();
+
+ setEnabled(longtable_options_->check_lt_firsthead, enable);
+ setEnabled(longtable_options_->check_1head_2border_above, enable);
+ setEnabled(longtable_options_->check_1head_2border_below, enable);
+ setEnabled(longtable_options_->check_1head_empty, enable);
+ setEnabled(longtable_options_->check_lt_head, enable);
+ setEnabled(longtable_options_->check_head_2border_above, enable);
+ setEnabled(longtable_options_->check_head_2border_below, enable);
+ setEnabled(longtable_options_->check_lt_foot, enable);
+ setEnabled(longtable_options_->check_foot_2border_above, enable);
+ setEnabled(longtable_options_->check_foot_2border_below, enable);
+ setEnabled(longtable_options_->check_lt_lastfoot, enable);
+ setEnabled(longtable_options_->check_lastfoot_2border_above, enable);
+ setEnabled(longtable_options_->check_lastfoot_2border_below, enable);
+ setEnabled(longtable_options_->check_lastfoot_empty, enable);
+ setEnabled(longtable_options_->check_lt_newpage, enable);
+
+ if (enable) {
+ LyXTabular::ltType ltt;
+ bool use_empty;
+ bool row_set = tabular.getRowOfLTHead(row, ltt);
+ fl_set_button(longtable_options_->check_lt_head, row_set);
+ if (ltt.set) {
+ fl_set_button(longtable_options_->check_head_2border_above,
+ ltt.topDL);
+ fl_set_button(longtable_options_->check_head_2border_below,
+ ltt.bottomDL);
+ use_empty = true;
+ } else {
+ setEnabled(longtable_options_->check_head_2border_above, 0);
+ setEnabled(longtable_options_->check_head_2border_below, 0);
+ fl_set_button(longtable_options_->check_head_2border_above,0);
+ fl_set_button(longtable_options_->check_head_2border_below,0);
+ fl_set_button(longtable_options_->check_1head_empty,0);
+ setEnabled(longtable_options_->check_1head_empty, 0);
+ use_empty = false;
+ }
+ //
+ row_set = tabular.getRowOfLTFirstHead(row, ltt);
+ fl_set_button(longtable_options_->check_lt_firsthead, row_set);
+ if (ltt.set && (!ltt.empty || !use_empty)) {
+ fl_set_button(longtable_options_->check_1head_2border_above,
+ ltt.topDL);
+ fl_set_button(longtable_options_->check_1head_2border_below,
+ ltt.bottomDL);
+ } else {
+ setEnabled(longtable_options_->check_1head_2border_above, 0);
+ setEnabled(longtable_options_->check_1head_2border_below, 0);
+ fl_set_button(longtable_options_->check_1head_2border_above,0);
+ fl_set_button(longtable_options_->check_1head_2border_below,0);
+ if (use_empty) {
+ fl_set_button(longtable_options_->check_1head_empty,ltt.empty);
+ if (ltt.empty)
+ setEnabled(longtable_options_->check_lt_firsthead, 0);
+ }
+ }
+ //
+ row_set = tabular.getRowOfLTFoot(row, ltt);
+ fl_set_button(longtable_options_->check_lt_foot, row_set);
+ if (ltt.set) {
+ fl_set_button(longtable_options_->check_foot_2border_above,
+ ltt.topDL);
+ fl_set_button(longtable_options_->check_foot_2border_below,
+ ltt.bottomDL);
+ use_empty = true;
+ } else {
+ setEnabled(longtable_options_->check_foot_2border_above, 0);
+ setEnabled(longtable_options_->check_foot_2border_below, 0);
+ fl_set_button(longtable_options_->check_foot_2border_above,0);
+ fl_set_button(longtable_options_->check_foot_2border_below,0);
+ fl_set_button(longtable_options_->check_lastfoot_empty, 0);
+ setEnabled(longtable_options_->check_lastfoot_empty, 0);
+ use_empty = false;
+ }
+ //
+ row_set = tabular.getRowOfLTLastFoot(row, ltt);
+ fl_set_button(longtable_options_->check_lt_lastfoot, row_set);
+ if (ltt.set && (!ltt.empty || !use_empty)) {
+ fl_set_button(longtable_options_->check_lastfoot_2border_above,
+ ltt.topDL);
+ fl_set_button(longtable_options_->check_lastfoot_2border_below,
+ ltt.bottomDL);
+ } else {
+ setEnabled(longtable_options_->check_lastfoot_2border_above,0);
+ setEnabled(longtable_options_->check_lastfoot_2border_below,0);
+ fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
+ fl_set_button(longtable_options_->check_lastfoot_2border_below, 0);
+ if (use_empty) {
+ fl_set_button(longtable_options_->check_lastfoot_empty,
+ ltt.empty);
+ if (ltt.empty)
+ setEnabled(longtable_options_->check_lt_lastfoot, 0);
+ }
+ }
+ fl_set_button(longtable_options_->check_lt_newpage,
+ tabular.getLTNewPage(row));
+ } else {
+ fl_set_button(longtable_options_->check_lt_firsthead, 0);
+ fl_set_button(longtable_options_->check_1head_2border_above, 0);
+ fl_set_button(longtable_options_->check_1head_2border_below, 0);
+ fl_set_button(longtable_options_->check_1head_empty, 0);
+ fl_set_button(longtable_options_->check_lt_head, 0);
+ fl_set_button(longtable_options_->check_head_2border_above, 0);
+ fl_set_button(longtable_options_->check_head_2border_below, 0);
+ fl_set_button(longtable_options_->check_lt_foot, 0);
+ fl_set_button(longtable_options_->check_foot_2border_above, 0);
+ fl_set_button(longtable_options_->check_foot_2border_below, 0);
+ fl_set_button(longtable_options_->check_lt_lastfoot, 0);
+ fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
+ fl_set_button(longtable_options_->check_lastfoot_2border_below, 0);
+ fl_set_button(longtable_options_->check_lastfoot_empty, 0);
+ fl_set_button(longtable_options_->check_lt_newpage, 0);
+ }
+ fl_set_button(tabular_options_->check_rotate_tabular,
+ tabular.getRotateTabular());