]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/XWorkArea.C
Introduce LFUN_PRINT.
[lyx.git] / src / frontends / xforms / XWorkArea.C
index 8c96af6acd6a303c8a7c6ede8ac8e0830c6a973a..379e1d82e8fa6e202530174e69d3919193b4b71f 100644 (file)
@@ -6,34 +6,28 @@
  * \author unknown
  * \author John Levon
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
 #include "XWorkArea.h"
+
 #include "debug.h"
 #include "XLyXKeySym.h"
 #include "funcrequest.h"
 #include "Timeout.h"
 
-#if FL_VERSION < 1 && (FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5))
-#include "lyxlookup.h"
-#endif
-
-using std::endl;
 using std::abs;
-using std::hex;
 using std::dec;
+using std::endl;
+using std::hex;
+using std::string;
+
 
 namespace {
 
-inline
-void waitForX(bool discard)
+inline void waitForX(bool discard)
 {
        XSync(fl_get_display(), discard);
 }
@@ -277,15 +271,18 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
        XEvent * ev = static_cast<XEvent*>(xev);
        XWorkArea * area = static_cast<XWorkArea*>(ob->u_vdata);
 
-       if (!area) return 1;
+       if (!area)
+               return 1;
 
        switch (event) {
+
        case FL_DRAW:
                if (!area->work_area || !area->work_area->form->visible)
                        return 1;
                lyxerr[Debug::WORKAREA] << "Workarea event: DRAW" << endl;
                area->redraw(area->workWidth(), area->workHeight());
                break;
+
        case FL_PUSH:
                if (!ev || ev->xbutton.button == 0) break;
                // Should really have used xbutton.state
@@ -296,6 +293,7 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
                                    ev->xbutton.y - ob->y,
                                    x_button_state(key)));
                break;
+
        case FL_RELEASE:
                if (!ev || ev->xbutton.button == 0) break;
                // Should really have used xbutton.state
@@ -306,20 +304,14 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
                                    ev->xbutton.y - ob->y,
                                    x_button_state(key)));
                break;
-#if FL_VERSION < 1 && FL_REVISION < 89
-       case FL_MOUSE:
-#else
-       case FL_DRAG:
-#endif
-       {
+
+       case FL_DRAG: {
                if (!ev || !area->scrollbar)
                        break;
 
                int const drag_x = ev->xmotion.x;
                int const drag_y = ev->xmotion.y;
-               int const area_x = ob->x;
                int const area_y = ob->y;
-               int const area_w = ob->w;
                int const area_h = ob->h;
 
                // Check if the mouse is above or below the workarea
@@ -378,24 +370,13 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
                break;
        }
 
-#if FL_VERSION < 1 && FL_REVISION < 89
-       case FL_KEYBOARD:
-#else
-       case FL_KEYPRESS:
-#endif
-       {
+       case FL_KEYPRESS: {
                lyxerr[Debug::WORKAREA] << "Workarea event: KEYPRESS" << endl;
 
                KeySym keysym = 0;
                char dummy[1];
                XKeyEvent * xke = reinterpret_cast<XKeyEvent *>(ev);
-#if FL_VERSION < 1 && (FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5))
-               // XForms < 0.89.5 does not have compose support
-               // so we are using our own compose support
-               LyXLookupString(ev, dummy, 1, &keysym);
-#else
                XLookupString(xke, dummy, 1, &keysym, 0);
-#endif
 
                if (lyxerr.debugging(Debug::KEY)) {
                        char const * const tmp  = XKeysymToString(key);
@@ -409,15 +390,6 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
                               << "' [" << keysym << ']' << endl;
                }
 
-#if FL_VERSION < 1 && (FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5))
-               if (keysym == NoSymbol) {
-                       lyxerr[Debug::KEY]
-                               << "Empty kdb action (probably composing)"
-                               << endl;
-                       break;
-               }
-               KeySym ret_key = keysym;
-#else
                // Note that we need this handling because of a bug
                // in XForms 0.89, if this bug is resolved in the way I hope
                // we can just use the keysym directly without looking
@@ -449,7 +421,6 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
                                //}
                }
 
-#endif
                unsigned int const ret_state = xke->state;
 
                // If you have a better way to handle "wild-output" of
@@ -487,21 +458,24 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
 
                area->workAreaKeyPress(LyXKeySymPtr(xlk),
                                       x_key_state(ret_state));
+               break;
        }
-       break;
 
-#if FL_VERSION > 0 || FL_REVISION >= 89
        case FL_KEYRELEASE:
                lyxerr[Debug::WORKAREA] << "Workarea event: KEYRELEASE" << endl;
                break;
-#endif
 
        case FL_ENTER:
                lyxerr[Debug::WORKAREA] << "Workarea event: ENTER" << endl;
+               fl_set_cursor(FL_ObjWin(area->work_area), XC_xterm);
                break;
+
        case FL_LEAVE:
                lyxerr[Debug::WORKAREA] << "Workarea event: LEAVE" << endl;
+               // There should be no need for this. But there is.
+               fl_set_cursor(FL_ObjWin(area->work_area), FL_DEFAULT_CURSOR);
                break;
+
        case FL_DBLCLICK:
                if (ev) {
                        lyxerr[Debug::WORKAREA] << "Workarea event: DBLCLICK" << endl;
@@ -512,6 +486,7 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
                        area->dispatch(cmd);
                }
                break;
+
        case FL_TRPLCLICK:
                if (ev) {
                        lyxerr[Debug::WORKAREA] << "Workarea event: TRPLCLICK" << endl;
@@ -522,6 +497,7 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
                        area->dispatch(cmd);
                }
                break;
+
        case FL_OTHER:
                if (ev)
                        lyxerr[Debug::WORKAREA] << "Workarea event: OTHER" << endl;