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
This commit is contained in:
Jürgen Vigna 2000-09-14 14:37:21 +00:00
parent 43b9673492
commit c00fe60338
9 changed files with 40 additions and 26 deletions

View File

@ -1,3 +1,21 @@
2000-09-14 Juergen Vigna <jug@sad.it>
* 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 <reese@isn.net> 2000-09-14 Garst Reese <reese@isn.net>
* lib/tex/hollywood.cls changed length of parenthicals to 1.5in * lib/tex/hollywood.cls changed length of parenthicals to 1.5in

View File

@ -274,10 +274,12 @@ void Combox::Hide(int who)
else else
fl_set_object_label(label, fl_set_object_label(label,
fl_get_browser_line(browser, sel)); fl_get_browser_line(browser, sel));
if (callback) callback(sel, cb_arg); // if (callback) callback(sel, cb_arg);
} }
XUngrabPointer(fl_display, 0); XUngrabPointer(fl_display, 0);
XFlush(fl_display); XFlush(fl_display);
if (!who && browser && label && callback)
callback(sel, cb_arg, this);
if (form) { if (form) {
fl_hide_form(form); fl_hide_form(form);
XSetInputFocus(fl_display, save_window, XSetInputFocus(fl_display, save_window,
@ -338,7 +340,7 @@ void Combox::combo_cb(FL_OBJECT * ob, long data)
combo->select(--i); combo->select(--i);
if (combo->callback) if (combo->callback)
combo->callback(combo->sel, combo->callback(combo->sel,
combo->cb_arg); combo->cb_arg, combo);
break; break;
} }
case 3: case 3:
@ -346,7 +348,7 @@ void Combox::combo_cb(FL_OBJECT * ob, long data)
combo->select(++i); combo->select(++i);
if (combo->callback) if (combo->callback)
combo->callback(combo->sel, combo->callback(combo->sel,
combo->cb_arg); combo->cb_arg, combo);
break; break;
} }
default: combo->Show(); break; default: combo->Show(); break;

View File

@ -41,8 +41,10 @@ enum combox_type {
FL_COMBOX_INPUT FL_COMBOX_INPUT
}; };
class Combox;
/// callback prototype /// callback prototype
typedef void (*FL_COMBO_CB) (int, void *); typedef void (*FL_COMBO_CB) (int, void *, Combox *);
/// pre post prototype /// pre post prototype
typedef void (*FL_COMBO_PRE_POST) (); typedef void (*FL_COMBO_PRE_POST) ();

View File

@ -163,7 +163,7 @@ void FormDocument::build()
fl_addto_choice(class_->choice_doc_spacing, fl_addto_choice(class_->choice_doc_spacing,
_(" Single | OneHalf | Double | Other ")); _(" Single | OneHalf | Double | Other "));
fl_addto_choice(class_->choice_doc_fontsize, "default|10|11|12"); 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_fonts,tex_fonts[n]);
} }
fl_addto_choice(class_->choice_doc_pagestyle, 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)); 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<FormDocument*>(v); FormDocument * pre = static_cast<FormDocument*>(v);
// pre->CheckChoiceClass(0, 0); if (combox == pre->combo_doc_class)
pre->CheckChoiceClass(0, 0);
pre->bc_->valid(pre->CheckDocumentInput(0,0)); pre->bc_->valid(pre->CheckDocumentInput(0,0));
} }

View File

@ -61,7 +61,7 @@ public:
/// ///
static void InputCB(FL_OBJECT *, long); static void InputCB(FL_OBJECT *, long);
/// ///
static void ComboInputCB(int, void *); static void ComboInputCB(int, void *, Combox *);
/// ///
static void ChoiceClassCB(FL_OBJECT *, long); static void ChoiceClassCB(FL_OBJECT *, long);
/// ///

View File

@ -32,7 +32,7 @@
using std::endl; using std::endl;
// this one is not "C" because combox callbacks are really C++ %-| // 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 char const ** get_pixmap_from_symbol(char const * arg, int, int);
extern LyXAction lyxaction; extern LyXAction lyxaction;

View File

@ -183,23 +183,16 @@ void Intl::KeyMapSec()
} }
} }
void Intl::LCombo(int, void * v, Combox * combox)
void Intl::LCombo(int, void * v)
{ {
Intl * itl = static_cast<Intl*>(v); Intl * itl = static_cast<Intl*>(v);
itl->Keymap(23); if (combox == itl->Language)
itl->Keymap(23);
else if (combox == itl->Language2)
itl->Keymap(43);
return; return;
} }
void Intl::LCombo2(int, void * v)
{
Intl * itl = static_cast<Intl*>(v);
itl->Keymap(43);
return;
}
void Intl::DispatchCallback(FL_OBJECT * ob, long code) void Intl::DispatchCallback(FL_OBJECT * ob, long code)
{ {
if (ob && (code == 0)) { if (ob && (code == 0)) {
@ -234,7 +227,7 @@ void Intl::InitKeyMapper(bool on)
Language = new Combox(FL_COMBOX_DROPLIST); Language = new Combox(FL_COMBOX_DROPLIST);
Language2 = new Combox(FL_COMBOX_DROPLIST); Language2 = new Combox(FL_COMBOX_DROPLIST);
Language->setcallback(LCombo, this); Language->setcallback(LCombo, this);
Language2->setcallback(LCombo2, this); Language2->setcallback(LCombo, this);
fd_form_keymap = create_form_KeyMap(); fd_form_keymap = create_form_KeyMap();

View File

@ -68,9 +68,7 @@ private:
/// ///
void update(); void update();
/// ///
static void LCombo(int i, void *); // callback static void LCombo(int i, void *, Combox *); // callback
///
static void LCombo2(int i, void *); // callback
/// ///
void Keymap(long code); void Keymap(long code);
/// ///

View File

@ -1175,7 +1175,7 @@ void MenuInsertLabel(char const * arg)
// candidate for move to LyXView // candidate for move to LyXView
// This is only used in toolbar.C // This is only used in toolbar.C
void LayoutsCB(int sel, void *) void LayoutsCB(int sel, void *, Combox *)
{ {
string tmp = tostr(sel); string tmp = tostr(sel);
current_view->owner()->getLyXFunc()->Dispatch(LFUN_LAYOUTNO, current_view->owner()->getLyXFunc()->Dispatch(LFUN_LAYOUTNO,