2002-03-11 17:00:41 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file FormTabular.C
|
2002-09-05 15:14:23 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2000-10-24 13:13:59 +00:00
|
|
|
|
*
|
2002-09-05 14:10:50 +00:00
|
|
|
|
* \author J<EFBFBD>rgen Vigna
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS
|
2000-07-11 15:08:54 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2001-03-15 13:37:04 +00:00
|
|
|
|
|
2002-11-15 02:44:20 +00:00
|
|
|
|
#include <vector>
|
|
|
|
|
#include <algorithm>
|
2002-12-01 22:59:25 +00:00
|
|
|
|
|
2002-11-15 02:44:20 +00:00
|
|
|
|
#include "ControlTabular.h"
|
|
|
|
|
#include "xformsBC.h"
|
2003-03-10 03:13:28 +00:00
|
|
|
|
#include "ButtonController.h"
|
2002-11-15 02:44:20 +00:00
|
|
|
|
#include "insets/insettabular.h"
|
2002-12-01 22:59:25 +00:00
|
|
|
|
|
2000-07-11 15:08:54 +00:00
|
|
|
|
#include "FormTabular.h"
|
2002-06-13 13:43:51 +00:00
|
|
|
|
#include "forms/form_tabular.h"
|
2002-11-15 02:44:20 +00:00
|
|
|
|
#include "debug.h"
|
2001-03-05 19:02:40 +00:00
|
|
|
|
#include "xforms_helpers.h"
|
2002-11-15 02:44:20 +00:00
|
|
|
|
#include "gettext.h"
|
|
|
|
|
#include "lyxrc.h"
|
2001-10-23 11:35:48 +00:00
|
|
|
|
#include "helper_funcs.h"
|
|
|
|
|
#include "input_validators.h"
|
|
|
|
|
#include "support/lstrings.h"
|
2000-07-11 15:08:54 +00:00
|
|
|
|
|
2003-05-14 09:17:22 +00:00
|
|
|
|
#include "lyx_forms.h"
|
2002-02-16 15:59:55 +00:00
|
|
|
|
|
|
|
|
|
using std::vector;
|
|
|
|
|
using std::bind2nd;
|
|
|
|
|
|
2000-07-11 15:08:54 +00:00
|
|
|
|
|
2003-04-09 21:34:50 +00:00
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
|
|
#if FL_VERSION == 0 || (FL_REVISION == 0 && FL_FIXLEVEL < 2)
|
|
|
|
|
bool const scalableTabfolders = false;
|
|
|
|
|
#else
|
|
|
|
|
bool const scalableTabfolders = true;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
} // namespace anon
|
|
|
|
|
|
|
|
|
|
|
2003-03-09 18:11:57 +00:00
|
|
|
|
typedef FormController<ControlTabular, FormView<FD_tabular> > base_class;
|
2002-11-15 02:44:20 +00:00
|
|
|
|
|
2003-03-09 18:11:57 +00:00
|
|
|
|
FormTabular::FormTabular(Dialog & parent)
|
2003-04-30 02:06:04 +00:00
|
|
|
|
: base_class(parent, _("Table Settings"), scalableTabfolders),
|
2002-11-15 02:44:20 +00:00
|
|
|
|
closing_(false), actCell_(-1)
|
2000-07-11 15:08:54 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-11-10 17:29:47 +00:00
|
|
|
|
void FormTabular::redraw()
|
|
|
|
|
{
|
2002-02-16 15:59:55 +00:00
|
|
|
|
if (form() && form()->visible)
|
2000-11-14 02:01:57 +00:00
|
|
|
|
fl_redraw_form(form());
|
2000-11-10 17:29:47 +00:00
|
|
|
|
else
|
|
|
|
|
return;
|
|
|
|
|
|
2002-03-12 14:11:15 +00:00
|
|
|
|
FL_FORM * outer_form = fl_get_active_folder(dialog_->tabfolder);
|
2000-11-10 17:29:47 +00:00
|
|
|
|
if (outer_form && outer_form->visible)
|
2000-11-14 02:01:57 +00:00
|
|
|
|
fl_redraw_form(outer_form);
|
2000-11-10 17:29:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-10-24 13:13:59 +00:00
|
|
|
|
void FormTabular::build()
|
2000-07-11 15:08:54 +00:00
|
|
|
|
{
|
2002-06-13 13:43:51 +00:00
|
|
|
|
dialog_.reset(build_tabular(this));
|
2002-03-11 18:24:31 +00:00
|
|
|
|
|
2002-03-20 17:53:39 +00:00
|
|
|
|
// Allow the base class to control messages
|
|
|
|
|
setMessageWidget(dialog_->text_warning);
|
|
|
|
|
|
2002-10-24 15:57:47 +00:00
|
|
|
|
// trigger an input event for cut&paste with middle mouse button.
|
2002-03-11 18:24:31 +00:00
|
|
|
|
setPrehandler(dialog_->input_tabular_column);
|
|
|
|
|
setPrehandler(dialog_->input_tabular_row);
|
|
|
|
|
|
2002-10-24 15:57:47 +00:00
|
|
|
|
// Create the contents of the unit choices; don't include the "%" terms.
|
|
|
|
|
vector<string> units_vec = getLatexUnits();
|
|
|
|
|
vector<string>::iterator ret =
|
|
|
|
|
remove_if(units_vec.begin(), units_vec.end(),
|
|
|
|
|
bind2nd(contains_functor(), "%"));
|
|
|
|
|
units_vec.erase(ret, units_vec.end());
|
|
|
|
|
string const units = getStringFromVector(units_vec, "|");
|
|
|
|
|
|
|
|
|
|
// tabular options form
|
2002-06-13 13:43:51 +00:00
|
|
|
|
tabular_options_.reset(build_tabular_options(this));
|
2002-10-24 15:57:47 +00:00
|
|
|
|
|
|
|
|
|
// column options form
|
2002-06-13 13:43:51 +00:00
|
|
|
|
column_options_.reset(build_tabular_column(this));
|
2000-10-24 13:13:59 +00:00
|
|
|
|
|
|
|
|
|
fl_set_input_return(column_options_->input_column_width,
|
2002-03-21 21:21:28 +00:00
|
|
|
|
FL_RETURN_END);
|
2000-10-24 13:13:59 +00:00
|
|
|
|
fl_set_input_return(column_options_->input_special_alignment,
|
2002-03-21 21:21:28 +00:00
|
|
|
|
FL_RETURN_END);
|
2002-03-11 18:24:31 +00:00
|
|
|
|
|
2002-10-24 15:57:47 +00:00
|
|
|
|
// trigger an input event for cut&paste with middle mouse button.
|
2002-03-11 18:24:31 +00:00
|
|
|
|
setPrehandler(column_options_->input_column_width);
|
|
|
|
|
setPrehandler(column_options_->input_special_alignment);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2002-10-24 15:57:47 +00:00
|
|
|
|
fl_addto_choice(column_options_->choice_value_column_width,
|
|
|
|
|
units.c_str());
|
|
|
|
|
|
|
|
|
|
// cell options form
|
|
|
|
|
cell_options_.reset(build_tabular_cell(this));
|
|
|
|
|
|
2000-10-24 13:13:59 +00:00
|
|
|
|
fl_set_input_return(cell_options_->input_mcolumn_width,
|
2002-03-21 21:21:28 +00:00
|
|
|
|
FL_RETURN_END);
|
2000-10-24 13:13:59 +00:00
|
|
|
|
fl_set_input_return(cell_options_->input_special_multialign,
|
2002-03-21 21:21:28 +00:00
|
|
|
|
FL_RETURN_END);
|
2000-10-24 13:13:59 +00:00
|
|
|
|
|
2002-10-24 15:57:47 +00:00
|
|
|
|
// trigger an input event for cut&paste with middle mouse button.
|
2002-03-11 18:24:31 +00:00
|
|
|
|
setPrehandler(cell_options_->input_mcolumn_width);
|
|
|
|
|
setPrehandler(cell_options_->input_special_multialign);
|
|
|
|
|
|
2002-10-24 15:57:47 +00:00
|
|
|
|
fl_addto_choice(cell_options_->choice_value_mcolumn_width,
|
|
|
|
|
units.c_str());
|
|
|
|
|
|
|
|
|
|
longtable_options_.reset(build_tabular_longtable(this));
|
|
|
|
|
|
2003-04-09 21:34:50 +00:00
|
|
|
|
// Enable the tabfolder to be rescaled correctly.
|
|
|
|
|
if (scalableTabfolders)
|
|
|
|
|
fl_set_tabfolder_autofit(dialog_->tabfolder, FL_FIT);
|
|
|
|
|
|
|
|
|
|
// Stack tabs
|
2003-05-19 21:08:58 +00:00
|
|
|
|
fl_addto_tabfolder(dialog_->tabfolder, _("Table").c_str(),
|
2002-03-21 21:21:28 +00:00
|
|
|
|
tabular_options_->form);
|
2003-05-19 21:08:58 +00:00
|
|
|
|
fl_addto_tabfolder(dialog_->tabfolder, _("Column/Row").c_str(),
|
2002-03-21 21:21:28 +00:00
|
|
|
|
column_options_->form);
|
2003-05-19 21:08:58 +00:00
|
|
|
|
fl_addto_tabfolder(dialog_->tabfolder, _("Cell").c_str(),
|
2002-03-21 21:21:28 +00:00
|
|
|
|
cell_options_->form);
|
2003-05-19 21:08:58 +00:00
|
|
|
|
fl_addto_tabfolder(dialog_->tabfolder, _("LongTable").c_str(),
|
2002-03-21 21:21:28 +00:00
|
|
|
|
longtable_options_->form);
|
2001-10-23 11:35:48 +00:00
|
|
|
|
|
2002-11-15 02:44:20 +00:00
|
|
|
|
// FIXME: addReadOnly everything
|
2000-07-11 15:08:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-10-24 13:13:59 +00:00
|
|
|
|
void FormTabular::update()
|
2000-07-11 15:08:54 +00:00
|
|
|
|
{
|
2002-01-07 09:50:19 +00:00
|
|
|
|
if (closing_)
|
|
|
|
|
return;
|
2002-12-01 22:59:25 +00:00
|
|
|
|
|
2003-03-09 10:08:22 +00:00
|
|
|
|
LyXTabular const & tabular = controller().tabular();
|
2002-12-01 22:59:25 +00:00
|
|
|
|
|
2001-04-04 21:58:35 +00:00
|
|
|
|
int align;
|
|
|
|
|
char buf[12];
|
2001-12-11 17:26:52 +00:00
|
|
|
|
LyXLength pwidth;
|
2001-04-04 21:58:35 +00:00
|
|
|
|
string special;
|
2000-10-24 13:13:59 +00:00
|
|
|
|
|
2003-03-09 10:08:22 +00:00
|
|
|
|
int const cell = controller().getActiveCell();
|
2001-04-04 21:58:35 +00:00
|
|
|
|
actCell_ = cell;
|
2003-03-09 10:08:22 +00:00
|
|
|
|
int column = tabular.column_of_cell(cell) + 1;
|
2002-03-20 17:53:39 +00:00
|
|
|
|
clearMessage();
|
2000-10-24 13:13:59 +00:00
|
|
|
|
fl_activate_object(column_options_->input_special_alignment);
|
|
|
|
|
fl_activate_object(cell_options_->input_special_multialign);
|
|
|
|
|
fl_activate_object(column_options_->input_column_width);
|
2001-10-23 11:35:48 +00:00
|
|
|
|
fl_activate_object(column_options_->choice_value_column_width);
|
2001-12-11 17:26:52 +00:00
|
|
|
|
sprintf(buf, "%d", column);
|
2000-10-24 13:13:59 +00:00
|
|
|
|
fl_set_input(dialog_->input_tabular_column, buf);
|
|
|
|
|
fl_deactivate_object(dialog_->input_tabular_column);
|
2003-03-09 10:08:22 +00:00
|
|
|
|
int row = tabular.row_of_cell(cell);
|
2001-12-19 16:13:21 +00:00
|
|
|
|
sprintf(buf, "%d", row + 1);
|
2000-10-24 13:13:59 +00:00
|
|
|
|
fl_set_input(dialog_->input_tabular_row, buf);
|
|
|
|
|
fl_deactivate_object(dialog_->input_tabular_row);
|
2003-03-09 10:08:22 +00:00
|
|
|
|
if (tabular.IsMultiColumn(cell)) {
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(cell_options_->check_multicolumn, 1);
|
|
|
|
|
fl_set_button(cell_options_->check_border_top,
|
2003-03-09 10:08:22 +00:00
|
|
|
|
tabular.TopLine(cell)?1:0);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
setEnabled(cell_options_->check_border_top, true);
|
|
|
|
|
fl_set_button(cell_options_->check_border_bottom,
|
2003-03-09 10:08:22 +00:00
|
|
|
|
tabular.BottomLine(cell)?1:0);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
setEnabled(cell_options_->check_border_bottom, true);
|
2002-03-18 15:27:41 +00:00
|
|
|
|
// 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.
|
2003-03-09 10:08:22 +00:00
|
|
|
|
if (tabular.IsFirstCellInRow(cell) ||
|
|
|
|
|
tabular.IsMultiColumn(cell-1)) {
|
2002-03-18 15:27:41 +00:00
|
|
|
|
fl_set_button(cell_options_->check_border_left,
|
2003-03-09 10:08:22 +00:00
|
|
|
|
tabular.LeftLine(cell)?1:0);
|
2002-03-18 15:27:41 +00:00
|
|
|
|
setEnabled(cell_options_->check_border_left, true);
|
|
|
|
|
} else {
|
|
|
|
|
fl_set_button(cell_options_->check_border_left, 0);
|
|
|
|
|
setEnabled(cell_options_->check_border_left, false);
|
|
|
|
|
}
|
2003-03-09 10:08:22 +00:00
|
|
|
|
if (tabular.IsLastCellInRow(cell) ||
|
|
|
|
|
tabular.IsMultiColumn(cell+1)) {
|
2002-03-18 15:27:41 +00:00
|
|
|
|
fl_set_button(cell_options_->check_border_right,
|
2003-03-09 10:08:22 +00:00
|
|
|
|
tabular.RightLine(cell)?1:0);
|
2002-03-18 15:27:41 +00:00
|
|
|
|
setEnabled(cell_options_->check_border_right, true);
|
|
|
|
|
} else {
|
|
|
|
|
fl_set_button(cell_options_->check_border_right, 0);
|
|
|
|
|
setEnabled(cell_options_->check_border_right, false);
|
|
|
|
|
}
|
2003-03-09 10:08:22 +00:00
|
|
|
|
pwidth = tabular.GetMColumnPWidth(cell);
|
|
|
|
|
align = tabular.GetAlignment(cell);
|
2003-01-06 14:02:24 +00:00
|
|
|
|
// set the horiz. alignment, default is left here
|
2003-01-08 09:03:32 +00:00
|
|
|
|
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);
|
2003-01-06 14:02:24 +00:00
|
|
|
|
if (align == LYX_ALIGN_RIGHT)
|
2000-10-24 13:13:59 +00:00
|
|
|
|
fl_set_button(cell_options_->radio_align_right, 1);
|
2003-01-06 14:02:24 +00:00
|
|
|
|
else if (align == LYX_ALIGN_CENTER)
|
2000-10-24 13:13:59 +00:00
|
|
|
|
fl_set_button(cell_options_->radio_align_center, 1);
|
2003-01-06 14:02:24 +00:00
|
|
|
|
else
|
|
|
|
|
fl_set_button(cell_options_->radio_align_left, 1);
|
2002-01-25 10:21:46 +00:00
|
|
|
|
|
2003-03-09 10:08:22 +00:00
|
|
|
|
align = tabular.GetVAlignment(cell);
|
2000-10-24 13:13:59 +00:00
|
|
|
|
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_center, 0);
|
2001-12-11 17:26:52 +00:00
|
|
|
|
if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
|
2000-10-24 13:13:59 +00:00
|
|
|
|
fl_set_button(cell_options_->radio_valign_center, 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);
|
2002-01-25 10:21:46 +00:00
|
|
|
|
|
2003-03-09 10:08:22 +00:00
|
|
|
|
special = tabular.GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
|
2000-10-24 13:13:59 +00:00
|
|
|
|
fl_set_input(cell_options_->input_special_multialign, special.c_str());
|
2003-03-09 10:08:22 +00:00
|
|
|
|
bool const metric(controller().useMetricUnits());
|
2002-02-20 14:48:59 +00:00
|
|
|
|
string const default_unit = metric ? "cm" : "in";
|
2001-12-11 17:26:52 +00:00
|
|
|
|
updateWidgetsFromLength(cell_options_->input_mcolumn_width,
|
2002-03-21 21:21:28 +00:00
|
|
|
|
cell_options_->choice_value_mcolumn_width,
|
|
|
|
|
pwidth, default_unit);
|
2001-10-23 11:35:48 +00:00
|
|
|
|
|
2003-01-06 14:02:24 +00:00
|
|
|
|
if (!bc().bp().isReadOnly()) {
|
2001-03-05 19:02:40 +00:00
|
|
|
|
setEnabled(cell_options_->input_special_multialign, true);
|
|
|
|
|
setEnabled(cell_options_->input_mcolumn_width, true);
|
2001-10-23 11:35:48 +00:00
|
|
|
|
setEnabled(cell_options_->choice_value_mcolumn_width, true);
|
2000-10-24 13:13:59 +00:00
|
|
|
|
}
|
2001-03-05 19:02:40 +00:00
|
|
|
|
|
2001-12-11 17:26:52 +00:00
|
|
|
|
setEnabled(cell_options_->radio_valign_top, !pwidth.zero());
|
|
|
|
|
setEnabled(cell_options_->radio_valign_bottom, !pwidth.zero());
|
|
|
|
|
setEnabled(cell_options_->radio_valign_center, !pwidth.zero());
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2002-09-06 13:41:19 +00:00
|
|
|
|
setEnabled(cell_options_->radio_align_left, true);
|
|
|
|
|
setEnabled(cell_options_->radio_align_right, true);
|
|
|
|
|
setEnabled(cell_options_->radio_align_center, true);
|
2000-10-24 13:13:59 +00:00
|
|
|
|
} else {
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(cell_options_->check_multicolumn, 0);
|
2001-03-05 19:02:40 +00:00
|
|
|
|
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(cell_options_->check_border_top, 0);
|
|
|
|
|
setEnabled(cell_options_->check_border_top, false);
|
2001-03-05 19:02:40 +00:00
|
|
|
|
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(cell_options_->check_border_bottom, 0);
|
|
|
|
|
setEnabled(cell_options_->check_border_bottom, false);
|
2001-03-05 19:02:40 +00:00
|
|
|
|
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(cell_options_->check_border_left, 0);
|
|
|
|
|
setEnabled(cell_options_->check_border_left, false);
|
2001-03-05 19:02:40 +00:00
|
|
|
|
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(cell_options_->check_border_right, 0);
|
|
|
|
|
setEnabled(cell_options_->check_border_right, false);
|
2001-03-05 19:02:40 +00:00
|
|
|
|
|
2000-10-24 13:13:59 +00:00
|
|
|
|
fl_set_button(cell_options_->radio_align_left, 0);
|
2001-03-05 19:02:40 +00:00
|
|
|
|
setEnabled(cell_options_->radio_align_left, false);
|
|
|
|
|
|
2000-10-24 13:13:59 +00:00
|
|
|
|
fl_set_button(cell_options_->radio_align_right, 0);
|
2001-03-05 19:02:40 +00:00
|
|
|
|
setEnabled(cell_options_->radio_align_right, false);
|
|
|
|
|
|
2000-10-24 13:13:59 +00:00
|
|
|
|
fl_set_button(cell_options_->radio_align_center, 0);
|
2001-03-05 19:02:40 +00:00
|
|
|
|
setEnabled(cell_options_->radio_align_center, false);
|
|
|
|
|
|
2000-10-24 13:13:59 +00:00
|
|
|
|
fl_set_button(cell_options_->radio_valign_top, 0);
|
2001-03-05 19:02:40 +00:00
|
|
|
|
setEnabled(cell_options_->radio_valign_top, false);
|
|
|
|
|
|
2000-10-24 13:13:59 +00:00
|
|
|
|
fl_set_button(cell_options_->radio_valign_bottom, 0);
|
2001-03-05 19:02:40 +00:00
|
|
|
|
setEnabled(cell_options_->radio_valign_bottom, false);
|
|
|
|
|
|
2000-10-24 13:13:59 +00:00
|
|
|
|
fl_set_button(cell_options_->radio_valign_center, 0);
|
2001-03-05 19:02:40 +00:00
|
|
|
|
setEnabled(cell_options_->radio_valign_center, false);
|
|
|
|
|
|
2000-10-24 13:13:59 +00:00
|
|
|
|
fl_set_input(cell_options_->input_special_multialign, "");
|
2001-03-05 19:02:40 +00:00
|
|
|
|
setEnabled(cell_options_->input_special_multialign, false);
|
|
|
|
|
|
|
|
|
|
fl_set_input(cell_options_->input_mcolumn_width, "");
|
|
|
|
|
setEnabled(cell_options_->input_mcolumn_width, false);
|
2001-10-23 11:35:48 +00:00
|
|
|
|
setEnabled(cell_options_->choice_value_mcolumn_width, false);
|
2000-10-24 13:13:59 +00:00
|
|
|
|
}
|
2003-03-09 10:08:22 +00:00
|
|
|
|
if (tabular.GetRotateCell(cell))
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(cell_options_->check_rotate_cell, 1);
|
2000-10-24 13:13:59 +00:00
|
|
|
|
else
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(cell_options_->check_rotate_cell, 0);
|
2003-03-09 10:08:22 +00:00
|
|
|
|
if (tabular.TopLine(cell, true))
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(column_options_->check_border_top, 1);
|
2000-10-24 13:13:59 +00:00
|
|
|
|
else
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(column_options_->check_border_top, 0);
|
2003-03-09 10:08:22 +00:00
|
|
|
|
if (tabular.BottomLine(cell, true))
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(column_options_->check_border_bottom, 1);
|
2000-10-24 13:13:59 +00:00
|
|
|
|
else
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(column_options_->check_border_bottom, 0);
|
2003-03-09 10:08:22 +00:00
|
|
|
|
if (tabular.LeftLine(cell, true))
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(column_options_->check_border_left, 1);
|
2000-10-24 13:13:59 +00:00
|
|
|
|
else
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(column_options_->check_border_left, 0);
|
2003-03-09 10:08:22 +00:00
|
|
|
|
if (tabular.RightLine(cell, true))
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(column_options_->check_border_right, 1);
|
2000-10-24 13:13:59 +00:00
|
|
|
|
else
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(column_options_->check_border_right, 0);
|
2003-03-09 10:08:22 +00:00
|
|
|
|
special = tabular.GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
|
2000-10-24 13:13:59 +00:00
|
|
|
|
fl_set_input(column_options_->input_special_alignment, special.c_str());
|
2001-03-05 19:02:40 +00:00
|
|
|
|
|
2002-11-15 02:44:20 +00:00
|
|
|
|
bool const isReadonly = bc().bp().isReadOnly();
|
2001-03-05 19:02:40 +00:00
|
|
|
|
setEnabled(column_options_->input_special_alignment, !isReadonly);
|
|
|
|
|
|
2003-03-09 10:08:22 +00:00
|
|
|
|
pwidth = tabular.GetColumnPWidth(cell);
|
|
|
|
|
bool const metric = controller().useMetricUnits();
|
2002-01-16 16:34:03 +00:00
|
|
|
|
string const default_unit = metric ? "cm" : "in";
|
2001-12-11 17:26:52 +00:00
|
|
|
|
updateWidgetsFromLength(column_options_->input_column_width,
|
2002-03-21 21:21:28 +00:00
|
|
|
|
column_options_->choice_value_column_width,
|
|
|
|
|
pwidth, default_unit);
|
2001-03-05 19:02:40 +00:00
|
|
|
|
setEnabled(column_options_->input_column_width, !isReadonly);
|
2001-10-23 11:35:48 +00:00
|
|
|
|
setEnabled(column_options_->choice_value_column_width, !isReadonly);
|
2001-03-05 19:02:40 +00:00
|
|
|
|
|
2002-03-12 14:11:15 +00:00
|
|
|
|
setEnabled(cell_options_->check_useminipage, !pwidth.zero());
|
2001-12-11 17:26:52 +00:00
|
|
|
|
if (!pwidth.zero()) {
|
2003-03-09 10:08:22 +00:00
|
|
|
|
if (tabular.GetUsebox(cell) == 2)
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(cell_options_->check_useminipage, 1);
|
2000-10-24 13:13:59 +00:00
|
|
|
|
else
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(cell_options_->check_useminipage, 0);
|
2000-10-24 13:13:59 +00:00
|
|
|
|
} else {
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(cell_options_->check_useminipage, 0);
|
2000-10-24 13:13:59 +00:00
|
|
|
|
}
|
2003-03-09 10:08:22 +00:00
|
|
|
|
align = tabular.GetAlignment(cell, true);
|
2000-10-24 13:13:59 +00:00
|
|
|
|
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);
|
2002-11-21 12:24:50 +00:00
|
|
|
|
fl_set_button(column_options_->radio_align_block, 0);
|
2002-09-06 13:41:19 +00:00
|
|
|
|
if (align == LYX_ALIGN_LEFT)
|
2000-10-24 13:13:59 +00:00
|
|
|
|
fl_set_button(column_options_->radio_align_left, 1);
|
2000-07-17 14:31:07 +00:00
|
|
|
|
else if (align == LYX_ALIGN_RIGHT)
|
2000-10-24 13:13:59 +00:00
|
|
|
|
fl_set_button(column_options_->radio_align_right, 1);
|
2002-11-21 12:24:50 +00:00
|
|
|
|
else if (align == LYX_ALIGN_CENTER)
|
2000-10-24 13:13:59 +00:00
|
|
|
|
fl_set_button(column_options_->radio_align_center, 1);
|
2002-11-21 12:24:50 +00:00
|
|
|
|
else
|
|
|
|
|
fl_set_button(column_options_->radio_align_block, 1);
|
2003-03-09 10:08:22 +00:00
|
|
|
|
align = tabular.GetVAlignment(cell, true);
|
2000-10-24 13:13:59 +00:00
|
|
|
|
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_center, 0);
|
2001-12-11 17:26:52 +00:00
|
|
|
|
if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
|
2000-10-24 13:13:59 +00:00
|
|
|
|
fl_set_button(column_options_->radio_valign_center, 1);
|
2000-07-17 14:31:07 +00:00
|
|
|
|
else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
|
2000-10-24 13:13:59 +00:00
|
|
|
|
fl_set_button(column_options_->radio_valign_bottom, 1);
|
2000-07-17 14:31:07 +00:00
|
|
|
|
else
|
2000-10-24 13:13:59 +00:00
|
|
|
|
fl_set_button(column_options_->radio_valign_top, 1);
|
2001-03-05 19:02:40 +00:00
|
|
|
|
|
2002-09-06 13:41:19 +00:00
|
|
|
|
setEnabled(column_options_->radio_align_left, true);
|
|
|
|
|
setEnabled(column_options_->radio_align_right, true);
|
|
|
|
|
setEnabled(column_options_->radio_align_center, true);
|
2002-11-21 12:24:50 +00:00
|
|
|
|
setEnabled(column_options_->radio_align_block, !pwidth.zero());
|
2001-12-11 17:26:52 +00:00
|
|
|
|
setEnabled(column_options_->radio_valign_top, !pwidth.zero());
|
|
|
|
|
setEnabled(column_options_->radio_valign_bottom, !pwidth.zero());
|
|
|
|
|
setEnabled(column_options_->radio_valign_center, !pwidth.zero());
|
2001-03-05 19:02:40 +00:00
|
|
|
|
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(tabular_options_->check_longtable,
|
2003-03-09 10:08:22 +00:00
|
|
|
|
tabular.IsLongTabular());
|
2001-03-05 19:02:40 +00:00
|
|
|
|
|
2003-03-09 10:08:22 +00:00
|
|
|
|
bool const enable = tabular.IsLongTabular();
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2002-03-12 14:11:15 +00:00
|
|
|
|
setEnabled(longtable_options_->check_lt_firsthead, enable);
|
2001-12-19 16:13:21 +00:00
|
|
|
|
setEnabled(longtable_options_->check_1head_2border_above, enable);
|
|
|
|
|
setEnabled(longtable_options_->check_1head_2border_below, enable);
|
|
|
|
|
setEnabled(longtable_options_->check_1head_empty, enable);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
setEnabled(longtable_options_->check_lt_head, enable);
|
2001-12-19 16:13:21 +00:00
|
|
|
|
setEnabled(longtable_options_->check_head_2border_above, enable);
|
|
|
|
|
setEnabled(longtable_options_->check_head_2border_below, enable);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
setEnabled(longtable_options_->check_lt_foot, enable);
|
2001-12-19 16:13:21 +00:00
|
|
|
|
setEnabled(longtable_options_->check_foot_2border_above, enable);
|
|
|
|
|
setEnabled(longtable_options_->check_foot_2border_below, enable);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
setEnabled(longtable_options_->check_lt_lastfoot, enable);
|
2001-12-19 16:13:21 +00:00
|
|
|
|
setEnabled(longtable_options_->check_lastfoot_2border_above, enable);
|
|
|
|
|
setEnabled(longtable_options_->check_lastfoot_2border_below, enable);
|
|
|
|
|
setEnabled(longtable_options_->check_lastfoot_empty, enable);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
setEnabled(longtable_options_->check_lt_newpage, enable);
|
2001-03-05 19:02:40 +00:00
|
|
|
|
|
|
|
|
|
if (enable) {
|
2001-12-19 16:13:21 +00:00
|
|
|
|
LyXTabular::ltType ltt;
|
2001-12-19 21:25:34 +00:00
|
|
|
|
bool use_empty;
|
2003-03-09 10:08:22 +00:00
|
|
|
|
bool row_set = tabular.GetRowOfLTHead(row, ltt);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_lt_head, row_set);
|
2001-12-20 14:52:15 +00:00
|
|
|
|
if (ltt.set) {
|
2001-12-19 16:13:21 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_head_2border_above,
|
2002-03-21 21:21:28 +00:00
|
|
|
|
ltt.topDL);
|
2002-11-26 10:53:37 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_head_2border_below,
|
|
|
|
|
ltt.bottomDL);
|
2001-12-19 21:25:34 +00:00
|
|
|
|
use_empty = true;
|
2001-12-19 16:13:21 +00:00
|
|
|
|
} 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);
|
2002-11-26 10:53:37 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_head_2border_below,0);
|
2001-12-19 21:25:34 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_1head_empty,0);
|
|
|
|
|
setEnabled(longtable_options_->check_1head_empty, 0);
|
|
|
|
|
use_empty = false;
|
|
|
|
|
}
|
|
|
|
|
//
|
2003-03-09 10:08:22 +00:00
|
|
|
|
row_set = tabular.GetRowOfLTFirstHead(row, ltt);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_lt_firsthead, row_set);
|
2001-12-20 14:52:15 +00:00
|
|
|
|
if (ltt.set && (!ltt.empty || !use_empty)) {
|
2001-12-19 21:25:34 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_1head_2border_above,
|
2002-03-21 21:21:28 +00:00
|
|
|
|
ltt.topDL);
|
2002-11-26 10:53:37 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_1head_2border_below,
|
|
|
|
|
ltt.bottomDL);
|
2001-12-19 21:25:34 +00:00
|
|
|
|
} 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);
|
2002-11-26 10:53:37 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_1head_2border_below,0);
|
2001-12-19 21:25:34 +00:00
|
|
|
|
if (use_empty) {
|
|
|
|
|
fl_set_button(longtable_options_->check_1head_empty,ltt.empty);
|
|
|
|
|
if (ltt.empty)
|
2002-03-12 14:11:15 +00:00
|
|
|
|
setEnabled(longtable_options_->check_lt_firsthead, 0);
|
2001-12-19 21:25:34 +00:00
|
|
|
|
}
|
2001-12-19 16:13:21 +00:00
|
|
|
|
}
|
2001-12-19 21:25:34 +00:00
|
|
|
|
//
|
2003-03-09 10:08:22 +00:00
|
|
|
|
row_set = tabular.GetRowOfLTFoot(row, ltt);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_lt_foot, row_set);
|
2001-12-20 14:52:15 +00:00
|
|
|
|
if (ltt.set) {
|
2001-12-19 16:13:21 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_foot_2border_above,
|
2002-03-21 21:21:28 +00:00
|
|
|
|
ltt.topDL);
|
2002-11-26 10:53:37 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_foot_2border_below,
|
|
|
|
|
ltt.bottomDL);
|
2001-12-19 21:25:34 +00:00
|
|
|
|
use_empty = true;
|
2001-12-19 16:13:21 +00:00
|
|
|
|
} 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);
|
2002-11-26 10:53:37 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_foot_2border_below,0);
|
2001-12-19 21:25:34 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_lastfoot_empty, 0);
|
|
|
|
|
setEnabled(longtable_options_->check_lastfoot_empty, 0);
|
|
|
|
|
use_empty = false;
|
2001-12-19 16:13:21 +00:00
|
|
|
|
}
|
2001-12-19 21:25:34 +00:00
|
|
|
|
//
|
2003-03-09 10:08:22 +00:00
|
|
|
|
row_set = tabular.GetRowOfLTLastFoot(row, ltt);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_lt_lastfoot, row_set);
|
2001-12-20 14:52:15 +00:00
|
|
|
|
if (ltt.set && (!ltt.empty || !use_empty)) {
|
2001-12-19 16:13:21 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_lastfoot_2border_above,
|
2002-03-21 21:21:28 +00:00
|
|
|
|
ltt.topDL);
|
2002-11-26 10:53:37 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_lastfoot_2border_below,
|
|
|
|
|
ltt.bottomDL);
|
2001-12-19 16:13:21 +00:00
|
|
|
|
} 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);
|
2002-11-26 10:53:37 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_lastfoot_2border_below, 0);
|
2001-12-19 21:25:34 +00:00
|
|
|
|
if (use_empty) {
|
|
|
|
|
fl_set_button(longtable_options_->check_lastfoot_empty,
|
2002-03-21 21:21:28 +00:00
|
|
|
|
ltt.empty);
|
2001-12-19 21:25:34 +00:00
|
|
|
|
if (ltt.empty)
|
2002-03-12 14:11:15 +00:00
|
|
|
|
setEnabled(longtable_options_->check_lt_lastfoot, 0);
|
2001-12-19 21:25:34 +00:00
|
|
|
|
}
|
2001-12-19 16:13:21 +00:00
|
|
|
|
}
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_lt_newpage,
|
2003-03-09 10:08:22 +00:00
|
|
|
|
tabular.GetLTNewPage(row));
|
2000-10-24 13:13:59 +00:00
|
|
|
|
} else {
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_lt_firsthead, 0);
|
2001-12-19 16:13:21 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_1head_2border_above, 0);
|
2002-11-26 10:53:37 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_1head_2border_below, 0);
|
2001-12-19 16:13:21 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_1head_empty, 0);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_lt_head, 0);
|
2001-12-19 16:13:21 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_head_2border_above, 0);
|
2002-11-26 10:53:37 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_head_2border_below, 0);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_lt_foot, 0);
|
2001-12-19 16:13:21 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_foot_2border_above, 0);
|
2002-11-26 10:53:37 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_foot_2border_below, 0);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_lt_lastfoot, 0);
|
2001-12-19 16:13:21 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
|
2002-11-26 10:53:37 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_lastfoot_2border_below, 0);
|
2001-12-19 16:13:21 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_lastfoot_empty, 0);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(longtable_options_->check_lt_newpage, 0);
|
2000-10-24 13:13:59 +00:00
|
|
|
|
}
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_set_button(tabular_options_->check_rotate_tabular,
|
2003-03-09 10:08:22 +00:00
|
|
|
|
tabular.GetRotateTabular());
|
2000-07-11 15:08:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-04-04 21:58:35 +00:00
|
|
|
|
|
2002-11-15 02:44:20 +00:00
|
|
|
|
ButtonPolicy::SMInput FormTabular::input(FL_OBJECT * ob, long)
|
2000-07-13 15:03:34 +00:00
|
|
|
|
{
|
2002-02-20 14:48:59 +00:00
|
|
|
|
int s;
|
|
|
|
|
LyXTabular::Feature num = LyXTabular::LAST_ACTION;
|
2002-11-15 02:44:20 +00:00
|
|
|
|
string special;
|
2002-02-20 14:48:59 +00:00
|
|
|
|
|
2003-03-09 10:08:22 +00:00
|
|
|
|
LyXTabular const & tabular = controller().tabular();
|
2002-12-01 22:59:25 +00:00
|
|
|
|
|
2003-03-09 10:08:22 +00:00
|
|
|
|
int const cell = controller().getActiveCell();
|
2002-02-20 14:48:59 +00:00
|
|
|
|
|
|
|
|
|
// ugly hack to auto-apply the stuff that hasn't been
|
|
|
|
|
// yet. don't let this continue to exist ...
|
|
|
|
|
if (ob == dialog_->button_close) {
|
|
|
|
|
closing_ = true;
|
2003-06-03 23:39:38 +00:00
|
|
|
|
string w1 =
|
2002-02-20 14:48:59 +00:00
|
|
|
|
getLengthFromWidgets(column_options_->input_column_width,
|
2002-03-21 16:59:12 +00:00
|
|
|
|
column_options_->choice_value_column_width);
|
2003-06-03 23:39:38 +00:00
|
|
|
|
string w2;
|
2003-03-09 10:08:22 +00:00
|
|
|
|
LyXLength llen = tabular.GetColumnPWidth(cell);
|
2002-02-20 14:48:59 +00:00
|
|
|
|
if (!llen.zero())
|
2003-06-03 23:39:38 +00:00
|
|
|
|
w2 = llen.asString();
|
|
|
|
|
|
|
|
|
|
string mw1 = getLengthFromWidgets(cell_options_->input_mcolumn_width,
|
2002-03-21 21:21:28 +00:00
|
|
|
|
cell_options_->choice_value_mcolumn_width);
|
2003-03-09 10:08:22 +00:00
|
|
|
|
llen = tabular.GetMColumnPWidth(cell);
|
2003-06-03 23:39:38 +00:00
|
|
|
|
string mw2;
|
2002-02-20 14:48:59 +00:00
|
|
|
|
if (llen.zero())
|
2003-06-03 23:39:38 +00:00
|
|
|
|
mw2 = "";
|
2002-02-20 14:48:59 +00:00
|
|
|
|
else
|
2003-06-03 23:39:38 +00:00
|
|
|
|
mw2 = llen.asString();
|
|
|
|
|
|
|
|
|
|
string al1 = getString(column_options_->input_special_alignment);
|
|
|
|
|
string al2 = tabular.GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
|
|
|
|
|
string mal1 = getString(cell_options_->input_special_multialign);
|
|
|
|
|
string mal2 = tabular.GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
|
|
|
|
|
|
|
|
|
|
// we must do these all at the end
|
|
|
|
|
if (w1 != w2)
|
|
|
|
|
input(column_options_->input_column_width, 0);
|
|
|
|
|
if (mw1 != mw2)
|
2002-02-20 14:48:59 +00:00
|
|
|
|
input(cell_options_->input_mcolumn_width, 0);
|
2003-06-03 23:39:38 +00:00
|
|
|
|
if (al1 != al2)
|
2002-02-20 14:48:59 +00:00
|
|
|
|
input(column_options_->input_special_alignment, 0);
|
2003-06-03 23:39:38 +00:00
|
|
|
|
if (mal1 != mal2)
|
2002-02-20 14:48:59 +00:00
|
|
|
|
input(cell_options_->input_special_multialign, 0);
|
|
|
|
|
closing_ = false;
|
2003-03-09 18:11:57 +00:00
|
|
|
|
dialog().OKButton();
|
2002-11-15 02:44:20 +00:00
|
|
|
|
return ButtonPolicy::SMI_VALID;
|
2002-02-20 14:48:59 +00:00
|
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2002-02-20 14:48:59 +00:00
|
|
|
|
if (actCell_ != cell) {
|
|
|
|
|
update();
|
2002-03-20 17:53:39 +00:00
|
|
|
|
postWarning(_("Wrong Cursor position, updated window"));
|
2002-11-15 02:44:20 +00:00
|
|
|
|
return ButtonPolicy::SMI_VALID;
|
2002-02-20 14:48:59 +00:00
|
|
|
|
}
|
2002-12-01 22:59:25 +00:00
|
|
|
|
|
2002-02-20 14:48:59 +00:00
|
|
|
|
// No point in processing directives that you can't do anything with
|
|
|
|
|
// anyhow, so exit now if the buffer is read-only.
|
2002-11-15 02:44:20 +00:00
|
|
|
|
if (bc().bp().isReadOnly()) {
|
2002-03-21 16:59:12 +00:00
|
|
|
|
update();
|
2002-11-15 02:44:20 +00:00
|
|
|
|
return ButtonPolicy::SMI_VALID;
|
2002-01-16 16:34:03 +00:00
|
|
|
|
}
|
2002-12-01 22:59:25 +00:00
|
|
|
|
|
2002-03-21 16:59:12 +00:00
|
|
|
|
if ((ob == column_options_->input_column_width) ||
|
|
|
|
|
(ob == column_options_->choice_value_column_width)) {
|
|
|
|
|
string const str =
|
|
|
|
|
getLengthFromWidgets(column_options_->input_column_width,
|
|
|
|
|
column_options_->choice_value_column_width);
|
2002-11-15 02:44:20 +00:00
|
|
|
|
controller().set(LyXTabular::SET_PWIDTH, str);
|
2002-03-20 17:53:39 +00:00
|
|
|
|
|
2002-03-21 16:59:12 +00:00
|
|
|
|
//check if the input is valid
|
2002-10-24 15:57:47 +00:00
|
|
|
|
string const input = getString(column_options_->input_column_width);
|
2002-03-21 16:59:12 +00:00
|
|
|
|
if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
|
|
|
|
|
postWarning(_("Invalid Length (valid example: 10mm)"));
|
2002-11-15 02:44:20 +00:00
|
|
|
|
return ButtonPolicy::SMI_INVALID;
|
2002-03-21 16:59:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
update(); // update for alignment
|
2002-11-15 02:44:20 +00:00
|
|
|
|
return ButtonPolicy::SMI_VALID;
|
2002-02-20 14:48:59 +00:00
|
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2002-02-20 14:48:59 +00:00
|
|
|
|
if ((ob == cell_options_->input_mcolumn_width) ||
|
2002-03-21 16:59:12 +00:00
|
|
|
|
(ob == cell_options_->choice_value_mcolumn_width)) {
|
2002-02-20 14:48:59 +00:00
|
|
|
|
string const str =
|
|
|
|
|
getLengthFromWidgets(cell_options_->input_mcolumn_width,
|
2002-03-21 16:59:12 +00:00
|
|
|
|
cell_options_->choice_value_mcolumn_width);
|
2002-11-15 02:44:20 +00:00
|
|
|
|
controller().set(LyXTabular::SET_MPWIDTH, str);
|
2002-02-20 14:48:59 +00:00
|
|
|
|
|
|
|
|
|
//check if the input is valid
|
2002-10-24 15:57:47 +00:00
|
|
|
|
string const input = getString(cell_options_->input_mcolumn_width);
|
2002-02-20 14:48:59 +00:00
|
|
|
|
if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
|
2002-03-20 17:53:39 +00:00
|
|
|
|
postWarning(_("Invalid Length (valid example: 10mm)"));
|
2002-11-15 02:44:20 +00:00
|
|
|
|
return ButtonPolicy::SMI_INVALID;
|
2002-02-20 14:48:59 +00:00
|
|
|
|
}
|
|
|
|
|
update(); // update for alignment
|
2002-11-15 02:44:20 +00:00
|
|
|
|
return ButtonPolicy::SMI_VALID;
|
2002-01-16 16:34:03 +00:00
|
|
|
|
}
|
2002-02-20 14:48:59 +00:00
|
|
|
|
|
|
|
|
|
if (ob == tabular_options_->button_append_row)
|
|
|
|
|
num = LyXTabular::APPEND_ROW;
|
|
|
|
|
else if (ob == tabular_options_->button_append_column)
|
|
|
|
|
num = LyXTabular::APPEND_COLUMN;
|
|
|
|
|
else if (ob == tabular_options_->button_delete_row)
|
|
|
|
|
num = LyXTabular::DELETE_ROW;
|
|
|
|
|
else if (ob == tabular_options_->button_delete_column)
|
|
|
|
|
num = LyXTabular::DELETE_COLUMN;
|
|
|
|
|
else if (ob == tabular_options_->button_set_borders)
|
|
|
|
|
num = LyXTabular::SET_ALL_LINES;
|
|
|
|
|
else if (ob == tabular_options_->button_unset_borders)
|
|
|
|
|
num = LyXTabular::UNSET_ALL_LINES;
|
2002-03-12 14:11:15 +00:00
|
|
|
|
else if (ob == column_options_->check_border_top)
|
2002-02-20 14:48:59 +00:00
|
|
|
|
num = LyXTabular::TOGGLE_LINE_TOP;
|
2002-03-12 14:11:15 +00:00
|
|
|
|
else if (ob == column_options_->check_border_bottom)
|
2002-02-20 14:48:59 +00:00
|
|
|
|
num = LyXTabular::TOGGLE_LINE_BOTTOM;
|
2002-03-12 14:11:15 +00:00
|
|
|
|
else if (ob == column_options_->check_border_left)
|
2002-02-20 14:48:59 +00:00
|
|
|
|
num = LyXTabular::TOGGLE_LINE_LEFT;
|
2002-03-12 14:11:15 +00:00
|
|
|
|
else if (ob == column_options_->check_border_right)
|
2002-02-20 14:48:59 +00:00
|
|
|
|
num = LyXTabular::TOGGLE_LINE_RIGHT;
|
|
|
|
|
else if (ob == column_options_->radio_align_left)
|
|
|
|
|
num = LyXTabular::ALIGN_LEFT;
|
|
|
|
|
else if (ob == column_options_->radio_align_right)
|
|
|
|
|
num = LyXTabular::ALIGN_RIGHT;
|
|
|
|
|
else if (ob == column_options_->radio_align_center)
|
|
|
|
|
num = LyXTabular::ALIGN_CENTER;
|
2002-11-21 12:24:50 +00:00
|
|
|
|
else if (ob == column_options_->radio_align_block)
|
|
|
|
|
num = LyXTabular::ALIGN_BLOCK;
|
2002-02-20 14:48:59 +00:00
|
|
|
|
else if (ob == column_options_->radio_valign_top)
|
|
|
|
|
num = LyXTabular::VALIGN_TOP;
|
|
|
|
|
else if (ob == column_options_->radio_valign_bottom)
|
|
|
|
|
num = LyXTabular::VALIGN_BOTTOM;
|
|
|
|
|
else if (ob == column_options_->radio_valign_center)
|
|
|
|
|
num = LyXTabular::VALIGN_CENTER;
|
2002-03-12 14:11:15 +00:00
|
|
|
|
else if (ob == cell_options_->check_multicolumn)
|
2002-02-20 14:48:59 +00:00
|
|
|
|
num = LyXTabular::MULTICOLUMN;
|
2002-03-12 14:11:15 +00:00
|
|
|
|
else if (ob == tabular_options_->check_longtable) {
|
|
|
|
|
if (fl_get_button(tabular_options_->check_longtable))
|
2002-03-21 16:59:12 +00:00
|
|
|
|
num = LyXTabular::SET_LONGTABULAR;
|
2001-10-24 15:07:39 +00:00
|
|
|
|
else
|
2001-12-19 16:13:21 +00:00
|
|
|
|
num = LyXTabular::UNSET_LONGTABULAR;
|
2002-03-12 14:11:15 +00:00
|
|
|
|
} else if (ob == tabular_options_->check_rotate_tabular) {
|
|
|
|
|
s = fl_get_button(tabular_options_->check_rotate_tabular);
|
2001-12-19 16:13:21 +00:00
|
|
|
|
if (s)
|
|
|
|
|
num = LyXTabular::SET_ROTATE_TABULAR;
|
2001-10-24 15:07:39 +00:00
|
|
|
|
else
|
2001-12-19 16:13:21 +00:00
|
|
|
|
num = LyXTabular::UNSET_ROTATE_TABULAR;
|
2002-03-12 14:11:15 +00:00
|
|
|
|
} else if (ob == cell_options_->check_rotate_cell) {
|
|
|
|
|
s = fl_get_button(cell_options_->check_rotate_cell);
|
2001-12-19 16:13:21 +00:00
|
|
|
|
if (s)
|
|
|
|
|
num = LyXTabular::SET_ROTATE_CELL;
|
2001-10-24 15:07:39 +00:00
|
|
|
|
else
|
2001-12-19 16:13:21 +00:00
|
|
|
|
num = LyXTabular::UNSET_ROTATE_CELL;
|
2002-03-12 14:11:15 +00:00
|
|
|
|
} else if (ob == cell_options_->check_useminipage) {
|
2001-12-19 16:13:21 +00:00
|
|
|
|
num = LyXTabular::SET_USEBOX;
|
|
|
|
|
special = "2";
|
2002-03-12 14:11:15 +00:00
|
|
|
|
} else if ((ob == longtable_options_->check_lt_firsthead) ||
|
2002-03-21 21:21:28 +00:00
|
|
|
|
(ob == longtable_options_->check_1head_2border_above) ||
|
|
|
|
|
(ob == longtable_options_->check_1head_2border_below) ||
|
|
|
|
|
(ob == longtable_options_->check_1head_empty) ||
|
|
|
|
|
(ob == longtable_options_->check_lt_head) ||
|
|
|
|
|
(ob == longtable_options_->check_head_2border_above) ||
|
|
|
|
|
(ob == longtable_options_->check_head_2border_below) ||
|
|
|
|
|
(ob == longtable_options_->check_lt_foot) ||
|
|
|
|
|
(ob == longtable_options_->check_foot_2border_above) ||
|
|
|
|
|
(ob == longtable_options_->check_foot_2border_below) ||
|
|
|
|
|
(ob == longtable_options_->check_lt_lastfoot) ||
|
|
|
|
|
(ob == longtable_options_->check_lastfoot_2border_above) ||
|
|
|
|
|
(ob == longtable_options_->check_lastfoot_2border_below) ||
|
|
|
|
|
(ob == longtable_options_->check_lastfoot_empty)) {
|
2001-12-19 16:13:21 +00:00
|
|
|
|
num = static_cast<LyXTabular::Feature>(checkLongtableOptions(ob, special));
|
2002-03-12 14:11:15 +00:00
|
|
|
|
} else if (ob == longtable_options_->check_lt_newpage) {
|
2002-02-20 14:48:59 +00:00
|
|
|
|
num = LyXTabular::SET_LTNEWPAGE;
|
|
|
|
|
} else if (ob == column_options_->input_special_alignment) {
|
2002-10-24 15:57:47 +00:00
|
|
|
|
special = getString(column_options_->input_special_alignment);
|
2002-02-20 14:48:59 +00:00
|
|
|
|
num = LyXTabular::SET_SPECIAL_COLUMN;
|
|
|
|
|
} else if (ob == cell_options_->input_special_multialign) {
|
2002-10-24 15:57:47 +00:00
|
|
|
|
special = getString(cell_options_->input_special_multialign);
|
2002-02-20 14:48:59 +00:00
|
|
|
|
num = LyXTabular::SET_SPECIAL_MULTI;
|
2002-03-12 14:11:15 +00:00
|
|
|
|
} else if (ob == cell_options_->check_border_top)
|
2002-02-20 14:48:59 +00:00
|
|
|
|
num = LyXTabular::M_TOGGLE_LINE_TOP;
|
2002-03-12 14:11:15 +00:00
|
|
|
|
else if (ob == cell_options_->check_border_bottom)
|
2002-02-20 14:48:59 +00:00
|
|
|
|
num = LyXTabular::M_TOGGLE_LINE_BOTTOM;
|
2002-03-12 14:11:15 +00:00
|
|
|
|
else if (ob == cell_options_->check_border_left)
|
2002-02-20 14:48:59 +00:00
|
|
|
|
num = LyXTabular::M_TOGGLE_LINE_LEFT;
|
2002-03-12 14:11:15 +00:00
|
|
|
|
else if (ob == cell_options_->check_border_right)
|
2002-02-20 14:48:59 +00:00
|
|
|
|
num = LyXTabular::M_TOGGLE_LINE_RIGHT;
|
|
|
|
|
else if (ob == cell_options_->radio_align_left)
|
|
|
|
|
num = LyXTabular::M_ALIGN_LEFT;
|
|
|
|
|
else if (ob == cell_options_->radio_align_right)
|
|
|
|
|
num = LyXTabular::M_ALIGN_RIGHT;
|
|
|
|
|
else if (ob == cell_options_->radio_align_center)
|
|
|
|
|
num = LyXTabular::M_ALIGN_CENTER;
|
|
|
|
|
else if (ob == cell_options_->radio_valign_top)
|
|
|
|
|
num = LyXTabular::M_VALIGN_TOP;
|
|
|
|
|
else if (ob == cell_options_->radio_valign_bottom)
|
|
|
|
|
num = LyXTabular::M_VALIGN_BOTTOM;
|
|
|
|
|
else if (ob == cell_options_->radio_valign_center)
|
|
|
|
|
num = LyXTabular::M_VALIGN_CENTER;
|
|
|
|
|
else
|
2002-11-15 02:44:20 +00:00
|
|
|
|
return ButtonPolicy::SMI_VALID;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2002-11-15 02:44:20 +00:00
|
|
|
|
controller().set(num, special);
|
2002-02-20 14:48:59 +00:00
|
|
|
|
update();
|
|
|
|
|
|
2002-11-15 02:44:20 +00:00
|
|
|
|
return ButtonPolicy::SMI_VALID;
|
2000-07-11 15:08:54 +00:00
|
|
|
|
}
|
2002-12-01 22:59:25 +00:00
|
|
|
|
|
2001-12-19 16:13:21 +00:00
|
|
|
|
|
|
|
|
|
int FormTabular::checkLongtableOptions(FL_OBJECT * ob, string & special)
|
|
|
|
|
{
|
|
|
|
|
bool flag = fl_get_button(ob);
|
|
|
|
|
if ((ob == longtable_options_->check_1head_2border_above) ||
|
2002-02-20 14:48:59 +00:00
|
|
|
|
(ob == longtable_options_->check_head_2border_above) ||
|
|
|
|
|
(ob == longtable_options_->check_foot_2border_above) ||
|
2002-03-21 16:59:12 +00:00
|
|
|
|
(ob == longtable_options_->check_lastfoot_2border_above)) {
|
2001-12-19 16:13:21 +00:00
|
|
|
|
special = "dl_above";
|
|
|
|
|
} else if ((ob == longtable_options_->check_1head_2border_below) ||
|
2002-03-21 16:59:12 +00:00
|
|
|
|
(ob == longtable_options_->check_head_2border_below) ||
|
|
|
|
|
(ob == longtable_options_->check_foot_2border_below) ||
|
|
|
|
|
(ob == longtable_options_->check_lastfoot_2border_below)) {
|
2001-12-19 16:13:21 +00:00
|
|
|
|
special = "dl_below";
|
|
|
|
|
} else if ((ob == longtable_options_->check_1head_empty) ||
|
2002-03-21 16:59:12 +00:00
|
|
|
|
(ob == longtable_options_->check_lastfoot_empty)) {
|
2001-12-19 16:13:21 +00:00
|
|
|
|
special = "empty";
|
|
|
|
|
} else {
|
|
|
|
|
special = "";
|
|
|
|
|
}
|
2002-03-12 14:11:15 +00:00
|
|
|
|
if ((ob == longtable_options_->check_lt_firsthead) ||
|
2002-02-20 14:48:59 +00:00
|
|
|
|
(ob == longtable_options_->check_1head_2border_above) ||
|
|
|
|
|
(ob == longtable_options_->check_1head_2border_below) ||
|
2002-03-21 16:59:12 +00:00
|
|
|
|
(ob == longtable_options_->check_1head_empty)) {
|
2001-12-19 16:13:21 +00:00
|
|
|
|
return (flag ? LyXTabular::SET_LTFIRSTHEAD :
|
2002-03-21 16:59:12 +00:00
|
|
|
|
LyXTabular::UNSET_LTFIRSTHEAD);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
} else if ((ob == longtable_options_->check_lt_head) ||
|
2002-03-21 16:59:12 +00:00
|
|
|
|
(ob == longtable_options_->check_head_2border_above) ||
|
|
|
|
|
(ob == longtable_options_->check_head_2border_below)) {
|
2001-12-19 16:13:21 +00:00
|
|
|
|
return (flag ? LyXTabular::SET_LTHEAD : LyXTabular::UNSET_LTHEAD);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
} else if ((ob == longtable_options_->check_lt_foot) ||
|
2002-03-21 16:59:12 +00:00
|
|
|
|
(ob == longtable_options_->check_foot_2border_above) ||
|
|
|
|
|
(ob == longtable_options_->check_foot_2border_below)) {
|
2001-12-19 16:13:21 +00:00
|
|
|
|
return (flag ? LyXTabular::SET_LTFOOT : LyXTabular::UNSET_LTFOOT);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
} else if ((ob == longtable_options_->check_lt_lastfoot) ||
|
2002-03-21 16:59:12 +00:00
|
|
|
|
(ob == longtable_options_->check_lastfoot_2border_above) ||
|
|
|
|
|
(ob == longtable_options_->check_lastfoot_2border_below) ||
|
|
|
|
|
(ob == longtable_options_->check_lastfoot_empty)) {
|
2001-12-19 16:13:21 +00:00
|
|
|
|
return (flag ? LyXTabular::SET_LTLASTFOOT :
|
2002-03-21 16:59:12 +00:00
|
|
|
|
LyXTabular::UNSET_LTLASTFOOT);
|
2001-12-19 16:13:21 +00:00
|
|
|
|
}
|
2002-03-21 16:59:12 +00:00
|
|
|
|
|
2001-12-19 16:13:21 +00:00
|
|
|
|
return LyXTabular::LAST_ACTION;
|
|
|
|
|
}
|