Fix for float dialog bug

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2728 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2001-09-11 17:27:28 +00:00
parent c800129f2b
commit 6a3d139c9e
6 changed files with 80 additions and 61 deletions

View File

@ -4,6 +4,10 @@
Author-Year/Numerical citation choice only if the natbib checkbox is
active.
* FormFloat.[Ch]: added new method input() to control the behaviour of
the buttons better.
* forms/form_float.fd: renamed Here as button_here_definitely.
* FormGraphics.C:
* forms/form_graphics.fd: add callbacks to a few widgets that didn't
have them, so enabling the Ok, Apply buttons appropriately.

View File

@ -32,9 +32,6 @@ FormFloat::FormFloat(ControlFloat & c)
// FIX: Needs to be implemented. (Lgb)
// A way to set to float default is missing.
// A way to set "force[!]" is missing.
// Also there are two groups of buttons [Here] and [top,bottom,page,here],
// is is not really possible to choose from both groups. So this should
// be disallowed by the dialog too.
void FormFloat::build()
{
@ -50,14 +47,14 @@ void FormFloat::build()
bc().addReadOnly(dialog_->radio_bottom);
bc().addReadOnly(dialog_->radio_page);
bc().addReadOnly(dialog_->radio_here);
bc().addReadOnly(dialog_->Here);
bc().addReadOnly(dialog_->button_here_definitely);
}
void FormFloat::apply()
{
string placement;
if (fl_get_button(dialog_->Here)) {
if (fl_get_button(dialog_->button_here_definitely)) {
placement += "H";
} else {
if (fl_get_button(dialog_->radio_top)) {
@ -83,12 +80,13 @@ void FormFloat::update()
bool bottom = false;
bool page = false;
bool here = false;
bool Here = false;
bool here_definitely = false;
string placement(controller().params().placement);
std::cerr << "FormFloat::update() " << placement << std::endl;
if (contains(placement, "H")) {
Here = true;
here_definitely = true;
} else {
if (contains(placement, "t")) {
top = true;
@ -107,7 +105,22 @@ void FormFloat::update()
fl_set_button(dialog_->radio_bottom, bottom);
fl_set_button(dialog_->radio_page, page);
fl_set_button(dialog_->radio_here, here);
fl_set_button(dialog_->Here, Here);
fl_set_button(dialog_->button_here_definitely, here_definitely);
}
ButtonPolicy::SMInput FormFloat::input(FL_OBJECT * ob, long)
{
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);
}
} else {
if (fl_get_button(dialog_->button_here_definitely)) {
fl_set_button(dialog_->button_here_definitely, false);
}
}
}

View File

@ -38,6 +38,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_float * build_float();

View File

@ -50,6 +50,20 @@ FD_form_float * FormFloat::build_float()
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
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)));
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_("Here, definitely|#H");
fdui->button_here_definitely = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 20, 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_("Cancel|^[");
fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 280, 160, 70, 30, idex(_(dummy)));
@ -74,20 +88,6 @@ FD_form_float * FormFloat::build_float()
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseRestoreCB, 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)));
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_("Here, definitely|#H");
fdui->Here = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 20, 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);
fl_end_form();
fdui->form->fdui = fdui;

View File

@ -20,12 +20,12 @@ struct FD_form_float {
FL_OBJECT *radio_top;
FL_OBJECT *radio_bottom;
FL_OBJECT *radio_page;
FL_OBJECT *radio_here;
FL_OBJECT *button_here_definitely;
FL_OBJECT *button_cancel;
FL_OBJECT *button_apply;
FL_OBJECT *button_ok;
FL_OBJECT *button_restore;
FL_OBJECT *radio_here;
FL_OBJECT *Here;
};
#endif /* FD_form_float_h_ */

View File

@ -120,6 +120,42 @@ name: radio_page
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 190 60 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: Here, if possible|#i
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: radio_here
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 20 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: Here, definitely|#H
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_here_definitely
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
@ -192,41 +228,5 @@ name: button_restore
callback: C_FormBaseRestoreCB
argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 190 60 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: Here, if possible|#i
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: radio_here
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 20 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: Here, definitely|#H
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: Here
callback: C_FormBaseInputCB
argument: 0
==============================
create_the_forms