2002-03-11 17:00:41 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file FormTabular.C
|
|
|
|
|
* Copyright 2000-2001 The LyX Team.
|
|
|
|
|
* See the file COPYING.
|
2000-10-24 13:13:59 +00:00
|
|
|
|
*
|
2002-03-11 17:00:41 +00:00
|
|
|
|
* \author J<EFBFBD>rgen Vigna, jug@sad.it
|
2000-07-11 15:08:54 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2001-03-15 13:37:04 +00:00
|
|
|
|
#ifdef __GNUG__
|
|
|
|
|
#pragma implementation
|
|
|
|
|
#endif
|
|
|
|
|
|
2002-02-20 14:48:59 +00:00
|
|
|
|
#include "debug.h"
|
|
|
|
|
|
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-05-23 12:08:47 +00:00
|
|
|
|
#include "frontends/LyXView.h"
|
2000-07-11 15:08:54 +00:00
|
|
|
|
#include "Dialogs.h"
|
|
|
|
|
#include "buffer.h"
|
2001-03-05 19:02:40 +00:00
|
|
|
|
#include "xforms_helpers.h"
|
2002-01-16 16:34:03 +00:00
|
|
|
|
#include "lyxrc.h" // to set the default length values
|
2001-10-23 11:35:48 +00:00
|
|
|
|
#include "helper_funcs.h"
|
|
|
|
|
#include "input_validators.h"
|
2002-02-16 15:59:55 +00:00
|
|
|
|
|
|
|
|
|
#include "insets/insettabular.h"
|
|
|
|
|
|
2001-10-23 11:35:48 +00:00
|
|
|
|
#include "support/lstrings.h"
|
2000-07-11 15:08:54 +00:00
|
|
|
|
|
2002-05-29 16:21:03 +00:00
|
|
|
|
#include <boost/bind.hpp>
|
|
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
|
#include <functional>
|
2002-06-13 13:43:51 +00:00
|
|
|
|
#include FORMS_H_LOCATION
|
2002-02-16 15:59:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using std::vector;
|
|
|
|
|
using std::bind2nd;
|
2002-02-18 10:12:12 +00:00
|
|
|
|
using std::remove_if;
|
2002-02-16 15:59:55 +00:00
|
|
|
|
|
2000-07-11 15:08:54 +00:00
|
|
|
|
|
|
|
|
|
FormTabular::FormTabular(LyXView * lv, Dialogs * d)
|
2001-03-15 13:37:04 +00:00
|
|
|
|
: FormInset(lv, d, _("Tabular Layout")),
|
2002-01-12 11:59:23 +00:00
|
|
|
|
inset_(0), actCell_(-1), closing_(false)
|
2000-07-11 15:08:54 +00:00
|
|
|
|
{
|
2000-10-24 13:13:59 +00:00
|
|
|
|
// let the dialog be shown
|
|
|
|
|
// This is a permanent connection so we won't bother
|
|
|
|
|
// storing a copy because we won't be disconnecting.
|
2002-05-29 16:21:03 +00:00
|
|
|
|
d->showTabular = boost::bind(&FormTabular::showInset, this, _1);
|
|
|
|
|
d->updateTabular = boost::bind(&FormTabular::updateInset, this, _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
|
|
|
|
FL_FORM * FormTabular::form() const
|
2000-07-11 15:08:54 +00:00
|
|
|
|
{
|
2001-03-15 13:37:04 +00:00
|
|
|
|
if (dialog_.get())
|
|
|
|
|
return dialog_->form;
|
2000-10-24 13:13:59 +00:00
|
|
|
|
return 0;
|
2000-07-11 15:08:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-10-24 13:13:59 +00:00
|
|
|
|
void FormTabular::disconnect()
|
2000-07-11 15:08:54 +00:00
|
|
|
|
{
|
|
|
|
|
inset_ = 0;
|
2000-10-24 13:13:59 +00:00
|
|
|
|
FormInset::disconnect();
|
2000-07-11 15:08:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-11-14 02:01:57 +00:00
|
|
|
|
void FormTabular::showInset(InsetTabular * inset)
|
2000-07-11 15:08:54 +00:00
|
|
|
|
{
|
2000-10-24 13:13:59 +00:00
|
|
|
|
if (inset == 0) return;
|
2000-07-11 15:08:54 +00:00
|
|
|
|
|
2000-10-24 13:13:59 +00:00
|
|
|
|
// If connected to another inset, disconnect from it.
|
|
|
|
|
if (inset_ != inset) {
|
|
|
|
|
ih_.disconnect();
|
2002-05-29 16:21:03 +00:00
|
|
|
|
ih_ = inset->hideDialog.connect(boost::bind(&FormTabular::hide, this));
|
2000-10-24 13:13:59 +00:00
|
|
|
|
inset_ = inset;
|
|
|
|
|
}
|
2000-07-11 15:08:54 +00:00
|
|
|
|
|
2000-10-24 13:13:59 +00:00
|
|
|
|
show();
|
2000-07-11 15:08:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-11-14 02:01:57 +00:00
|
|
|
|
void FormTabular::updateInset(InsetTabular * inset)
|
2000-07-11 15:08:54 +00:00
|
|
|
|
{
|
2000-10-24 13:13:59 +00:00
|
|
|
|
if (inset == 0 || inset_ == 0) return;
|
2000-07-11 15:08:54 +00:00
|
|
|
|
|
2000-10-24 13:13:59 +00:00
|
|
|
|
// If connected to another inset, disconnect from it.
|
|
|
|
|
if (inset_ != inset) {
|
|
|
|
|
ih_.disconnect();
|
2002-05-29 16:21:03 +00:00
|
|
|
|
ih_ = inset->hideDialog.connect(boost::bind(&FormTabular::hide, this));
|
2000-10-24 13:13:59 +00:00
|
|
|
|
inset_ = inset;
|
|
|
|
|
}
|
2000-07-11 15:08:54 +00:00
|
|
|
|
|
2000-10-24 13:13:59 +00:00
|
|
|
|
update();
|
2000-07-11 15:08:54 +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-03-11 18:24:31 +00:00
|
|
|
|
setPrehandler(dialog_->input_tabular_column);
|
|
|
|
|
setPrehandler(dialog_->input_tabular_row);
|
|
|
|
|
|
2002-06-13 13:43:51 +00:00
|
|
|
|
tabular_options_.reset(build_tabular_options(this));
|
|
|
|
|
column_options_.reset(build_tabular_column(this));
|
|
|
|
|
cell_options_.reset(build_tabular_cell(this));
|
|
|
|
|
longtable_options_.reset(build_tabular_longtable(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
|
|
|
|
|
|
|
|
|
setPrehandler(column_options_->input_column_width);
|
|
|
|
|
setPrehandler(column_options_->input_special_alignment);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
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-03-11 18:24:31 +00:00
|
|
|
|
setPrehandler(cell_options_->input_mcolumn_width);
|
|
|
|
|
setPrehandler(cell_options_->input_special_multialign);
|
|
|
|
|
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_addto_tabfolder(dialog_->tabfolder, _("Tabular"),
|
2002-03-21 21:21:28 +00:00
|
|
|
|
tabular_options_->form);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_addto_tabfolder(dialog_->tabfolder, _("Column/Row"),
|
2002-03-21 21:21:28 +00:00
|
|
|
|
column_options_->form);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_addto_tabfolder(dialog_->tabfolder, _("Cell"),
|
2002-03-21 21:21:28 +00:00
|
|
|
|
cell_options_->form);
|
2002-03-12 14:11:15 +00:00
|
|
|
|
fl_addto_tabfolder(dialog_->tabfolder, _("LongTable"),
|
2002-03-21 21:21:28 +00:00
|
|
|
|
longtable_options_->form);
|
2001-10-23 11:35:48 +00:00
|
|
|
|
|
|
|
|
|
// Create the contents of the unit choices
|
|
|
|
|
// Don't include the "%" terms...
|
2002-02-16 15:59:55 +00:00
|
|
|
|
vector<string> units_vec = getLatexUnits();
|
|
|
|
|
#if 0
|
|
|
|
|
for (vector<string>::iterator it = units_vec.begin();
|
2002-03-21 16:59:12 +00:00
|
|
|
|
it != units_vec.end(); ++it) {
|
2002-02-20 14:48:59 +00:00
|
|
|
|
if (contains(*it, "%"))
|
|
|
|
|
it = units_vec.erase(it, it + 1) - 1;
|
2001-10-23 11:35:48 +00:00
|
|
|
|
}
|
2002-02-16 15:59:55 +00:00
|
|
|
|
#else
|
|
|
|
|
vector<string>::iterator ret =
|
2002-02-20 14:48:59 +00:00
|
|
|
|
remove_if(units_vec.begin(), units_vec.end(),
|
2002-03-21 21:21:28 +00:00
|
|
|
|
bind2nd(contains_functor(), "%"));
|
2002-02-16 15:59:55 +00:00
|
|
|
|
units_vec.erase(ret, units_vec.end());
|
|
|
|
|
#endif
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2001-10-23 11:35:48 +00:00
|
|
|
|
string units = getStringFromVector(units_vec, "|");
|
|
|
|
|
|
|
|
|
|
fl_addto_choice(column_options_->choice_value_column_width,
|
2002-03-21 21:21:28 +00:00
|
|
|
|
units.c_str());
|
2001-10-23 11:35:48 +00:00
|
|
|
|
fl_addto_choice(cell_options_->choice_value_mcolumn_width,
|
2002-03-21 21:21:28 +00:00
|
|
|
|
units.c_str());
|
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-03-21 21:21:28 +00:00
|
|
|
|
|
2001-04-04 21:58:35 +00:00
|
|
|
|
if (!inset_ || !inset_->tabular.get())
|
2000-10-24 13:13:59 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2001-04-04 21:58:35 +00:00
|
|
|
|
LyXTabular * tabular = inset_->tabular.get();
|
|
|
|
|
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
|
|
|
|
|
2001-06-28 10:25:20 +00:00
|
|
|
|
int cell = inset_->getActCell();
|
2001-04-04 21:58:35 +00:00
|
|
|
|
actCell_ = cell;
|
2001-12-11 17:26:52 +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);
|
2001-12-19 16:13:21 +00:00
|
|
|
|
int row = tabular->row_of_cell(cell);
|
|
|
|
|
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);
|
|
|
|
|
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,
|
2002-03-21 21:21:28 +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,
|
2002-03-21 21:21:28 +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.
|
|
|
|
|
if (tabular->IsFirstCellInRow(cell) ||
|
2002-03-21 16:59:12 +00:00
|
|
|
|
tabular->IsMultiColumn(cell-1)) {
|
2002-03-18 15:27:41 +00:00
|
|
|
|
fl_set_button(cell_options_->check_border_left,
|
2002-03-21 16:59:12 +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);
|
|
|
|
|
}
|
|
|
|
|
if (tabular->IsLastCellInRow(cell) ||
|
2002-03-21 16:59:12 +00:00
|
|
|
|
tabular->IsMultiColumn(cell+1)) {
|
2002-03-18 15:27:41 +00:00
|
|
|
|
fl_set_button(cell_options_->check_border_right,
|
2002-03-21 16:59:12 +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);
|
|
|
|
|
}
|
2000-10-24 13:13:59 +00:00
|
|
|
|
pwidth = tabular->GetMColumnPWidth(cell);
|
|
|
|
|
align = tabular->GetAlignment(cell);
|
2001-12-11 17:26:52 +00:00
|
|
|
|
if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
|
2000-10-24 13:13:59 +00:00
|
|
|
|
fl_set_button(cell_options_->radio_align_left, 1);
|
|
|
|
|
else if (align == LYX_ALIGN_RIGHT)
|
|
|
|
|
fl_set_button(cell_options_->radio_align_right, 1);
|
|
|
|
|
else
|
|
|
|
|
fl_set_button(cell_options_->radio_align_center, 1);
|
2002-01-25 10:21:46 +00:00
|
|
|
|
|
2000-10-24 13:13:59 +00:00
|
|
|
|
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_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
|
|
|
|
|
2001-12-11 17:26:52 +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());
|
2002-01-16 16:34:03 +00:00
|
|
|
|
bool const metric = lyxrc.default_papersize > 3;
|
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
|
|
|
|
|
2000-10-24 13:13:59 +00:00
|
|
|
|
if (!lv_->buffer()->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
|
|
|
|
|
2001-12-11 17:26:52 +00:00
|
|
|
|
setEnabled(cell_options_->radio_align_left, pwidth.zero());
|
|
|
|
|
setEnabled(cell_options_->radio_align_right, pwidth.zero());
|
|
|
|
|
setEnabled(cell_options_->radio_align_center, pwidth.zero());
|
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
|
|
|
|
}
|
|
|
|
|
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);
|
2000-10-24 13:13:59 +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);
|
2000-10-24 13:13:59 +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);
|
2000-10-24 13:13:59 +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);
|
2000-10-24 13:13:59 +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);
|
2001-12-11 17:26:52 +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
|
|
|
|
|
|
|
|
|
bool const isReadonly = lv_->buffer()->isReadonly();
|
|
|
|
|
setEnabled(column_options_->input_special_alignment, !isReadonly);
|
|
|
|
|
|
2000-10-24 13:13:59 +00:00
|
|
|
|
pwidth = tabular->GetColumnPWidth(cell);
|
2002-01-16 16:34:03 +00:00
|
|
|
|
bool const metric = lyxrc.default_papersize > 3;
|
|
|
|
|
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()) {
|
2000-10-24 13:13:59 +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
|
|
|
|
}
|
|
|
|
|
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);
|
2001-12-11 17:26:52 +00:00
|
|
|
|
if (!pwidth.zero() || (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);
|
2000-07-17 14:31:07 +00:00
|
|
|
|
else
|
2000-10-24 13:13:59 +00:00
|
|
|
|
fl_set_button(column_options_->radio_align_center, 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_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
|
|
|
|
|
2001-12-11 17:26:52 +00:00
|
|
|
|
setEnabled(column_options_->radio_align_left, pwidth.zero());
|
|
|
|
|
setEnabled(column_options_->radio_align_right, pwidth.zero());
|
|
|
|
|
setEnabled(column_options_->radio_align_center, pwidth.zero());
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
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,
|
2002-03-21 21:21:28 +00:00
|
|
|
|
tabular->IsLongTabular());
|
2001-03-05 19:02:40 +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;
|
|
|
|
|
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);
|
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);
|
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);
|
|
|
|
|
fl_set_button(longtable_options_->check_head_2border_above,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;
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
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);
|
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);
|
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);
|
|
|
|
|
fl_set_button(longtable_options_->check_1head_2border_above,0);
|
|
|
|
|
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
|
|
|
|
//
|
|
|
|
|
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);
|
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);
|
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);
|
|
|
|
|
fl_set_button(longtable_options_->check_foot_2border_above,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
|
|
|
|
//
|
|
|
|
|
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);
|
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);
|
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);
|
|
|
|
|
fl_set_button(longtable_options_->check_lastfoot_2border_above, 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,
|
2002-03-21 21:21:28 +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);
|
|
|
|
|
fl_set_button(longtable_options_->check_1head_2border_above, 0);
|
|
|
|
|
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);
|
|
|
|
|
fl_set_button(longtable_options_->check_head_2border_above, 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);
|
|
|
|
|
fl_set_button(longtable_options_->check_foot_2border_above, 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);
|
|
|
|
|
fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
|
|
|
|
|
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,
|
2002-03-21 21:21:28 +00:00
|
|
|
|
tabular->GetRotateTabular());
|
2000-07-11 15:08:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-04-04 21:58:35 +00:00
|
|
|
|
|
2000-10-24 13:13:59 +00:00
|
|
|
|
bool FormTabular::input(FL_OBJECT * ob, long)
|
2000-07-13 15:03:34 +00:00
|
|
|
|
{
|
2002-02-20 14:48:59 +00:00
|
|
|
|
if (!inset_)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
int s;
|
|
|
|
|
LyXTabular::Feature num = LyXTabular::LAST_ACTION;
|
|
|
|
|
string special;;
|
|
|
|
|
|
|
|
|
|
int cell = inset_->getActCell();
|
|
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
LyXTabular * tabular = inset_->tabular.get();
|
|
|
|
|
string str1 =
|
|
|
|
|
getLengthFromWidgets(column_options_->input_column_width,
|
2002-03-21 16:59:12 +00:00
|
|
|
|
column_options_->choice_value_column_width);
|
2002-02-20 14:48:59 +00:00
|
|
|
|
string str2;
|
|
|
|
|
LyXLength llen = tabular->GetColumnPWidth(cell);
|
|
|
|
|
if (!llen.zero())
|
|
|
|
|
str2 = llen.asString();
|
|
|
|
|
if (str1 != str2)
|
|
|
|
|
input(column_options_->input_column_width, 0);
|
|
|
|
|
str1 = getLengthFromWidgets(cell_options_->input_mcolumn_width,
|
2002-03-21 21:21:28 +00:00
|
|
|
|
cell_options_->choice_value_mcolumn_width);
|
2002-02-20 14:48:59 +00:00
|
|
|
|
llen = tabular->GetMColumnPWidth(cell);
|
|
|
|
|
if (llen.zero())
|
|
|
|
|
str2 = "";
|
|
|
|
|
else
|
|
|
|
|
str2 = llen.asString();
|
|
|
|
|
if (str1 != str2)
|
|
|
|
|
input(cell_options_->input_mcolumn_width, 0);
|
|
|
|
|
str1 = fl_get_input(column_options_->input_special_alignment);
|
|
|
|
|
str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
|
|
|
|
|
if (str1 != str2)
|
|
|
|
|
input(column_options_->input_special_alignment, 0);
|
|
|
|
|
str1 = fl_get_input(cell_options_->input_special_multialign);
|
|
|
|
|
str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
|
|
|
|
|
if (str1 != str2)
|
|
|
|
|
input(cell_options_->input_special_multialign, 0);
|
|
|
|
|
closing_ = false;
|
|
|
|
|
ok();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
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-02-20 14:48:59 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// No point in processing directives that you can't do anything with
|
|
|
|
|
// anyhow, so exit now if the buffer is read-only.
|
|
|
|
|
if (lv_->buffer()->isReadonly()) {
|
2002-03-21 16:59:12 +00:00
|
|
|
|
update();
|
2002-01-16 16:34:03 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
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);
|
|
|
|
|
inset_->tabularFeatures(lv_->view(), 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
|
|
|
|
|
string const input =
|
|
|
|
|
fl_get_input(column_options_->input_column_width);
|
|
|
|
|
if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
|
|
|
|
|
postWarning(_("Invalid Length (valid example: 10mm)"));
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
update(); // update for alignment
|
|
|
|
|
return true;
|
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-02-20 14:48:59 +00:00
|
|
|
|
inset_->tabularFeatures(lv_->view(), LyXTabular::SET_MPWIDTH, str);
|
|
|
|
|
|
|
|
|
|
//check if the input is valid
|
|
|
|
|
string const input =
|
|
|
|
|
fl_get_input(cell_options_->input_mcolumn_width);
|
|
|
|
|
if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
|
2002-03-20 17:53:39 +00:00
|
|
|
|
postWarning(_("Invalid Length (valid example: 10mm)"));
|
2002-02-20 14:48:59 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
update(); // update for alignment
|
|
|
|
|
return true;
|
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;
|
|
|
|
|
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) {
|
|
|
|
|
special = fl_get_input(column_options_->input_special_alignment);
|
|
|
|
|
num = LyXTabular::SET_SPECIAL_COLUMN;
|
|
|
|
|
} else if (ob == cell_options_->input_special_multialign) {
|
|
|
|
|
special = fl_get_input(cell_options_->input_special_multialign);
|
|
|
|
|
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
|
|
|
|
|
return false;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2002-02-20 14:48:59 +00:00
|
|
|
|
inset_->tabularFeatures(lv_->view(), num, special);
|
|
|
|
|
update();
|
|
|
|
|
|
|
|
|
|
return true;
|
2000-07-11 15:08:54 +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;
|
|
|
|
|
}
|