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
This commit is contained in:
Angus Leeming 2002-10-04 10:39:01 +00:00
parent cf27d6019a
commit ddfef28e29
7 changed files with 42 additions and 59 deletions

View 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,

View 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_ &&

View 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();

View 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_);

View 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, "");

View 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;
};

View 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