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
This commit is contained in:
Angus Leeming 2001-09-24 10:49:55 +00:00
parent 46295a02f4
commit 9c6e6a958a
4 changed files with 22 additions and 5 deletions

View File

@ -1,3 +1,12 @@
2001-09-24 Angus Leeming <a.leeming@ic.ac.uk>
* 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 <dekelts@tau.ac.il>
* FormRef.C (input): Fix crash when using dialog with keyboard.

View File

@ -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));
}

View File

@ -202,6 +202,13 @@ void FormBaseDeprecated::InputCB(FL_OBJECT * ob, long data)
FormBaseDeprecated * pre =
static_cast<FormBaseDeprecated*>(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));
}

View File

@ -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() ==