]> git.lyx.org Git - lyx.git/commitdiff
Refine yesterday's bug fix a little and apply to the combox also.
authorAngus Leeming <leeming@lyx.org>
Fri, 4 Oct 2002 10:39:01 +0000 (10:39 +0000)
committerAngus Leeming <leeming@lyx.org>
Fri, 4 Oct 2002 10:39:01 +0000 (10:39 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5358 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/xforms/ChangeLog
src/frontends/xforms/FeedbackController.C
src/frontends/xforms/FormDocument.C
src/frontends/xforms/FormPreferences.C
src/frontends/xforms/combox.C
src/frontends/xforms/combox.h
src/frontends/xforms/forms/form_graphics.fd

index 8de3fd68da4909e691a481979797a7171ef62d2d..b7702e4c40ef3ceaf5644ff3db5f1840d531c146 100644 (file)
@@ -1,3 +1,20 @@
+2002-10-04  Angus Leeming  <leeming@lyx.org>
+
+       * 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  <leeming@lyx.org>
 
        * FeedbackController.C (PrehandlerCB): re-compute the folder->x,
index 16b6ebf9bd7ccf6e3fbd7e6b5af9cd939435384e..f639c12c4c0510dc3333c21559cd01a0e24eb6b1 100644 (file)
@@ -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_ &&
index 6180f829528df5823e819092ec8b734e1f2e8e45..b139340413c11756b2405154ee9511e4f27ca741 100644 (file)
@@ -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();
index 9025c83aa0e43e454f9ed1bef6f6117d3ec23d4d..0bf440b5f02641e3ab549a6fc9132eac789a9651 100644 (file)
@@ -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_);
 
index 783116ab836f92eafafb180e99c78a6a54bae03d..53ae537296c748182d67ffb387189803803d33fe 100644 (file)
@@ -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, "");
index e7613f23f32d334fd11db479a57be0642546827f..391d09d5aa4ff253d7bfcc13fe28a435437b4342 100644 (file)
@@ -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;
 };
 
 
index f3fa6aef7d966ccc86bca64baa31bbf134079421..399a545b03bd20aed9871f5e81f9ffd14a15cca4 100644 (file)
@@ -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