]> git.lyx.org Git - features.git/commitdiff
redraw() cleanup
authorJohn Levon <levon@movementarian.org>
Fri, 21 Jun 2002 02:22:13 +0000 (02:22 +0000)
committerJohn Levon <levon@movementarian.org>
Fri, 21 Jun 2002 02:22:13 +0000 (02:22 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4450 a592a061-630c-0410-9148-cb99ea01b6c8

21 files changed:
src/BufferView.C
src/BufferView.h
src/BufferView_pimpl.C
src/BufferView_pimpl.h
src/ChangeLog
src/buffer.C
src/converter.C
src/exporter.C
src/frontends/ChangeLog
src/frontends/WorkArea.h
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlBibitem.C
src/frontends/controllers/ControlBibtex.C
src/frontends/screen.C
src/frontends/screen.h
src/frontends/xforms/XWorkArea.h
src/frontends/xforms/xscreen.C
src/frontends/xforms/xscreen.h
src/lyxfunc.C
src/mathed/ChangeLog
src/mathed/formula.C

index 170a348c657ed62e6daf2f91164ad4355403218a..d9d6e37774f8d42d76914d441c697f46f911a643 100644 (file)
@@ -71,9 +71,9 @@ void BufferView::resize()
 }
 
 
-void BufferView::redraw()
+void BufferView::repaint()
 {
-       pimpl_->redraw();
+       pimpl_->repaint();
 }
 
 
index 9168849a6881d485130a627d98670a7a502ce01e..0c91f1c3808f2c21d70619f96105dc22d86186d7 100644 (file)
@@ -59,8 +59,12 @@ public:
        void buffer(Buffer * b);
        ///
        void resize();
-       ///
-       void redraw();
+       /**
+        * Repaint the pixmap. Used for when we don't want
+        * to go through the full update() logic, just a simple
+        * repaint of the whole screen.
+        */
+       void repaint();
        ///
        bool fitCursor();
        ///
index cd2b197a73dc34b6f6d9a0c333229fd269317c3c..c159a7266c3ce4042e41da25776e86d6aa0e744c 100644 (file)
@@ -207,28 +207,22 @@ void BufferView::Pimpl::buffer(Buffer * b)
        if (buffer_) {
                lyxerr[Debug::INFO] << "Buffer addr: " << buffer_ << endl;
                buffer_->addUser(bv_);
                // If we don't have a text object for this, we make one
                if (bv_->text == 0) {
                        resizeCurrentBuffer();
-               } else {
-                       updateScreen();
-                       updateScrollbar();
                }
+
+               // FIXME: needed when ?
                bv_->text->first_y = screen().topCursorVisible(bv_->text->cursor, bv_->text->first_y);
-               owner_->updateMenubar();
-               owner_->updateToolbar();
                // Similarly, buffer-dependent dialogs should be updated or
                // hidden. This should go here because some dialogs (eg ToC)
                // require bv_->text.
                owner_->getDialogs()->updateBufferDependent(true);
-               redraw();
        } else {
                lyxerr[Debug::INFO] << "  No Buffer!" << endl;
-               owner_->updateMenubar();
-               owner_->updateToolbar();
                owner_->getDialogs()->hideBufferDependent();
-               updateScrollbar();
-               workarea().redraw();
 
                // Also remove all remaining text's from the testcache.
                // (there should not be any!) (if there is any it is a
@@ -237,20 +231,16 @@ void BufferView::Pimpl::buffer(Buffer * b)
                        textcache.show(lyxerr, "buffer delete all");
                textcache.clear();
        }
-       // should update layoutchoice even if we don't have a buffer.
+       repaint();
+       updateScrollbar();
+       owner_->updateMenubar();
+       owner_->updateToolbar();
        owner_->updateLayoutChoice();
-
        owner_->updateWindowTitle();
 }
 
 
-void BufferView::Pimpl::redraw()
-{
-       lyxerr[Debug::INFO] << "BufferView::redraw()" << endl;
-       workarea().redraw();
-}
-
-
 bool BufferView::Pimpl::fitCursor()
 {
        bool ret;
@@ -356,10 +346,6 @@ int BufferView::Pimpl::resizeCurrentBuffer()
 
        bv_->text->first_y = screen().topCursorVisible(bv_->text->cursor, bv_->text->first_y);
 
-       // this will scroll the screen such that the cursor becomes visible
-       updateScrollbar();
-       redraw();
-
        setState();
        owner_->allowInput();
 
@@ -370,7 +356,7 @@ int BufferView::Pimpl::resizeCurrentBuffer()
 }
 
 
-void BufferView::Pimpl::updateScreen()
+void BufferView::Pimpl::repaint()
 {
        // Regenerate the screen.
        screen().redraw(bv_->text, bv_);
@@ -910,6 +896,7 @@ void BufferView::Pimpl::workAreaResize()
        // update from work area
        work_area_width = workarea().workWidth();
        work_area_height = workarea().workHeight();
        if (buffer_ != 0) {
                if (widthChange) {
                        // The visible LyXView need a resize
@@ -931,9 +918,6 @@ void BufferView::Pimpl::workAreaResize()
                        // to the start of the document on vertical
                        // resize
                        fitCursor();
-
-                       // The main window size has changed, repaint most stuff
-                       redraw();
                } else {
                        screen().redraw(bv_->text, bv_);
                }
@@ -1312,7 +1296,6 @@ void BufferView::Pimpl::center()
                screen().draw(bv_->text, bv_, 0);
        }
        update(bv_->text, BufferView::SELECT|BufferView::FITCUR);
-       redraw();
 }
 
 
index 79af7c390fdc9be8cdec78c95786c970ac992f93..05a390b28fed8b7aa3e659f5fe6e0e9e753b2c4a 100644 (file)
@@ -44,8 +44,6 @@ struct BufferView::Pimpl : public boost::signals::trackable {
        LyXScreen & screen() const;
        ///
        void buffer(Buffer *);
-       ///
-       void redraw();
        /// Return true if the cursor was fitted.
        bool fitCursor();
        ///
@@ -56,8 +54,11 @@ struct BufferView::Pimpl : public boost::signals::trackable {
        void update();
        //
        void update(LyXText *, BufferView::UpdateCodes);
-       /// Update pixmap of screen
-       void updateScreen();
+       /**
+        * Repaint pixmap. Used for when we've made a visible
+        * change but don't need the full update() logic
+        */
+       void repaint();
        ///
        void workAreaResize();
        ///
index f31fddc817c6f832ecaa6324047c1fdc728162b0..761540b0181576507fe4e2f5069a8d44a86b3527 100644 (file)
@@ -1,3 +1,17 @@
+2002-06-21  John Levon  <moz@compsoc.man.ac.uk>
+
+       * buffer.C: 
+       * converter.C: 
+       * exporter.C:
+       * lyxfunc.C: 
+       * BufferView.h:
+       * BufferView.C: use repaint()
+
+       * BufferView_pimpl.h:
+       * BufferView_pimpl.C: s/updateScreen()/repaint()/
+         as it's a clearer description. Remove superfluous
+         redraws.
 2002-06-21  John Levon  <moz@compsoc.man.ac.uk>
 
        * text.C: fix bug 488. Not ideal, but getting
index ef5cf085388181c8591a7349cb85c86120a25b4c..2c9812fae48b48b1b27f7755e97217d277a2d159 100644 (file)
@@ -3634,7 +3634,8 @@ int Buffer::runChktex()
        // if we removed error insets before we ran chktex or if we inserted
        // error insets after we ran chktex, this must be run:
        if (removedErrorInsets || res) {
-               users->redraw();
+#warning repaint needed here, or do you mean update() ?
+               users->repaint();
                users->fitCursor();
        }
        users->owner()->allowInput();
@@ -3921,7 +3922,8 @@ void Buffer::resizeInsets(BufferView * bv)
 
 void Buffer::redraw()
 {
-       users->redraw();
+#warning repaint needed here, or do you mean update() ?
+       users->repaint();
        users->fitCursor();
 }
 
index 0881b06d213aaa9805dda78ec8f3e957f56fa29c..f91c85f6077e552e167a7e28cea6c181ac3fc4f3 100644 (file)
@@ -796,7 +796,8 @@ bool Converters::scanLog(Buffer const * buffer, string const & command,
                if ((result & LaTeX::ERRORS)) {
                        // Insert all errors as errors boxes
                        bv->insertErrors(terr);
-                       bv->redraw();
+#warning repaint() or update() or nothing ?
+                       bv->repaint();
                        bv->fitCursor();
                }
                bv->owner()->allowInput();
@@ -853,7 +854,8 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command)
                if ((result & LaTeX::ERRORS)) {
                        // Insert all errors as errors boxes
                        bv->insertErrors(terr);
-                       bv->redraw();
+#warning repaint() or update() or nothing ?
+                       bv->repaint();
                        bv->fitCursor();
                }
        }
index 7d9c2b3f09de64253175d85e765b5bade4fd5122..898d6301a9d66f113843588d2abf507a2733bce6 100644 (file)
@@ -39,7 +39,8 @@ bool Exporter::Export(Buffer * buffer, string const & format,
        if (bv) {
                // Remove all error insets
                if (bv->removeAutoInsets()) {
-                       bv->redraw();
+#warning repaint() or update() or nothing ? 
+                       bv->repaint();
                        bv->fitCursor();
                }
        }
index 5ca86d3dd7a04dc25861a762be6bacc984ff6391..0e79b700f076064d58d3e63bd95334d2f4f56294 100644 (file)
@@ -1,3 +1,7 @@
+2002-06-21  John Levon  <moz@compsoc.man.ac.uk>
+
+       * WorkArea.h: remove redraw()
 2002-06-20  John Levon  <moz@compsoc.man.ac.uk>
 
        * guiapi.h:
index 0c7a78b9d0b33d53932f821af0eed69744bbacc2..28f3d35ad49b1c74996def583ebc92d8a3de416e 100644 (file)
@@ -46,9 +46,6 @@ public:
        /// return the height of the work area in pixels
        virtual int workHeight() const = 0;
   
-       /// FIXME: GUII
-       virtual void redraw() const = 0;
        /**
         * Update the scrollbar.
         * @param height the total document height in pixels
index 3d6c71e35ded1c14b34e0f4d61f7e733362eb97e..d6d2ff8e51e40d3d3ee2dbaef9a1a34e3c23ecc1 100644 (file)
@@ -1,3 +1,8 @@
+2002-06-21  John Levon  <moz@compsoc.man.ac.uk>
+
+       * ControlBibtex.C:
+       * ControlBibitem.C: use repaint()
 2002-06-21  John Levon  <moz@compsoc.man.ac.uk>
 
        * ControlTexinfo.C: do the same for Texinfo
index 288bfff455d94eaf1e9a78acf68a478997f6ad1b..6a21aa0abbb16b041eb41b151cb04382a87a66a8 100644 (file)
@@ -40,6 +40,8 @@ void ControlBibitem::applyParamsToInset()
 
        // We need to do a redraw because the maximum
        // InsetBibKey width could have changed
-       lv_.view()->redraw();
+#warning please check you mean repaint() not update(),
+#warning and whether the repaint() is needed at all
+       lv_.view()->repaint();
        lv_.view()->fitCursor();
 }
index d089ada704117603547fd28bc29c1eb973476e93..9f8df298d69259484d12ce40f22a9d9d1fd046cd 100644 (file)
@@ -49,7 +49,8 @@ void ControlBibtex::applyParamsToInset()
 
        // We need to do a redraw because the maximum
        // InsetBibKey width could have changed
-       lv_.view()->redraw();
+#warning are you sure you need this repaint() ? 
+       lv_.view()->repaint();
        lv_.view()->fitCursor();
 }
 
index 8c72d540183fcc70b12222c2f153d87765b712e5..3322d112f5f1f75990f6e410e4624d6235d5d5a9 100644 (file)
@@ -303,6 +303,8 @@ void LyXScreen::drawFromTo(LyXText * text, BufferView * bv,
        int y1, int y2, int yo, int xo,
        bool internal)
 {
+       lyxerr[Debug::GUI] << "screen: drawFromTo " << y1 << "-" << y2 << endl;
        int y_text = text->first_y + y1;
   
        // get the first needed row
index 47f092d8e563bc673466d4acd03cb3e7f4eec1b1..bfa7e82e823c00678385da3d7f3c7fde875a765a 100644 (file)
@@ -144,8 +144,8 @@ public:
        virtual bool forceClear() const { return force_clear_; }
 
 protected:
-       /// copies specified area of pixmap to screen
-       virtual void expose(int x, int y, int exp_width, int exp_height) = 0;
+       /// cause the display of the given area of the work area
+       virtual void expose(int x, int y, int w, int h) = 0;
 
        /// get the work area
        virtual WorkArea & workarea() const = 0;
index ddbe34b6af95ee2b10b76c93879ec895d2fc1318..1c1835de9e55449db9382e8eed8802c11601e3bb 100644 (file)
@@ -35,8 +35,8 @@ public:
        virtual int workHeight() const { return work_area->h; }
        ///
        virtual void redraw() const {
-               fl_redraw_object(work_area);
-               fl_redraw_object(scrollbar);
+               //fl_redraw_object(work_area);
+               //fl_redraw_object(scrollbar);
        }
        ///
        Window getWin() const { return work_area->form->window; }
index 715b0f3d4ac58a614319f2f2f2fba84c295dcc45..2025de8d1ca6c61f846c4158855f31e45b917953 100644 (file)
@@ -29,6 +29,7 @@
 #include "insets/insettext.h"
 #include "ColorHandler.h"
 #include "language.h"
+#include "debug.h"
 
 using std::max;
 using std::min;
@@ -185,18 +186,15 @@ void XScreen::hideCursor()
 }
 
  
-void XScreen::expose(int x, int y, int exp_width, int exp_height)
+void XScreen::expose(int x, int y, int w, int h)
 {
-       // FIXME: here we should definitely NOT do this.
-       // we need to generate an expose event for the workarea
-       // and then copy from the pixmap to the screen. This
-       // is the Sane Way (tm) 
+       lyxerr[Debug::GUI] << "expose " << w << "x" << h
+               << "+" << x << "+" << y << endl;
        XCopyArea(fl_get_display(),
                  owner_.getPixmap(),
                  owner_.getWin(),
                  gc_copy,
-                 x, y,
-                 exp_width, exp_height,
+                 x, y, w, h,
                  x + owner_.xpos(),
                  y + owner_.ypos());
 }
index 2fad257118fdb19cd68faf02250af1dadebd1786..1fc39adc268a39e175e3890eeb5a537e9db53c93 100644 (file)
@@ -52,7 +52,7 @@ protected:
        virtual WorkArea & workarea() const { return owner_; }
  
        /// Copies specified area of pixmap to screen
-       virtual void expose(int x, int y, int exp_width, int exp_height); 
+       virtual void expose(int x, int y, int w, int h); 
  
 private:
        /// our owning widget
index 832aa76e4467f5cb9084b0fc3987bc038883c15a..fe5c9056a3b255b46d100f083bceedfd217a5cbb 100644 (file)
@@ -1197,7 +1197,8 @@ string const LyXFunc::dispatch(kb_action action, string argument)
 
        case LFUN_REMOVEERRORS:
                if (owner->view()->removeAutoInsets()) {
-                       owner->view()->redraw();
+#warning repaint() or update() or nothing ?
+                       owner->view()->repaint();
                        owner->view()->fitCursor();
                }
                break;
@@ -1634,7 +1635,7 @@ string const LyXFunc::dispatch(kb_action action, string argument)
                        gc.changeDisplay(true);
                }
 
-               owner->view()->redraw();
+               owner->view()->repaint();
                break;
        }
 
index d807a7c2ddf6df5dedf1f4ddd6b8bb9592b064ec..85c7ddd3eb0e65699ba8d52e6b59822ef55ba78f 100644 (file)
@@ -1,3 +1,7 @@
+2002-06-21  John Levon  <moz@compsoc.man.ac.uk>
+
+       * formula.C: use repaint()
 2002-06-16  André Pönitz <poenitz@gmx.net>
 
        * math_factory.C:
index c87271376fefe9f91eb9509367739708f8faa317..12dc32de3beb7ff8ee1b7d1ea34a509fdb906cfd 100644 (file)
@@ -278,8 +278,10 @@ InsetFormula::localDispatch(BufferView * bv, kb_action action,
                                hull()->numbered(row, true);
                        }
 
+#warning FIXME: please check you really mean repaint() ... is it needed,
+#warning and if so, should it be update() instead ? 
                        if (!new_label.empty() && bv->ChangeRefsIfUnique(old_label, new_label))
-                               bv->redraw();
+                               bv->repaint();
 
                        hull()->label(row, new_label);