From c00fe603385b4275c039c9bb35c2b241db93d021 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Vigna?= Date: Thu, 14 Sep 2000 14:37:21 +0000 Subject: [PATCH] Move callback call in combox and add a Combox * to the callback-type. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1018 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 18 ++++++++++++++++++ src/combox.C | 8 +++++--- src/combox.h | 4 +++- src/frontends/xforms/FormDocument.C | 7 ++++--- src/frontends/xforms/FormDocument.h | 2 +- src/frontends/xforms/Toolbar_pimpl.C | 2 +- src/intl.C | 19 ++++++------------- src/intl.h | 4 +--- src/lyx_cb.C | 2 +- 9 files changed, 40 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 66ada6d24e..4a4aa1ffe3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2000-09-14 Juergen Vigna + + * src/frontends/xforms/FormDocument.C (ComboInputCB): fixed the + callback to check which combo called it and do the right action. + + * src/combox.C (combo_cb): added combo * to the callbacks. + (Hide): moved call of callback after Ungrab of the pointer. + + * src/intl.h: removed LCombo2 function. + + * src/intl.C (LCombo): added Combox * to call and removed LCombo2 + function as this can now be handled in one function. + + * src/combox.h: added Combox * to callback prototype. + + * src/frontends/xforms/Toolbar_pimpl.C: + * src/lyx_cb.C (LayoutsCB): added Combox * to function call. + 2000-09-14 Garst Reese * lib/tex/hollywood.cls changed length of parenthicals to 1.5in diff --git a/src/combox.C b/src/combox.C index 400e3da44d..260d781eed 100644 --- a/src/combox.C +++ b/src/combox.C @@ -274,10 +274,12 @@ void Combox::Hide(int who) else fl_set_object_label(label, fl_get_browser_line(browser, sel)); - if (callback) callback(sel, cb_arg); +// if (callback) callback(sel, cb_arg); } XUngrabPointer(fl_display, 0); XFlush(fl_display); + if (!who && browser && label && callback) + callback(sel, cb_arg, this); if (form) { fl_hide_form(form); XSetInputFocus(fl_display, save_window, @@ -338,7 +340,7 @@ void Combox::combo_cb(FL_OBJECT * ob, long data) combo->select(--i); if (combo->callback) combo->callback(combo->sel, - combo->cb_arg); + combo->cb_arg, combo); break; } case 3: @@ -346,7 +348,7 @@ void Combox::combo_cb(FL_OBJECT * ob, long data) combo->select(++i); if (combo->callback) combo->callback(combo->sel, - combo->cb_arg); + combo->cb_arg, combo); break; } default: combo->Show(); break; diff --git a/src/combox.h b/src/combox.h index 8668797a74..8dee29f1fc 100644 --- a/src/combox.h +++ b/src/combox.h @@ -41,8 +41,10 @@ enum combox_type { FL_COMBOX_INPUT }; +class Combox; + /// callback prototype -typedef void (*FL_COMBO_CB) (int, void *); +typedef void (*FL_COMBO_CB) (int, void *, Combox *); /// pre post prototype typedef void (*FL_COMBO_PRE_POST) (); diff --git a/src/frontends/xforms/FormDocument.C b/src/frontends/xforms/FormDocument.C index 1cc618f77c..52d7d02afb 100644 --- a/src/frontends/xforms/FormDocument.C +++ b/src/frontends/xforms/FormDocument.C @@ -163,7 +163,7 @@ void FormDocument::build() fl_addto_choice(class_->choice_doc_spacing, _(" Single | OneHalf | Double | Other ")); fl_addto_choice(class_->choice_doc_fontsize, "default|10|11|12"); - for (n=0; tex_fonts[n][0]; ++n) { + for (n=0; tex_fonts[n][0]; ++n) { fl_addto_choice(class_->choice_doc_fonts,tex_fonts[n]); } fl_addto_choice(class_->choice_doc_pagestyle, @@ -853,10 +853,11 @@ void FormDocument::InputCB(FL_OBJECT * ob, long) pre->bc_->valid(pre->CheckDocumentInput(ob,0)); } -void FormDocument::ComboInputCB(int, void * v) +void FormDocument::ComboInputCB(int, void * v, Combox * combox) { FormDocument * pre = static_cast(v); -// pre->CheckChoiceClass(0, 0); + if (combox == pre->combo_doc_class) + pre->CheckChoiceClass(0, 0); pre->bc_->valid(pre->CheckDocumentInput(0,0)); } diff --git a/src/frontends/xforms/FormDocument.h b/src/frontends/xforms/FormDocument.h index 3a66bac02b..3dadb8a5d8 100644 --- a/src/frontends/xforms/FormDocument.h +++ b/src/frontends/xforms/FormDocument.h @@ -61,7 +61,7 @@ public: /// static void InputCB(FL_OBJECT *, long); /// - static void ComboInputCB(int, void *); + static void ComboInputCB(int, void *, Combox *); /// static void ChoiceClassCB(FL_OBJECT *, long); /// diff --git a/src/frontends/xforms/Toolbar_pimpl.C b/src/frontends/xforms/Toolbar_pimpl.C index 07406dbc98..62c362d948 100644 --- a/src/frontends/xforms/Toolbar_pimpl.C +++ b/src/frontends/xforms/Toolbar_pimpl.C @@ -32,7 +32,7 @@ using std::endl; // this one is not "C" because combox callbacks are really C++ %-| -extern void LayoutsCB(int, void *); +extern void LayoutsCB(int, void *, Combox *); extern char const ** get_pixmap_from_symbol(char const * arg, int, int); extern LyXAction lyxaction; diff --git a/src/intl.C b/src/intl.C index faaa79910b..a3b93fe55b 100644 --- a/src/intl.C +++ b/src/intl.C @@ -183,23 +183,16 @@ void Intl::KeyMapSec() } } - -void Intl::LCombo(int, void * v) -{ - Intl * itl = static_cast(v); - itl->Keymap(23); - return; -} - - -void Intl::LCombo2(int, void * v) +void Intl::LCombo(int, void * v, Combox * combox) { Intl * itl = static_cast(v); - itl->Keymap(43); + if (combox == itl->Language) + itl->Keymap(23); + else if (combox == itl->Language2) + itl->Keymap(43); return; } - void Intl::DispatchCallback(FL_OBJECT * ob, long code) { if (ob && (code == 0)) { @@ -234,7 +227,7 @@ void Intl::InitKeyMapper(bool on) Language = new Combox(FL_COMBOX_DROPLIST); Language2 = new Combox(FL_COMBOX_DROPLIST); Language->setcallback(LCombo, this); - Language2->setcallback(LCombo2, this); + Language2->setcallback(LCombo, this); fd_form_keymap = create_form_KeyMap(); diff --git a/src/intl.h b/src/intl.h index 8432bfcd1a..f6a7caa1db 100644 --- a/src/intl.h +++ b/src/intl.h @@ -68,9 +68,7 @@ private: /// void update(); /// - static void LCombo(int i, void *); // callback - /// - static void LCombo2(int i, void *); // callback + static void LCombo(int i, void *, Combox *); // callback /// void Keymap(long code); /// diff --git a/src/lyx_cb.C b/src/lyx_cb.C index da971808f2..e6cd7c02a5 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -1175,7 +1175,7 @@ void MenuInsertLabel(char const * arg) // candidate for move to LyXView // This is only used in toolbar.C -void LayoutsCB(int sel, void *) +void LayoutsCB(int sel, void *, Combox *) { string tmp = tostr(sel); current_view->owner()->getLyXFunc()->Dispatch(LFUN_LAYOUTNO, -- 2.39.5