]> git.lyx.org Git - lyx.git/commitdiff
Fix the WorkArea problems.
authorAngus Leeming <leeming@lyx.org>
Tue, 2 Oct 2001 16:00:54 +0000 (16:00 +0000)
committerAngus Leeming <leeming@lyx.org>
Tue, 2 Oct 2001 16:00:54 +0000 (16:00 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2834 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView_pimpl.C
src/ChangeLog
src/WorkArea.C
src/WorkArea.h

index 56d4858e2a74b84cff5fc689981475d0c324dfc3..03354332484a0715c8fbbe30f0348336be748dcc 100644 (file)
@@ -208,7 +208,6 @@ void BufferView::Pimpl::buffer(Buffer * b)
                // hidden. This should go here because some dialogs (eg ToC)
                // require bv_->text.
                owner_->getDialogs()->updateBufferDependent(true);
-               workarea_.show();
                redraw();
                insetWakeup();
        } else {
index 740de4f9fbcf93429e37479edf111e1a1b5e3a5f..ed58801fbc9828bb13513a8cd010296d10103346 100644 (file)
@@ -1,3 +1,13 @@
+2001-10-01  Angus Leeming  <a.leeming@ic.ac.uk>
+
+       * BufferView_pimpl.C (buffer): remove call to WorkArea::show() and
+       revert to previous code.
+
+       WorkArea.[Ch]: (show, destroySplash): methods removed.
+
+       WorkArea.C: rework code so that it's an amalgam of the codes before and
+       after the splash screen was moved to WorkArea.
+
 2001-10-01  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
        * lyxrc.C (read): 
index 61dc11e4a8b0eae3c5a834ef74ffa9b86efbaa0d..4ae15b94f0de9569bf316bbdcaf3d8df48e95b22 100644 (file)
@@ -64,31 +64,6 @@ extern "C" {
                return WorkArea::work_area_handler(ob, event,
                                                   0, 0, key, xev);
         }
-
-
-       // Resizing the display causes the version string to move relative to
-       // the splash pixmap because the parameters xforms uses to control
-       // resizing are not very sophisticated.
-       // I found it easier, therefore, to just remove the splash screen.
-       // (Angus, 25 September 2001)
-        static
-        int C_WorkAreaSplashPH(FL_OBJECT * ob, int event,
-                              FL_Coord, FL_Coord, int, void *)
-        {
-               static int counter = 0;
-                if (event != FL_DRAW || ++counter > 3) {
-                        return 0;
-               }
-
-               lyx::Assert(ob && ob->u_vdata);
-                WorkArea * pre = static_cast<WorkArea *>(ob->u_vdata);
-
-               if (counter == 3) {
-                       pre->destroySplash();
-               }
-
-               return 0;
-        }
 }
 
 
@@ -140,9 +115,6 @@ WorkArea::WorkArea(int xpos, int ypos, int width, int height)
                        fl_add_pixmapbutton(FL_NORMAL_BUTTON,
                                            splash_x, splash_y, 
                                            splash_w, splash_h, "");
-               obj->u_vdata = this;
-               fl_set_object_prehandler(obj, C_WorkAreaSplashPH);
-
                fl_set_pixmapbutton_file(obj, splash_file.c_str());
                fl_set_pixmapbutton_focus_outline(obj, 3);
                fl_set_object_boxtype(obj, FL_NO_BOX);
@@ -159,9 +131,6 @@ WorkArea::WorkArea(int xpos, int ypos, int width, int height)
                fl_set_object_lcol(obj, FL_FREE_COL3);
                fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
                fl_set_object_lstyle(obj, FL_BOLD_STYLE);
-
-               fl_hide_object(splash_);
-               fl_hide_object(splash_text_);
        }
 
        //
@@ -258,14 +227,37 @@ void WorkArea::resize(int xpos, int ypos, int width, int height)
                               width - 15 - 2 * bw,
                               height - 2 * bw);
 
-       destroySplash();
-
        fl_unfreeze_all_forms();
 }
 
 
+namespace {
+void destroy_object(FL_OBJECT * obj)
+{
+       if (!obj)
+               return;
+
+       if (obj->visible) {
+               fl_hide_object(obj);
+       }
+       fl_delete_object(obj);
+       fl_free_object(obj);
+}
+} // namespace anon
+       
+
 void WorkArea::createPixmap(int width, int height)
 {
+       // Three calls to createPixmap are needed to draw the initial view
+       // of LyX. Any more and the splash is destroyed.
+       static int counter = 0;
+       if (++counter == 4) {
+               destroy_object(splash_);
+               splash_ = 0;
+               destroy_object(splash_text_);
+               splash_text_ = 0;
+       }
+
        static int cur_width = -1;
        static int cur_height = -1;
 
@@ -292,53 +284,16 @@ void WorkArea::createPixmap(int width, int height)
 }
 
 
-void WorkArea::show() const
-{
-       if (!work_area->visible) {
-               fl_show_object(work_area);
-       }
-       
-       destroySplash();
-}
-
-
 void WorkArea::greyOut() const
 {
-       if (work_area->visible) {
-               fl_hide_object(work_area);
-       }
-
-       if (splash_ && !splash_->visible) {
-               fl_show_object(splash_);
-               fl_show_object(splash_text_);
+       if (!splash_) {
+               fl_winset(FL_ObjWin(work_area));
+               fl_rectangle(1, work_area->x, work_area->y,
+                            work_area->w, work_area->h, FL_GRAY63);
        }
 }
 
 
-void WorkArea::destroySplash() const
-{
-       if (splash_) {
-               if (splash_->visible) {
-                       fl_hide_object(splash_);
-               }
-               fl_set_object_prehandler(splash_, 0);
-               // Causes a segmentation fault!
-               // fl_delete_object(splash_);
-               // fl_free_object(splash_);
-               splash_ = 0;
-       }
-
-       if (splash_text_) {
-               if (splash_text_->visible) {
-                       fl_hide_object(splash_text_);
-               }
-               fl_delete_object(splash_text_);
-               fl_free_object(splash_text_);
-               splash_text_ = 0;
-       }
-}
-       
-
 void WorkArea::setFocus() const
 {
        fl_set_focus_object(work_area->form, work_area);
index 118c0d1b68b3d08f6336c57c4ebb52f7da1bb8b7..c9f58b7fa9a3fe453cc815e0af8ff7a5527213e6 100644 (file)
@@ -68,10 +68,6 @@ public:
        ///
        void greyOut() const;
        ///
-       void show() const;
-       ///
-       void destroySplash() const;
-       ///
        void setScrollbar(double pos, double length_fraction) const;
        ///
        void setScrollbarValue(double y) const {