mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
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:
parent
c1093f1c92
commit
a8a90bf854
@ -1,5 +1,12 @@
|
||||
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
|
||||
messages.
|
||||
|
||||
|
15
INSTALL
15
INSTALL
@ -278,6 +278,16 @@ notify us.
|
||||
will be solved if you use --with-included-gettext when configuring
|
||||
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
|
||||
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
|
||||
@ -381,8 +391,3 @@ Warning: Linking some objects which contain exception information sections
|
||||
|
||||
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.
|
||||
|
||||
|
@ -364,6 +364,29 @@ void BufferView::gotoError()
|
||||
_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)
|
||||
{
|
||||
@ -392,7 +415,7 @@ void BufferView::create_view(int xpos, int ypos, int width, int height)
|
||||
xpos +bw, ypos+bw,
|
||||
width-15-2*bw /* scrollbarwidth */,
|
||||
height-2*bw,"",
|
||||
work_area_handler);
|
||||
C_BufferView_work_area_handler);
|
||||
obj->wantkey = FL_KEY_TAB;
|
||||
obj->u_vdata = this; /* This is how we pass the BufferView
|
||||
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_resize(obj, FL_RESIZE_ALL);
|
||||
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);
|
||||
|
||||
#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_resize(obj, FL_RESIZE_ALL);
|
||||
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
|
||||
#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_resize(obj, FL_RESIZE_ALL);
|
||||
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_border_width(-bw);
|
||||
|
||||
@ -468,7 +491,7 @@ void BufferView::create_view(int xpos, int ypos, int width, int height)
|
||||
// timer_cursor
|
||||
timer_cursor = obj = fl_add_timer(FL_HIDDEN_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;
|
||||
}
|
||||
|
||||
|
@ -89,6 +89,7 @@ private:
|
||||
///
|
||||
void ScrollDownOnePage(long /*time*/);
|
||||
|
||||
public:
|
||||
/// A callback for the up arrow in the scrollbar.
|
||||
static void UpCB(FL_OBJECT *ob, long);
|
||||
|
||||
@ -98,10 +99,13 @@ private:
|
||||
/// A callback for the down arrow in the scrollbar.
|
||||
static void DownCB(FL_OBJECT *ob, long);
|
||||
|
||||
///
|
||||
static void CursorToggleCB(FL_OBJECT *ob, long);
|
||||
/** Work area free object handler
|
||||
*/
|
||||
static int work_area_handler(FL_OBJECT *, int event,
|
||||
FL_Coord, FL_Coord, int key, void *xev);
|
||||
private:
|
||||
///
|
||||
int WorkAreaMotionNotify(FL_OBJECT *ob,
|
||||
Window win,
|
||||
@ -122,8 +126,6 @@ private:
|
||||
int w, int h,
|
||||
XEvent *ev, void *d);
|
||||
///
|
||||
static void CursorToggleCB(FL_OBJECT *ob, long);
|
||||
///
|
||||
LyXView *_owner;
|
||||
///
|
||||
Buffer *_buffer;
|
||||
|
@ -46,11 +46,12 @@ int current_layout = 0;
|
||||
// This is very temporary
|
||||
BufferView *current_view;
|
||||
|
||||
extern "C" int C_LyXView_atCloseMainFormCB(FL_FORM *, void *);
|
||||
|
||||
LyXView::LyXView(int width, int 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;
|
||||
lyxfunc = new LyXFunc(this);
|
||||
intl = new Intl;
|
||||
@ -91,6 +92,12 @@ void LyXView::UpdateTimerCB(FL_OBJECT *ob, long)
|
||||
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
|
||||
void LyXView::AutosaveTimerCB(FL_OBJECT *, long)
|
||||
@ -99,6 +106,11 @@ void LyXView::AutosaveTimerCB(FL_OBJECT *, long)
|
||||
AutoSave();
|
||||
}
|
||||
|
||||
// Wrapper for the above
|
||||
extern "C" void C_LyXView_AutosaveTimerCB(FL_OBJECT *ob, long data) {
|
||||
LyXView::AutosaveTimerCB(ob, data);
|
||||
}
|
||||
|
||||
|
||||
/// Reset autosave timer
|
||||
void LyXView::resetAutosaveTimer()
|
||||
@ -115,6 +127,11 @@ int LyXView::atCloseMainFormCB(FL_FORM *, void *)
|
||||
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)
|
||||
{
|
||||
@ -198,12 +215,12 @@ FD_form_main *LyXView::create_form_form_main(int width, int height)
|
||||
// timer_autosave
|
||||
fdui->timer_autosave = obj = fl_add_timer(FL_HIDDEN_TIMER,
|
||||
0,0,0,0,"Timer");
|
||||
fl_set_object_callback(obj,AutosaveTimerCB,0);
|
||||
fl_set_object_callback(obj,C_LyXView_AutosaveTimerCB,0);
|
||||
|
||||
// timer_update
|
||||
fdui->timer_update = obj = fl_add_timer(FL_HIDDEN_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;
|
||||
|
||||
//
|
||||
@ -231,6 +248,7 @@ FD_form_main *LyXView::create_form_form_main(int width, int height)
|
||||
return fdui;
|
||||
}
|
||||
|
||||
extern "C" int C_LyXView_KeyPressMask_raw_callback(FL_FORM *fl, void *xev);
|
||||
|
||||
void LyXView::init()
|
||||
{
|
||||
@ -247,7 +265,7 @@ void LyXView::init()
|
||||
// Install the raw callback for keyboard events
|
||||
fl_register_raw_callback(_form,
|
||||
KeyPressMask,
|
||||
KeyPressMask_raw_callback);
|
||||
C_LyXView_KeyPressMask_raw_callback);
|
||||
intl->InitKeyMapper(lyxrc->use_kbmap);
|
||||
}
|
||||
|
||||
@ -333,6 +351,11 @@ int LyXView::KeyPressMask_raw_callback(FL_FORM *fl, void *xev)
|
||||
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
|
||||
void LyXView::updateWindowTitle() {
|
||||
|
@ -119,11 +119,9 @@ private:
|
||||
void invalidateLayoutChoice();
|
||||
///
|
||||
void UpdateDocumentClassChoice();
|
||||
public:
|
||||
///
|
||||
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
|
||||
window manager. */
|
||||
static int atCloseMainFormCB(FL_FORM *, void *);
|
||||
@ -131,6 +129,9 @@ private:
|
||||
static void AutosaveTimerCB(FL_OBJECT *, long);
|
||||
/// A callback
|
||||
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.
|
||||
FD_form_main *_form_main;
|
||||
/// A pointer to the form.
|
||||
|
37
src/combox.C
37
src/combox.C
@ -40,6 +40,12 @@
|
||||
|
||||
#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)
|
||||
{
|
||||
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->");
|
||||
fl_set_object_color(obj,FL_MCOL, FL_MCOL);
|
||||
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,"");
|
||||
fl_set_object_boxtype(obj,FL_DOWN_BOX);
|
||||
fl_set_object_color(obj,FL_MCOL,FL_BLACK);
|
||||
fl_set_object_lalign(obj,FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
|
||||
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;
|
||||
}
|
||||
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,"");
|
||||
fl_set_object_color(obj,FL_MCOL, FL_MCOL);
|
||||
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);
|
||||
label = button;
|
||||
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,
|
||||
x+w-22,y,22,hmin,"@2->");
|
||||
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,"");
|
||||
fl_set_object_boxtype(obj,FL_DOWN_BOX);
|
||||
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_lalign(obj,FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
|
||||
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_color(obj,FL_MCOL, FL_YELLOW);
|
||||
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();
|
||||
browser->u_vdata = (void*)this;
|
||||
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)
|
||||
fl_addto_form(current_form);
|
||||
@ -309,6 +317,11 @@ void Combox::input_cb(FL_OBJECT *ob, long)
|
||||
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)
|
||||
{
|
||||
@ -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)
|
||||
{
|
||||
@ -416,6 +434,11 @@ int Combox::peek_event(FL_FORM * form, void *xev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" int C_Combox_peek_event(FL_FORM * form, void *xev)
|
||||
{
|
||||
return Combox::peek_event(form, xev);
|
||||
}
|
||||
|
||||
|
||||
#ifdef TESTCOMBO
|
||||
typedef struct {
|
||||
|
12
src/combox.h
12
src/combox.h
@ -107,6 +107,12 @@ public:
|
||||
void Redraw();
|
||||
///
|
||||
void Show();
|
||||
///
|
||||
static void combo_cb(FL_OBJECT *, long);
|
||||
///
|
||||
static void input_cb(FL_OBJECT *, long);
|
||||
///
|
||||
static int peek_event(FL_FORM *, void *);
|
||||
protected:
|
||||
/// At least Hide should not be public
|
||||
void Hide(int who = 0);
|
||||
@ -122,12 +128,6 @@ public:
|
||||
///
|
||||
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;
|
||||
///
|
||||
void *cb_arg;
|
||||
|
@ -75,6 +75,12 @@ static const long ONE_HOUR_SEC = 60L * 60L;
|
||||
// global instance (user cache root)
|
||||
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
|
||||
UserCache * UserCache::Add(uid_t ID)
|
||||
@ -196,6 +202,13 @@ int LyXDirEntry::ldeCompProc(const LyXDirEntry * r1,
|
||||
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
|
||||
|
||||
// static members
|
||||
@ -361,7 +374,7 @@ void LyXFileDlg::Reread()
|
||||
|
||||
// Sort the names
|
||||
qsort(pCurrentNames, iNumNames, sizeof(LyXDirEntry),
|
||||
(int (*)(const void *, const void *))LyXDirEntry::ldeCompProc);
|
||||
C_LyXDirEntry_ldeCompProc);
|
||||
|
||||
// Add them to directory box
|
||||
for (i = 0; i < iNumNames; ++i) {
|
||||
@ -412,27 +425,28 @@ LyXFileDlg::LyXFileDlg()
|
||||
pFileDlgForm = create_form_FileDlg();
|
||||
// Set callbacks. This means that we don't need a patch file
|
||||
fl_set_object_callback(pFileDlgForm->DirBox,
|
||||
LyXFileDlg::FileDlgCB,0);
|
||||
C_LyXFileDlg_FileDlgCB,0);
|
||||
fl_set_object_callback(pFileDlgForm->PatBox,
|
||||
LyXFileDlg::FileDlgCB,1);
|
||||
C_LyXFileDlg_FileDlgCB,1);
|
||||
fl_set_object_callback(pFileDlgForm->List,
|
||||
LyXFileDlg::FileDlgCB,2);
|
||||
C_LyXFileDlg_FileDlgCB,2);
|
||||
fl_set_object_callback(pFileDlgForm->Filename,
|
||||
LyXFileDlg::FileDlgCB,3);
|
||||
C_LyXFileDlg_FileDlgCB,3);
|
||||
fl_set_object_callback(pFileDlgForm->Rescan,
|
||||
LyXFileDlg::FileDlgCB,10);
|
||||
C_LyXFileDlg_FileDlgCB,10);
|
||||
fl_set_object_callback(pFileDlgForm->Home,
|
||||
LyXFileDlg::FileDlgCB,11);
|
||||
C_LyXFileDlg_FileDlgCB,11);
|
||||
fl_set_object_callback(pFileDlgForm->User1,
|
||||
LyXFileDlg::FileDlgCB,12);
|
||||
C_LyXFileDlg_FileDlgCB,12);
|
||||
fl_set_object_callback(pFileDlgForm->User2,
|
||||
LyXFileDlg::FileDlgCB,13);
|
||||
C_LyXFileDlg_FileDlgCB,13);
|
||||
|
||||
// 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
|
||||
fl_set_browser_dblclick_callback(pFileDlgForm->List,
|
||||
DoubleClickCB,0);
|
||||
C_LyXFileDlg_DoubleClickCB,0);
|
||||
}
|
||||
fl_hide_object(pFileDlgForm->User1);
|
||||
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
|
||||
void LyXFileDlg::HandleListHit()
|
||||
@ -581,6 +600,10 @@ void LyXFileDlg::DoubleClickCB(FL_OBJECT *, long)
|
||||
pCurrentDlg->Force(false);
|
||||
}
|
||||
|
||||
extern "C" void C_LyXFileDlg_DoubleClickCB(FL_OBJECT *ob, long data)
|
||||
{
|
||||
LyXFileDlg::DoubleClickCB(ob, data);
|
||||
}
|
||||
|
||||
// Handle double click from list
|
||||
bool LyXFileDlg::HandleDoubleClick()
|
||||
@ -685,6 +708,10 @@ int LyXFileDlg::CancelCB(FL_FORM *, void *)
|
||||
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
|
||||
void LyXFileDlg::Force(bool cancel)
|
||||
|
@ -84,9 +84,10 @@ private:
|
||||
string pszName;
|
||||
string pszDisplayed;
|
||||
string pszLsEntry;
|
||||
LyXDirEntry() {};
|
||||
public:
|
||||
/// compares two LyXDirEntry objects content (used by qsort)
|
||||
static int ldeCompProc(const LyXDirEntry *r1, const LyXDirEntry *r2);
|
||||
LyXDirEntry() {};
|
||||
};
|
||||
|
||||
|
||||
@ -112,6 +113,8 @@ public:
|
||||
static void FileDlgCB(FL_OBJECT *, long);
|
||||
/// Callback for double click in list
|
||||
static void DoubleClickCB(FL_OBJECT *, long);
|
||||
/// Handle Cancel CB from WM close
|
||||
static int CancelCB(FL_FORM *, void *);
|
||||
private:
|
||||
// data
|
||||
static FD_FileDlg *pFileDlgForm;
|
||||
@ -148,8 +151,6 @@ private:
|
||||
bool HandleDoubleClick();
|
||||
/// Handle OK button call
|
||||
bool HandleOK();
|
||||
/// Handle Cancel CB from WM close
|
||||
static int CancelCB(FL_FORM *, void *);
|
||||
/// Simulates a click on OK/Cancel
|
||||
void Force(bool);
|
||||
};
|
||||
|
25
src/intl.C
25
src/intl.C
@ -31,6 +31,9 @@
|
||||
|
||||
extern LyXRC* lyxrc;
|
||||
|
||||
// a wrapper around the callback static member.
|
||||
extern "C" void C_Intl_DispatchCallback(FL_OBJECT *ob,long code);
|
||||
|
||||
|
||||
Intl::Intl()
|
||||
: prim_lang(lyxrc->primary_kbmap),
|
||||
@ -225,6 +228,10 @@ void Intl::DispatchCallback(FL_OBJECT *ob,long 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)
|
||||
/* initialize key mapper */
|
||||
@ -253,13 +260,19 @@ void Intl::InitKeyMapper(bool on)
|
||||
fd_form_keymap->KeyOnBtn2->u_vdata=(void *)this;
|
||||
|
||||
// add the callbacks.
|
||||
fl_set_object_callback(fd_form_keymap->AcceptChset,DispatchCallback,27);
|
||||
fl_set_object_callback(fd_form_keymap->Charset,DispatchCallback,26);
|
||||
fl_set_object_callback(fd_form_keymap->Accept,DispatchCallback,0);
|
||||
fl_set_object_callback(fd_form_keymap->AcceptChset,
|
||||
C_Intl_DispatchCallback,27);
|
||||
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->KeyOffBtn,DispatchCallback,3);
|
||||
fl_set_object_callback(fd_form_keymap->KeyOnBtn2,DispatchCallback,43);
|
||||
fl_set_object_callback(fd_form_keymap->KeyOnBtn,
|
||||
C_Intl_DispatchCallback,23);
|
||||
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)
|
||||
fl_set_form_atclose(fd_form_keymap->KeyMap, CancelCloseBoxCB, 0);
|
||||
|
@ -64,6 +64,8 @@ public:
|
||||
bool keymapon;
|
||||
///
|
||||
char *chsetcode;
|
||||
///
|
||||
static void DispatchCallback(FL_OBJECT*,long);
|
||||
private:
|
||||
///
|
||||
//int SelectCharset(char const *code);
|
||||
@ -76,8 +78,6 @@ private:
|
||||
///
|
||||
void Keymap(long code);
|
||||
///
|
||||
static void DispatchCallback(FL_OBJECT*,long);
|
||||
///
|
||||
bool primarykeymap;
|
||||
///
|
||||
int curkeymap;
|
||||
|
@ -79,6 +79,10 @@ int mkfifo( char *__path, mode_t __mode ) {
|
||||
|
||||
extern LyXAction lyxaction;
|
||||
|
||||
// C wrapper
|
||||
extern "C" void C_LyXComm_callback(int fd, void *v);
|
||||
|
||||
|
||||
// LyXComm class
|
||||
|
||||
// Open pipes
|
||||
@ -148,7 +152,7 @@ void LyXComm::openConnection() {
|
||||
<< strerror(errno) << endl;
|
||||
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 ---------------------------------------
|
||||
|
||||
@ -234,7 +238,7 @@ void LyXComm::closeConnection() {
|
||||
}
|
||||
|
||||
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";
|
||||
#ifdef __EMX__ // Notify the operating system.
|
||||
@ -347,6 +351,12 @@ void LyXComm::callback(int fd, void *v)
|
||||
errno=0;
|
||||
}
|
||||
|
||||
extern "C" void C_LyXComm_callback(int fd, void *v)
|
||||
{
|
||||
LyXComm::callback(fd, v);
|
||||
}
|
||||
|
||||
|
||||
void LyXComm::send(string const & msg) {
|
||||
if (msg.empty()) {
|
||||
lyxerr << "LyXComm: Request to send empty string. Ignoring."
|
||||
|
@ -53,6 +53,10 @@ public:
|
||||
|
||||
/// Send message
|
||||
void send(string const &);
|
||||
|
||||
/// We receive messages via XForms through this callback
|
||||
static void callback(int fd, void *v);
|
||||
|
||||
private:
|
||||
/// Open pipes
|
||||
void openConnection();
|
||||
@ -60,9 +64,6 @@ private:
|
||||
/// Close pipes
|
||||
void closeConnection();
|
||||
|
||||
/// We receive messages via XForms through this callback
|
||||
static void callback(int fd, void *v);
|
||||
|
||||
/// This is -1 if not open
|
||||
int infd;
|
||||
|
||||
|
15
src/lyxvc.C
15
src/lyxvc.C
@ -308,6 +308,12 @@ void LyXVC::logClose(FL_OBJECT *obj, long)
|
||||
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)
|
||||
{
|
||||
@ -315,6 +321,11 @@ void LyXVC::logUpdate(FL_OBJECT *obj, long)
|
||||
This->showLog();
|
||||
}
|
||||
|
||||
extern "C" void C_LyXVC_logUpdate(FL_OBJECT *ob, long data)
|
||||
{
|
||||
LyXVC::logUpdate(ob, data);
|
||||
}
|
||||
|
||||
|
||||
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, "");
|
||||
obj = fl_add_button(FL_RETURN_BUTTON, 270, 340, 90, 30, _("Close"));
|
||||
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,
|
||||
idex(_("Update|#Uu")));
|
||||
fl_set_button_shortcut(obj,scex(_("Update|#Uu")),1);
|
||||
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_set_form_atclose(browser->LaTeXLog, CancelCloseBoxCB, 0);
|
||||
}
|
||||
|
@ -87,6 +87,11 @@ public:
|
||||
|
||||
/// Returns the userid of the person who has locked the doc.
|
||||
string const getLocker() const;
|
||||
|
||||
///
|
||||
static void logClose(FL_OBJECT*, long);
|
||||
///
|
||||
static void logUpdate(FL_OBJECT*, long);
|
||||
protected:
|
||||
private:
|
||||
///
|
||||
@ -133,10 +138,6 @@ private:
|
||||
///
|
||||
FD_LaTeXLog *browser; // FD_LaTeXLog is just a browser with a
|
||||
// close button. Unfortunately we can not use the standard callbacks.
|
||||
///
|
||||
static void logClose(FL_OBJECT*, long);
|
||||
///
|
||||
static void logUpdate(FL_OBJECT*, long);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
70
src/menus.C
70
src/menus.C
@ -64,6 +64,54 @@ extern void ToggleFloat();
|
||||
extern void AllFloats(char flag, char figmar);
|
||||
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)
|
||||
: _view(view)
|
||||
{
|
||||
@ -167,7 +215,7 @@ void Menus::create_menus(int air)
|
||||
mbheight,_("File"));
|
||||
moffset += obj->w + air;
|
||||
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;
|
||||
|
||||
// Edit menu button
|
||||
@ -181,7 +229,7 @@ void Menus::create_menus(int air)
|
||||
mbheight,_("Edit"));
|
||||
moffset += obj->w + air;
|
||||
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;
|
||||
|
||||
// Layout menu button
|
||||
@ -195,7 +243,7 @@ void Menus::create_menus(int air)
|
||||
mbheight,_("Layout"));
|
||||
moffset += obj->w + air;
|
||||
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;
|
||||
|
||||
// Insert menu button button
|
||||
@ -209,7 +257,7 @@ void Menus::create_menus(int air)
|
||||
mbheight,_("Insert"));
|
||||
moffset += obj->w + air;
|
||||
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;
|
||||
|
||||
// Math menu button
|
||||
@ -223,7 +271,7 @@ void Menus::create_menus(int air)
|
||||
mbheight,_("Math"));
|
||||
moffset += obj->w + air;
|
||||
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;
|
||||
|
||||
// Options menu button
|
||||
@ -237,7 +285,7 @@ void Menus::create_menus(int air)
|
||||
mbheight,_("Options"));
|
||||
moffset += obj->w + air;
|
||||
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;
|
||||
|
||||
// Documents menu button
|
||||
@ -251,7 +299,7 @@ void Menus::create_menus(int air)
|
||||
mbheight,_("Documents"));
|
||||
moffset += obj->w + air;
|
||||
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;
|
||||
|
||||
// Help menu button
|
||||
@ -265,7 +313,7 @@ void Menus::create_menus(int air)
|
||||
mbheight,_("Help"));
|
||||
moffset += obj->w + air;
|
||||
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;
|
||||
|
||||
fl_end_group();
|
||||
@ -298,7 +346,7 @@ void Menus::create_menus(int air)
|
||||
mbheight,_("File"));
|
||||
moffset += obj->w + air;
|
||||
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;
|
||||
|
||||
// Options menu button
|
||||
@ -312,7 +360,7 @@ void Menus::create_menus(int air)
|
||||
mbheight,_("Options"));
|
||||
moffset += obj->w + air;
|
||||
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;
|
||||
|
||||
// Help menu button
|
||||
@ -326,7 +374,7 @@ void Menus::create_menus(int air)
|
||||
mbheight,_("Help"));
|
||||
moffset += obj->w + air;
|
||||
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;
|
||||
|
||||
fl_end_group();
|
||||
|
28
src/menus.h
28
src/menus.h
@ -35,20 +35,6 @@ public:
|
||||
void hideMenus();
|
||||
///
|
||||
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);
|
||||
///
|
||||
@ -67,6 +53,20 @@ private:
|
||||
static void ShowBufferMenu(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();
|
||||
///
|
||||
|
120
src/minibuffer.C
120
src/minibuffer.C
@ -36,6 +36,10 @@ void MiniBuffer::TimerCB(FL_OBJECT *, long tmp)
|
||||
obj->Init();
|
||||
}
|
||||
|
||||
extern "C" void C_MiniBuffer_TimerCB(FL_OBJECT *ob, long data)
|
||||
{
|
||||
MiniBuffer::TimerCB(ob, data);
|
||||
}
|
||||
|
||||
void MiniBuffer::ExecutingCB(FL_OBJECT *ob, long)
|
||||
{
|
||||
@ -72,6 +76,67 @@ void MiniBuffer::ExecutingCB(FL_OBJECT *ob, long)
|
||||
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()
|
||||
{
|
||||
@ -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_color(obj,FL_MCOL,FL_MCOL);
|
||||
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
|
||||
fl_set_object_prehandler(obj, peek_event);
|
||||
fl_set_object_prehandler(obj, C_MiniBuffer_peek_event);
|
||||
obj->u_vdata = (void*)this;
|
||||
obj->wantkey = FL_KEY_TAB;
|
||||
|
||||
// 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());
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,13 @@ public:
|
||||
void Activate();
|
||||
///
|
||||
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:
|
||||
///
|
||||
LyXView *owner;
|
||||
@ -60,13 +67,6 @@ private:
|
||||
string text_stored;
|
||||
///
|
||||
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;
|
||||
///
|
||||
|
@ -136,13 +136,18 @@ Toolbar::Toolbar(Toolbar const &rct, LyXView *o, int x, int y)
|
||||
|
||||
|
||||
// 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;
|
||||
char* help = (char*) ob->u_vdata;
|
||||
fl_show_oneliner(help, ob->form->x + ob->x,
|
||||
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)
|
||||
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()){
|
||||
fl_set_object_callback(t->bubble_timer,
|
||||
BubbleTimerCB, (long) ob);
|
||||
C_Toolbar_BubbleTimerCB, (long) ob);
|
||||
fl_set_timer(t->bubble_timer, 1);
|
||||
}
|
||||
else if(event != FL_MOTION){
|
||||
@ -163,6 +168,12 @@ int Toolbar::BubblePost(FL_OBJECT *ob, int event,
|
||||
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()
|
||||
{
|
||||
@ -201,6 +212,10 @@ void Toolbar::ToolbarCB(FL_OBJECT *ob, long ac)
|
||||
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)
|
||||
{
|
||||
@ -305,7 +320,7 @@ void Toolbar::set(bool doingmain)
|
||||
fl_set_object_gravity(obj,
|
||||
NorthWestGravity,
|
||||
NorthWestGravity);
|
||||
fl_set_object_callback(obj,ToolbarCB,
|
||||
fl_set_object_callback(obj,C_Toolbar_ToolbarCB,
|
||||
(long)item->action);
|
||||
#if FL_REVISION >85
|
||||
// Remove the blue feedback rectangle
|
||||
@ -318,7 +333,7 @@ void Toolbar::set(bool doingmain)
|
||||
// belongs too. (Lgb)
|
||||
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);
|
||||
item = item->next;
|
||||
|
@ -86,6 +86,14 @@ public:
|
||||
/// deactivates the toolbar
|
||||
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:
|
||||
///
|
||||
struct toolbarItem
|
||||
@ -147,13 +155,6 @@ private:
|
||||
char **getPixmap(kb_action, string const & arg=string());
|
||||
/// removes all toolbar buttons from the toolbar.
|
||||
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...
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user