]> git.lyx.org Git - lyx.git/blobdiff - src/WorkArea.C
Fix deleting of paragraphs after undo (fix #236).
[lyx.git] / src / WorkArea.C
index ba4c4407df742bac0a556144065b1afec655559a..7b028ef122966cb1b47716aa94a61582c1f94193 100644 (file)
@@ -37,8 +37,7 @@ FL_APPEVENT_CB fl_set_preemptive_callback(Window, FL_APPEVENT_CB, void *);
  
 using std::endl;
 using std::abs;
-
-FL_OBJECT * figinset_canvas;
+using std::hex;
 
 namespace {
 
@@ -83,8 +82,6 @@ WorkArea::WorkArea(int xpos, int ypos, int width, int height)
 {
        fl_freeze_all_forms();
 
-       figinset_canvas = 0;
-
        if (lyxerr.debugging(Debug::WORKAREA))
                lyxerr << "Creating work area: +"
                       << xpos << '+' << ypos << ' '
@@ -93,14 +90,6 @@ WorkArea::WorkArea(int xpos, int ypos, int width, int height)
        FL_OBJECT * obj;
        int const bw = int(abs(fl_get_border_width()));
 
-       // We really want to get rid of figinset_canvas.
-       ::figinset_canvas = figinset_canvas = obj =
-                 fl_add_canvas(FL_NORMAL_CANVAS,
-                               xpos + 1, ypos + 1, 1, 1, "");
-       fl_set_object_boxtype(obj, FL_NO_BOX);
-       fl_set_object_resize(obj, FL_RESIZE_ALL);
-       fl_set_object_gravity(obj, NorthWestGravity, NorthWestGravity);
-
        // a box
        if (lyxerr.debugging(Debug::WORKAREA))
                lyxerr << "\tbackground box: +"
@@ -156,7 +145,8 @@ WorkArea::WorkArea(int xpos, int ypos, int width, int height)
        fl_set_object_gravity(obj, NorthEastGravity, SouthEastGravity);
        obj->u_vdata = this;
        fl_set_object_callback(obj, C_WorkArea_scroll_cb, 0);
-
+       setScrollbarBounds(0.0, 0.0);
+       
        ///
        /// The free object
 
@@ -353,7 +343,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
 
        if (!area) return 1;
        
-       switch (event){
+       switch (event) {
        case FL_DRAW:
                if (!area->work_area ||
                    !area->work_area->form->visible)
@@ -576,11 +566,16 @@ extern "C" {
 
 void WorkArea::event_cb(XEvent * xev)
 {
-       if (xev->type != SelectionRequest)
-               return;
-       selectionRequested.emit();
-       return;
+       switch (xev->type) {
+               case SelectionRequest:
+                       lyxerr[Debug::GUI] << "X requested selection." << endl;
+                       selectionRequested.emit();
+                       break;
+               case SelectionClear:
+                       lyxerr[Debug::GUI] << "Lost selection." << endl;
+                       selectionLost.emit();
+                       break; 
+       }
 }
 
 
@@ -608,8 +603,8 @@ string const WorkArea::getClipboard() const
                if (fl_check_forms() == FL_EVENT) {
                        fl_XNextEvent(&ev);
                        lyxerr << "Received unhandled X11 event" << endl; 
-                       lyxerr << "Type: 0x" << std::hex << ev.xany.type <<
-                               "Target: 0x" << std::hex << ev.xany.window << endl;
+                       lyxerr << "Type: 0x" << hex << ev.xany.type <<
+                               " Target: 0x" << hex << ev.xany.window << endl;
                }
        }
        return clipboard_selection;