]> git.lyx.org Git - features.git/commitdiff
* Status.15x: updates.
authorAbdelrazak Younes <younes@lyx.org>
Mon, 20 Nov 2006 14:42:18 +0000 (14:42 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Mon, 20 Nov 2006 14:42:18 +0000 (14:42 +0000)
* buffer.h: changed() signal do not have an argument now.

* BufferView.C:
  - setBuffer(): changed update() call to updateMetrics().
  - update(): sanitize how the flags are used.
  - scrollDocView():  add a call to updateMetrics() at the end.

* LyXFunc::dispatch(): adjust changed() signal emission.

* LyXText/text3.C:
  - cursorPrevious(): delete BufferView::update call; adjust cursor flag.
  - cursorNext(): ditto.

* frontends/LyXView.C: adjust Buffer::changed() signal connection.

* frontends/WorkArea.[Ch]:
  - redraw(): no need to re-update the metrics if we don't change views.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15997 a592a061-630c-0410-9148-cb99ea01b6c8

Status.15x
src/BufferView.C
src/buffer.h
src/frontends/LyXView.C
src/frontends/WorkArea.C
src/frontends/WorkArea.h
src/lyxfunc.C
src/lyxtext.h
src/text3.C

index f0c1ce47b407e22dc3f1e82eccb6dc2e667f813c..eb9994e9605d9568ebdd1da2608d223134a04f0c 100644 (file)
@@ -144,21 +144,6 @@ EDITING
 
 * Copy/paste using middle mouse button inserts musical notes.
 
-* open a file; mark with the mouse and scroll; assert will fail:
-
-  Row const & LyXText::getRowNearY(BufferView const & bv, int y, pit_type pit) const
-  {
-       Paragraph const & par = pars_[pit];
-       int yy = bv.coordCache().get(this, pit).y_ - par.ascent();
-       BOOST_ASSERT(!par.rows().empty());
-       RowList::const_iterator rit = par.rows().begin();
-       RowList::const_iterator const rlast = boost::prior(par.rows().end());
-       for (; rit != rlast; yy += rit->height(), ++rit)
-               if (yy + rit->height() > y)
-                       break;
-       return *rit;
-  }
-
 * new document; insert note; place cursor in front of the note; activate change tracking;
   press delete => 
 
@@ -205,19 +190,21 @@ LAYOUT
 
 PAINTING & PERFORMANCE
 
-* Selection highlighting is broken. Test case: two paragraphs with "Hello"
-  and "World"; move cursor past "Wor", press Shift+Up 
+* Too much painting 2 (Edwin 3/11/2006): There is also a lot of painting going
+  on when selecting text. When selecting a word the whole screen is repainted.
+  PARTLY FIXED (Abdel 2006-11-20): there's a full repaint only when the mouse is
+  released. More to come in this area.
 
 * Too much painting 1 (Edwin 3/11/2006): when i click in the workarea (to put
   the cursor in another part of the text) the screen is repainted *twice*
   whereas it seems to me that no repainting is necessary at all.
-
-* Too much painting 2 (Edwin 3/11/2006): There is also a lot of painting going
-  on when selecting text. When selecting a word the whole screen is repainted.
+  PARTLY FIXED (Abdel 2006-11-20): except for math insets.
 
 * Too much painting 3 (Edwin 3/11/2006): the screen is repainted even when the
   selection does not change (moving the mouse with the left button pushed down 
   always triggers a repaint).
+  PARTLY FIXED (Abdel 2006-11-20): When within the main text inset only the
+  current line is repainted.
 
 * The cursor is not L-shaped for foreign languages
 
@@ -462,3 +449,10 @@ CREDITS:
 * M-x is broken (does not bring up the minibuffer).
   FIXED (Bo, 2006-11-18): set toolbar flag in display function.
 
+* open a file; mark with the mouse and scroll; assert will fail:
+  FIXED (Abdel 2006-11-20): side effect of updateMetrics() cleanup.
+  
+* Selection highlighting is broken. Test case: two paragraphs with "Hello"
+  and "World"; move cursor past "Wor", press Shift+Up 
+  FIXED (Abdel 2006-11-20): side effect of updateMetrics() cleanup.
+  
\ No newline at end of file
index d1d768ac36b652dc994091710f066efa08d17265..0689719a21a0eea22895f06402c09ce41141aef3 100644 (file)
@@ -197,7 +197,7 @@ void BufferView::setBuffer(Buffer * b)
                }
        }
 
-       update();
+       updateMetrics(false);
 
        if (buffer_ && graphics::Previews::status() != LyXRC::PREVIEW_OFF)
                graphics::Previews::get().generateBufferPreviews(*buffer_);
@@ -367,25 +367,22 @@ std::pair<bool, bool> BufferView::update(Update::flags flags)
        // The second drawing step is done in WorkArea::redraw() if needed.
 
        // Case when no explicit update is requested.
-       if (!(flags & (Update::SinglePar | Update::Force))) {
-               if (fitCursor() || multiParSel()) {
-                       // a CoordCache update is needed
-                       updateMetrics(false);
-                       // tell the frontend to update the screen.
-                       return make_pair(true, false);
-               }
+       if (!flags) {
                // no need to do anything.
                return make_pair(false, false);
        }
 
-       // We are now in the case (Update::SinglePar | Update::Force)
-       bool single_par = flags & Update::SinglePar;
+       bool full_metrics = flags & Update::Force;
+       if (flags & Update::MultiParSel)
+               full_metrics |= multiParSel();
+
+       bool const single_par = !full_metrics;
        updateMetrics(single_par);
 
-       // Don't forget to do check for fitCursor() and multiParSel().
-       fitCursor();
-       multiParSel();
+       if (flags & Update::FitCursor && fitCursor())
+               updateMetrics(false);
 
+       // tell the frontend to update the screen.
        return make_pair(true, single_par);
 }
 
@@ -476,6 +473,7 @@ void BufferView::scrollDocView(int value)
        t.redoParagraph(*this, anchor_ref_);
        int const h = t.getPar(anchor_ref_).height();
        offset_ref_ = int((bar * t.paragraphs().size() - anchor_ref_) * h);
+       updateMetrics(false);
 }
 
 
index 280fc05c8d23b3eb5c279cd1e7115bb9c00f1fd0..ab48f508173aa1c4ebe247dcda134cad96ca2188 100644 (file)
@@ -120,7 +120,7 @@ public:
        bool hasParWithID(int id) const;
 
        /// This signal is emitted when the buffer is changed.
-       boost::signal<void(bool)> changed;
+       boost::signal<void()> changed;
        /// This signal is emitted when some parsing error shows up.
        boost::signal<void(std::string)> errors;
        /// This signal is emitted when some message shows up.
index fa6da758ada39808ba6f217ad806a71ab338950c..17cd7bc6d4c6a11410e9edecf7d43b5c811340dd 100644 (file)
@@ -169,7 +169,7 @@ void LyXView::connectBuffer(Buffer & buf)
 
        bufferChangedConnection_ =
                buf.changed.connect(
-                       boost::bind(&WorkArea::redraw, work_area_, _1));
+                       boost::bind(&WorkArea::redraw, work_area_));
 
        errorsConnection_ =
                buf.errors.connect(
index c2b8faf25c2638ed82d55d4da4f1fa7d6c958af2..40bc070341a6b223d0915d6fb4c56e4f585160c0 100644 (file)
@@ -131,7 +131,7 @@ void WorkArea::startBlinkingCursor()
 }
 
 
-void WorkArea::redraw(bool singlePar)
+void WorkArea::redraw()
 {
        if (!buffer_view_ || !buffer_view_->buffer()) {
                greyed_out_ = true;
@@ -140,7 +140,11 @@ void WorkArea::redraw(bool singlePar)
                return;
        }
 
-       buffer_view_->updateMetrics(singlePar && hasFocus());
+       // No need to do anything if this is the current view. The BufferView 
+       // metrics are already up to date.
+       if (&lyx_view_ != &theApp->currentView())
+               // FIXME: it would be nice to optimize for the off-screen case.
+               buffer_view_->updateMetrics(false);
 
        updateScrollbar();
 
@@ -210,7 +214,7 @@ void WorkArea::dispatch(FuncRequest const & cmd0)
        toggleCursor();
 
        if (needRedraw.first)
-               redraw(needRedraw.second);
+               redraw();
 }
 
 
index 0db53ceaabda8aea8bfe3f75ef146ef71106b237..a7ab99fc701ee59481bae5324a1d3d3489aa2a1b 100644 (file)
@@ -83,7 +83,7 @@ public:
        virtual void setScrollbarParams(int height, int pos, int line_height) = 0;
 
        /// redraw the screen, without using existing pixmap
-       virtual void redraw(bool singlePar = false);
+       virtual void redraw();
        ///
        void stopBlinkingCursor();
        void startBlinkingCursor();
index 7de71684d5d8267f2de39d929e5b4b88325e2ce3..1975bce2e9476fa867ca8669cf8e21aeb46b75a0 100644 (file)
@@ -1718,7 +1718,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        std::pair<bool, bool> needSecondUpdate = view()->update(updateFlags);
 
                        if (needSecondUpdate.first)
-                               view()->buffer()->changed(needSecondUpdate.second);
+                               view()->buffer()->changed();
 
                        lyx_view_->updateStatusBar();
 
index 5bf93d8278def4cd6aa4c2fee3d53d6eeb340f40..db13b054b284dd5aa3aa22cae007fb39ccf96afc 100644 (file)
@@ -222,9 +222,9 @@ public:
        ///
        bool cursorEnd(LCursor & cur);
        ///
-       bool cursorPrevious(LCursor & cur);
+       void cursorPrevious(LCursor & cur);
        ///
-       bool cursorNext(LCursor & cur);
+       void cursorNext(LCursor & cur);
        ///
        bool cursorTop(LCursor & cur);
        ///
index 9fb01eda4f153259b3307df1a09148b06d5424b3..2a4b78c8250b1ddb9255b0df782bc89da59d93be 100644 (file)
@@ -198,16 +198,15 @@ string const freefont2string()
 
 }
 
-bool LyXText::cursorPrevious(LCursor & cur)
+void LyXText::cursorPrevious(LCursor & cur)
 {
        pos_type cpos = cur.pos();
        pit_type cpar = cur.pit();
 
        int x = cur.x_target();
 
+       // FIXME: there would maybe a need for this 'updated' boolean in the future...
        bool updated = setCursorFromCoordinates(cur, x, 0);
-       if (updated)
-               cur.bv().update();
        updated |= cursorUp(cur);
 
        if (cpar == cur.pit() && cpos == cur.pos()) {
@@ -217,19 +216,18 @@ bool LyXText::cursorPrevious(LCursor & cur)
        }
 
        finishUndo();
-       return updated;
+       cur.updateFlags(Update::Force | Update::FitCursor);
 }
 
 
-bool LyXText::cursorNext(LCursor & cur)
+void LyXText::cursorNext(LCursor & cur)
 {
        pos_type cpos = cur.pos();
        pit_type cpar = cur.pit();
 
        int x = cur.x_target();
+       // FIXME: there would maybe a need for this 'updated' boolean in the future...
        bool updated = setCursorFromCoordinates(cur, x, cur.bv().workHeight() - 1);
-       if (updated)
-               cur.bv().update();
        updated |= cursorDown(cur);
 
        if (cpar == cur.pit() && cpos == cur.pos()) {
@@ -239,7 +237,7 @@ bool LyXText::cursorNext(LCursor & cur)
        }
 
        finishUndo();
-       return updated;
+       cur.updateFlags(Update::Force | Update::FitCursor);
 }
 
 
@@ -500,7 +498,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                        cur.undispatched();
                        cmd = FuncRequest(LFUN_FINISHED_UP);
                } else {
-                       needsUpdate |= cursorPrevious(cur);
+                       cursorPrevious(cur);
                }
                break;
 
@@ -512,7 +510,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                        cur.undispatched();
                        cmd = FuncRequest(LFUN_FINISHED_DOWN);
                } else {
-                       needsUpdate |= cursorNext(cur);
+                       cursorNext(cur);
                }
                break;