/**
* \file FormTabular.C
- * Copyright 2000-2001 The LyX Team.
- * See the file COPYING.
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * \author Jürgen Vigna, jug@sad.it
+ * \author Jürgen Vigna
+ *
+ * Full author contact details are available in file CREDITS
*/
#include <config.h>
#include "FormTabular.h"
#include "forms/form_tabular.h"
#include "frontends/LyXView.h"
-#include "Dialogs.h"
#include "buffer.h"
#include "xforms_helpers.h"
#include "lyxrc.h" // to set the default length values
FormTabular::FormTabular(LyXView & lv, Dialogs & d)
- : FormInset(&lv, &d, _("Tabular Layout")),
+ : FormInset(lv, d, _("Tabular Layout")),
inset_(0), actCell_(-1), closing_(false)
{
-#if 0
- // let the dialog be shown
- // This is a permanent connection so we won't bother
- // storing a copy because we won't be disconnecting.
- d->showTabular = boost::bind(&FormTabular::showInset, this, _1);
- d->updateTabular = boost::bind(&FormTabular::updateInset, this, _1);
-#endif
}
// Create the contents of the unit choices
// Don't include the "%" terms...
vector<string> units_vec = getLatexUnits();
-#if 0
- for (vector<string>::iterator it = units_vec.begin();
- it != units_vec.end(); ++it) {
- if (contains(*it, "%"))
- it = units_vec.erase(it, it + 1) - 1;
- }
-#else
vector<string>::iterator ret =
remove_if(units_vec.begin(), units_vec.end(),
bind2nd(contains_functor(), "%"));
units_vec.erase(ret, units_vec.end());
-#endif
string units = getStringFromVector(units_vec, "|");
}
pwidth = tabular->GetMColumnPWidth(cell);
align = tabular->GetAlignment(cell);
- if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
+ if (align == LYX_ALIGN_LEFT)
fl_set_button(cell_options_->radio_align_left, 1);
else if (align == LYX_ALIGN_RIGHT)
fl_set_button(cell_options_->radio_align_right, 1);
cell_options_->choice_value_mcolumn_width,
pwidth, default_unit);
- if (!lv_->buffer()->isReadonly()) {
+ if (!lv_.buffer()->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_bottom, !pwidth.zero());
setEnabled(cell_options_->radio_valign_center, !pwidth.zero());
- setEnabled(cell_options_->radio_align_left, pwidth.zero());
- setEnabled(cell_options_->radio_align_right, pwidth.zero());
- setEnabled(cell_options_->radio_align_center, 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);
special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
fl_set_input(column_options_->input_special_alignment, special.c_str());
- bool const isReadonly = lv_->buffer()->isReadonly();
+ bool const isReadonly = lv_.buffer()->isReadonly();
setEnabled(column_options_->input_special_alignment, !isReadonly);
pwidth = tabular->GetColumnPWidth(cell);
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);
- if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
+ 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
fl_set_button(column_options_->radio_valign_top, 1);
- setEnabled(column_options_->radio_align_left, pwidth.zero());
- setEnabled(column_options_->radio_align_right, pwidth.zero());
- setEnabled(column_options_->radio_align_center, pwidth.zero());
-
+ 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_valign_top, !pwidth.zero());
setEnabled(column_options_->radio_valign_bottom, !pwidth.zero());
setEnabled(column_options_->radio_valign_center, !pwidth.zero());
}
// 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()) {
+ if (lv_.buffer()->isReadonly()) {
update();
return false;
}
string const str =
getLengthFromWidgets(column_options_->input_column_width,
column_options_->choice_value_column_width);
- inset_->tabularFeatures(lv_->view(), LyXTabular::SET_PWIDTH, str);
+ inset_->tabularFeatures(lv_.view().get(), LyXTabular::SET_PWIDTH, str);
//check if the input is valid
string const input =
string const str =
getLengthFromWidgets(cell_options_->input_mcolumn_width,
cell_options_->choice_value_mcolumn_width);
- inset_->tabularFeatures(lv_->view(), LyXTabular::SET_MPWIDTH, str);
+ inset_->tabularFeatures(lv_.view().get(), LyXTabular::SET_MPWIDTH, str);
//check if the input is valid
string const input =
else
return false;
- inset_->tabularFeatures(lv_->view(), num, special);
+ inset_->tabularFeatures(lv_.view().get(), num, special);
update();
return true;