From 892e858adf7d99f6e7933d2f94fa8b8fa4ff8a1b Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Mon, 28 Oct 2002 12:53:23 +0000 Subject: [PATCH] Work-around xforms' bug, enabling tooltips for browser widgets. I've told the xforms list of the bug and proposed some solns. We'll see if anything is done... git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5531 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/xforms/ChangeLog | 12 +++++++ src/frontends/xforms/FeedbackController.C | 38 ++++++++++++++++++++--- src/frontends/xforms/FormBibtex.C | 2 ++ src/frontends/xforms/FormCitation.C | 6 ++++ src/frontends/xforms/FormForks.C | 4 +++ src/frontends/xforms/FormSpellchecker.C | 2 ++ src/frontends/xforms/FormTexinfo.C | 2 ++ 7 files changed, 61 insertions(+), 5 deletions(-) diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index deabbc5657..162cf11a3e 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,15 @@ +2002-10-28 Angus Leeming + + * FeedbackController.C (PrehandlerCB): show tooltips for browser + widgets, working-around an xforms bug. + + * FormBibtex.C (build): + * FormCitation.C (build): + * FormForks.C (build): + * FormSpellchecker.C (build): + * FormTexinfo.C (build): + set the prehandler for the browser widgets so that we can have tooltips. + 2002-10-28 Dekel Tsur * xfont_loader.C (getFontinfo): Cleanup. diff --git a/src/frontends/xforms/FeedbackController.C b/src/frontends/xforms/FeedbackController.C index 5712d7b8d2..0f453cb4bb 100644 --- a/src/frontends/xforms/FeedbackController.C +++ b/src/frontends/xforms/FeedbackController.C @@ -70,6 +70,15 @@ void FeedbackController::MessageCB(FL_OBJECT * ob, int event) } } +#if FL_VERSION > 0 || FL_REVISION >= 89 +extern "C" { + +void fl_show_tooltip(const char *, int, int); + +void fl_hide_tooltip(); + +} +#endif void FeedbackController::PrehandlerCB(FL_OBJECT * ob, int event, int key) { @@ -79,9 +88,14 @@ void FeedbackController::PrehandlerCB(FL_OBJECT * ob, int event, int key) // Trigger an input event when pasting in an xforms input object // using the middle mouse button. InputCB(ob, 0); - - } else if (ob->objclass == FL_TABFOLDER && - (event == FL_ENTER || event == FL_LEAVE)) { + return; + } + + + if (event != FL_ENTER && event != FL_LEAVE) + return; + + if (ob->objclass == FL_TABFOLDER) { // This prehandler is used to work-around an xforms bug and // ensures that the form->x, form->y coords of the active // tabfolder are up to date. @@ -96,13 +110,27 @@ void FeedbackController::PrehandlerCB(FL_OBJECT * ob, int event, int key) fl_get_winorigin(folder->window, &(folder->x), &(folder->y)); } + + } - } else if (message_widget_ && - (event == FL_ENTER || event == FL_LEAVE)) { + if (message_widget_) { // Post feedback as the mouse enters the object, // remove it as the mouse leaves. MessageCB(ob, event); } + +#if FL_VERSION > 0 || FL_REVISION >= 89 + // Tooltips are not displayed on browser widgets due to an xforms' bug. + // This is a work-around: + if (ob->objclass == FL_BROWSER) { + if (event == FL_ENTER && ob->tooltip && *(ob->tooltip)) { + fl_show_tooltip(ob->tooltip, ob->form->x + ob->x, + ob->form->y + ob->y + ob->h + 1); + } else if (event == FL_LEAVE) { + fl_hide_tooltip(); + } + } +#endif } diff --git a/src/frontends/xforms/FormBibtex.C b/src/frontends/xforms/FormBibtex.C index d7e8004609..cbe76f66c3 100644 --- a/src/frontends/xforms/FormBibtex.C +++ b/src/frontends/xforms/FormBibtex.C @@ -86,6 +86,8 @@ void FormBibtex::build() str = _("Choose a BibTeX style from the list."); tooltips().init(dialog_->browser_styles, str); + // Work-around xforms' bug; enable tooltips for browser widgets. + setPrehandler(dialog_->browser_styles); str = _("Updates your TeX system for a new bibstyle list. Only " "the styles which are in directories where TeX finds them " diff --git a/src/frontends/xforms/FormCitation.C b/src/frontends/xforms/FormCitation.C index 75451fa9e7..fafc6375c9 100644 --- a/src/frontends/xforms/FormCitation.C +++ b/src/frontends/xforms/FormCitation.C @@ -177,12 +177,18 @@ void FormCitation::build() str = _("The entries which will be cited. Select them with the arrow buttons from the right browser window."); tooltips().init(dialog_->browser_cite, str); + // Work-around xforms' bug; enable tooltips for browser widgets. + setPrehandler(dialog_->browser_cite); str = _("All entries in the database you have loaded (via \"Insert->Lists&TOC->BibTex Reference\"). Move the ones you want to cite with the arrow buttons into the left browser window."); tooltips().init(dialog_->browser_bib, str); + // Work-around xforms' bug; enable tooltips for browser widgets. + setPrehandler(dialog_->browser_bib); str = _("Information about the selected entry"); tooltips().init(dialog_->browser_info, str); + // Work-around xforms' bug; enable tooltips for browser widgets. + setPrehandler(dialog_->browser_info); str = _("Here you may select how the citation label should look inside the text (Natbib)."); tooltips().init(dialog_->choice_style, str); diff --git a/src/frontends/xforms/FormForks.C b/src/frontends/xforms/FormForks.C index d776fffa9e..b6494c332b 100644 --- a/src/frontends/xforms/FormForks.C +++ b/src/frontends/xforms/FormForks.C @@ -56,9 +56,13 @@ void FormForks::build() { // Set up the tooltip mechanism string str = _("All currently running child processes forked by LyX."); tooltips().init(dialog_->browser_children, str); + // Work-around xforms' bug; enable tooltips for browser widgets. + setPrehandler(dialog_->browser_children); str = _("A list of all child processes to kill."); tooltips().init(dialog_->browser_kill, str); + // Work-around xforms' bug; enable tooltips for browser widgets. + setPrehandler(dialog_->browser_kill); str = _("Add all processes to the list of processes to kill."); tooltips().init(dialog_->button_all, str); diff --git a/src/frontends/xforms/FormSpellchecker.C b/src/frontends/xforms/FormSpellchecker.C index 56b2f262da..fccb0f1091 100644 --- a/src/frontends/xforms/FormSpellchecker.C +++ b/src/frontends/xforms/FormSpellchecker.C @@ -60,6 +60,8 @@ void FormSpellchecker::build() tooltips().init(dialog_->input_replacement, str); str = _("List of replacement suggestions from dictionary."); tooltips().init(dialog_->browser_suggestions, str); + // Work-around xforms' bug; enable tooltips for browser widgets. + setPrehandler(dialog_->browser_suggestions); str = _("Start the spellingchecker."); tooltips().init(dialog_->button_start, str); str = _("Replace unknown word."); diff --git a/src/frontends/xforms/FormTexinfo.C b/src/frontends/xforms/FormTexinfo.C index aca0edd0f3..bda1ad1858 100644 --- a/src/frontends/xforms/FormTexinfo.C +++ b/src/frontends/xforms/FormTexinfo.C @@ -60,6 +60,8 @@ void FormTexinfo::build() { str = _("Double click to view contents of file."); tooltips().init(dialog_->browser, str); + // Work-around xforms' bug; enable tooltips for browser widgets. + setPrehandler(dialog_->browser); str = _("Runs the script \"texhash\" which builds a new LaTeX tree. " "Needed if you install a new TeX class or style. You need write " -- 2.39.5