From: Lars Gullik Bjønnes Date: Mon, 14 Aug 2000 15:31:16 +0000 (+0000) Subject: different low-level key handling for xforms 0.89, use signals in workarea, changes... X-Git-Tag: 1.6.10~22038 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=9062ce972e562477eb64c294769747ebf386fa6c;p=features.git different low-level key handling for xforms 0.89, use signals in workarea, changes to allow docxx to compile git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@969 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/ChangeLog b/ChangeLog index 3db7996ac6..3776396481 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2000-08-14 Lars Gullik Bjønnes + + * src/Timeout.h: remove Qt::emit hack. + + * several files: changes to allo doc++ compilation + + * src/lyxfunc.C (processKeySym): new method + (processKeyEvent): comment out if FL_REVISION < 89 + + * src/WorkArea.C: change some debugging levels. + (WorkArea): set wantkey to FL_KEY_ALL + (work_area_handler): enable the FL_KEYBOARD clause, this enables + clearer code and the use of compose with XForms 0.89. Change to + use signals instead of calling methods in bufferview directly. + + * src/Painter.C: change some debugging levels. + + * src/LyXView.C: don't setup of use the KeyPressMask_raw_callback + if FL_REVISION < 89 + + * src/BufferView_pimpl.C (Pimpl): Connect to the WorkArea signals. + (workAreaKeyPress): new method + 2000-08-14 Juergen Vigna * src/frontends/kde/Dialogs.C (Dialogs): added missing dialogs. @@ -55,8 +78,9 @@ Gnome implementation * src/frontends/gnome/Dialogs.C - * src/frontends/gnome/Makefile.am: added Print, Insert Url and all other - dialogs. Copy all unimplemented dialogs from Xforms frontend + * src/frontends/gnome/Makefile.am: added Print, Insert Url and + all other dialogs. Copy all unimplemented dialogs from Xforms + frontend * src/frontends/gnome/support.c * src/frontends/gnome/support.h: support files generated by Glade @@ -68,9 +92,9 @@ * config/lyxinclude.m4: cleanup: frontend renamed from gtk to gnome in configure --help message - * src/lyx_gui.C: Gnome/Gtk releases control in LyXGUI::runTime() only if - there are no events pendling in Gnome/Gtk. This enhances the performance of - menus. + * src/lyx_gui.C: Gnome/Gtk releases control in LyXGUI::runTime() + only if there are no events pendling in Gnome/Gtk. This enhances + the performance of menus. 2000-08-14 Allan Rae @@ -120,9 +144,10 @@ * src/lyx_gui.C: ditto * src/menus.[Ch]: ditto * src/lyx.[Ch]: ditto - * src/lyx_cb.C: ditto + code from here moved to make screen-font-update. - And people wonder why progress on GUII is slow. Look at how scattered - this stuff was! It takes forever just find it all. + * src/lyx_cb.C: ditto + code from here moved to make + screen-font-update. And people wonder why progress on GUII is + slow. Look at how scattered this stuff was! It takes forever + just find it all. * forms/fdfix.sh: Fixup the spacing after commas. * forms/makefile: Remove date from generated files. Fewer clashes now. diff --git a/po/POTFILES.in b/po/POTFILES.in index 18e7c4644c..2eca144861 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -44,17 +44,6 @@ src/frontends/xforms/FormPrint.C src/frontends/xforms/form_print.C src/frontends/xforms/FormRef.C src/frontends/xforms/form_ref.C -src/frontends/xforms/forms/form_citation.C -src/frontends/xforms/forms/form_copyright.C -src/frontends/xforms/forms/form_document.C -src/frontends/xforms/forms/form_graphics.C -src/frontends/xforms/forms/form_index.C -src/frontends/xforms/forms/form_preferences.C -src/frontends/xforms/forms/form_print.C -src/frontends/xforms/forms/form_ref.C -src/frontends/xforms/forms/form_tabular.C -src/frontends/xforms/forms/form_toc.C -src/frontends/xforms/forms/form_url.C src/frontends/xforms/FormTabular.C src/frontends/xforms/form_tabular.C src/frontends/xforms/FormToc.C diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index fc0f96954d..11970de6f3 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -79,6 +79,27 @@ BufferView::Pimpl::Pimpl(BufferView * b, LyXView * o, { buffer_ = 0; workarea_ = new WorkArea(bv_, xpos, ypos, width, height); + // Setup the signals + workarea_->workAreaExpose + .connect(slot(this, &BufferView::Pimpl::workAreaExpose)); + workarea_->workAreaEnter + .connect(slot(this, &BufferView::Pimpl::enterView)); + workarea_->workAreaLeave + .connect(slot(this, &BufferView::Pimpl::leaveView)); + workarea_->workAreaButtonPress + .connect(slot(this, &BufferView::Pimpl::workAreaButtonPress)); + workarea_->workAreaButtonRelease + .connect(slot(this, + &BufferView::Pimpl::workAreaButtonRelease)); + workarea_->workAreaMotionNotify + .connect(slot(this, &BufferView::Pimpl::workAreaMotionNotify)); + workarea_->workAreaDoubleClick + .connect(slot(this, &BufferView::Pimpl::doubleClick)); + workarea_->workAreaTripleClick + .connect(slot(this, &BufferView::Pimpl::tripleClick)); + workarea_->workAreaKeyPress + .connect(slot(this, &BufferView::Pimpl::workAreaKeyPress)); + screen_ = 0; cursor_timeout.timeout.connect(slot(this, @@ -493,6 +514,12 @@ int BufferView::Pimpl::scrollDown(long time) } +void BufferView::Pimpl::workAreaKeyPress(KeySym keysym, unsigned int state) +{ + bv_->owner()->getLyXFunc()->processKeySym(keysym, state); +} + + void BufferView::Pimpl::workAreaMotionNotify(int x, int y, unsigned int state) { // Only use motion with button 1 diff --git a/src/BufferView_pimpl.h b/src/BufferView_pimpl.h index 7de82ef77a..e0a33d4aa4 100644 --- a/src/BufferView_pimpl.h +++ b/src/BufferView_pimpl.h @@ -63,6 +63,8 @@ struct BufferView::Pimpl : public Object { /// int scrollDown(long time); /// + void workAreaKeyPress(KeySym, unsigned int state); + /// void workAreaMotionNotify(int x, int y, unsigned int state); /// void workAreaButtonPress(int x, int y, unsigned int button); diff --git a/src/LyXView.C b/src/LyXView.C index a6cc8adb0b..a32725d0b0 100644 --- a/src/LyXView.C +++ b/src/LyXView.C @@ -319,8 +319,11 @@ void LyXView::create_form_form_main(int width, int height) } +#if FL_REVISION < 89 extern "C" int C_LyXView_KeyPressMask_raw_callback(FL_FORM * fl, void * xev); +#endif + void LyXView::init() { @@ -337,11 +340,13 @@ void LyXView::init() autosave_timeout.setTimeout(lyxrc.autosave * 1000); autosave_timeout.start(); } - + +#if FL_REVISION < 89 // Install the raw callback for keyboard events fl_register_raw_callback(form_, KeyPressMask, C_LyXView_KeyPressMask_raw_callback); +#endif intl->InitKeyMapper(lyxrc.use_kbmap); } @@ -395,6 +400,7 @@ void LyXView::UpdateDocumentClassChoice() } +#if FL_REVISION < 89 // This is necessary, since FL_FREE-Objects doesn't get all keypress events // as FL_KEYBOARD events :-( Matthias 280596 int LyXView::KeyPressMask_raw_callback(FL_FORM * fl, void * xev) @@ -439,7 +445,7 @@ int LyXView::KeyPressMask_raw_callback(FL_FORM * fl, void * xev) // last_time_pressed is 0, that sinifies an autoreapeat // at least on my system. It like some feedback from // others, especially from user running LyX remote. - //lyxerr << "Syncing - purging X events." << endl; + lyxerr[Debug::KEY] << "Syncing - purging X events." << endl; XSync(fl_get_display(), 1); // This purge make f.ex. scrolling stop imidiatly when // releaseing the PageDown button. The question is if this @@ -456,6 +462,7 @@ int C_LyXView_KeyPressMask_raw_callback(FL_FORM * fl, void * xev) { return LyXView::KeyPressMask_raw_callback(fl, xev); } +#endif // Updates the title of the window with the filename of the current document diff --git a/src/LyXView.h b/src/LyXView.h index cd5c48706e..85f56b7fd7 100644 --- a/src/LyXView.h +++ b/src/LyXView.h @@ -148,8 +148,10 @@ private: /// void UpdateDocumentClassChoice(); public: +#if FL_REVISION < 89 /// static int KeyPressMask_raw_callback(FL_FORM *, void * xev); +#endif /** This callback is run when a close event is sent from the window manager. */ static int atCloseMainFormCB(FL_FORM *, void *); diff --git a/src/Painter.C b/src/Painter.C index 5eadc98646..d3216b9ef9 100644 --- a/src/Painter.C +++ b/src/Painter.C @@ -49,7 +49,7 @@ extern bool Lgb_bug_find_hack; PainterBase & Painter::point(int x, int y, LColor::color c) { - if (lyxerr.debugging()) { + if (lyxerr.debugging(Debug::GUI)) { if (!Lgb_bug_find_hack) lyxerr << "point not called from " "workarea::workhandler\n"; @@ -68,7 +68,7 @@ PainterBase & Painter::line(int x1, int y1, int x2, int y2, enum line_style ls, enum line_width lw) { - if (lyxerr.debugging()) { + if (lyxerr.debugging(Debug::GUI)) { if (!Lgb_bug_find_hack) lyxerr << "line not called from " "workarea::workhandler\n"; @@ -88,7 +88,7 @@ PainterBase & Painter::lines(int const * xp, int const * yp, int np, enum line_style ls, enum line_width lw) { - if (lyxerr.debugging()) { + if (lyxerr.debugging(Debug::GUI)) { if (!Lgb_bug_find_hack) lyxerr << "lines not called from " "workarea::workhandler\n"; @@ -122,7 +122,7 @@ PainterBase & Painter::rectangle(int x, int y, int w, int h, enum line_style ls, enum line_width lw) { - if (lyxerr.debugging()) { + if (lyxerr.debugging(Debug::GUI)) { if (!Lgb_bug_find_hack) lyxerr << "rectangle not called from " "workarea::workhandler\n"; @@ -140,7 +140,7 @@ PainterBase & Painter::rectangle(int x, int y, int w, int h, PainterBase & Painter::fillRectangle(int x, int y, int w, int h, LColor::color col) { - if (lyxerr.debugging()) { + if (lyxerr.debugging(Debug::GUI)) { if (!Lgb_bug_find_hack) lyxerr << "fillrectangle not called from " "workarea::workhandler\n"; @@ -157,7 +157,7 @@ PainterBase & Painter::fillRectangle(int x, int y, int w, int h, PainterBase & Painter::fillPolygon(int const * xp, int const * yp, int np, LColor::color col) { - if (lyxerr.debugging()) { + if (lyxerr.debugging(Debug::GUI)) { if (!Lgb_bug_find_hack) lyxerr <<"fillpolygon not called from " "workarea::workhandler\n"; @@ -188,7 +188,7 @@ PainterBase & Painter::arc(int x, int y, unsigned int w, unsigned int h, int a1, int a2, LColor::color col) { - if (lyxerr.debugging()) { + if (lyxerr.debugging(Debug::GUI)) { if (!Lgb_bug_find_hack) lyxerr << "arc not called from " "workarea::workhandler\n"; @@ -208,7 +208,7 @@ PainterBase & Painter::segments(int const * x1, int const * y1, LColor::color col, enum line_style ls, enum line_width lw) { - if (lyxerr.debugging()) { + if (lyxerr.debugging(Debug::GUI)) { if (!Lgb_bug_find_hack) lyxerr << "segments not called from " "workarea::workhandler\n"; @@ -238,7 +238,7 @@ PainterBase & Painter::segments(int const * x1, int const * y1, PainterBase & Painter::pixmap(int x, int y, int w, int h, Pixmap bitmap) { - if (lyxerr.debugging()) { + if (lyxerr.debugging(Debug::GUI)) { if (!Lgb_bug_find_hack) lyxerr << "workAreaExpose not called from " "workarea::workhandler\n"; @@ -295,7 +295,7 @@ PainterBase & Painter::text(int x, int y, char const * s, int ls, return *this; } - if (lyxerr.debugging()) { + if (lyxerr.debugging(Debug::GUI)) { if (!Lgb_bug_find_hack) lyxerr << "text not called from " "workarea::workhandler\n"; @@ -318,13 +318,11 @@ PainterBase & Painter::text(int x, int y, char const * s, int ls, XDrawString(display, owner.getPixmap(), gc, tmpx, y, &c, 1); tmpx += lyxfont::XTextWidth(smallfont, &c, 1); - //tmpx += lyxfont::width(c, f); } else { lyxfont::XSetFont(display, gc, f); XDrawString(display, owner.getPixmap(), gc, tmpx, y, &c, 1); tmpx += lyxfont::XTextWidth(f, &c, 1); - //tmpx += lyxfont::width(c, f); } } } @@ -337,7 +335,7 @@ PainterBase & Painter::text(int x, int y, char const * s, int ls, PainterBase & Painter::text(int x, int y, XChar2b const * s, int ls, LyXFont const & f) { - if (lyxerr.debugging()) { + if (lyxerr.debugging(Debug::GUI)) { if (!Lgb_bug_find_hack) lyxerr << "text not called from " "workarea::workhandler\n"; diff --git a/src/Timeout.h b/src/Timeout.h index 3233b72e92..0853026cfb 100644 --- a/src/Timeout.h +++ b/src/Timeout.h @@ -18,15 +18,6 @@ #pragma interface #endif -#include -/* ugly hack to prevent Qt's '#define emit ...' from - * screwing us up below - jbl 2000/8/10 - */ -#ifdef KDEGUI -#undef emit -#endif - - #ifdef SIGC_CXX_NAMESPACES using SigC::Signal0; #endif diff --git a/src/WorkArea.C b/src/WorkArea.C index 0be0fc9f18..7633b8362b 100644 --- a/src/WorkArea.C +++ b/src/WorkArea.C @@ -19,12 +19,14 @@ #include "debug.h" #include "support/lstrings.h" #include "BufferView.h" +#include "LyXView.h" +#include "lyxfunc.h" using std::endl; FL_OBJECT * figinset_canvas; -// need to make the c++ compiler find the correct version of abs. +// needed to make the c++ compiler find the correct version of abs. // This is at least true for g++. using std::abs; @@ -59,7 +61,7 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height) figinset_canvas = 0; - if (lyxerr.debugging()) + if (lyxerr.debugging(Debug::GUI)) lyxerr << "Creating work area: +" << xpos << '+' << ypos << ' ' << width << 'x' << height << endl; @@ -76,7 +78,7 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height) fl_set_object_gravity(obj, NorthWestGravity, NorthWestGravity); // a box - if (lyxerr.debugging()) + if (lyxerr.debugging(Debug::GUI)) lyxerr << "\tbackground box: +" << xpos << '+' << ypos << ' ' << width - 15 << 'x' << height << endl; @@ -108,7 +110,7 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height) // We add this object as late as possible to avoit problems // with drawing. - if (lyxerr.debugging()) + if (lyxerr.debugging(Debug::GUI)) lyxerr << "\tfree object: +" << xpos + bw << '+' << ypos + bw << ' ' << width - 15 - 2 * bw << 'x' @@ -119,7 +121,8 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height) width - 15 - 2 * bw, // scrollbarwidth height - 2 * bw, "", C_WorkArea_work_area_handler); - obj->wantkey = FL_KEY_TAB; + //obj->wantkey = FL_KEY_TAB; + obj->wantkey = FL_KEY_ALL; obj->u_vdata = this; /* This is how we pass the WorkArea to the work_area_handler. */ fl_set_object_boxtype(obj,FL_DOWN_BOX); @@ -200,7 +203,7 @@ void WorkArea::createPixmap(int width, int height) if (workareapixmap) XFreePixmap(fl_display, workareapixmap); - if (lyxerr.debugging()) + if (lyxerr.debugging(Debug::GUI)) lyxerr << "Creating pixmap (" << width << 'x' << height << ")" << endl; @@ -209,7 +212,7 @@ void WorkArea::createPixmap(int width, int height) width, height, fl_get_visual_depth()); - if (lyxerr.debugging()) + if (lyxerr.debugging(Debug::GUI)) lyxerr << "\tpixmap=" << workareapixmap << endl; } @@ -262,7 +265,7 @@ bool Lgb_bug_find_hack = false; int WorkArea::work_area_handler(FL_OBJECT * ob, int event, FL_Coord, FL_Coord , - int /*key*/, void * xev) + int key, void * xev) { static int x_old = -1; static int y_old = -1; @@ -278,35 +281,28 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event, if (!area->work_area || !area->work_area->form->visible) return 1; - lyxerr.debug() << "Workarea event: DRAW" << endl; + lyxerr[Debug::GUI] << "Workarea event: DRAW" << endl; area->createPixmap(area->workWidth(), area->height()); Lgb_bug_find_hack = true; - //workAreaExpose(); - area->owner_->workAreaExpose(); + area->workAreaExpose(); Lgb_bug_find_hack = false; break; case FL_PUSH: if (!ev) break; // Should really have used xbutton.state - lyxerr.debug() << "Workarea event: PUSH" << endl; - //workAreaButtonPress(ev->xbutton.x - ob->x, - // ev->xbutton.y - ob->y, - // ev->xbutton.button); - - area->owner_->workAreaButtonPress(ev->xbutton.x - ob->x, - ev->xbutton.y - ob->y, - ev->xbutton.button); + lyxerr[Debug::GUI] << "Workarea event: PUSH" << endl; + area->workAreaButtonPress(ev->xbutton.x - ob->x, + ev->xbutton.y - ob->y, + ev->xbutton.button); + //area->workAreaKeyPress(XK_Pointer_Button1, ev->xbutton.state); break; case FL_RELEASE: if (!ev) break; // Should really have used xbutton.state - lyxerr.debug() << "Workarea event: RELEASE" << endl; - //workAreaButtonRelease(ev->xbutton.x - ob->x, - // ev->xbutton.y - ob->y, - // ev->xbutton.button); - area->owner_->workAreaButtonRelease(ev->xbutton.x - ob->x, - ev->xbutton.y - ob->y, - ev->xbutton.button); + lyxerr[Debug::GUI] << "Workarea event: RELEASE" << endl; + area->workAreaButtonRelease(ev->xbutton.x - ob->x, + ev->xbutton.y - ob->y, + ev->xbutton.button); break; case FL_MOUSE: if (!ev || ! area->scrollbar) break; @@ -314,59 +310,97 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event, ev->xmotion.y != y_old || fl_get_scrollbar_value(area->scrollbar) != scrollbar_value_old ) { - lyxerr.debug() << "Workarea event: MOUSE" << endl; - //workAreaMotionNotify(ev->xmotion.x - ob->x, - // ev->xmotion.y - ob->y, - // ev->xbutton.state); - - area->owner_->workAreaMotionNotify(ev->xmotion.x - ob->x, - ev->xmotion.y - ob->y, - ev->xbutton.state); + lyxerr[Debug::GUI] << "Workarea event: MOUSE" << endl; + area->workAreaMotionNotify(ev->xmotion.x - ob->x, + ev->xmotion.y - ob->y, + ev->xbutton.state); } break; - // Done by the raw callback: - // case FL_KEYBOARD: WorkAreaKeyPress(ob, 0,0,0,ev,0); break; + case FL_KEYBOARD: + { + lyxerr[Debug::KEY] << "Workarea event: KEYBOARD"; + if (static_cast(ev)->type == KeyPress) + lyxerr << "KeyPress" << endl; + else + lyxerr << "KeyRelease" << endl; + + KeySym keysym = 0; + char s_r[10]; + XKeyEvent * xke = reinterpret_cast(ev); + XLookupString(xke, s_r, 10, &keysym, 0); + if (lyxerr.debugging(Debug::KEY)) { + char const * tmp = XKeysymToString(key); + char const * tmp2 = XKeysymToString(keysym); + string stm = (tmp ? tmp : ""); + string stm2 = (tmp2 ? tmp2 : ""); + + lyxerr << "WorkArea: Key is `" << stm << "' [" + << key << "]" << endl; + lyxerr << "WorkArea: Keysym is `" << stm2 << "' [" + << keysym << "]" << endl; + } + + if (!key) break; + + KeySym ret_key = (keysym ? keysym : key); + unsigned int ret_state = xke->state; + + static Time last_time_pressed = 0; + static unsigned int last_key_pressed = 0; + static unsigned int last_state_pressed = 0; + if (xke->time - last_time_pressed < 50 // should perhaps be tunable + && xke->state == last_state_pressed + && xke->keycode == last_key_pressed) { + lyxerr[Debug::KEY] + << "Workarea: Purging X events." << endl; + XSync(fl_get_display(), 1); + // This purge make f.ex. scrolling stop immidiatly when + // releasing the PageDown button. The question is if + // this purging of XEvents can cause any harm... + // after some testing I can see no problems, but + // I'd like other reports too. + break; + } + last_time_pressed = xke->time; + last_key_pressed = xke->keycode; + last_state_pressed = xke->state; + + area->workAreaKeyPress(ret_key, ret_state); + } + break; case FL_FOCUS: - lyxerr.debug() << "Workarea event: FOCUS" << endl; - //workAreaFocus(); + lyxerr[Debug::GUI] << "Workarea event: FOCUS" << endl; + area->workAreaFocus(); break; case FL_UNFOCUS: - lyxerr.debug() << "Workarea event: UNFOCUS" << endl; - //workAreaUnfocus(); + lyxerr[Debug::GUI] << "Workarea event: UNFOCUS" << endl; + area->workAreaUnfocus(); break; case FL_ENTER: - lyxerr.debug() << "Workarea event: ENTER" << endl; - //workAreaEnter(); - area->owner_->enterView(); + lyxerr[Debug::GUI] << "Workarea event: ENTER" << endl; + area->workAreaEnter(); break; case FL_LEAVE: - lyxerr.debug() << "Workarea event: LEAVE" << endl; - //workAreaLeave(); - area->owner_->leaveView(); + lyxerr[Debug::GUI] << "Workarea event: LEAVE" << endl; + area->workAreaLeave(); break; case FL_DBLCLICK: if (!ev) break; - lyxerr.debug() << "Workarea event: DBLCLICK" << endl; - //workAreaDoubleClick(ev->xbutton.x - ob->x, - // ev->xbutton.y - ob->y, - // ev->xbutton.button); - area->owner_->doubleClick(ev->xbutton.x - ob->x, - ev->xbutton.y - ob->y, - ev->xbutton.button); + lyxerr[Debug::GUI] << "Workarea event: DBLCLICK" << endl; + area->workAreaDoubleClick(ev->xbutton.x - ob->x, + ev->xbutton.y - ob->y, + ev->xbutton.button); break; case FL_TRPLCLICK: if (!ev) break; - lyxerr.debug() << "Workarea event: TRPLCLICK" << endl; - //workAreaTripleClick(ev->xbutton.x - ob->x, - // ev->xbutton.y - ob->y, - // ev->xbutton.button); - area->owner_->tripleClick(ev->xbutton.x - ob->x, - ev->xbutton.y - ob->y, - ev->xbutton.button); + lyxerr[Debug::GUI] << "Workarea event: TRPLCLICK" << endl; + area->workAreaTripleClick(ev->xbutton.x - ob->x, + ev->xbutton.y - ob->y, + ev->xbutton.button); break; case FL_OTHER: if (!ev) break; - lyxerr.debug() << "Workarea event: OTHER" << endl; + lyxerr[Debug::GUI] << "Workarea event: OTHER" << endl; break; } diff --git a/src/WorkArea.h b/src/WorkArea.h index 85c85629c1..df91b43618 100644 --- a/src/WorkArea.h +++ b/src/WorkArea.h @@ -18,15 +18,16 @@ #include -//#include +#include #include FORMS_H_LOCATION #include "Painter.h" -//#ifdef SIGC_CXX_NAMESPACES -//using SigC::Signal0; -//using SigC::Signal3; -//#endif +#ifdef SIGC_CXX_NAMESPACES +using SigC::Signal0; +using SigC::Signal2; +using SigC::Signal3; +#endif class BufferView; @@ -106,26 +107,28 @@ public: BufferView * owner() const { return owner_; } // Signals - // - // Signal0 workAreaExpose; - // - // Signal3 workAreaButtonPress; - // - // Signal3 workAreaButtonRelease; - // - // Signal3 workAreaMotionNotify; - // - // Signal0 workAreaFocus; - // - // Signal0 workAreaUnfocus; - // - // Signal0 workAreaEnter; - // - // Signal0 workAreaLeave; - // - // Signal3 workAreaDoubleClick; - // - // Signal3 workAreaTripleClick; + /// + Signal0 workAreaExpose; + /// + Signal2 workAreaKeyPress; + /// + Signal3 workAreaButtonPress; + /// + Signal3 workAreaButtonRelease; + /// + Signal3 workAreaMotionNotify; + /// + Signal0 workAreaFocus; + /// + Signal0 workAreaUnfocus; + /// + Signal0 workAreaEnter; + /// + Signal0 workAreaLeave; + /// + Signal3 workAreaDoubleClick; + /// + Signal3 workAreaTripleClick; private: /// void createPixmap(int, int); diff --git a/src/frontends/xforms/FormCitation.h b/src/frontends/xforms/FormCitation.h index f6e222d8e8..c0c002ef33 100644 --- a/src/frontends/xforms/FormCitation.h +++ b/src/frontends/xforms/FormCitation.h @@ -23,24 +23,28 @@ struct FD_form_citation; */ class FormCitation : public FormCommand { public: - /**@name Constructors and Destructors */ - //@{ /// FormCitation(LyXView *, Dialogs *); /// ~FormCitation(); - //@} - private: /// enum State { + /// DOWN, + /// UP, + /// DELETE, + /// ADD, + /// BIBBRSR, + /// CITEBRSR, + /// ON, + /// OFF }; /// Build the dialog diff --git a/src/frontends/xforms/FormCommand.h b/src/frontends/xforms/FormCommand.h index ab3899113b..6fedf5e668 100644 --- a/src/frontends/xforms/FormCommand.h +++ b/src/frontends/xforms/FormCommand.h @@ -31,7 +31,6 @@ class FormCommand : public DialogBase, public noncopyable { public: /// Constructor FormCommand(LyXView *, Dialogs *, string const & ); - /// static int WMHideCB(FL_FORM *, void *); /// diff --git a/src/frontends/xforms/FormDocument.h b/src/frontends/xforms/FormDocument.h index 1aa8be27e6..8669b02277 100644 --- a/src/frontends/xforms/FormDocument.h +++ b/src/frontends/xforms/FormDocument.h @@ -34,101 +34,131 @@ using SigC::Connection; */ class FormDocument : public DialogBase, public noncopyable { public: - /**@name Constructors and Destructors */ - //@{ /// #FormDocument x(Communicator ..., Popups ...);# FormDocument(LyXView *, Dialogs *); /// ~FormDocument(); + /// void SetDocumentClassChoice(vector const & choices); - //@} - - /**@name Real per-instance Callback Methods */ - //@{ + /// static int WMHideCB(FL_FORM *, void *); + /// static void OKCB(FL_OBJECT *, long); + /// static void CancelCB(FL_OBJECT *, long); + /// static void ApplyCB(FL_OBJECT *, long); + /// static void InputCB(FL_OBJECT *, long); - //@} - + /// enum EnumPopupStatus { + /// POPUP_UNMODIFIED, + /// POPUP_MODIFIED, + /// POPUP_READONLY }; private: + /// void DeactivateDocumentButtons(); + /// void ActivateDocumentButtons(); + /// void EnableDocumentLayout(); + /// void DisableDocumentLayout(); + /// void CheckDocumentInput(FL_OBJECT * ob, long); + /// void ChoiceBulletSize(FL_OBJECT * ob, long); + /// void InputBulletLaTeX(FL_OBJECT * ob, long); + /// void BulletDepth(FL_OBJECT * ob, long); + /// void BulletPanel(FL_OBJECT * ob, long); + /// void BulletBMTable(FL_OBJECT * ob, long); + /// void checkMarginValues(); - - /**@name Real per-instance Callback Methods */ - //@{ + /// static void DocumentInputCB(FL_OBJECT * ob, long); + /// static void ChoiceBulletSizeCB(FL_OBJECT * ob, long); + /// static void InputBulletLaTeXCB(FL_OBJECT * ob, long); + /// static void BulletDepthCB(FL_OBJECT * ob, long); + /// static void BulletPanelCB(FL_OBJECT * ob, long); + /// static void BulletBMTableCB(FL_OBJECT * ob, long); - //@} - - /**@name Slot Methods */ - //@{ + /// Create the popup if necessary, update it and display it. void show(); /// Hide the popup. void hide(); /// Update the popup. void update(); + /// void paper_update(); + /// void class_update(); + /// void language_update(); + /// void options_update(); + /// void bullets_update(); /// Apply from popup void apply(); + /// void paper_apply(); + /// bool class_apply(); + /// bool language_apply(); + /// bool options_apply(); + /// void bullets_apply(); /// Cancel from popup void cancel(); - //@} /// Build the popup void build(); - /// /// Explicitly free the popup. void free(); /// Typedefinitions from the fdesign produced Header file FD_form_tabbed_document * build_tabbed_document(); + /// FD_form_doc_paper * build_doc_paper(); + /// FD_form_doc_class * build_doc_class(); + /// FD_form_doc_language * build_doc_language(); + /// FD_form_doc_options * build_doc_options(); + /// FD_form_doc_bullet * build_doc_bullet(); - /**@name Private Data */ - //@{ /// Real GUI implementation. FD_form_tabbed_document * dialog_; + /// FD_form_doc_paper * paper_; + /// FD_form_doc_class * class_; + /// FD_form_doc_language * language_; + /// FD_form_doc_options * options_; + /// FD_form_doc_bullet * bullets_; /// Which LyXView do we belong to? LyXView * lv_; + /// Dialogs * d_; /// Update connection. Connection u_; @@ -136,10 +166,14 @@ private: Connection h_; /// has form contents changed? Used to control OK/Apply EnumPopupStatus status; - //@} - int - ActCell, Confirmed, - current_bullet_panel, current_bullet_depth; + /// + int ActCell; + /// + int Confirmed; + /// + int current_bullet_panel; + /// + int current_bullet_depth; /// FL_OBJECT * fbullet; /// diff --git a/src/frontends/xforms/FormGraphics.h b/src/frontends/xforms/FormGraphics.h index 111a5469ba..d554b25468 100644 --- a/src/frontends/xforms/FormGraphics.h +++ b/src/frontends/xforms/FormGraphics.h @@ -20,8 +20,8 @@ #include "LString.h" #include "frontends/DialogBase.h" -//#include "form_graphics.h" #include "RadioButtonGroup.h" +#include "support/utility.hpp" #ifdef __GNUG__ #pragma interface @@ -36,8 +36,7 @@ struct FD_form_graphics; /** This class provides an XForms implementation of the FormGraphics Dialog. */ -class FormGraphics: public DialogBase -{ +class FormGraphics: public DialogBase, public noncopyable { public: /// #FormGraphics x(LyXFunc ..., Dialogs ...);# FormGraphics(LyXView *, Dialogs *); @@ -59,12 +58,6 @@ public: static void InputCB(FL_OBJECT *, long); private: - /// - FormGraphics() -: widthButtons(5), heightButtons(4), displayButtons(4) {} - // -FormGraphics(FormGraphics const &) : DialogBase() {} - /// The maximum digits for the image width (cm, inch, percent) enum { /// @@ -86,8 +79,6 @@ FormGraphics(FormGraphics const &) : DialogBase() {} FILENAME_MAXCHARS = 1024 }; - /**@name Slot Methods */ - //@{ /// Save the active inset and show the dialog. void showDialog(InsetGraphics * inset); /// Create the dialog if necessary, update it and display it. @@ -96,17 +87,13 @@ FormGraphics(FormGraphics const &) : DialogBase() {} void hide(); /// Update the dialog void update(); - //@} - /**@name Callback methods */ - //@{ /// Apply the changes to the inset. void apply(); /// Verify that the input is correct. If not disable ok/apply buttons. void input(); /// Open the file browse dialog to select an image file. void browse(); - //@} /// Build the dialog void build(); @@ -117,8 +104,6 @@ FormGraphics(FormGraphics const &) : DialogBase() {} /// Display a file browser dialog and return the file chosen. string browseFile(string const & filename); - /**@name Data */ - //@{ /// Real GUI implementation. FD_form_graphics * dialog_; /** Which LyXFunc do we use? @@ -149,9 +134,6 @@ FormGraphics(FormGraphics const &) : DialogBase() {} Connection u_; /// Last used figure path string last_image_path; - //@} - -} -; +}; #endif diff --git a/src/frontends/xforms/FormIndex.h b/src/frontends/xforms/FormIndex.h index e2ac09500c..5b8958542d 100644 --- a/src/frontends/xforms/FormIndex.h +++ b/src/frontends/xforms/FormIndex.h @@ -23,14 +23,10 @@ struct FD_form_index; */ class FormIndex : public FormCommand { public: - /**@name Constructors and Destructors */ - //@{ /// FormIndex(LyXView *, Dialogs *); /// ~FormIndex(); - //@} - private: /// Build the dialog virtual void build(); @@ -44,10 +40,10 @@ private: virtual FL_FORM * const form() const; /// FD_form_index * build_index(); - - /// - int minh, minw; + int minh; + /// + int minw; /// Real GUI implementation. FD_form_index * dialog_; }; diff --git a/src/frontends/xforms/FormPreferences.h b/src/frontends/xforms/FormPreferences.h index b3c328849d..ad69716354 100644 --- a/src/frontends/xforms/FormPreferences.h +++ b/src/frontends/xforms/FormPreferences.h @@ -46,37 +46,31 @@ using SigC::Connection; */ class FormPreferences : public DialogBase, public noncopyable { public: - /**@name Constructors and Destructors */ - //@{ /// #FormPreferences x(LyXFunc ..., Dialogs ...);# FormPreferences(LyXView *, Dialogs *); /// ~FormPreferences(); - //@} - /**@name Real per-instance Callback Methods */ - //@{ + /// static int WMHideCB(FL_FORM *, void *); + /// static void OKCB(FL_OBJECT *, long); + /// static void ApplyCB(FL_OBJECT *, long); + /// static void CancelCB(FL_OBJECT *, long); + /// static void InputCB(FL_OBJECT *, long); + /// static void RestoreCB(FL_OBJECT *, long); - //@} - private: - /**@name Slot Methods */ - //@{ /// Create the dialog if necessary, update it and display it. void show(); /// Hide the dialog. void hide(); /// Update the dialog. void update(); - //@} - /**@name Dialog internal methods */ - //@{ /// Apply from dialog void apply(); /// Filter the inputs -- return true if entries are valid @@ -97,10 +91,7 @@ private: FD_form_printer * build_printer(); /// FD_form_paths * build_paths(); - //@} - /**@name Private Data */ - //@{ /// Real GUI implementation. FD_form_preferences * dialog_; /// @@ -124,10 +115,11 @@ private: /// Hide connection. Connection h_; /// Overcome a dumb xforms sizing bug - int minw_, minh_; + int minw_; + /// + int minh_; /// ButtonController * bc_; - //@} }; #endif diff --git a/src/frontends/xforms/FormPrint.h b/src/frontends/xforms/FormPrint.h index d9fb26cb00..1d9a568b42 100644 --- a/src/frontends/xforms/FormPrint.h +++ b/src/frontends/xforms/FormPrint.h @@ -37,36 +37,29 @@ using SigC::Connection; */ class FormPrint : public DialogBase, public noncopyable { public: - /**@name Constructors and Destructors */ - //@{ /// #FormPrint x(LyXFunc ..., Dialogs ...);# FormPrint(LyXView *, Dialogs *); /// ~FormPrint(); - //@} - /**@name Real per-instance Callback Methods */ - //@{ + /// static int WMHideCB(FL_FORM *, void *); + /// static void OKCB(FL_OBJECT *, long); + /// static void ApplyCB(FL_OBJECT *, long); + /// static void CancelCB(FL_OBJECT *, long); + /// static void InputCB(FL_OBJECT *, long); - //@} - private: - /**@name Slot Methods */ - //@{ /// Create the dialog if necessary, update it and display it. void show(); /// Hide the dialog. void hide(); /// Update the dialog. void update(); - //@} - /**@name Dialog internal methods */ - //@{ /// Apply from dialog void apply(); /// Filter the inputs @@ -75,10 +68,7 @@ private: void build(); /// FD_form_print * build_print(); - //@} - /**@name Private Data */ - //@{ /// Real GUI implementation. FD_form_print * dialog_; /// Which LyXView do we belong to? @@ -89,7 +79,6 @@ private: Connection u_; /// Hide connection. Connection h_; - //@} }; #endif diff --git a/src/frontends/xforms/FormRef.h b/src/frontends/xforms/FormRef.h index e74c9259a3..f0548cfb66 100644 --- a/src/frontends/xforms/FormRef.h +++ b/src/frontends/xforms/FormRef.h @@ -23,19 +23,33 @@ struct FD_form_ref; */ class FormRef : public FormCommand { public: - /**@name Constructors and Destructors */ - //@{ /// FormRef(LyXView *, Dialogs *); /// ~FormRef(); - //@} - private: /// - enum Type{ REF=0, PAGEREF, VREF, VPAGEREF, PRETTYREF }; + enum Type{ + /// + REF, + /// + PAGEREF, + /// + VREF, + /// + VPAGEREF, + /// + PRETTYREF + }; /// - enum Goto{ GOREF=0, GOBACK, GOFIRST }; + enum Goto{ + /// + GOREF, + /// + GOBACK, + /// + GOFIRST + }; /// Build the dialog virtual void build(); diff --git a/src/frontends/xforms/FormTabular.h b/src/frontends/xforms/FormTabular.h index 3fe374e200..f625b587af 100644 --- a/src/frontends/xforms/FormTabular.h +++ b/src/frontends/xforms/FormTabular.h @@ -39,43 +39,43 @@ struct FD_form_create_tabular; */ class FormTabular : public DialogBase, public noncopyable { public: - /**@name Constructors and Destructors */ - //@{ /// #FormTabular x(LyXFunc ..., Dialogs ...);# FormTabular(LyXView *, Dialogs *); /// ~FormTabular(); - //@} - - /**@name Real per-instance Callback Methods */ - //@{ + /// static int WMHideCB(FL_FORM *, void *); + /// static void CloseCB(FL_OBJECT *, long); + /// static void OKCB(FL_OBJECT *, long); + /// static void CancelCB(FL_OBJECT *, long); + /// static void ApplyCB(FL_OBJECT *, long); + /// static void InputCB(FL_OBJECT *, long); - //@} private: - /**@name Slot Methods */ - //@{ /// Create the dialog if necessary, update it and display it. void show(); + /// void show_create(); + /// void showInset(InsetTabular *); /// Hide the dialog. void hide(); + /// void hide_create(); + /// void hideInset(InsetTabular *); /// Update the dialog. void update(); + /// void updateInset(InsetTabular *); + /// bool local_update(bool); - //@} - /**@name Dialog internal methods */ - //@{ /// Apply from dialog void apply_create(); /// Build the dialog @@ -94,10 +94,7 @@ private: FD_form_longtable_options * build_longtable_options(); /// FD_form_create_tabular * build_create_tabular(); - //@} - /**@name Private Data */ - //@{ /// Real GUI implementation. FD_form_tabular * dialog_; /// @@ -110,7 +107,7 @@ private: FD_form_longtable_options * longtable_options_; /// FD_form_create_tabular * create_tabular_; - // + /// Which LyXView do we belong to? LyXView * lv_; /// @@ -123,7 +120,6 @@ private: InsetTabular * inset_; /// int actCell_; - //@} }; #endif diff --git a/src/frontends/xforms/FormToc.h b/src/frontends/xforms/FormToc.h index 7872ce813a..78cbaa5263 100644 --- a/src/frontends/xforms/FormToc.h +++ b/src/frontends/xforms/FormToc.h @@ -24,13 +24,10 @@ struct FD_form_toc; */ class FormToc : public FormCommand { public: - /**@name Constructors and Destructors */ - //@{ /// FormToc(LyXView *, Dialogs *); /// ~FormToc(); - private: /// Build the dialog virtual void build(); diff --git a/src/frontends/xforms/FormUrl.h b/src/frontends/xforms/FormUrl.h index d02dd0f40c..1c7703ea29 100644 --- a/src/frontends/xforms/FormUrl.h +++ b/src/frontends/xforms/FormUrl.h @@ -23,14 +23,10 @@ struct FD_form_url; */ class FormUrl : public FormCommand { public: - /**@name Constructors and Destructors */ - //@{ /// FormUrl(LyXView *, Dialogs *); /// ~FormUrl(); - //@} - private: /// Build the dialog virtual void build(); @@ -44,9 +40,10 @@ private: virtual FL_FORM * const form() const; /// FD_form_url * build_url(); - /// - int minh, minw; + int minh; + /// + int minw; /// Real GUI implementation. FD_form_url * dialog_; }; diff --git a/src/frontends/xforms/Menubar_pimpl.h b/src/frontends/xforms/Menubar_pimpl.h index 69ff06e842..0b4a472264 100644 --- a/src/frontends/xforms/Menubar_pimpl.h +++ b/src/frontends/xforms/Menubar_pimpl.h @@ -46,12 +46,14 @@ public: /// static void MenuCallback(FL_OBJECT *, long); - /// Add to "menu" the list of last opened files - /// (add "extra_label" to the last entry) + /** Add to "menu" the list of last opened files + (add "extra_label" to the last entry) + */ void add_lastfiles(int menu, string const & extra_label, std::vector & smn, StrPool & strpool); - /// Add to "menu" the list of opened documents - /// (add "extra_label" to the last entry) + /** Add to "menu" the list of opened documents + (add "extra_label" to the last entry) + */ void add_documents(int menu, string const & extra_label, std::vector & smn, StrPool & strpool); /// @@ -60,7 +62,7 @@ public: std::vector & smn, StrPool & strpool); /// update the state of the menuitems - void update() { } + void update() {} private: /// diff --git a/src/frontends/xforms/RadioButtonGroup.h b/src/frontends/xforms/RadioButtonGroup.h index 77f223e2f7..dbb33337b8 100644 --- a/src/frontends/xforms/RadioButtonGroup.h +++ b/src/frontends/xforms/RadioButtonGroup.h @@ -23,20 +23,19 @@ #pragma interface #endif -#include -#include +#include +#include + using std::vector; using std::pair; #include FORMS_H_LOCATION -class RadioButtonGroup -{ +/// +class RadioButtonGroup { public: /// Constructor. Allocate space for 'n' items in the group. RadioButtonGroup(unsigned n = 5) : map(n) {}; - /// Destructor. Cleans up. - ~RadioButtonGroup() {}; /// Register a radio button with it's corresponding value. void registerRadioButton(FL_OBJECT *button, int value); @@ -50,8 +49,11 @@ public: int getButton(); private: - typedef pair < FL_OBJECT *, int > ButtonValuePair; - typedef vector < ButtonValuePair > ButtonValueMap; + /// + typedef pair ButtonValuePair; + /// + typedef vector ButtonValueMap; + /// ButtonValueMap map; }; diff --git a/src/frontends/xforms/Toolbar_pimpl.h b/src/frontends/xforms/Toolbar_pimpl.h index 43aa965fda..f070ebae09 100644 --- a/src/frontends/xforms/Toolbar_pimpl.h +++ b/src/frontends/xforms/Toolbar_pimpl.h @@ -47,7 +47,8 @@ public: void set(bool doingmain = false); /** this is to be the entry point to the toolbar - frame, where you can change the toolbar realtime. */ + frame, where you can change the toolbar realtime. + */ void edit(); /// add a new button to the toolbar. void add(int , bool doclean = true); @@ -99,7 +100,9 @@ public: /// Combox * combox; /// Starting position - int sxpos, sypos; + int sxpos; + /// + int sypos; /// int xpos; /// @@ -110,12 +113,10 @@ public: /// removes all toolbar buttons from the toolbar. void clean(); - /** more... - */ + /// more... void reset(); - /** more... - */ + /// more... void lightReset(); }; #endif diff --git a/src/graphics/EPS_Renderer.h b/src/graphics/EPS_Renderer.h index 947146bc3c..ed7051c78b 100644 --- a/src/graphics/EPS_Renderer.h +++ b/src/graphics/EPS_Renderer.h @@ -18,6 +18,7 @@ #include "graphics/Renderer.h" +/// class EPS_Renderer : public Renderer { public: /// c-tor. diff --git a/src/graphics/GraphicsCache.h b/src/graphics/GraphicsCache.h index ebb0f7bcaf..847eedc789 100644 --- a/src/graphics/GraphicsCache.h +++ b/src/graphics/GraphicsCache.h @@ -22,8 +22,8 @@ #include "GraphicsCacheItem.h" #include "support/utility.hpp" -/** GraphicsCache is the manager of the image cache, it is responsible to - create the GraphicsCacheItem's and maintain them. +/** GraphicsCache is the manager of the image cache. + It is responsible of create the GraphicsCacheItem's and maintain them. GraphicsCache is a singleton class, there should be only one instance of it at any moment. diff --git a/src/graphics/GraphicsCacheItem.h b/src/graphics/GraphicsCacheItem.h index 27f67f2249..53dca53c9c 100644 --- a/src/graphics/GraphicsCacheItem.h +++ b/src/graphics/GraphicsCacheItem.h @@ -57,25 +57,29 @@ public: /// Return a pixmap that can be displayed on X server. Pixmap getImage() const; - + /// enum ImageStatus { + /// Loading = 1, + /// ErrorConverting, + /// ErrorReading, + /// Loaded }; /// Is the pixmap ready for display? ImageStatus getImageStatus() const; - /// Get a notification when the image conversion is done. - /// used by an internal callback mechanism. + /** Get a notification when the image conversion is done. + used by an internal callback mechanism. + */ void imageConverted(int retval); - private: - /// Private c-tor so that only GraphicsCache can create an instance. - GraphicsCacheItem(); + /// Private c-tor so that only GraphicsCache can create an instance. + GraphicsCacheItem(); /// internal copy mechanism. void copy(GraphicsCacheItem const &); @@ -85,13 +89,15 @@ private: /// Set the filename this item will be pointing too. bool setFilename(string const & filename); - /// - friend class GraphicsCache; + /// + friend class GraphicsCache; + /// GraphicsCacheItem_pimpl * pimpl; - /// The filename we refer too, this is used when removing ourselves - /// from the cache. + /** The filename we refer too. + This is used when removing ourselves from the cache. + */ string filename_; }; diff --git a/src/graphics/Renderer.h b/src/graphics/Renderer.h index ee2101b156..a8b6044db8 100644 --- a/src/graphics/Renderer.h +++ b/src/graphics/Renderer.h @@ -22,11 +22,11 @@ #include "X11/Xlib.h" #include "support/utility.hpp" -/** Renderer is a base class that is used to take an image format, and render - * it into a Pixmap in order to be able to display it later on in LyX. - * Essentially it's job is to load an image format and create a Pixmap from it. - * It also needs to do various transforms on the image, like Rotation, - * Resize and color reduction. +/** Renderer is a base class that is used to take an image format, and + render it into a Pixmap in order to be able to display it later on + in LyX. Essentially it's job is to load an image format and create + a Pixmap from it. It also needs to do various transforms on the + image, like Rotation, Resize and color reduction. */ class Renderer : public noncopyable { public: @@ -56,7 +56,7 @@ protected: /// Set the pixmap. void setPixmap(Pixmap pixmap, unsigned int width, unsigned int height); - + /// string const & getFilename() const; private: diff --git a/src/graphics/XPM_Renderer.C b/src/graphics/XPM_Renderer.C index c51bdca672..2d9e41b490 100644 --- a/src/graphics/XPM_Renderer.C +++ b/src/graphics/XPM_Renderer.C @@ -27,12 +27,11 @@ using std::endl; using std::ios; + XPM_Renderer::XPM_Renderer() : Renderer() {} -XPM_Renderer::~XPM_Renderer() -{} bool XPM_Renderer::renderImage() { @@ -70,6 +69,7 @@ bool XPM_Renderer::renderImage() return true; } + bool XPM_Renderer::isImageFormatOK(string const & filename) const { std::ifstream is(filename.c_str(), ios::in); diff --git a/src/graphics/XPM_Renderer.h b/src/graphics/XPM_Renderer.h index 2b294267fc..a7b7b7bdf1 100644 --- a/src/graphics/XPM_Renderer.h +++ b/src/graphics/XPM_Renderer.h @@ -18,12 +18,11 @@ #include "graphics/Renderer.h" +/// class XPM_Renderer : public Renderer { public: /// c-tor. XPM_Renderer(); - /// d-tor. - virtual ~XPM_Renderer(); /// Load the XPM image and create a pixmap out of it. virtual bool renderImage(); diff --git a/src/kbmap.C b/src/kbmap.C index 8423c5d635..68cde51c6a 100644 --- a/src/kbmap.C +++ b/src/kbmap.C @@ -180,7 +180,7 @@ int kb_keymap::defkey(kb_sequence * seq, int action, int idx /*= 0*/) if (idx + 1 == seq->length) { string buf; seq->print(buf, true); - lyxerr[Debug::KEY] + lyxerr[Debug::KBMAP] << "Warning: New binding for '" << buf << "' is overriding old binding..." diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 034865018c..94a287c9ae 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -187,13 +187,142 @@ void LyXFunc::moveCursorUpdate(bool selecting) } +int LyXFunc::processKeySym(KeySym keysym, unsigned int state) +{ + string argument; + + if (lyxerr.debugging(Debug::KEY)) { + char * tmp = XKeysymToString(keysym); + string stm = (tmp ? tmp : ""); + lyxerr << "KeySym is " + << stm + << "[" + << keysym << "]" + << endl; + } + // Do nothing if we have nothing (JMarc) + if (keysym == NoSymbol) { + lyxerr[Debug::KEY] << "Empty kbd action (probably composing)" + << endl; + //return 0; + return FL_PREEMPT; + } + + // this function should be used always [asierra060396] + UpdatableInset * tli = owner->view()->the_locking_inset; + if (owner->view()->available() && tli && (keysym == XK_Escape)) { + if (tli == tli->GetLockingInset()) { + owner->view()->unlockInset(tli); + owner->view()->text->CursorRight(owner->view()); + moveCursorUpdate(false); + owner->showState(); + } else { + tli->UnlockInsetInInset(owner->view(), + tli->GetLockingInset(),true); + } + //return 0; + return FL_PREEMPT; + } + + // Can we be sure that this will work for all X-Windows + // implementations? (Lgb) + // This code snippet makes lyx ignore some keys. Perhaps + // all of them should be explictly mentioned? + if((keysym >= XK_Shift_L && keysym <= XK_Hyper_R) + || keysym == XK_Mode_switch || keysym == 0x0) + return 0; + + // Do a one-deep top-level lookup for + // cancel and meta-fake keys. RVDK_PATCH_5 + cancel_meta_seq.reset(); + + int action = cancel_meta_seq.addkey(keysym, state + &(ShiftMask|ControlMask + |Mod1Mask)); + + // When not cancel or meta-fake, do the normal lookup. + // Note how the meta_fake Mod1 bit is OR-ed in and reset afterwards. + // Mostly, meta_fake_bit = 0. RVDK_PATCH_5. + if ( (action != LFUN_CANCEL) && (action != LFUN_META_FAKE) ) { + + // remove Caps Lock and Mod2 as a modifiers + action = keyseq.addkey(keysym, + (state | meta_fake_bit) + &(ShiftMask|ControlMask + |Mod1Mask)); + } + // Dont remove this unless you know what you are doing. + meta_fake_bit = 0; + + if (action == 0) action = LFUN_PREFIX; + + if (lyxerr.debugging(Debug::KEY)) { + string buf; + keyseq.print(buf); + lyxerr << "Key [" + << action << "][" + << buf << "]" +#if 0 + << "[" + << num_bytes << "]" +#endif + << endl; + } + + // already here we know if it any point in going further + // why not return already here if action == -1 and + // num_bytes == 0? (Lgb) + + if(keyseq.length > 1 || keyseq.length < -1) { + string buf; + keyseq.print(buf); + owner->getMiniBuffer()->Set(buf); + } + + if (action == -1) { + if (keyseq.length < -1) { // unknown key sequence... + string buf; + LyXBell(); + keyseq.print(buf); + owner->getMiniBuffer()->Set(_("Unknown sequence:"), buf); + return 0; + } + + char isochar = keyseq.getiso(); + if (!(state & ControlMask) && + !(state & Mod1Mask) && + (isochar && keysym < 0xF000)) { + argument += isochar; + } + if (argument.empty()) { + lyxerr.debug() << "Empty argument!" << endl; + // This can`t possibly be of any use + // so we`ll skip the dispatch. + return 0; + } + } +#if 0 + else + if (action == LFUN_SELFINSERT) { + argument = s_r[0]; + } +#endif + bool tmp_sc = show_sc; + show_sc = false; + Dispatch(action, argument.c_str()); + show_sc = tmp_sc; + + return 0; +} + + +#if FL_REVISION < 89 int LyXFunc::processKeyEvent(XEvent * ev) { char s_r[10]; + KeySym keysym_return = 0; string argument; XKeyEvent * keyevent = &ev->xkey; - KeySym keysym_return = 0; - int num_bytes = LyXLookupString(ev, s_r, 10, &keysym_return); s_r[num_bytes] = '\0'; @@ -207,7 +336,8 @@ int LyXFunc::processKeyEvent(XEvent * ev) << " and num_bytes is " << num_bytes << " the string returned is \"" - << s_r << '\"' << endl; + << s_r << '\"' + << endl; } // Do nothing if we have nothing (JMarc) if (num_bytes == 0 && keysym_return == NoSymbol) { @@ -268,8 +398,10 @@ int LyXFunc::processKeyEvent(XEvent * ev) keyseq.print(buf); lyxerr << "Key [" << action << "][" - << buf << "][" - << num_bytes << "]" << endl; + << buf << "]" + << "[" + << num_bytes << "]" + << endl; } // already here we know if it any point in going further @@ -303,11 +435,12 @@ int LyXFunc::processKeyEvent(XEvent * ev) // so we`ll skip the dispatch. return 0; } - } else + } + else if (action == LFUN_SELFINSERT) { argument = s_r[0]; } - + bool tmp_sc = show_sc; show_sc = false; Dispatch(action, argument.c_str()); @@ -315,6 +448,7 @@ int LyXFunc::processKeyEvent(XEvent * ev) return 0; } +#endif LyXFunc::func_status LyXFunc::getStatus(int ac) const diff --git a/src/lyxfunc.h b/src/lyxfunc.h index ec0685a265..508d035085 100644 --- a/src/lyxfunc.h +++ b/src/lyxfunc.h @@ -6,6 +6,7 @@ #pragma interface #endif +#include FORMS_H_LOCATION #include "commandtags.h" #include "kbsequence.h" #include "insets/lyxinset.h" @@ -48,9 +49,13 @@ public: /// Same again but for xtl buffers. Still looking for better idea. bool Dispatch(int action, auto_mem_buffer &); +#if FL_REVISION < 89 /// A keyboard event is processed to execute a lyx action. int processKeyEvent(XEvent * ev); - +#else + /// + int processKeySym(KeySym k, unsigned int state); +#endif /// func_status getStatus(int ac) const; diff --git a/src/lyxlookup.C b/src/lyxlookup.C index 16653062fb..4f4e20cd06 100644 --- a/src/lyxlookup.C +++ b/src/lyxlookup.C @@ -164,11 +164,13 @@ int LyXLookupString(XEvent * event, << "LyXLookupString: found DeadEvent" << endl; return 0; } +#if 1 if (XFilterEvent (event, None)) { - //lyxerr <<"XFilterEvent"); + lyxerr[Debug::KEY] <<"XFilterEvent" << endl; *keysym_return = NoSymbol; return 0; } +#endif if (event->type != KeyPress) lyxerr << "LyXLookupString: wrong event type" << event->type << endl; @@ -178,22 +180,34 @@ int LyXLookupString(XEvent * event, bytes_buffer, keysym_return, &status_return); switch(status_return) { + case XBufferOverflow: + lyxerr[Debug::KEY] << "XBufferOverflow" << endl; + break; case XLookupBoth: - //lyxerr <<"XLookupBoth"); + lyxerr[Debug::KEY] << "XLookupBoth" + << string(buffer_return, result) + << endl; break; case XLookupChars: - //lyxerr <<"XLookupChars"); + lyxerr[Debug::KEY] << "XLookupChars " + << string(buffer_return, result) + << endl; + *keysym_return = NoSymbol; break; case XLookupKeySym: - //lyxerr <<"XLookupKeySym"); + lyxerr[Debug::KEY] << "XLookupKeySym" << endl; result = 0; break; - default: - //lyxerr <<"default"); + case XLookupNone: + lyxerr[Debug::KEY] << "XLookupNone" << endl; *keysym_return = NoSymbol; result = 0; break; + default: + lyxerr << "Unknown status_return from" + " XmbLookupString" << endl; + break; } } else { result = XLookupString(&event->xkey, buffer_return, @@ -203,6 +217,7 @@ int LyXLookupString(XEvent * event, return result; } + // This is called after the main window has been destroyed void CloseLyXLookup() { diff --git a/src/lyxrc.C b/src/lyxrc.C index c9ab9d5f3c..414080eae2 100644 --- a/src/lyxrc.C +++ b/src/lyxrc.C @@ -929,7 +929,7 @@ int LyXRC::read(string const & filename) } if ((action = lyxaction.LookupFunc(cmd.c_str()))>= 0) { - if (lyxerr.debugging(Debug::KEY)) { + if (lyxerr.debugging(Debug::KBMAP)) { lyxerr << "RC_BIND: Sequence `" << seq << "' Command `" << cmd << "' Action `"