Finish to add wrappers for xforms callbacks. Now dec C++ 6.1 compiles lyx

happily :)


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@242 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 1999-10-25 14:18:30 +00:00
parent c1093f1c92
commit a8a90bf854
22 changed files with 388 additions and 160 deletions

View File

@ -1,5 +1,12 @@
1999-10-25 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr> 1999-10-25 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* INSTALL: it is now possible to compile LyX with digital C++ 6.1
(and presumably 6.2).
* src/{BufferView,LyXView,combox,filedlg,intl,lyxserver,lyxvc,
menus,minibuffer,toolbar}.{C,h}: added C_xxx wrappers around
remaining static member callbacks.
* src/lyxfunc.C (Dispatch): Use _() instead of N_() fot minibuffer * src/lyxfunc.C (Dispatch): Use _() instead of N_() fot minibuffer
messages. messages.

15
INSTALL
View File

@ -278,6 +278,16 @@ notify us.
will be solved if you use --with-included-gettext when configuring will be solved if you use --with-included-gettext when configuring
LyX. LyX.
o It is possible to compile lyx with Digital Unix cxx compiler
version 6.1 (and presumably compaq C++ 6.2 on both Tru64 unix and
linux/alpha, when this will be available), provided one uses
CXX=cxx
CXXFLAGS='-ptr /tmp/lyx_cxx_repository -std strict_ansi -g -O'
Note that this will not work when compiling directly from the cvs
repository, due to the tricks used by automake for dependencies. Ask
Jean-Marc.Lasgouttes@inria.fr for a workaround.
o On Digital Unix with cxx, you may have a compilation error in o On Digital Unix with cxx, you may have a compilation error in
lyx_main.C if you have GNU gettext installed. This is due to a bug lyx_main.C if you have GNU gettext installed. This is due to a bug
in gettext. To solve this, you can either (1) configure with in gettext. To solve this, you can either (1) configure with
@ -381,8 +391,3 @@ Warning: Linking some objects which contain exception information sections
You can safely ignore it. You can safely ignore it.
o Configure fails to work with cxx V5.0-3 on Digital Unix
V3.2c. This is due to a bug in this particular version of cxx.
Contact Achim Bohnet <ach@rosat.mpe-garching.mpg.de> for more
details concerning this problem.

View File

@ -364,6 +364,29 @@ void BufferView::gotoError()
_buffer->text->cursor; _buffer->text->cursor;
} }
// Just a bunch of C wrappers around static members of BufferView
extern "C" void C_BufferView_UpCB(FL_OBJECT *ob, long buf) {
BufferView::UpCB(ob,buf);
}
extern "C" void C_BufferView_DownCB(FL_OBJECT *ob, long buf) {
BufferView::DownCB(ob,buf);
}
extern "C" void C_BufferView_ScrollCB(FL_OBJECT *ob, long buf) {
BufferView::ScrollCB(ob,buf);
}
extern "C" void C_BufferView_CursorToggleCB(FL_OBJECT *ob, long buf) {
BufferView::CursorToggleCB(ob,buf);
}
extern "C" int C_BufferView_work_area_handler(FL_OBJECT *ob, int event,
FL_Coord, FL_Coord,
int key, void *xev) {
return BufferView::work_area_handler(ob, event, 0, 0, key, xev);
}
void BufferView::create_view(int xpos, int ypos, int width, int height) void BufferView::create_view(int xpos, int ypos, int width, int height)
{ {
@ -392,7 +415,7 @@ void BufferView::create_view(int xpos, int ypos, int width, int height)
xpos +bw, ypos+bw, xpos +bw, ypos+bw,
width-15-2*bw /* scrollbarwidth */, width-15-2*bw /* scrollbarwidth */,
height-2*bw,"", height-2*bw,"",
work_area_handler); C_BufferView_work_area_handler);
obj->wantkey = FL_KEY_TAB; obj->wantkey = FL_KEY_TAB;
obj->u_vdata = this; /* This is how we pass the BufferView obj->u_vdata = this; /* This is how we pass the BufferView
to the work_area_handler. */ to the work_area_handler. */
@ -418,7 +441,7 @@ void BufferView::create_view(int xpos, int ypos, int width, int height)
fl_set_object_color(obj,FL_MCOL,FL_BLUE); fl_set_object_color(obj,FL_MCOL,FL_BLUE);
fl_set_object_resize(obj, FL_RESIZE_ALL); fl_set_object_resize(obj, FL_RESIZE_ALL);
fl_set_object_gravity(obj,NorthEastGravity, NorthEastGravity); fl_set_object_gravity(obj,NorthEastGravity, NorthEastGravity);
fl_set_object_callback(obj,UpCB,(long)this); fl_set_object_callback(obj,C_BufferView_UpCB,(long)this);
fl_set_pixmapbutton_data(obj, up_xpm); fl_set_pixmapbutton_data(obj, up_xpm);
#if FL_REVISION >85 #if FL_REVISION >85
@ -436,7 +459,7 @@ void BufferView::create_view(int xpos, int ypos, int width, int height)
fl_set_object_boxtype(obj, FL_UP_BOX); fl_set_object_boxtype(obj, FL_UP_BOX);
fl_set_object_resize(obj, FL_RESIZE_ALL); fl_set_object_resize(obj, FL_RESIZE_ALL);
fl_set_object_gravity(obj, NorthEastGravity, SouthEastGravity); fl_set_object_gravity(obj, NorthEastGravity, SouthEastGravity);
fl_set_object_callback(obj,ScrollCB,(long)this); fl_set_object_callback(obj,C_BufferView_ScrollCB,(long)this);
// down - scrollbar button // down - scrollbar button
#if FL_REVISION > 85 #if FL_REVISION > 85
@ -452,7 +475,7 @@ void BufferView::create_view(int xpos, int ypos, int width, int height)
fl_set_object_color(obj,FL_MCOL,FL_BLUE); fl_set_object_color(obj,FL_MCOL,FL_BLUE);
fl_set_object_resize(obj, FL_RESIZE_ALL); fl_set_object_resize(obj, FL_RESIZE_ALL);
fl_set_object_gravity(obj, SouthEastGravity, SouthEastGravity); fl_set_object_gravity(obj, SouthEastGravity, SouthEastGravity);
fl_set_object_callback(obj,DownCB,(long)this); fl_set_object_callback(obj,C_BufferView_DownCB,(long)this);
fl_set_pixmapbutton_data(obj, down_xpm); fl_set_pixmapbutton_data(obj, down_xpm);
fl_set_border_width(-bw); fl_set_border_width(-bw);
@ -468,7 +491,7 @@ void BufferView::create_view(int xpos, int ypos, int width, int height)
// timer_cursor // timer_cursor
timer_cursor = obj = fl_add_timer(FL_HIDDEN_TIMER, timer_cursor = obj = fl_add_timer(FL_HIDDEN_TIMER,
0,0,0,0,"Timer"); 0,0,0,0,"Timer");
fl_set_object_callback(obj,CursorToggleCB,0); fl_set_object_callback(obj,C_BufferView_CursorToggleCB,0);
obj->u_vdata = this; obj->u_vdata = this;
} }

View File

@ -89,6 +89,7 @@ private:
/// ///
void ScrollDownOnePage(long /*time*/); void ScrollDownOnePage(long /*time*/);
public:
/// A callback for the up arrow in the scrollbar. /// A callback for the up arrow in the scrollbar.
static void UpCB(FL_OBJECT *ob, long); static void UpCB(FL_OBJECT *ob, long);
@ -98,10 +99,13 @@ private:
/// A callback for the down arrow in the scrollbar. /// A callback for the down arrow in the scrollbar.
static void DownCB(FL_OBJECT *ob, long); static void DownCB(FL_OBJECT *ob, long);
///
static void CursorToggleCB(FL_OBJECT *ob, long);
/** Work area free object handler /** Work area free object handler
*/ */
static int work_area_handler(FL_OBJECT *, int event, static int work_area_handler(FL_OBJECT *, int event,
FL_Coord, FL_Coord, int key, void *xev); FL_Coord, FL_Coord, int key, void *xev);
private:
/// ///
int WorkAreaMotionNotify(FL_OBJECT *ob, int WorkAreaMotionNotify(FL_OBJECT *ob,
Window win, Window win,
@ -122,8 +126,6 @@ private:
int w, int h, int w, int h,
XEvent *ev, void *d); XEvent *ev, void *d);
/// ///
static void CursorToggleCB(FL_OBJECT *ob, long);
///
LyXView *_owner; LyXView *_owner;
/// ///
Buffer *_buffer; Buffer *_buffer;

View File

@ -46,11 +46,12 @@ int current_layout = 0;
// This is very temporary // This is very temporary
BufferView *current_view; BufferView *current_view;
extern "C" int C_LyXView_atCloseMainFormCB(FL_FORM *, void *);
LyXView::LyXView(int width, int height) LyXView::LyXView(int width, int height)
{ {
fd_form_main = create_form_form_main(width,height); fd_form_main = create_form_form_main(width,height);
fl_set_form_atclose(_form, atCloseMainFormCB, 0); fl_set_form_atclose(_form, C_LyXView_atCloseMainFormCB, 0);
lyxerr.debug() << "Initializing LyXFunc" << endl; lyxerr.debug() << "Initializing LyXFunc" << endl;
lyxfunc = new LyXFunc(this); lyxfunc = new LyXFunc(this);
intl = new Intl; intl = new Intl;
@ -91,6 +92,12 @@ void LyXView::UpdateTimerCB(FL_OBJECT *ob, long)
updatetimer = 0; updatetimer = 0;
} }
// Wrapper for the above
extern "C" void C_LyXView_UpdateTimerCB(FL_OBJECT *ob, long data) {
LyXView::UpdateTimerCB(ob,data);
}
// Callback for autosave timer // Callback for autosave timer
void LyXView::AutosaveTimerCB(FL_OBJECT *, long) void LyXView::AutosaveTimerCB(FL_OBJECT *, long)
@ -99,6 +106,11 @@ void LyXView::AutosaveTimerCB(FL_OBJECT *, long)
AutoSave(); AutoSave();
} }
// Wrapper for the above
extern "C" void C_LyXView_AutosaveTimerCB(FL_OBJECT *ob, long data) {
LyXView::AutosaveTimerCB(ob, data);
}
/// Reset autosave timer /// Reset autosave timer
void LyXView::resetAutosaveTimer() void LyXView::resetAutosaveTimer()
@ -115,6 +127,11 @@ int LyXView::atCloseMainFormCB(FL_FORM *, void *)
return FL_IGNORE; return FL_IGNORE;
} }
// Wrapper for the above
extern "C" int C_LyXView_atCloseMainFormCB(FL_FORM *form, void *p) {
return LyXView::atCloseMainFormCB(form,p);
}
void LyXView::setPosition(int x, int y) void LyXView::setPosition(int x, int y)
{ {
@ -198,12 +215,12 @@ FD_form_main *LyXView::create_form_form_main(int width, int height)
// timer_autosave // timer_autosave
fdui->timer_autosave = obj = fl_add_timer(FL_HIDDEN_TIMER, fdui->timer_autosave = obj = fl_add_timer(FL_HIDDEN_TIMER,
0,0,0,0,"Timer"); 0,0,0,0,"Timer");
fl_set_object_callback(obj,AutosaveTimerCB,0); fl_set_object_callback(obj,C_LyXView_AutosaveTimerCB,0);
// timer_update // timer_update
fdui->timer_update = obj = fl_add_timer(FL_HIDDEN_TIMER, fdui->timer_update = obj = fl_add_timer(FL_HIDDEN_TIMER,
0,0,0,0,"Timer"); 0,0,0,0,"Timer");
fl_set_object_callback(obj,UpdateTimerCB,0); fl_set_object_callback(obj,C_LyXView_UpdateTimerCB,0);
obj->u_vdata = (void*) this; obj->u_vdata = (void*) this;
// //
@ -231,6 +248,7 @@ FD_form_main *LyXView::create_form_form_main(int width, int height)
return fdui; return fdui;
} }
extern "C" int C_LyXView_KeyPressMask_raw_callback(FL_FORM *fl, void *xev);
void LyXView::init() void LyXView::init()
{ {
@ -247,7 +265,7 @@ void LyXView::init()
// Install the raw callback for keyboard events // Install the raw callback for keyboard events
fl_register_raw_callback(_form, fl_register_raw_callback(_form,
KeyPressMask, KeyPressMask,
KeyPressMask_raw_callback); C_LyXView_KeyPressMask_raw_callback);
intl->InitKeyMapper(lyxrc->use_kbmap); intl->InitKeyMapper(lyxrc->use_kbmap);
} }
@ -333,6 +351,11 @@ int LyXView::KeyPressMask_raw_callback(FL_FORM *fl, void *xev)
return retval; return retval;
} }
// wrapper for the above
extern "C" int C_LyXView_KeyPressMask_raw_callback(FL_FORM *fl, void *xev)
{
return LyXView::KeyPressMask_raw_callback(fl, xev);
}
// Updates the title of the window with the filename of the current document // Updates the title of the window with the filename of the current document
void LyXView::updateWindowTitle() { void LyXView::updateWindowTitle() {

View File

@ -119,11 +119,9 @@ private:
void invalidateLayoutChoice(); void invalidateLayoutChoice();
/// ///
void UpdateDocumentClassChoice(); void UpdateDocumentClassChoice();
public:
/// ///
static int KeyPressMask_raw_callback(FL_FORM *, void *xev); static int KeyPressMask_raw_callback(FL_FORM *, void *xev);
/// makes the main form.
FD_form_main *create_form_form_main(int width, int height);
/** This callback is run when a close event is sent from the /** This callback is run when a close event is sent from the
window manager. */ window manager. */
static int atCloseMainFormCB(FL_FORM *, void *); static int atCloseMainFormCB(FL_FORM *, void *);
@ -131,6 +129,9 @@ private:
static void AutosaveTimerCB(FL_OBJECT *, long); static void AutosaveTimerCB(FL_OBJECT *, long);
/// A callback /// A callback
static void UpdateTimerCB(FL_OBJECT *, long); static void UpdateTimerCB(FL_OBJECT *, long);
private:
/// makes the main form.
FD_form_main *create_form_form_main(int width, int height);
/// A pointer to the form. /// A pointer to the form.
FD_form_main *_form_main; FD_form_main *_form_main;
/// A pointer to the form. /// A pointer to the form.

View File

@ -40,6 +40,12 @@
#include "debug.h" #include "debug.h"
// These are C wrappers around static members of Combox, used as
// callbacks for xforms.
extern "C" void C_Combox_input_cb(FL_OBJECT *ob, long);
extern "C" void C_Combox_combo_cb(FL_OBJECT *ob, long data) ;
extern "C" int C_Combox_peek_event(FL_FORM * form, void *xev);
Combox::Combox(combox_type t): type(t) Combox::Combox(combox_type t): type(t)
{ {
browser = button = 0; browser = button = 0;
@ -156,13 +162,13 @@ void Combox::add(int x, int y, int w, int hmin, int hmax)
x+w-22,y,22,hmin,"@2->"); x+w-22,y,22,hmin,"@2->");
fl_set_object_color(obj,FL_MCOL, FL_MCOL); fl_set_object_color(obj,FL_MCOL, FL_MCOL);
fl_set_object_dblbuffer(obj, 1); fl_set_object_dblbuffer(obj, 1);
fl_set_object_callback(obj,combo_cb,0); fl_set_object_callback(obj,C_Combox_combo_cb,0);
label = obj = fl_add_button(FL_NORMAL_TEXT,x,y,w-22,hmin,""); label = obj = fl_add_button(FL_NORMAL_TEXT,x,y,w-22,hmin,"");
fl_set_object_boxtype(obj,FL_DOWN_BOX); fl_set_object_boxtype(obj,FL_DOWN_BOX);
fl_set_object_color(obj,FL_MCOL,FL_BLACK); fl_set_object_color(obj,FL_MCOL,FL_BLACK);
fl_set_object_lalign(obj,FL_ALIGN_CENTER|FL_ALIGN_INSIDE); fl_set_object_lalign(obj,FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
fl_set_object_dblbuffer(obj, 1); fl_set_object_dblbuffer(obj, 1);
fl_set_object_callback(obj,combo_cb,0); fl_set_object_callback(obj,C_Combox_combo_cb,0);
break; break;
} }
case FL_COMBOX_NORMAL: case FL_COMBOX_NORMAL:
@ -170,7 +176,7 @@ void Combox::add(int x, int y, int w, int hmin, int hmax)
button = obj = fl_add_button(FL_NORMAL_BUTTON,x,y,w,hmin,""); button = obj = fl_add_button(FL_NORMAL_BUTTON,x,y,w,hmin,"");
fl_set_object_color(obj,FL_MCOL, FL_MCOL); fl_set_object_color(obj,FL_MCOL, FL_MCOL);
fl_set_object_boxtype(obj,FL_DOWN_BOX); fl_set_object_boxtype(obj,FL_DOWN_BOX);
fl_set_object_callback(obj,combo_cb,0); fl_set_object_callback(obj,C_Combox_combo_cb,0);
fl_set_object_color(obj,FL_MCOL,FL_BLACK); fl_set_object_color(obj,FL_MCOL,FL_BLACK);
label = button; label = button;
break; break;
@ -180,11 +186,11 @@ void Combox::add(int x, int y, int w, int hmin, int hmax)
button = obj = fl_add_button(FL_NORMAL_BUTTON, button = obj = fl_add_button(FL_NORMAL_BUTTON,
x+w-22,y,22,hmin,"@2->"); x+w-22,y,22,hmin,"@2->");
fl_set_object_color(obj,FL_MCOL, FL_MCOL); fl_set_object_color(obj,FL_MCOL, FL_MCOL);
fl_set_object_callback(obj,combo_cb,0); fl_set_object_callback(obj,C_Combox_combo_cb,0);
label = obj = fl_add_input(FL_NORMAL_INPUT,x,y,w-22,hmin,""); label = obj = fl_add_input(FL_NORMAL_INPUT,x,y,w-22,hmin,"");
fl_set_object_boxtype(obj,FL_DOWN_BOX); fl_set_object_boxtype(obj,FL_DOWN_BOX);
fl_set_object_return(obj, FL_RETURN_END_CHANGED); fl_set_object_return(obj, FL_RETURN_END_CHANGED);
fl_set_object_callback(obj,input_cb,0); fl_set_object_callback(obj,C_Combox_input_cb,0);
//fl_set_object_color(obj,FL_MCOL,FL_BLACK); //fl_set_object_color(obj,FL_MCOL,FL_BLACK);
//fl_set_object_lalign(obj,FL_ALIGN_CENTER|FL_ALIGN_INSIDE); //fl_set_object_lalign(obj,FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
break; break;
@ -208,11 +214,13 @@ void Combox::add(int x, int y, int w, int hmin, int hmax)
fl_set_object_boxtype(obj,FL_UP_BOX); fl_set_object_boxtype(obj,FL_UP_BOX);
fl_set_object_color(obj,FL_MCOL, FL_YELLOW); fl_set_object_color(obj,FL_MCOL, FL_YELLOW);
fl_set_object_gravity(obj, NorthWestGravity, NorthWestGravity); fl_set_object_gravity(obj, NorthWestGravity, NorthWestGravity);
fl_set_object_callback(obj,combo_cb,2); fl_set_object_callback(obj,C_Combox_combo_cb,2);
fl_end_form(); fl_end_form();
browser->u_vdata = (void*)this; browser->u_vdata = (void*)this;
form->u_vdata = browser; form->u_vdata = browser;
fl_register_raw_callback(form, ButtonPressMask|KeyPressMask,peek_event); fl_register_raw_callback(form,
ButtonPressMask|KeyPressMask,
C_Combox_peek_event);
// And revert to adding to the old form (Asger) // And revert to adding to the old form (Asger)
fl_addto_form(current_form); fl_addto_form(current_form);
@ -309,6 +317,11 @@ void Combox::input_cb(FL_OBJECT *ob, long)
combo->is_empty = false; combo->is_empty = false;
} }
extern "C" void C_Combox_input_cb(FL_OBJECT *ob, long data)
{
Combox::input_cb(ob, data);
}
void Combox::combo_cb(FL_OBJECT *ob, long data) void Combox::combo_cb(FL_OBJECT *ob, long data)
{ {
@ -344,6 +357,11 @@ void Combox::combo_cb(FL_OBJECT *ob, long data)
} }
} }
extern "C" void C_Combox_combo_cb(FL_OBJECT *ob, long data)
{
Combox::combo_cb(ob,data);
}
int Combox::peek_event(FL_FORM * form, void *xev) int Combox::peek_event(FL_FORM * form, void *xev)
{ {
@ -416,6 +434,11 @@ int Combox::peek_event(FL_FORM * form, void *xev)
return 0; return 0;
} }
extern "C" int C_Combox_peek_event(FL_FORM * form, void *xev)
{
return Combox::peek_event(form, xev);
}
#ifdef TESTCOMBO #ifdef TESTCOMBO
typedef struct { typedef struct {

View File

@ -107,6 +107,12 @@ public:
void Redraw(); void Redraw();
/// ///
void Show(); void Show();
///
static void combo_cb(FL_OBJECT *, long);
///
static void input_cb(FL_OBJECT *, long);
///
static int peek_event(FL_FORM *, void *);
protected: protected:
/// At least Hide should not be public /// At least Hide should not be public
void Hide(int who = 0); void Hide(int who = 0);
@ -122,12 +128,6 @@ public:
/// ///
bool is_empty; bool is_empty;
/// ///
static void combo_cb(FL_OBJECT *, long);
///
static void input_cb(FL_OBJECT *, long);
///
static int peek_event(FL_FORM *, void *);
///
FL_COMBO_CB callback; FL_COMBO_CB callback;
/// ///
void *cb_arg; void *cb_arg;

View File

@ -75,6 +75,12 @@ static const long ONE_HOUR_SEC = 60L * 60L;
// global instance (user cache root) // global instance (user cache root)
UserCache lyxUserCache = UserCache(string(),0,0); UserCache lyxUserCache = UserCache(string(),0,0);
// some "C" wrappers around callbacks
extern "C" void C_LyXFileDlg_FileDlgCB(FL_OBJECT *, long lArgument);
extern "C" void C_LyXFileDlg_DoubleClickCB(FL_OBJECT *, long);
extern "C" int C_LyXFileDlg_CancelCB(FL_FORM *, void *);
extern "C" int C_LyXDirEntryC_ldeCompProc(const void* r1,
const void* r2);
// Add: creates a new user entry // Add: creates a new user entry
UserCache * UserCache::Add(uid_t ID) UserCache * UserCache::Add(uid_t ID)
@ -196,6 +202,13 @@ int LyXDirEntry::ldeCompProc(const LyXDirEntry * r1,
return r1->pszName.compare(r2->pszName); return r1->pszName.compare(r2->pszName);
} }
extern "C" int C_LyXDirEntry_ldeCompProc(const void * r1,
const void * r2)
{
return LyXDirEntry::ldeCompProc((const LyXDirEntry *)r1,
(const LyXDirEntry *)r2);
}
// *** LyXFileDlg class implementation // *** LyXFileDlg class implementation
// static members // static members
@ -361,7 +374,7 @@ void LyXFileDlg::Reread()
// Sort the names // Sort the names
qsort(pCurrentNames, iNumNames, sizeof(LyXDirEntry), qsort(pCurrentNames, iNumNames, sizeof(LyXDirEntry),
(int (*)(const void *, const void *))LyXDirEntry::ldeCompProc); C_LyXDirEntry_ldeCompProc);
// Add them to directory box // Add them to directory box
for (i = 0; i < iNumNames; ++i) { for (i = 0; i < iNumNames; ++i) {
@ -412,27 +425,28 @@ LyXFileDlg::LyXFileDlg()
pFileDlgForm = create_form_FileDlg(); pFileDlgForm = create_form_FileDlg();
// Set callbacks. This means that we don't need a patch file // Set callbacks. This means that we don't need a patch file
fl_set_object_callback(pFileDlgForm->DirBox, fl_set_object_callback(pFileDlgForm->DirBox,
LyXFileDlg::FileDlgCB,0); C_LyXFileDlg_FileDlgCB,0);
fl_set_object_callback(pFileDlgForm->PatBox, fl_set_object_callback(pFileDlgForm->PatBox,
LyXFileDlg::FileDlgCB,1); C_LyXFileDlg_FileDlgCB,1);
fl_set_object_callback(pFileDlgForm->List, fl_set_object_callback(pFileDlgForm->List,
LyXFileDlg::FileDlgCB,2); C_LyXFileDlg_FileDlgCB,2);
fl_set_object_callback(pFileDlgForm->Filename, fl_set_object_callback(pFileDlgForm->Filename,
LyXFileDlg::FileDlgCB,3); C_LyXFileDlg_FileDlgCB,3);
fl_set_object_callback(pFileDlgForm->Rescan, fl_set_object_callback(pFileDlgForm->Rescan,
LyXFileDlg::FileDlgCB,10); C_LyXFileDlg_FileDlgCB,10);
fl_set_object_callback(pFileDlgForm->Home, fl_set_object_callback(pFileDlgForm->Home,
LyXFileDlg::FileDlgCB,11); C_LyXFileDlg_FileDlgCB,11);
fl_set_object_callback(pFileDlgForm->User1, fl_set_object_callback(pFileDlgForm->User1,
LyXFileDlg::FileDlgCB,12); C_LyXFileDlg_FileDlgCB,12);
fl_set_object_callback(pFileDlgForm->User2, fl_set_object_callback(pFileDlgForm->User2,
LyXFileDlg::FileDlgCB,13); C_LyXFileDlg_FileDlgCB,13);
// Make sure pressing the close box doesn't crash LyX. (RvdK) // Make sure pressing the close box doesn't crash LyX. (RvdK)
fl_set_form_atclose(pFileDlgForm->FileDlg, CancelCB, 0); fl_set_form_atclose(pFileDlgForm->FileDlg,
C_LyXFileDlg_CancelCB, 0);
// Register doubleclick callback // Register doubleclick callback
fl_set_browser_dblclick_callback(pFileDlgForm->List, fl_set_browser_dblclick_callback(pFileDlgForm->List,
DoubleClickCB,0); C_LyXFileDlg_DoubleClickCB,0);
} }
fl_hide_object(pFileDlgForm->User1); fl_hide_object(pFileDlgForm->User1);
fl_hide_object(pFileDlgForm->User2); fl_hide_object(pFileDlgForm->User2);
@ -559,6 +573,11 @@ void LyXFileDlg::FileDlgCB(FL_OBJECT *, long lArgument)
} }
} }
extern "C" void C_LyXFileDlg_FileDlgCB(FL_OBJECT *ob, long data)
{
LyXFileDlg::FileDlgCB(ob, data);
}
// Handle callback from list // Handle callback from list
void LyXFileDlg::HandleListHit() void LyXFileDlg::HandleListHit()
@ -581,6 +600,10 @@ void LyXFileDlg::DoubleClickCB(FL_OBJECT *, long)
pCurrentDlg->Force(false); pCurrentDlg->Force(false);
} }
extern "C" void C_LyXFileDlg_DoubleClickCB(FL_OBJECT *ob, long data)
{
LyXFileDlg::DoubleClickCB(ob, data);
}
// Handle double click from list // Handle double click from list
bool LyXFileDlg::HandleDoubleClick() bool LyXFileDlg::HandleDoubleClick()
@ -685,6 +708,10 @@ int LyXFileDlg::CancelCB(FL_FORM *, void *)
return FL_IGNORE; return FL_IGNORE;
} }
extern "C" int C_LyXFileDlg_CancelCB(FL_FORM *fl, void *xev)
{
return LyXFileDlg::CancelCB(fl, xev);
}
// Simulates a click on OK/Cancel // Simulates a click on OK/Cancel
void LyXFileDlg::Force(bool cancel) void LyXFileDlg::Force(bool cancel)

View File

@ -84,9 +84,10 @@ private:
string pszName; string pszName;
string pszDisplayed; string pszDisplayed;
string pszLsEntry; string pszLsEntry;
LyXDirEntry() {};
public:
/// compares two LyXDirEntry objects content (used by qsort) /// compares two LyXDirEntry objects content (used by qsort)
static int ldeCompProc(const LyXDirEntry *r1, const LyXDirEntry *r2); static int ldeCompProc(const LyXDirEntry *r1, const LyXDirEntry *r2);
LyXDirEntry() {};
}; };
@ -112,6 +113,8 @@ public:
static void FileDlgCB(FL_OBJECT *, long); static void FileDlgCB(FL_OBJECT *, long);
/// Callback for double click in list /// Callback for double click in list
static void DoubleClickCB(FL_OBJECT *, long); static void DoubleClickCB(FL_OBJECT *, long);
/// Handle Cancel CB from WM close
static int CancelCB(FL_FORM *, void *);
private: private:
// data // data
static FD_FileDlg *pFileDlgForm; static FD_FileDlg *pFileDlgForm;
@ -148,8 +151,6 @@ private:
bool HandleDoubleClick(); bool HandleDoubleClick();
/// Handle OK button call /// Handle OK button call
bool HandleOK(); bool HandleOK();
/// Handle Cancel CB from WM close
static int CancelCB(FL_FORM *, void *);
/// Simulates a click on OK/Cancel /// Simulates a click on OK/Cancel
void Force(bool); void Force(bool);
}; };

View File

@ -31,6 +31,9 @@
extern LyXRC* lyxrc; extern LyXRC* lyxrc;
// a wrapper around the callback static member.
extern "C" void C_Intl_DispatchCallback(FL_OBJECT *ob,long code);
Intl::Intl() Intl::Intl()
: prim_lang(lyxrc->primary_kbmap), : prim_lang(lyxrc->primary_kbmap),
@ -225,6 +228,10 @@ void Intl::DispatchCallback(FL_OBJECT *ob,long code)
if (itl!=0) itl->Keymap(code); if (itl!=0) itl->Keymap(code);
} }
extern "C" void C_Intl_DispatchCallback(FL_OBJECT *ob,long code)
{
Intl::DispatchCallback(ob,code);
}
void Intl::InitKeyMapper(bool on) void Intl::InitKeyMapper(bool on)
/* initialize key mapper */ /* initialize key mapper */
@ -253,13 +260,19 @@ void Intl::InitKeyMapper(bool on)
fd_form_keymap->KeyOnBtn2->u_vdata=(void *)this; fd_form_keymap->KeyOnBtn2->u_vdata=(void *)this;
// add the callbacks. // add the callbacks.
fl_set_object_callback(fd_form_keymap->AcceptChset,DispatchCallback,27); fl_set_object_callback(fd_form_keymap->AcceptChset,
fl_set_object_callback(fd_form_keymap->Charset,DispatchCallback,26); C_Intl_DispatchCallback,27);
fl_set_object_callback(fd_form_keymap->Accept,DispatchCallback,0); fl_set_object_callback(fd_form_keymap->Charset,
C_Intl_DispatchCallback,26);
fl_set_object_callback(fd_form_keymap->Accept,
C_Intl_DispatchCallback,0);
fl_set_object_callback(fd_form_keymap->KeyOnBtn,DispatchCallback,23); fl_set_object_callback(fd_form_keymap->KeyOnBtn,
fl_set_object_callback(fd_form_keymap->KeyOffBtn,DispatchCallback,3); C_Intl_DispatchCallback,23);
fl_set_object_callback(fd_form_keymap->KeyOnBtn2,DispatchCallback,43); fl_set_object_callback(fd_form_keymap->KeyOffBtn,
C_Intl_DispatchCallback,3);
fl_set_object_callback(fd_form_keymap->KeyOnBtn2,
C_Intl_DispatchCallback,43);
// Make sure pressing the close box does not kill LyX. (RvdK) // Make sure pressing the close box does not kill LyX. (RvdK)
fl_set_form_atclose(fd_form_keymap->KeyMap, CancelCloseBoxCB, 0); fl_set_form_atclose(fd_form_keymap->KeyMap, CancelCloseBoxCB, 0);

View File

@ -64,6 +64,8 @@ public:
bool keymapon; bool keymapon;
/// ///
char *chsetcode; char *chsetcode;
///
static void DispatchCallback(FL_OBJECT*,long);
private: private:
/// ///
//int SelectCharset(char const *code); //int SelectCharset(char const *code);
@ -76,8 +78,6 @@ private:
/// ///
void Keymap(long code); void Keymap(long code);
/// ///
static void DispatchCallback(FL_OBJECT*,long);
///
bool primarykeymap; bool primarykeymap;
/// ///
int curkeymap; int curkeymap;

View File

@ -79,6 +79,10 @@ int mkfifo( char *__path, mode_t __mode ) {
extern LyXAction lyxaction; extern LyXAction lyxaction;
// C wrapper
extern "C" void C_LyXComm_callback(int fd, void *v);
// LyXComm class // LyXComm class
// Open pipes // Open pipes
@ -148,7 +152,7 @@ void LyXComm::openConnection() {
<< strerror(errno) << endl; << strerror(errno) << endl;
return; return;
} }
fl_add_io_callback(infd, FL_READ, callback, (void*)this); fl_add_io_callback(infd, FL_READ, C_LyXComm_callback, (void*)this);
// --- prepare output pipe --------------------------------------- // --- prepare output pipe ---------------------------------------
@ -234,7 +238,7 @@ void LyXComm::closeConnection() {
} }
if(infd > -1) { if(infd > -1) {
fl_remove_io_callback(infd, FL_READ, callback); fl_remove_io_callback(infd, FL_READ, C_LyXComm_callback);
string tmp = pipename + ".in"; string tmp = pipename + ".in";
#ifdef __EMX__ // Notify the operating system. #ifdef __EMX__ // Notify the operating system.
@ -346,6 +350,12 @@ void LyXComm::callback(int fd, void *v)
c->openConnection(); c->openConnection();
errno=0; errno=0;
} }
extern "C" void C_LyXComm_callback(int fd, void *v)
{
LyXComm::callback(fd, v);
}
void LyXComm::send(string const & msg) { void LyXComm::send(string const & msg) {
if (msg.empty()) { if (msg.empty()) {

View File

@ -53,6 +53,10 @@ public:
/// Send message /// Send message
void send(string const &); void send(string const &);
/// We receive messages via XForms through this callback
static void callback(int fd, void *v);
private: private:
/// Open pipes /// Open pipes
void openConnection(); void openConnection();
@ -60,9 +64,6 @@ private:
/// Close pipes /// Close pipes
void closeConnection(); void closeConnection();
/// We receive messages via XForms through this callback
static void callback(int fd, void *v);
/// This is -1 if not open /// This is -1 if not open
int infd; int infd;

View File

@ -308,6 +308,12 @@ void LyXVC::logClose(FL_OBJECT *obj, long)
fl_hide_form(This->browser->LaTeXLog); fl_hide_form(This->browser->LaTeXLog);
} }
// and, hack over hack, here is a C wrapper :)
extern "C" void C_LyXVC_logClose(FL_OBJECT *ob, long data)
{
LyXVC::logClose(ob, data);
}
void LyXVC::logUpdate(FL_OBJECT *obj, long) void LyXVC::logUpdate(FL_OBJECT *obj, long)
{ {
@ -315,6 +321,11 @@ void LyXVC::logUpdate(FL_OBJECT *obj, long)
This->showLog(); This->showLog();
} }
extern "C" void C_LyXVC_logUpdate(FL_OBJECT *ob, long data)
{
LyXVC::logUpdate(ob, data);
}
void LyXVC::viewLog(string const & fil) void LyXVC::viewLog(string const & fil)
{ {
@ -328,12 +339,12 @@ void LyXVC::viewLog(string const & fil)
browser->browser_latexlog = fl_add_browser(FL_NORMAL_BROWSER, 10, 10, 450, 320, ""); browser->browser_latexlog = fl_add_browser(FL_NORMAL_BROWSER, 10, 10, 450, 320, "");
obj = fl_add_button(FL_RETURN_BUTTON, 270, 340, 90, 30, _("Close")); obj = fl_add_button(FL_RETURN_BUTTON, 270, 340, 90, 30, _("Close"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, logClose, 0); fl_set_object_callback(obj, C_LyXVC_logClose, 0);
obj = fl_add_button(FL_NORMAL_BUTTON,370,340,90,30, obj = fl_add_button(FL_NORMAL_BUTTON,370,340,90,30,
idex(_("Update|#Uu"))); idex(_("Update|#Uu")));
fl_set_button_shortcut(obj,scex(_("Update|#Uu")),1); fl_set_button_shortcut(obj,scex(_("Update|#Uu")),1);
fl_set_object_lsize(obj,FL_NORMAL_SIZE); fl_set_object_lsize(obj,FL_NORMAL_SIZE);
fl_set_object_callback(obj,logUpdate,0); fl_set_object_callback(obj, C_LyXVC_logUpdate,0);
fl_end_form(); fl_end_form();
fl_set_form_atclose(browser->LaTeXLog, CancelCloseBoxCB, 0); fl_set_form_atclose(browser->LaTeXLog, CancelCloseBoxCB, 0);
} }

View File

@ -87,6 +87,11 @@ public:
/// Returns the userid of the person who has locked the doc. /// Returns the userid of the person who has locked the doc.
string const getLocker() const; string const getLocker() const;
///
static void logClose(FL_OBJECT*, long);
///
static void logUpdate(FL_OBJECT*, long);
protected: protected:
private: private:
/// ///
@ -133,10 +138,6 @@ private:
/// ///
FD_LaTeXLog *browser; // FD_LaTeXLog is just a browser with a FD_LaTeXLog *browser; // FD_LaTeXLog is just a browser with a
// close button. Unfortunately we can not use the standard callbacks. // close button. Unfortunately we can not use the standard callbacks.
///
static void logClose(FL_OBJECT*, long);
///
static void logUpdate(FL_OBJECT*, long);
}; };
#endif #endif

View File

@ -64,6 +64,54 @@ extern void ToggleFloat();
extern void AllFloats(char flag, char figmar); extern void AllFloats(char flag, char figmar);
extern void LaTeXOptions(); extern void LaTeXOptions();
// A bunch of wrappers
extern "C" void C_Menus_ShowFileMenu(FL_OBJECT *ob, long data)
{
Menus::ShowFileMenu(ob, data);
}
extern "C" void C_Menus_ShowFileMenu2(FL_OBJECT *ob, long data)
{
Menus::ShowFileMenu2(ob, data);
}
extern "C" void C_Menus_ShowEditMenu(FL_OBJECT *ob, long data)
{
Menus::ShowEditMenu(ob, data);
}
extern "C" void C_Menus_ShowLayoutMenu(FL_OBJECT *ob, long data)
{
Menus::ShowLayoutMenu(ob, data);
}
extern "C" void C_Menus_ShowInsertMenu(FL_OBJECT *ob, long data)
{
Menus::ShowInsertMenu(ob, data);
}
extern "C" void C_Menus_ShowMathMenu(FL_OBJECT *ob, long data)
{
Menus::ShowMathMenu(ob, data);
}
extern "C" void C_Menus_ShowOptionsMenu(FL_OBJECT *ob, long data)
{
Menus::ShowOptionsMenu(ob, data);
}
extern "C" void C_Menus_ShowBufferMenu(FL_OBJECT *ob, long data)
{
Menus::ShowBufferMenu(ob, data);
}
extern "C" void C_Menus_ShowHelpMenu(FL_OBJECT *ob, long data)
{
Menus::ShowHelpMenu(ob, data);
}
Menus::Menus(LyXView *view,int air) Menus::Menus(LyXView *view,int air)
: _view(view) : _view(view)
{ {
@ -167,7 +215,7 @@ void Menus::create_menus(int air)
mbheight,_("File")); mbheight,_("File"));
moffset += obj->w + air; moffset += obj->w + air;
fl_set_object_shortcut(obj, scex(_("MB|#F")), 1); fl_set_object_shortcut(obj, scex(_("MB|#F")), 1);
fl_set_object_callback(obj,ShowFileMenu, 0); fl_set_object_callback(obj,C_Menus_ShowFileMenu, 0);
obj->u_ldata = (long)this; obj->u_ldata = (long)this;
// Edit menu button // Edit menu button
@ -181,7 +229,7 @@ void Menus::create_menus(int air)
mbheight,_("Edit")); mbheight,_("Edit"));
moffset += obj->w + air; moffset += obj->w + air;
fl_set_object_shortcut(obj, scex(_("MB|#E")),1); fl_set_object_shortcut(obj, scex(_("MB|#E")),1);
fl_set_object_callback(obj,ShowEditMenu,0); fl_set_object_callback(obj,C_Menus_ShowEditMenu,0);
obj->u_ldata = (long) this; obj->u_ldata = (long) this;
// Layout menu button // Layout menu button
@ -195,7 +243,7 @@ void Menus::create_menus(int air)
mbheight,_("Layout")); mbheight,_("Layout"));
moffset += obj->w + air; moffset += obj->w + air;
fl_set_object_shortcut(obj, scex(_("MB|#L")), 1); fl_set_object_shortcut(obj, scex(_("MB|#L")), 1);
fl_set_object_callback(obj,ShowLayoutMenu,0); fl_set_object_callback(obj,C_Menus_ShowLayoutMenu,0);
obj->u_ldata = (long) this; obj->u_ldata = (long) this;
// Insert menu button button // Insert menu button button
@ -209,7 +257,7 @@ void Menus::create_menus(int air)
mbheight,_("Insert")); mbheight,_("Insert"));
moffset += obj->w + air; moffset += obj->w + air;
fl_set_object_shortcut(obj, scex(_("MB|#I")), 1); fl_set_object_shortcut(obj, scex(_("MB|#I")), 1);
fl_set_object_callback(obj,ShowInsertMenu,0); fl_set_object_callback(obj,C_Menus_ShowInsertMenu,0);
obj->u_ldata = (long) this; obj->u_ldata = (long) this;
// Math menu button // Math menu button
@ -223,7 +271,7 @@ void Menus::create_menus(int air)
mbheight,_("Math")); mbheight,_("Math"));
moffset += obj->w + air; moffset += obj->w + air;
fl_set_object_shortcut(obj, scex(_("MB|#M")), 1); fl_set_object_shortcut(obj, scex(_("MB|#M")), 1);
fl_set_object_callback(obj,ShowMathMenu,0); fl_set_object_callback(obj,C_Menus_ShowMathMenu,0);
obj->u_ldata = (long) this; obj->u_ldata = (long) this;
// Options menu button // Options menu button
@ -237,7 +285,7 @@ void Menus::create_menus(int air)
mbheight,_("Options")); mbheight,_("Options"));
moffset += obj->w + air; moffset += obj->w + air;
fl_set_object_shortcut(obj, scex(_("MB|#O")), 1); fl_set_object_shortcut(obj, scex(_("MB|#O")), 1);
fl_set_object_callback(obj,ShowOptionsMenu, 0); fl_set_object_callback(obj,C_Menus_ShowOptionsMenu, 0);
obj->u_ldata = (long) this; obj->u_ldata = (long) this;
// Documents menu button // Documents menu button
@ -251,7 +299,7 @@ void Menus::create_menus(int air)
mbheight,_("Documents")); mbheight,_("Documents"));
moffset += obj->w + air; moffset += obj->w + air;
fl_set_object_shortcut(obj, scex(_("MB|#D")), 1); fl_set_object_shortcut(obj, scex(_("MB|#D")), 1);
fl_set_object_callback(obj,ShowBufferMenu,0); fl_set_object_callback(obj,C_Menus_ShowBufferMenu,0);
obj->u_ldata = (long) this; obj->u_ldata = (long) this;
// Help menu button // Help menu button
@ -265,7 +313,7 @@ void Menus::create_menus(int air)
mbheight,_("Help")); mbheight,_("Help"));
moffset += obj->w + air; moffset += obj->w + air;
fl_set_object_shortcut(obj, scex(_("MB|#H")), 1); fl_set_object_shortcut(obj, scex(_("MB|#H")), 1);
fl_set_object_callback(obj,ShowHelpMenu,0); fl_set_object_callback(obj,C_Menus_ShowHelpMenu,0);
obj->u_ldata = (long) this; obj->u_ldata = (long) this;
fl_end_group(); fl_end_group();
@ -298,7 +346,7 @@ void Menus::create_menus(int air)
mbheight,_("File")); mbheight,_("File"));
moffset += obj->w + air; moffset += obj->w + air;
fl_set_object_shortcut(obj, scex(_("MB|#F")), 1); fl_set_object_shortcut(obj, scex(_("MB|#F")), 1);
fl_set_object_callback(obj,ShowFileMenu2, 0); fl_set_object_callback(obj,C_Menus_ShowFileMenu2, 0);
obj->u_ldata = (long)this; obj->u_ldata = (long)this;
// Options menu button // Options menu button
@ -312,7 +360,7 @@ void Menus::create_menus(int air)
mbheight,_("Options")); mbheight,_("Options"));
moffset += obj->w + air; moffset += obj->w + air;
fl_set_object_shortcut(obj, scex(_("MB|#O")), 1); fl_set_object_shortcut(obj, scex(_("MB|#O")), 1);
fl_set_object_callback(obj,ShowOptionsMenu, 0); fl_set_object_callback(obj,C_Menus_ShowOptionsMenu, 0);
obj->u_ldata = (long) this; obj->u_ldata = (long) this;
// Help menu button // Help menu button
@ -326,7 +374,7 @@ void Menus::create_menus(int air)
mbheight,_("Help")); mbheight,_("Help"));
moffset += obj->w + air; moffset += obj->w + air;
fl_set_object_shortcut(obj, scex(_("MB|#H")), 1); fl_set_object_shortcut(obj, scex(_("MB|#H")), 1);
fl_set_object_callback(obj,ShowHelpMenu,0); fl_set_object_callback(obj,C_Menus_ShowHelpMenu,0);
obj->u_ldata = (long) this; obj->u_ldata = (long) this;
fl_end_group(); fl_end_group();

View File

@ -35,20 +35,6 @@ public:
void hideMenus(); void hideMenus();
/// ///
void openByName(string const &menuName); void openByName(string const &menuName);
private:
///
void create_menus(int air);
///
void ScreenOptions();
///
void showCopyright();
///
void showLicense();
///
void MenuDocu(string const & docname);
///
void handleBufferMenu(int choice);
/// ///
static void ShowFileMenu(FL_OBJECT *ob, long); static void ShowFileMenu(FL_OBJECT *ob, long);
/// ///
@ -67,6 +53,20 @@ private:
static void ShowBufferMenu(FL_OBJECT *ob, long); static void ShowBufferMenu(FL_OBJECT *ob, long);
/// ///
static void ShowHelpMenu(FL_OBJECT *ob, long); static void ShowHelpMenu(FL_OBJECT *ob, long);
private:
///
void create_menus(int air);
///
void ScreenOptions();
///
void showCopyright();
///
void showLicense();
///
void MenuDocu(string const & docname);
///
void handleBufferMenu(int choice);
/// ///
BufferView *currentView(); BufferView *currentView();
/// ///

View File

@ -36,6 +36,10 @@ void MiniBuffer::TimerCB(FL_OBJECT *, long tmp)
obj->Init(); obj->Init();
} }
extern "C" void C_MiniBuffer_TimerCB(FL_OBJECT *ob, long data)
{
MiniBuffer::TimerCB(ob, data);
}
void MiniBuffer::ExecutingCB(FL_OBJECT *ob, long) void MiniBuffer::ExecutingCB(FL_OBJECT *ob, long)
{ {
@ -72,6 +76,67 @@ void MiniBuffer::ExecutingCB(FL_OBJECT *ob, long)
return ; return ;
} }
extern "C" void C_MiniBuffer_ExecutingCB(FL_OBJECT *ob, long data)
{
MiniBuffer::TimerCB(ob, data);
}
// This is not as dirty as it seems, the hidden buttons removed by this
// function were just kludges for an uncomplete keyboard callback (ale)
int MiniBuffer::peek_event(FL_OBJECT *ob, int event, FL_Coord, FL_Coord,
int key, void */*xev*/)
{
MiniBuffer *mini = (MiniBuffer*)ob->u_vdata;
if (event==FL_KEYBOARD){
switch (key) {
case XK_Down:
mini->history_idx++;
if (!mini->getHistory().empty()) {
fl_set_input(ob, mini->getHistory().c_str());
} else
mini->history_idx--;
return 1;
case XK_Up:
if (mini->history_idx > 0) mini->history_idx--;
fl_set_input(ob, mini->getHistory().c_str());
return 1;
case 9:
case XK_Tab:
{
// complete or increment the command
const char *s = lyxaction.getApproxFuncName(fl_get_input(ob));
if (s && s[0])
fl_set_input(ob, s);
return 1;
}
case 27:
case XK_Escape:
// Abort
fl_set_focus_object(mini->owner->getForm(),
mini->owner->currentView()->getWorkArea());
mini->Init();
return 1;
case 13:
case XK_Return:
// Execute a command.
mini->cur_cmd = string(fl_get_input(ob));
ExecutingCB(ob, 0);
return 1;
default:
return 0;
}
}
return 0;
}
extern "C" int C_MiniBuffer_peek_event(FL_OBJECT *ob, int event,
FL_Coord, FL_Coord,
int key, void *xev)
{
return MiniBuffer::peek_event(ob,event,0,0,key,xev);
}
void MiniBuffer::ExecCommand() void MiniBuffer::ExecCommand()
{ {
@ -92,16 +157,16 @@ FL_OBJECT *MiniBuffer::add(int type, FL_Coord x, FL_Coord y,
fl_set_object_gravity(obj, SouthWestGravity, SouthEastGravity); fl_set_object_gravity(obj, SouthWestGravity, SouthEastGravity);
fl_set_object_color(obj,FL_MCOL,FL_MCOL); fl_set_object_color(obj,FL_MCOL,FL_MCOL);
fl_set_object_lsize(obj,FL_NORMAL_SIZE); fl_set_object_lsize(obj,FL_NORMAL_SIZE);
fl_set_object_callback(obj,ExecutingCB, 0); fl_set_object_callback(obj,C_MiniBuffer_ExecutingCB, 0);
// To intercept Up, Down, Table for history // To intercept Up, Down, Table for history
fl_set_object_prehandler(obj, peek_event); fl_set_object_prehandler(obj, C_MiniBuffer_peek_event);
obj->u_vdata = (void*)this; obj->u_vdata = (void*)this;
obj->wantkey = FL_KEY_TAB; obj->wantkey = FL_KEY_TAB;
// timer // timer
timer = fl_add_timer(FL_HIDDEN_TIMER, 0,0,0,0, "Timer"); timer = fl_add_timer(FL_HIDDEN_TIMER, 0,0,0,0, "Timer");
fl_set_object_callback(timer, TimerCB, (long)this); fl_set_object_callback(timer, C_MiniBuffer_TimerCB, (long)this);
fl_set_input(the_buffer, text.c_str()); fl_set_input(the_buffer, text.c_str());
return obj; return obj;
@ -203,52 +268,3 @@ void MiniBuffer::Deactivate()
} }
// This is not as dirty as it seems, the hidden buttons removed by this
// function were just kludges for an uncomplete keyboard callback (ale)
int MiniBuffer::peek_event(FL_OBJECT *ob, int event, FL_Coord, FL_Coord,
int key, void */*xev*/)
{
MiniBuffer *mini = (MiniBuffer*)ob->u_vdata;
if (event==FL_KEYBOARD){
switch (key) {
case XK_Down:
mini->history_idx++;
if (!mini->getHistory().empty()) {
fl_set_input(ob, mini->getHistory().c_str());
} else
mini->history_idx--;
return 1;
case XK_Up:
if (mini->history_idx > 0) mini->history_idx--;
fl_set_input(ob, mini->getHistory().c_str());
return 1;
case 9:
case XK_Tab:
{
// complete or increment the command
const char *s = lyxaction.getApproxFuncName(fl_get_input(ob));
if (s && s[0])
fl_set_input(ob, s);
return 1;
}
case 27:
case XK_Escape:
// Abort
fl_set_focus_object(mini->owner->getForm(),
mini->owner->currentView()->getWorkArea());
mini->Init();
return 1;
case 13:
case XK_Return:
// Execute a command.
mini->cur_cmd = string(fl_get_input(ob));
ExecutingCB(ob, 0);
return 1;
default:
return 0;
}
}
return 0;
}

View File

@ -51,6 +51,13 @@ public:
void Activate(); void Activate();
/// ///
void Deactivate(); void Deactivate();
///
static void ExecutingCB(FL_OBJECT *ob, long);
///
static void TimerCB(FL_OBJECT *ob, long);
///
static int peek_event(FL_OBJECT *, int, FL_Coord, FL_Coord,
int, void *);
private: private:
/// ///
LyXView *owner; LyXView *owner;
@ -60,13 +67,6 @@ private:
string text_stored; string text_stored;
/// ///
FL_OBJECT *add(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord); FL_OBJECT *add(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord);
///
static void ExecutingCB(FL_OBJECT *ob, long);
///
static void TimerCB(FL_OBJECT *ob, long);
///
static int peek_event(FL_OBJECT *, int, FL_Coord, FL_Coord,
int, void *);
/// ///
FL_OBJECT *timer; FL_OBJECT *timer;
/// ///

View File

@ -136,13 +136,18 @@ Toolbar::Toolbar(Toolbar const &rct, LyXView *o, int x, int y)
// timer-cb for bubble-help (Matthias) // timer-cb for bubble-help (Matthias)
void Toolbar::BubbleTimerCB(FL_OBJECT *, long data){ void Toolbar::BubbleTimerCB(FL_OBJECT *, long data)
{
FL_OBJECT* ob = (FL_OBJECT*) data; FL_OBJECT* ob = (FL_OBJECT*) data;
char* help = (char*) ob->u_vdata; char* help = (char*) ob->u_vdata;
fl_show_oneliner(help, ob->form->x + ob->x, fl_show_oneliner(help, ob->form->x + ob->x,
ob->form->y + ob->y + ob->h); ob->form->y + ob->y + ob->h);
} }
extern "C" void C_Toolbar_BubbleTimerCB(FL_OBJECT *ob, long data)
{
Toolbar::BubbleTimerCB(ob, data);
}
// post_handler for bubble-help (Matthias) // post_handler for bubble-help (Matthias)
int Toolbar::BubblePost(FL_OBJECT *ob, int event, int Toolbar::BubblePost(FL_OBJECT *ob, int event,
@ -153,7 +158,7 @@ int Toolbar::BubblePost(FL_OBJECT *ob, int event,
if(event == FL_ENTER && !help.empty()){ if(event == FL_ENTER && !help.empty()){
fl_set_object_callback(t->bubble_timer, fl_set_object_callback(t->bubble_timer,
BubbleTimerCB, (long) ob); C_Toolbar_BubbleTimerCB, (long) ob);
fl_set_timer(t->bubble_timer, 1); fl_set_timer(t->bubble_timer, 1);
} }
else if(event != FL_MOTION){ else if(event != FL_MOTION){
@ -163,6 +168,12 @@ int Toolbar::BubblePost(FL_OBJECT *ob, int event,
return 0; return 0;
} }
extern "C" int C_Toolbar_BubblePost(FL_OBJECT *ob, int event,
FL_Coord /*mx*/, FL_Coord /*my*/,
int key, void *xev)
{
return Toolbar::BubblePost(ob,event,0,0,key,xev);
}
void Toolbar::activate() void Toolbar::activate()
{ {
@ -201,6 +212,10 @@ void Toolbar::ToolbarCB(FL_OBJECT *ob, long ac)
lyxerr[Debug::TOOLBAR] << res << endl; lyxerr[Debug::TOOLBAR] << res << endl;
} }
extern "C" void C_Toolbar_ToolbarCB(FL_OBJECT *ob, long data)
{
Toolbar::ToolbarCB(ob, data);
}
int Toolbar::get_toolbar_func(string const & func) int Toolbar::get_toolbar_func(string const & func)
{ {
@ -305,7 +320,7 @@ void Toolbar::set(bool doingmain)
fl_set_object_gravity(obj, fl_set_object_gravity(obj,
NorthWestGravity, NorthWestGravity,
NorthWestGravity); NorthWestGravity);
fl_set_object_callback(obj,ToolbarCB, fl_set_object_callback(obj,C_Toolbar_ToolbarCB,
(long)item->action); (long)item->action);
#if FL_REVISION >85 #if FL_REVISION >85
// Remove the blue feedback rectangle // Remove the blue feedback rectangle
@ -318,7 +333,7 @@ void Toolbar::set(bool doingmain)
// belongs too. (Lgb) // belongs too. (Lgb)
obj->u_ldata = (long) this; obj->u_ldata = (long) this;
fl_set_object_posthandler(obj, BubblePost); fl_set_object_posthandler(obj, C_Toolbar_BubblePost);
fl_set_pixmapbutton_data(obj,item->pixmap); fl_set_pixmapbutton_data(obj,item->pixmap);
item = item->next; item = item->next;

View File

@ -86,6 +86,14 @@ public:
/// deactivates the toolbar /// deactivates the toolbar
void deactivate(); void deactivate();
///
static void ToolbarCB(FL_OBJECT*, long);
///
static void BubbleTimerCB(FL_OBJECT *, long);
///
static int BubblePost(FL_OBJECT *ob, int event,
FL_Coord mx, FL_Coord my, int key, void *xev);
private: private:
/// ///
struct toolbarItem struct toolbarItem
@ -147,13 +155,6 @@ private:
char **getPixmap(kb_action, string const & arg=string()); char **getPixmap(kb_action, string const & arg=string());
/// removes all toolbar buttons from the toolbar. /// removes all toolbar buttons from the toolbar.
void clean(); void clean();
///
static void ToolbarCB(FL_OBJECT*, long);
///
static void BubbleTimerCB(FL_OBJECT *, long);
///
static int BubblePost(FL_OBJECT *ob, int event,
FL_Coord mx, FL_Coord my, int key, void *xev);
/** more... /** more...
*/ */