here is a patch for the not finished float-gui placement is not checked, should be done when user has the possibility to it wrong ...
attached also a gif with the feedback for the exclamation button. default button gives htbp Herbert
Index: src/frontends/controllers/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ChangeLog,v retrieving revision 1.102 diff -u -r1.102 ChangeLog --- src/frontends/controllers/ChangeLog 2001/10/23 16:32:16 1.102 +++ src/frontends/controllers/ChangeLog 2001/10/29 09:04:26 @@ -1,3 +1,7 @@ +2001-10-29 Herbert Voss <[EMAIL PROTECTED]> + + * ControlFloat.[Ch]: adding wide option + 2001-10-23 Jean-Marc Lasgouttes <[EMAIL PROTECTED]> * ControlSpellchecker.C: include <sys/types.h> since FreeBSD needs Index: src/frontends/controllers/ControlFloat.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlFloat.C,v retrieving revision 1.1 diff -u -r1.1 ControlFloat.C --- src/frontends/controllers/ControlFloat.C 2001/07/30 11:55:57 1.1 +++ src/frontends/controllers/ControlFloat.C 2001/10/29 09:04:26 @@ -43,6 +43,7 @@ void ControlFloat::applyParamsToInset() { inset()->placement(params().placement); + inset()->wide(params().wide); } @@ -57,10 +58,10 @@ FloatParams::FloatParams() - : placement("htbp") + : placement("htbp"), wide() {} FloatParams::FloatParams(InsetFloat const & inset) - : placement(inset.placement()) + : placement(inset.placement()), wide(inset.wide()) {} Index: src/frontends/controllers/ControlFloat.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlFloat.h,v retrieving revision 1.2 diff -u -r1.2 ControlFloat.h --- src/frontends/controllers/ControlFloat.h 2001/07/30 13:35:08 1.2 +++ src/frontends/controllers/ControlFloat.h 2001/10/29 09:04:26 @@ -32,13 +32,16 @@ FloatParams(InsetFloat const &); /// string placement; + /// + bool wide; }; inline bool operator==(FloatParams const & p1, FloatParams const & p2) { - return p1.placement == p2.placement; + return (p1.placement == p2.placement) && + (p1.wide == p2.wide) ; } Index: src/frontends/xforms/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/ChangeLog,v retrieving revision 1.192 diff -u -r1.192 ChangeLog --- src/frontends/xforms/ChangeLog 2001/10/24 15:07:39 1.192 +++ src/frontends/xforms/ChangeLog 2001/10/29 09:04:28 @@ -1,3 +1,8 @@ +2001-10-29 Herbert Voss <[EMAIL PROTECTED]> + + * FormFloat.[Ch]: end the placement dialog + * forms/form_float.fd: Add missing buttons + 2001-10-24 Juergen Vigna <[EMAIL PROTECTED]> * FormTabular.C: changed calls for footer/headers of longtabulars. Index: src/frontends/xforms/FormFloat.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormFloat.C,v retrieving revision 1.4 diff -u -r1.4 FormFloat.C --- src/frontends/xforms/FormFloat.C 2001/09/12 09:29:46 1.4 +++ src/frontends/xforms/FormFloat.C 2001/10/29 09:04:29 @@ -20,12 +20,44 @@ #include "ControlFloat.h" #include "FormFloat.h" #include "form_float.h" +#include "xforms_helpers.h" #include "support/lstrings.h" +#include "support/LAssert.h" +namespace { + +// C function wrapper, required by xforms. +extern "C" +int C_FormFloatFeedbackCB(FL_OBJECT * ob, int event, + FL_Coord, FL_Coord, int, void *) +{ + // Note that the return value is important in the pre-emptive handler. + // Don't return anything other than 0. + + lyx::Assert(ob); + // Don't Assert this one, as it can happen quite reasonably when things + // are being deleted in the d-tor. + //Assert(ob->form); + if (!ob->form) return 0; + + FormFloat * pre = static_cast<FormFloat*>(ob->form->u_vdata); + pre->feedbackCB(ob, event); + return 0; +} + +void setPreHandler(FL_OBJECT * ob) +{ + lyx::Assert(ob); + fl_set_object_prehandler(ob, C_FormFloatFeedbackCB); +} + +} // namespace anon + + typedef FormCB<ControlFloat, FormDB<FD_form_float> > base_class; FormFloat::FormFloat(ControlFloat & c) - : base_class(c, _("Float Options")) + : base_class(c, _("Float Options")), warningPosted(false) {} @@ -43,11 +75,14 @@ bc().setCancel(dialog_->button_cancel); bc().setRestore(dialog_->button_restore); - bc().addReadOnly(dialog_->radio_top); - bc().addReadOnly(dialog_->radio_bottom); - bc().addReadOnly(dialog_->radio_page); - bc().addReadOnly(dialog_->radio_here); - bc().addReadOnly(dialog_->button_here_definitely); + setPreHandler(dialog_->radio_top); + setPreHandler(dialog_->radio_bottom); + setPreHandler(dialog_->radio_page); + setPreHandler(dialog_->radio_here); + setPreHandler(dialog_->button_here_definitely); + setPreHandler(dialog_->button_exclamation); + setPreHandler(dialog_->button_wide); + setPreHandler(dialog_->button_default); } @@ -57,6 +92,9 @@ if (fl_get_button(dialog_->button_here_definitely)) { placement += "H"; } else { + if (fl_get_button(dialog_->button_exclamation)) { + placement += "!"; + } if (fl_get_button(dialog_->radio_top)) { placement += "t"; } @@ -71,11 +109,13 @@ } } controller().params().placement = placement; + controller().params().wide = fl_get_button(dialog_->button_wide); } void FormFloat::update() { + bool excl = false; bool top = false; bool bottom = false; bool page = false; @@ -87,6 +127,9 @@ if (contains(placement, "H")) { here_definitely = true; } else { + if (contains(placement, "!")) { + excl = true; + } if (contains(placement, "t")) { top = true; } @@ -105,23 +148,98 @@ fl_set_button(dialog_->radio_page, page); fl_set_button(dialog_->radio_here, here); fl_set_button(dialog_->button_here_definitely, here_definitely); + fl_set_button(dialog_->button_exclamation, excl); + fl_set_button(dialog_->button_wide, controller().params().wide); } ButtonPolicy::SMInput FormFloat::input(FL_OBJECT * ob, long) { - if (ob == dialog_->button_here_definitely) { + if (ob == dialog_->button_default) { + fl_set_button(dialog_->radio_top, true); + fl_set_button(dialog_->radio_bottom, true); + fl_set_button(dialog_->radio_page, true); + fl_set_button(dialog_->radio_here, true); + fl_set_button(dialog_->button_exclamation, true); + fl_set_button(dialog_->button_here_definitely, false); + setEnabled(dialog_->button_exclamation, true); + fl_set_button(dialog_->button_exclamation, false); + } else if (ob == dialog_->button_wide) { + fl_set_button(dialog_->button_here_definitely, false); + setEnabled(dialog_->button_here_definitely, + !fl_get_button(dialog_->button_wide)); + } else if (ob == dialog_->button_here_definitely) { if (fl_get_button(dialog_->button_here_definitely)) { fl_set_button(dialog_->radio_top, false); fl_set_button(dialog_->radio_bottom, false); fl_set_button(dialog_->radio_page, false); fl_set_button(dialog_->radio_here, false); + fl_set_button(dialog_->button_exclamation, false); + setEnabled(dialog_->button_exclamation, false); } } else { if (fl_get_button(dialog_->button_here_definitely)) { fl_set_button(dialog_->button_here_definitely, false); } + } + if (fl_get_button(dialog_->radio_top) || // excl only when any + fl_get_button(dialog_->radio_bottom) || // button is set + fl_get_button(dialog_->radio_page) || + fl_get_button(dialog_->radio_here)) + setEnabled(dialog_->button_exclamation, true); + else { + fl_set_button(dialog_->button_exclamation, false); + setEnabled(dialog_->button_exclamation, false); } return ButtonPolicy::SMI_VALID; +} + +// preemptive handler for feedback messages +void FormFloat::feedbackCB(FL_OBJECT * ob, int event) +{ + lyx::Assert(ob); + switch (event) { + case FL_ENTER: + warningPosted = false; + feedback(ob); + break; + case FL_LEAVE: + if (!warningPosted) { + fl_set_object_label(dialog_->message, ""); + fl_redraw_object(dialog_->message); + } + break; + default: + break; + } +} + +void FormFloat::feedback(FL_OBJECT * ob) +{ + lyx::Assert(ob); + string str; + if (ob == dialog_->radio_top) { + str = _("floats appear always on top of the page, if possible"); + } else if (ob == dialog_->radio_bottom) { + str = _("floats appear always on bottom of the page, if possible"); + } else if (ob == dialog_->radio_here) { + str = _("floats appear on page, where they are defined,\n" + "if possible"); + } else if (ob == dialog_->radio_page) { + str = _("floats appear always on an own page\n" + "at the end of the doc"); + } else if (ob == dialog_->button_here_definitely) { + str = _("floats appear definitive HERE! Not possible with wide +floats\n" + "This is a restriction to LaTeX. Use it sparingly!"); + } else if (ob == dialog_->button_exclamation) { + str = _("LaTeX tries harder to realize the placement"); + } else if (ob == dialog_->button_wide) { + str = _("Only for twocolumn mode: float spans over both columns.\n" + "Has no effect in onecolumn mode."); + } else if (ob == dialog_->button_default) { + str = _("sets all values to LaTeX defaults"); + } + fl_set_object_label(dialog_->message, str.c_str()); + fl_redraw_object(dialog_->message); } Index: src/frontends/xforms/FormFloat.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormFloat.h,v retrieving revision 1.2 diff -u -r1.2 FormFloat.h --- src/frontends/xforms/FormFloat.h 2001/09/11 17:27:28 1.2 +++ src/frontends/xforms/FormFloat.h 2001/10/29 09:04:29 @@ -30,6 +30,8 @@ public: /// FormFloat(ControlFloat &); + /// preemptive handler for feedback messages + void feedbackCB(FL_OBJECT *, int); private: /// Set the Params variable for the Controller. @@ -40,7 +42,10 @@ virtual void update(); /// Filter the inputs on callback from xforms virtual ButtonPolicy::SMInput input(FL_OBJECT *, long); - + /// + void feedback(FL_OBJECT *); + /// + bool warningPosted; /// Fdesign generated method FD_form_float * build_float(); }; Index: src/frontends/xforms/form_float.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/form_float.C,v retrieving revision 1.3 diff -u -r1.3 form_float.C --- src/frontends/xforms/form_float.C 2001/09/11 17:27:28 1.3 +++ src/frontends/xforms/form_float.C 2001/10/29 09:04:33 @@ -22,11 +22,11 @@ FL_OBJECT *obj; FD_form_float *fdui = new FD_form_float; - fdui->form = fl_bgn_form(FL_NO_BOX, 360, 200); + fdui->form = fl_bgn_form(FL_NO_BOX, 360, 300); fdui->form->u_vdata = this; - obj = fl_add_box(FL_FLAT_BOX, 0, 0, 360, 200, ""); + obj = fl_add_box(FL_FLAT_BOX, 0, 0, 360, 300, ""); obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 100, 340, 50, ""); - obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 10, 20, 340, 80, _("Placement")); + obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 10, 20, 340, 80, _("Placement and +Type")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lstyle(obj, FL_BOLD_STYLE); { @@ -52,7 +52,7 @@ fl_set_object_callback(obj, C_FormBaseInputCB, 0); { char const * const dummy = N_("Here, if possible|#i"); - fdui->radio_here = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 190, 60, 152, 30, idex(_(dummy))); + fdui->radio_here = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 190, 60, 150, 30, +idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_lsize(obj, FL_NORMAL_SIZE); @@ -66,28 +66,54 @@ fl_set_object_callback(obj, C_FormBaseInputCB, 0); { char const * const dummy = N_("Cancel|^["); - fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 280, 160, 70, 30, idex(_(dummy))); + fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 280, 260, 70, 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_FormBaseCancelCB, 0); { char const * const dummy = N_("Apply|#A"); - fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 160, 70, 30, idex(_(dummy))); + fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 260, 70, 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_FormBaseApplyCB, 0); - fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 120, 160, 70, 30, _("OK")); + fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 120, 260, 70, 30, _("OK")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseOKCB, 0); { char const * const dummy = N_("Restore|#R"); - fdui->button_restore = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 160, 80, 30, idex(_(dummy))); + fdui->button_restore = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 260, 80, 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_FormBaseRestoreCB, 0); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 150, 340, 50, ""); + { + char const * const dummy = N_("Wide Float|#W"); + fdui->button_wide = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 20, 160, 152, 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_FormBaseInputCB, 0); + { + char const * const dummy = N_("with Exclamation|#E"); + fdui->button_exclamation = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 190, 110, +152, 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_FormBaseInputCB, 0); + { + char const * const dummy = N_("Placement Defaults|#D"); + fdui->button_default = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 160, 130, 30, +idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fdui->message = obj = fl_add_text(FL_NORMAL_TEXT, 11, 213, 337, 36, ""); + fl_set_object_color(obj, FL_MCOL, FL_MCOL); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_gravity(obj, FL_SouthWest, FL_SouthEast); fl_end_form(); fdui->form->fdui = fdui; Index: src/frontends/xforms/form_float.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/form_float.h,v retrieving revision 1.2 diff -u -r1.2 form_float.h --- src/frontends/xforms/form_float.h 2001/09/11 17:27:28 1.2 +++ src/frontends/xforms/form_float.h 2001/10/29 09:04:33 @@ -26,6 +26,10 @@ FL_OBJECT *button_apply; FL_OBJECT *button_ok; FL_OBJECT *button_restore; + FL_OBJECT *button_wide; + FL_OBJECT *button_exclamation; + FL_OBJECT *button_default; + FL_OBJECT *message; }; #endif /* FD_form_float_h_ */ Index: src/frontends/xforms/forms/form_float.fd =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/forms/form_float.fd,v retrieving revision 1.3 diff -u -r1.3 form_float.fd --- src/frontends/xforms/forms/form_float.fd 2001/09/11 17:27:28 1.3 +++ src/frontends/xforms/forms/form_float.fd 2001/10/29 09:04:34 @@ -5,17 +5,18 @@ Number of forms: 1 Unit of measure: FL_COORD_PIXEL +SnapGrid: 1 =============== FORM =============== Name: form_float Width: 360 -Height: 200 -Number of Objects: 12 +Height: 300 +Number of Objects: 17 -------------------- class: FL_BOX type: FLAT_BOX -box: 0 0 360 200 +box: 0 0 360 300 boxtype: FL_FLAT_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -58,7 +59,7 @@ style: FL_BOLD_STYLE size: FL_NORMAL_SIZE lcol: FL_BLACK -label: Placement +label: Placement and Type shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity @@ -123,7 +124,7 @@ -------------------- class: FL_CHECKBUTTON type: PUSH_BUTTON -box: 190 60 152 30 +box: 190 60 150 30 boxtype: FL_NO_BOX colors: FL_COL1 FL_YELLOW alignment: FL_ALIGN_CENTER @@ -159,7 +160,7 @@ -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 280 160 70 30 +box: 280 260 70 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -177,7 +178,7 @@ -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 200 160 70 30 +box: 200 260 70 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -195,7 +196,7 @@ -------------------- class: FL_BUTTON type: RETURN_BUTTON -box: 120 160 70 30 +box: 120 260 70 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -213,7 +214,7 @@ -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 10 160 80 30 +box: 10 260 80 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -227,6 +228,96 @@ name: button_restore callback: C_FormBaseRestoreCB argument: 0 + +-------------------- +class: FL_FRAME +type: ENGRAVED_FRAME +box: 10 150 340 50 +boxtype: FL_NO_BOX +colors: FL_BLACK FL_COL1 +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_CHECKBUTTON +type: PUSH_BUTTON +box: 20 160 152 30 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_YELLOW +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Wide Float|#W +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_wide +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_CHECKBUTTON +type: PUSH_BUTTON +box: 190 110 152 30 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_YELLOW +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: with Exclamation|#E +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_exclamation +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 200 160 130 30 +boxtype: FL_UP_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: Placement Defaults|#D +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_default +callback: C_FormBaseInputCB +argument: 0 + +-------------------- +class: FL_TEXT +type: NORMAL_TEXT +box: 11 213 337 36 +boxtype: FL_FLAT_BOX +colors: FL_MCOL FL_MCOL +alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_SouthWest FL_SouthEast +name: message +callback: +argument: ============================== create_the_forms