]> git.lyx.org Git - lyx.git/commitdiff
different low-level key handling for xforms 0.89, use signals in workarea, changes...
authorLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 14 Aug 2000 15:31:16 +0000 (15:31 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 14 Aug 2000 15:31:16 +0000 (15:31 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@969 a592a061-630c-0410-9148-cb99ea01b6c8

35 files changed:
ChangeLog
po/POTFILES.in
src/BufferView_pimpl.C
src/BufferView_pimpl.h
src/LyXView.C
src/LyXView.h
src/Painter.C
src/Timeout.h
src/WorkArea.C
src/WorkArea.h
src/frontends/xforms/FormCitation.h
src/frontends/xforms/FormCommand.h
src/frontends/xforms/FormDocument.h
src/frontends/xforms/FormGraphics.h
src/frontends/xforms/FormIndex.h
src/frontends/xforms/FormPreferences.h
src/frontends/xforms/FormPrint.h
src/frontends/xforms/FormRef.h
src/frontends/xforms/FormTabular.h
src/frontends/xforms/FormToc.h
src/frontends/xforms/FormUrl.h
src/frontends/xforms/Menubar_pimpl.h
src/frontends/xforms/RadioButtonGroup.h
src/frontends/xforms/Toolbar_pimpl.h
src/graphics/EPS_Renderer.h
src/graphics/GraphicsCache.h
src/graphics/GraphicsCacheItem.h
src/graphics/Renderer.h
src/graphics/XPM_Renderer.C
src/graphics/XPM_Renderer.h
src/kbmap.C
src/lyxfunc.C
src/lyxfunc.h
src/lyxlookup.C
src/lyxrc.C

index 3db7996ac6efc3021911e8f329f7ee5ef2a67401..3776396481e85ce8ea52b13126a8e8c27a02a0aa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2000-08-14  Lars Gullik Bjønnes  <larsbj@lyx.org>
+
+       * 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  <jug@sad.it>
 
        * 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  <rae@lyx.org>
        * 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.
index 18e7c4644c7dbf7c62d2f86e38c41a75d499c663..2eca144861bf23ada9de399b45e9f2370d267ab4 100644 (file)
@@ -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
index fc0f96954de1b1e42856c2f2514c269c9798c654..11970de6f3f384200d09f4c6f074e2ea307e6e9e 100644 (file)
@@ -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
index 7de82ef77a28ec79bf60678615ac05aa270f95bc..e0a33d4aa415f5c2acb2b324fd53f0894dd3803f 100644 (file)
@@ -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);
index a6cc8adb0bdcef452855259fa1e332bb620bfd7f..a32725d0b01e30ccca8e57ced25c29faf0356c3b 100644 (file)
@@ -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
index cd5c48706ed0680e7bc81ec09abcb302f8f4fb00..85f56b7fd73f02171ca5371cb8d099fe2415d811 100644 (file)
@@ -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 *);
index 5eadc986465f8119f118d0a5fc7289c5b628c88a..d3216b9ef93c27515be46b26e61ed2cb63aa1079 100644 (file)
@@ -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";
index 3233b72e92f014b45ba1bb77c601857a2ff9b912..0853026cfbf4569535f172ac48a682549bfc070d 100644 (file)
 #pragma interface
 #endif
 
-#include <sigc++/signal_system.h>
-/* 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
index 0be0fc9f183cedc0376e192904da80ed08913988..7633b8362b1a77679a3bd2e3a02e121e4ed09a06 100644 (file)
 #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<XEvent*>(ev)->type == KeyPress)
+                       lyxerr << "KeyPress" << endl;
+               else
+                       lyxerr << "KeyRelease" << endl;
+               
+               KeySym keysym = 0;
+               char s_r[10];
+               XKeyEvent * xke = reinterpret_cast<XKeyEvent *>(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;
        }
index 85c85629c1c6d9211bd926ed2e44ff65bd032022..df91b43618dbd5d77ebb8f0974cca1725ca066d4 100644 (file)
 
 #include <utility>
 
-//#include <sigc++/signal_system.h>
+#include <sigc++/signal_system.h>
 
 #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<void> workAreaExpose;
-       //
-       // Signal3<void, int, int, unsigned int> workAreaButtonPress;
-       //
-       // Signal3<void, int, int, unsigned int> workAreaButtonRelease;
-       //
-       // Signal3<void, int, int, unsigned int> workAreaMotionNotify;
-       //
-       // Signal0<void> workAreaFocus;
-       //
-       // Signal0<void> workAreaUnfocus;
-       //
-       // Signal0<void> workAreaEnter;
-       //
-       // Signal0<void> workAreaLeave;
-       //
-       // Signal3<void, int, int, unsigned int> workAreaDoubleClick;
-       //
-       // Signal3<void, int, int, unsigned int> workAreaTripleClick;
+       ///
+       Signal0<void> workAreaExpose;
+       ///
+       Signal2<void, KeySym, unsigned int> workAreaKeyPress;
+       ///
+       Signal3<void, int, int, unsigned int> workAreaButtonPress;
+       ///
+       Signal3<void, int, int, unsigned int> workAreaButtonRelease;
+       ///
+       Signal3<void, int, int, unsigned int> workAreaMotionNotify;
+       ///
+       Signal0<void> workAreaFocus;
+       ///
+       Signal0<void> workAreaUnfocus;
+       ///
+       Signal0<void> workAreaEnter;
+       ///
+       Signal0<void> workAreaLeave;
+       ///
+       Signal3<void, int, int, unsigned int> workAreaDoubleClick;
+       ///
+       Signal3<void, int, int, unsigned int> workAreaTripleClick;
 private:
        ///
        void createPixmap(int, int);
index f6e222d8e81daa9e6a3168f83f3a47ff811ce2f5..c0c002ef3380f9f28426da26c2674ca4f3bb7282 100644 (file)
@@ -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
index ab3899113b3c40388cf4e3cad0904ee4cf23d631..6fedf5e668bbb92ad5832d4f10a0046627564d94 100644 (file)
@@ -31,7 +31,6 @@ class FormCommand : public DialogBase, public noncopyable {
 public:
        /// Constructor
        FormCommand(LyXView *, Dialogs *, string const & );
-
        ///
        static  int WMHideCB(FL_FORM *, void *);
        ///
index 1aa8be27e6dfe31db74cc9980f0de6d59e26f111..8669b022777b4ccdda706b19eacac02c13078eef 100644 (file)
@@ -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<string> 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;
     ///
index 111a5469ba57c6d15f467ee3ee2d250cb26579c5..d554b25468c0685b5485c0e03769714e617737d9 100644 (file)
@@ -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 
index e2ac09500c5a96d6267e81e418fec71cd2717489..5b8958542dcd285081bdaaac23cb701717de2654 100644 (file)
@@ -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_;
 };
index b3c328849d2ab56e5f62a03a4748a593e66ba264..ad69716354bb838b6fdb47ae69d481eda6080bf9 100644 (file)
@@ -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<PreferencesPolicy> * bc_;
-       //@}
 };
 
 #endif
index d9fb26cb00257e49f7edf24de9d4df305993064a..1d9a568b420b97259202fa0d16b8de4baf9e6a20 100644 (file)
@@ -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
index e74c9259a3f5d18c0bb79df78bec164639eefef8..f0548cfb66532f93831e676e0ac9dee715c3fd1a 100644 (file)
@@ -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();
index 3fe374e2008a25977146dda0e319d9d14e11fd27..f625b587af6f7af9f385812caf86939a9f2608b9 100644 (file)
@@ -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
index 7872ce813afa6139e358222db87bede327386b8a..78cbaa5263090b0e42ff1a6429dfb73ff9611aee 100644 (file)
@@ -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();
index d02dd0f40c987f75f89229446a81ad09356dbb3d..1c7703ea29e6deafe6b5260f7cb44d029776459a 100644 (file)
@@ -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_;
 };
index 69ff06e8425df0214aed65445667017da4d01943..0b4a472264d800c06a2f07582c7a6be29f7075ba 100644 (file)
@@ -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<int> & 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<int> & smn, StrPool & strpool);
        ///
@@ -60,7 +62,7 @@ public:
                           std::vector<int> & smn, StrPool & strpool);
 
         /// update the state of the menuitems
-        void update() { }
+        void update() {}
 
 private:
        ///
index 77f223e2f76c8fc020ef72429da48700dd9b185f..dbb33337b889efb71f39e86f6b0b05e0bc69f064 100644 (file)
 #pragma interface
 #endif 
 
-#include <vector> 
-#include <utility> 
+#include <vector>
+#include <utility>
+
 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<FL_OBJECT *, int> ButtonValuePair;
+       ///
+       typedef vector<ButtonValuePair> ButtonValueMap;
+       ///
        ButtonValueMap map;
 };
 
index 43aa965fda54d04435b3c0c77f57ef1d4a77631f..f070ebae09c036e3e98626e9fc52b0f7b5967e16 100644 (file)
@@ -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
index 947146bc3c74c68648491bd9188a76994d71d965..ed7051c78b3a8d1be55e9b15cb9dc0d6cbb20bf7 100644 (file)
@@ -18,6 +18,7 @@
 
 #include "graphics/Renderer.h"
 
+///
 class EPS_Renderer : public Renderer {
 public:
        /// c-tor.
index ebb0f7bcaf3dbae8b4d911af3e56eb68f5597368..847eedc7893265dde8ba4d78f9e2f988c54d31a9 100644 (file)
@@ -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.
index 27f67f2249806810ac0cdf02abb5e0d712ba2f45..53dca53c9c2183d9c2cb1559dea77e69cd23c312 100644 (file)
@@ -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_;
 };
 
index ee2101b156cd71051828dd3e9010d7496578d7b1..a8b6044db8387e34c01bd6cf63e3a9716d743ec3 100644 (file)
 #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:
index c51bdca672227a62f79730be100afc94a9da50cd..2d9e41b4900cef49777e6a4282a7368187cce5f5 100644 (file)
 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);
index 2b294267fc2a5e1ebd4a38485e3356128bb96ec2..a7b7b7bdf15d555250010016ab844dddc812253a 100644 (file)
 
 #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();
index 8423c5d6356b47db55068901805079ad4f492520..68cde51c6a779bf80b28a777c55d711deedb35d0 100644 (file)
@@ -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..."
index 034865018c8d42a27f37a555e5443b56a0ee77b6..94a287c9ae4bd040c07e098f98a6f664047dd2e2 100644 (file)
@@ -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
index ec0685a265b850ba2411f1f066db3e51caf3d55b..508d0350859ea550ef584d2c50c72003b741c3d1 100644 (file)
@@ -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;
        
index 16653062fb3695eb20be412446cc571f38724c7e..4f4e20cd069d4ff6d3655a1d74b2da949f47f62b 100644 (file)
@@ -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() 
 {
index c9ab9d5f3cf6caa4d7161eb5b537b3c267574bae..414080eae20db6afa73dd86252b10e7125515b5b 100644 (file)
@@ -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 `"