From: Angus Leeming Date: Fri, 4 Oct 2002 10:39:01 +0000 (+0000) Subject: Refine yesterday's bug fix a little and apply to the combox also. X-Git-Tag: 1.6.10~18218 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=ddfef28e296dde1058a02b1a2e1c8d5baa386e59;p=lyx.git Refine yesterday's bug fix a little and apply to the combox also. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5358 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 8de3fd68da..b7702e4c40 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,20 @@ +2002-10-04 Angus Leeming + + * form_graphics.fd: un-cripple dialog by reverting yesterday's change. + + * FeedbackController.C (PrehandlerCB): reduce the necessary calcs to the + bare minimum. + + * combox.[Ch]: the optional tabfolder args passed to the c-tor are + no longer necessary and are scrapped. + (show): use the same, minimal fix as in PrehandlerCB to ensure that + the form's x,y coords are up to date. In truth, this fix should be + redundant, but not all "enter" events are caught by the prehandler. + + * FormDocument.C (build): + * FormPreferences.C (xyz::build): no longer pass the tabfolder to the + combox c-tor. + 2002-10-03 Angus Leeming * FeedbackController.C (PrehandlerCB): re-compute the folder->x, diff --git a/src/frontends/xforms/FeedbackController.C b/src/frontends/xforms/FeedbackController.C index 16b6ebf9bd..f639c12c4c 100644 --- a/src/frontends/xforms/FeedbackController.C +++ b/src/frontends/xforms/FeedbackController.C @@ -88,10 +88,10 @@ void FeedbackController::PrehandlerCB(FL_OBJECT * ob, int event, int key) // It updates the form->x, form->y coords of the active // tabfolder when the mouse enters. FL_FORM * const form = fl_get_active_folder(ob); - Window win = fl_prepare_form_window(form, 0, 0, "Folder"); - if (win) { + if (form->window) { FL_Coord w, h; - fl_get_wingeometry(win, &(form->x), &(form->y), &w, &h); + fl_get_wingeometry(form->window, + &(form->x), &(form->y), &w, &h); } } else if (message_widget_ && diff --git a/src/frontends/xforms/FormDocument.C b/src/frontends/xforms/FormDocument.C index 6180f82952..b139340413 100644 --- a/src/frontends/xforms/FormDocument.C +++ b/src/frontends/xforms/FormDocument.C @@ -180,8 +180,7 @@ void FormDocument::build() fl_deactivate_object(obj); fl_addto_form(class_->form); combo_doc_class.reset(new Combox(FL_COMBOX_DROPLIST)); - combo_doc_class->add(obj->x, obj->y, obj->w, obj->h, 400, - dialog_->tabfolder); + combo_doc_class->add(obj->x, obj->y, obj->w, obj->h, 400); combo_doc_class->shortcut("#C",1); combo_doc_class->setcallback(ComboInputCB, this); fl_end_form(); @@ -244,8 +243,7 @@ void FormDocument::build() fl_deactivate_object(obj); fl_addto_form(language_->form); combo_language.reset(new Combox(FL_COMBOX_DROPLIST)); - combo_language->add(obj->x, obj->y, obj->w, obj->h, 400, - dialog_->tabfolder); + combo_language->add(obj->x, obj->y, obj->w, obj->h, 400); combo_language->shortcut("#L",1); combo_language->setcallback(ComboInputCB, this); fl_end_form(); diff --git a/src/frontends/xforms/FormPreferences.C b/src/frontends/xforms/FormPreferences.C index 9025c83aa0..0bf440b5f0 100644 --- a/src/frontends/xforms/FormPreferences.C +++ b/src/frontends/xforms/FormPreferences.C @@ -1648,9 +1648,7 @@ void FormPreferences::Language::build() FL_OBJECT * obj = dialog_->choice_default_lang; fl_deactivate_object(dialog_->choice_default_lang); combo_default_lang.reset(new Combox(FL_COMBOX_DROPLIST)); - combo_default_lang->add(obj->x, obj->y, obj->w, obj->h, 400, - parent_.lang_opts_tab_->tabfolder_inner, - parent_.dialog_->tabfolder_prefs); + combo_default_lang->add(obj->x, obj->y, obj->w, obj->h, 400); combo_default_lang->shortcut("#L",1); combo_default_lang->setcallback(ComboCB, &parent_); diff --git a/src/frontends/xforms/combox.C b/src/frontends/xforms/combox.C index 783116ab83..53ae537296 100644 --- a/src/frontends/xforms/combox.C +++ b/src/frontends/xforms/combox.C @@ -71,7 +71,7 @@ extern "C" { Combox::Combox(combox_type t) - : type(t), tabfolder1(0), tabfolder2(0) + : type(t) { browser = button = 0; callback = 0; @@ -179,13 +179,8 @@ void Combox::select(int i) } -void Combox::add(int x, int y, int w, int hmin, int hmax, - FL_OBJECT * tabfolder1_, FL_OBJECT * tabfolder2_) +void Combox::add(int x, int y, int w, int hmin, int hmax) { - // Store these for later use in working round an xforms bug in show() - tabfolder1 = tabfolder1_; - tabfolder2 = tabfolder2_; - FL_OBJECT * obj; switch (type) { @@ -287,35 +282,20 @@ void Combox::show() fl_redraw_object(button); } - int x = label->x; - int y = label->y + label->h; - if (tabfolder1) { - // This is a bug work around suggested by Steve Lamont on the - // xforms mailing list. It correctly positions the browser form - // after the main window has been moved. - // The bug only occurs in tabbed folders. - int folder_x, folder_y, folder_w, folder_h; - fl_get_folder_area( tabfolder1, - &folder_x, &folder_y, - &folder_w, &folder_h); - x += folder_x; - y += folder_y; - - if (tabfolder2) { - fl_get_folder_area( tabfolder2, - &folder_x, &folder_y, - &folder_w, &folder_h); - x += tabfolder2->form->x + folder_x; - y += tabfolder2->form->y + folder_y; - } else { - x += tabfolder1->form->x; - y += tabfolder1->form->y; - } - - } else { - x += label->form->x; - y += label->form->y; + // This fix ensures that, even if label lies on a tabfolder, + // the x,y coords of the underlying form are up to date. + // It should be rendered redundant by a similar fix in the + // tabfolder prehandler, but apparently "enter" events are not always + // caught... + // Angus 4 Oct, 2002. + if (label->form->window) { + FL_FORM * lf = label->form; + FL_Coord w, h; + fl_get_wingeometry(lf->window, &(lf->x), &(lf->y), &w, &h); } + + int const x = label->form->x + label->x; + int const y = label->form->y + label->y + label->h; fl_set_form_position(form, x, y); fl_show_form(form, FL_PLACE_POSITION, FL_NOBORDER, ""); diff --git a/src/frontends/xforms/combox.h b/src/frontends/xforms/combox.h index e7613f23f3..391d09d5aa 100644 --- a/src/frontends/xforms/combox.h +++ b/src/frontends/xforms/combox.h @@ -61,15 +61,9 @@ public: ~Combox(); /** To add this object to a form. Note that there are two heights - for normal (button) and expanded (browser) mode each. - The optional tabfolder arguments are needed to overcome an - xforms bug when repositioning a combox in a tab folder. - tabfolder1_ is the folder holding the combox. - If using nested tabfolders, tabfolder2_ is the "base" folder - holding tabfolder1_. - */ - void add(int x, int y, int w, int hmin, int hmax, - FL_OBJECT * tabfolder1_ = 0, FL_OBJECT * tabfolder2_ = 0); + * for normal (button) and expanded (browser) mode each. + */ + void add(int x, int y, int w, int hmin, int hmax); /// Add lines. Same as for fl_browser object void addline(string const &); @@ -158,10 +152,6 @@ public: FL_OBJECT * label; /// FL_FORM* form; - /// - FL_OBJECT * tabfolder1; - /// - FL_OBJECT * tabfolder2; }; diff --git a/src/frontends/xforms/forms/form_graphics.fd b/src/frontends/xforms/forms/form_graphics.fd index f3fa6aef7d..399a545b03 100644 --- a/src/frontends/xforms/forms/form_graphics.fd +++ b/src/frontends/xforms/forms/form_graphics.fd @@ -34,7 +34,7 @@ argument: -------------------- class: FL_TABFOLDER type: TOP_TABFOLDER -box: 0 10 400 255 +box: 0 5 400 255 boxtype: FL_FRAME_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_TOP_LEFT