From 9c6e6a958ab8084b670d0396837248c5751b747d Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Mon, 24 Sep 2001 10:49:55 +0000 Subject: [PATCH] Generalise Dekel's fix to the "select choice < 1" problem. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2791 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/xforms/ChangeLog | 9 +++++++++ src/frontends/xforms/FormBase.C | 6 ++++++ src/frontends/xforms/FormBaseDeprecated.C | 7 +++++++ src/frontends/xforms/FormRef.C | 5 ----- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index d9a0e92471..0e0375bb24 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,12 @@ +2001-09-24 Angus Leeming + + * FormBase.C (InputCB): + * FormBaseDeprecated.C (InputCB): generalised Dekel's fix to the + "select choice < 1" problem. + + * FormRef.C (input): undid Dekel's change in light of the above + generalisation. + 2001-09-21 Dekel Tsur * FormRef.C (input): Fix crash when using dialog with keyboard. diff --git a/src/frontends/xforms/FormBase.C b/src/frontends/xforms/FormBase.C index bfee6f8bd9..ecd0cfbc42 100644 --- a/src/frontends/xforms/FormBase.C +++ b/src/frontends/xforms/FormBase.C @@ -99,6 +99,12 @@ void FormBase::hide() void FormBase::InputCB(FL_OBJECT * ob, long data) { + // It is possible to set the choice to 0 when using the + // keyboard shortcuts. This work-around deals with the problem. + if (ob && ob->objclass == FL_CHOICE && fl_get_choice(ob) < 1) { + fl_set_choice(ob, 1); + } + bc().input(input(ob, data)); } diff --git a/src/frontends/xforms/FormBaseDeprecated.C b/src/frontends/xforms/FormBaseDeprecated.C index bd661f10c1..c020a59cb1 100644 --- a/src/frontends/xforms/FormBaseDeprecated.C +++ b/src/frontends/xforms/FormBaseDeprecated.C @@ -202,6 +202,13 @@ void FormBaseDeprecated::InputCB(FL_OBJECT * ob, long data) FormBaseDeprecated * pre = static_cast(ob->form->u_vdata); lyx::Assert(pre); + + // It is possible to set the choice to 0 when using the + // keyboard shortcuts. This work-around deals with the problem. + if (ob && ob->objclass == FL_CHOICE && fl_get_choice(ob) < 1) { + fl_set_choice(ob, 1); + } + pre->bc().valid(pre->input(ob, data)); } diff --git a/src/frontends/xforms/FormRef.C b/src/frontends/xforms/FormRef.C index 909c8ec304..b4a64c3e1b 100644 --- a/src/frontends/xforms/FormRef.C +++ b/src/frontends/xforms/FormRef.C @@ -197,9 +197,6 @@ ButtonPolicy::SMInput FormRef::input(FL_OBJECT * ob, long) } else if (ob == dialog_->button_update || ob == dialog_->sort || ob == dialog_->buffer) { - if (ob == dialog_->buffer && - fl_get_choice(dialog_->buffer) < 1) - fl_set_choice(dialog_->buffer, 1); if (ob == dialog_->button_update || ob == dialog_->buffer) { @@ -213,8 +210,6 @@ ButtonPolicy::SMInput FormRef::input(FL_OBJECT * ob, long) fl_unfreeze_form(form()); } else if (ob == dialog_->type) { - if (fl_get_choice(dialog_->type) < 1) - fl_set_choice(dialog_->type, 1); int const type = fl_get_choice(dialog_->type) - 1; if (controller().params().getCmdName() == -- 2.39.2