+2001-10-23 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
+
+ * forms/form_tabular.fd: Add value choices
+ * FormTabular.C: Handle that choices
+
+ * FormDocument.C: fix small bug.
+
2001-10-23 Angus Leeming <a.leeming@ic.ac.uk>
* FormGraphics.[Ch]: move some parameters out of the heaader file and
if (ob == class_->radio_doc_skip ||
ob == class_->radio_doc_indent) {
setEnabled(class_->choice_doc_skip, skip_used);
- setEnabled(class_->input_doc_skip, skip_used);
- setEnabled(class_->choice_default_skip_units, skip_used);
+ setEnabled(class_->input_doc_skip,
+ skip_used && length_input);
+ setEnabled(class_->choice_default_skip_units,
+ skip_used && length_input);
// Default unit choice is cm if metric, inches if US paper.
int const paperchoice = fl_get_choice(paper_->choice_papersize);
bool const metric = paperchoice < 3 || paperchoice > 5;
#include "insets/insettabular.h"
#include "buffer.h"
#include "xforms_helpers.h"
+#include "helper_funcs.h"
+#include "input_validators.h"
+#include "support/lstrings.h"
using SigC::slot;
cell_options_->form);
fl_addto_tabfolder(dialog_->tabFolder, _("LongTable"),
longtable_options_->form);
+
+ // We should set these input filters on width fields to make them accept
+ // only unsigned numbers.
+ // But this leeds to trouble with the current apply behaviour (JSpitzm).
+ // fl_set_input_filter(column_options_->input_column_width,
+ // fl_unsigned_float_filter);
+ // fl_set_input_filter(cell_options_->input_mcolumn_width,
+ // fl_unsigned_float_filter);
+
+ // Create the contents of the unit choices
+ // Don't include the "%" terms...
+ std::vector<string> units_vec = getLatexUnits();
+ for (std::vector<string>::iterator it = units_vec.begin();
+ it != units_vec.end(); ++it) {
+ if (contains(*it, "%"))
+ it = units_vec.erase(it, it+1) - 1;
+ }
+ string units = getStringFromVector(units_vec, "|");
+
+ fl_addto_choice(column_options_->choice_value_column_width,
+ units.c_str());
+ fl_addto_choice(cell_options_->choice_value_mcolumn_width,
+ units.c_str());
}
fl_activate_object(column_options_->input_special_alignment);
fl_activate_object(cell_options_->input_special_multialign);
fl_activate_object(column_options_->input_column_width);
+ fl_activate_object(column_options_->choice_value_column_width);
sprintf(buf,"%d",column);
fl_set_input(dialog_->input_tabular_column, buf);
fl_deactivate_object(dialog_->input_tabular_column);
setEnabled(cell_options_->radio_valign_center, true);
special = tabular->GetAlignSpecial(cell,LyXTabular::SET_SPECIAL_MULTI);
fl_set_input(cell_options_->input_special_multialign, special.c_str());
- fl_set_input(cell_options_->input_mcolumn_width,pwidth.c_str());
+ string const default_unit = "cm";
+ updateWidgetsFromLengthString(cell_options_->input_mcolumn_width,
+ cell_options_->choice_value_mcolumn_width,
+ pwidth.c_str(), default_unit);
+
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_top, !pwidth.empty());
fl_set_input(cell_options_->input_mcolumn_width, "");
setEnabled(cell_options_->input_mcolumn_width, false);
+ setEnabled(cell_options_->choice_value_mcolumn_width, false);
}
if (tabular->GetRotateCell(cell))
fl_set_button(cell_options_->radio_rotate_cell, 1);
setEnabled(column_options_->input_special_alignment, !isReadonly);
pwidth = tabular->GetColumnPWidth(cell);
- fl_set_input(column_options_->input_column_width,pwidth.c_str());
+ string const default_unit = "cm";
+ updateWidgetsFromLengthString(column_options_->input_column_width,
+ column_options_->choice_value_column_width,
+ pwidth.c_str(), default_unit);
setEnabled(column_options_->input_column_width, !isReadonly);
+ setEnabled(column_options_->choice_value_column_width, !isReadonly);
setEnabled(cell_options_->radio_useminipage, !pwidth.empty());
if (!pwidth.empty()) {
return false;
}
if (ob == column_options_->input_column_width) {
- string const str = fl_get_input(ob);
- if (!str.empty() && !isValidLength(str)) {
- fl_set_object_label(dialog_->text_warning,
- _("Warning: Invalid Length (valid example: 10mm)"));
- fl_show_object(dialog_->text_warning);
- 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);
update(); // update for alignment
return true;
}
if (ob == cell_options_->input_mcolumn_width) {
- string const str = fl_get_input(ob);
- if (!str.empty() && !isValidLength(str)) {
- fl_set_object_label(dialog_->text_warning,
- _("Warning: Invalid Length (valid example: 10mm)"));
- fl_show_object(dialog_->text_warning);
- return false;
- }
+ string const str =
+ getLengthFromWidgets(cell_options_->input_mcolumn_width,
+ cell_options_->choice_value_mcolumn_width);
inset_->tabularFeatures(lv_->view(), LyXTabular::SET_MPWIDTH,str);
update(); // update for alignment
return true;
}
- string const str = fl_get_input(column_options_->input_column_width);
- if (!str.empty() && !isValidLength(str)) {
- fl_set_object_label(
- dialog_->text_warning,
- _("Warning: Invalid Length (valid example: 10mm)"));
- fl_show_object(dialog_->text_warning);
- return false;
- }
+
if (ob == tabular_options_->button_append_row)
num = LyXTabular::APPEND_ROW;
else if (ob == tabular_options_->button_append_column)
obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 20, 245, 400, 85, _("Separation"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
- obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 300, 110, 115, 80, _("Page cols"));
+ obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 300, 110, 120, 75, _("Page cols"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 300, 20, 120, 75, _("Sides"));
fl_set_button(obj, 1);
fl_end_group();
- fdui->input_doc_spacing = obj = fl_add_input(FL_NORMAL_INPUT, 300, 200, 115, 30, "");
+ fdui->input_doc_spacing = obj = fl_add_input(FL_NORMAL_INPUT, 300, 200, 120, 30, "");
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, INPUT);
fdui->choice_default_skip_units = obj = fl_add_choice(FL_NORMAL_CHOICE, 350, 290, 60, 30, "");
FL_OBJECT *obj;
FD_form_column_options *fdui = new FD_form_column_options;
- fdui->form = fl_bgn_form(FL_NO_BOX, 505, 227);
+ fdui->form = fl_bgn_form(FL_NO_BOX, 505, 225);
fdui->form->u_vdata = this;
- obj = fl_add_box(FL_FLAT_BOX, 0, 0, 505, 227, "");
+ obj = fl_add_box(FL_FLAT_BOX, 0, 0, 505, 225, "");
{
char const * const dummy = N_("Top|#t");
fdui->radio_border_top = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 85, 45, 25, 25, idex(_(dummy)));
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
{
char const * const dummy = N_("Width|#W");
- fdui->input_column_width = obj = fl_add_input(FL_NORMAL_INPUT, 320, 170, 95, 30, idex(_(dummy)));
+ fdui->input_column_width = obj = fl_add_input(FL_NORMAL_INPUT, 275, 170, 95, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
{
char const * const dummy = N_("Alignment|#A");
- fdui->input_special_alignment = obj = fl_add_input(FL_NORMAL_INPUT, 85, 170, 215, 30, idex(_(dummy)));
+ fdui->input_special_alignment = obj = fl_add_input(FL_NORMAL_INPUT, 40, 170, 215, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_TOP);
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
+ fdui->choice_value_column_width = obj = fl_add_choice(FL_NORMAL_CHOICE, 375, 170, 75, 30, "");
+ fl_set_object_boxtype(obj, FL_FRAME_BOX);
+ fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
fl_end_form();
fdui->form->fdui = fdui;
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
{
char const * const dummy = N_("Width|#W");
- fdui->input_mcolumn_width = obj = fl_add_input(FL_NORMAL_INPUT, 280, 180, 175, 30, idex(_(dummy)));
+ fdui->input_mcolumn_width = obj = fl_add_input(FL_NORMAL_INPUT, 280, 180, 95, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 180, 135, 290, 80, _("Special Multicolumn"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
+ fdui->choice_value_mcolumn_width = obj = fl_add_choice(FL_NORMAL_CHOICE, 380, 180, 75, 30, "");
+ fl_set_object_boxtype(obj, FL_FRAME_BOX);
+ fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
fl_end_form();
fdui->form->fdui = fdui;
FL_OBJECT *radio_valign_bottom;
FL_OBJECT *input_column_width;
FL_OBJECT *input_special_alignment;
+ FL_OBJECT *choice_value_column_width;
};
struct FD_form_cell_options {
~FD_form_cell_options();
FL_OBJECT *radio_multicolumn;
FL_OBJECT *radio_useminipage;
FL_OBJECT *radio_rotate_cell;
+ FL_OBJECT *choice_value_mcolumn_width;
};
struct FD_form_longtable_options {
~FD_form_longtable_options();
--------------------
class: FL_LABELFRAME
type: ENGRAVED_FRAME
-box: 300 110 115 80
+box: 300 110 120 75
boxtype: FL_NO_BOX
colors: FL_BLACK FL_COL1
alignment: FL_ALIGN_TOP_LEFT
--------------------
class: FL_INPUT
type: NORMAL_INPUT
-box: 300 200 115 30
+box: 300 200 120 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
=============== FORM ===============
Name: form_column_options
Width: 505
-Height: 227
-Number of Objects: 17
+Height: 225
+Number of Objects: 18
--------------------
class: FL_BOX
type: FLAT_BOX
-box: 0 0 505 227
+box: 0 0 505 225
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
--------------------
class: FL_INPUT
type: NORMAL_INPUT
-box: 320 170 95 30
+box: 275 170 95 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_TOP
--------------------
class: FL_INPUT
type: NORMAL_INPUT
-box: 85 170 215 30
+box: 40 170 215 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_TOP
callback:
argument:
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 375 170 75 30
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label:
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: choice_value_column_width
+callback: C_FormBaseDeprecatedInputCB
+argument: 0
+
=============== FORM ===============
Name: form_cell_options
Width: 505
Height: 225
-Number of Objects: 21
+Number of Objects: 22
--------------------
class: FL_BOX
--------------------
class: FL_INPUT
type: NORMAL_INPUT
-box: 280 180 175 30
+box: 280 180 95 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
callback:
argument:
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 380 180 75 30
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label:
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: choice_value_mcolumn_width
+callback: C_FormBaseDeprecatedInputCB
+argument: 0
+
=============== FORM ===============
Name: form_longtable_options
Width: 505