J�rgen S's consistent minipage patch.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3447 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2002-01-29 09:38:09 +00:00
parent f09619a7e8
commit b28cf0655f
7 changed files with 63 additions and 4 deletions

View File

@ -339,15 +339,19 @@ string const LaTeXFeatures::getTClassPreamble() const
// the text class specific preamble
LyXTextClass const & tclass = textclasslist.TextClass(params.textclass);
ostringstream tcpreamble;
tcpreamble << tclass.preamble();
for (layout_type i = 0; i < tclass.numLayouts(); ++i) {
if (layout[i]) {
tcpreamble << tclass[i].preamble();
tcpreamble << tclass[i].preamble();
}
}
// DEC's implementation of ostringstream has a bug which can be
// overcome with this forcing.
tcpreamble.seekp(std::ios::beg);
return tcpreamble.str().c_str();
}

View File

@ -8,6 +8,13 @@
* xforms-helpers.h: added two choice const for the LyXLength
one with all and one only with length which have a unit.
2002-01-29 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* forms/form_minipage.fd: add text_warning field.
*FormMinipage.[Ch]: added input filters and warnings
(ButtonPolicy::SMInput FormMinipage::input)
2002-01-28 Angus Leeming <a.leeming@ic.ac.uk>
* FormAboutlyx.[Ch]: Removed redundant form() method and

View File

@ -90,3 +90,28 @@ void FormMinipage::update()
break;
}
}
ButtonPolicy::SMInput FormMinipage::input(FL_OBJECT * ob, long)
{
ButtonPolicy::SMInput action = ButtonPolicy::SMI_NOOP;
// disallow senseless data
// warnings if input is senseless
//
string input = fl_get_input(dialog_->input_width);
bool invalid = false;
if (ob == dialog_->input_width) {
invalid = !isValidLength(input) && !isStrDbl(input);
if (invalid) {
fl_set_object_label(dialog_->text_warning,
_("Warning: Invalid Length!"));
fl_show_object(dialog_->text_warning);
action = ButtonPolicy::SMI_INVALID;
} else {
fl_hide_object(dialog_->text_warning);
action = ButtonPolicy::SMI_VALID;
}
}
return action;
}

View File

@ -39,6 +39,8 @@ private:
virtual void build();
/// Update dialog before/whilst showing it.
virtual void update();
/// Filter the inputs on callback from xforms
virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
/// Fdesign generated method
FD_form_minipage * build_minipage();

View File

@ -89,6 +89,8 @@ FD_form_minipage * FormMinipage::build_minipage()
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseRestoreCB, 0);
fdui->text_warning = obj = fl_add_text(FL_NORMAL_TEXT, 20, 90, 210, 30, "");
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
fl_end_form();
fdui->form->fdui = fdui;

View File

@ -27,6 +27,7 @@ struct FD_form_minipage {
FL_OBJECT *button_apply;
FL_OBJECT *button_ok;
FL_OBJECT *button_restore;
FL_OBJECT *text_warning;
};
#endif /* FD_form_minipage_h_ */

View File

@ -10,7 +10,7 @@ Unit of measure: FL_COORD_PIXEL
Name: form_minipage
Width: 430
Height: 170
Number of Objects: 14
Number of Objects: 15
--------------------
class: FL_BOX
@ -105,7 +105,7 @@ argument: 0
--------------------
class: FL_BEGIN_GROUP
type: 0
box: 0 10 10 0
box: 0 0 0 0
boxtype: FL_NO_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER
@ -264,5 +264,23 @@ name: button_restore
callback: C_FormBaseRestoreCB
argument: 0
--------------------
class: FL_TEXT
type: NORMAL_TEXT
box: 20 90 210 30
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: text_warning
callback:
argument:
==============================
create_the_forms