]> git.lyx.org Git - features.git/commitdiff
Update/cursor and drawing fixes.
authorJürgen Vigna <jug@sad.it>
Thu, 2 Aug 2001 14:55:06 +0000 (14:55 +0000)
committerJürgen Vigna <jug@sad.it>
Thu, 2 Aug 2001 14:55:06 +0000 (14:55 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2405 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/frontends/controllers/ControlBibitem.C
src/frontends/controllers/ControlBibtex.C
src/insets/ChangeLog
src/insets/insetcollapsable.h
src/insets/insetlabel.C
src/insets/insetminipage.C
src/insets/insettext.C
src/insets/insettext.h
src/lyxfunc.C
src/lyxscreen.h
src/lyxtext.h
src/screen.C
src/text.C
src/text2.C

index 3a2388f2eaa7f3c276a647062c78b3e658bf5beb..6ed3ed8fa41ca59bceaf43c273b76b109a63da6c 100644 (file)
@@ -89,9 +89,9 @@ void BufferView::redraw()
 }
 
 
-void BufferView::fitCursor(LyXText * text)
+void BufferView::fitCursor()
 {
-       pimpl_->fitCursor(text);
+       pimpl_->fitCursor();
 }
 
 
index 5610aa32c5d066d6b7b39aa15863048e3f60e799..027d46cb900d352be5faf58b5f59e39ea46c3971 100644 (file)
@@ -65,7 +65,7 @@ public:
        ///
        void redraw();
        ///
-       void fitCursor(LyXText *);
+       void fitCursor();
        ///
        void update();
        //
index 584f1a0c73b02cbd42bffadf44f747beff88d97a..4cef48be677264074bc672c45050216313caa1e5 100644 (file)
@@ -256,7 +256,7 @@ void BufferView::Pimpl::redraw()
 }
 
 
-bool BufferView::Pimpl::fitCursor(LyXText * text)
+bool BufferView::Pimpl::fitCursor()
 {
        lyx::Assert(screen_.get());
 
@@ -266,7 +266,7 @@ bool BufferView::Pimpl::fitCursor(LyXText * text)
                bv_->theLockingInset()->fitInsetCursor(bv_);
                ret = true;
        } else {
-               ret = screen_->fitCursor(text, bv_);
+               ret = screen_->fitCursor(bv_->text, bv_);
        }
 
        bv_->owner()->getDialogs()->updateParagraph();
@@ -558,7 +558,7 @@ void BufferView::Pimpl::workAreaMotionNotify(int x, int y, unsigned int state)
       
        bv_->text->setSelection(bv_);
        screen_->toggleToggle(bv_->text, bv_);
-       fitCursor(bv_->text);
+       fitCursor();
 #if 0
        screen_->showCursor(bv_->text, bv_);
 #else
@@ -621,7 +621,11 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
        screen_->toggleSelection(bv_->text, bv_);
        bv_->text->clearSelection();
        bv_->text->fullRebreak(bv_);
+#if 0
        screen_->update(bv_->text, bv_);
+#else
+       update();
+#endif
        updateScrollbar();
        
        // Single left click in math inset?
@@ -650,7 +654,7 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
        bv_->text->cursor.x_fix(bv_->text->cursor.x());
        
        owner_->updateLayoutChoice();
-       if (fitCursor(bv_->text)) {
+       if (fitCursor()) {
                selection_possible = false;
        }
        
@@ -943,7 +947,7 @@ void BufferView::Pimpl::workAreaExpose()
                        // fitCursor() ensures we don't jump back
                        // to the start of the document on vertical
                        // resize
-                       fitCursor(bv_->text);
+                       fitCursor();
 
                        // The main window size has changed, repaint most stuff
                        redraw();
@@ -966,7 +970,18 @@ void BufferView::Pimpl::update()
        if (screen_.get() &&
                (!bv_->theLockingInset() || !bv_->theLockingInset()->nodraw()))
        {
+               LyXText::text_status st = bv_->text->status();
                screen_->update(bv_->text, bv_);
+               while(bv_->text->status() == LyXText::CHANGED_IN_DRAW) {
+                       if (bv_->text->fullRebreak(bv_)) {
+                               st = LyXText::NEED_MORE_REFRESH;
+                               bv_->text->setCursor(bv_, bv_->text->cursor.par(),
+                                                                        bv_->text->cursor.pos());
+                               fitCursor();
+                       }
+                       bv_->text->status(bv_, st);
+                       screen_->update(bv_->text, bv_);
+               }
        }
 }
 
@@ -1026,7 +1041,7 @@ void BufferView::Pimpl::update(LyXText * text, BufferView::UpdateCodes f)
        }
                
        if ((f & FITCUR)) {
-               fitCursor(text);
+               fitCursor();
        }
 
        if ((f & CHANGE)) {
@@ -1060,7 +1075,7 @@ void BufferView::Pimpl::cursorToggle()
        }
 
        if (!bv_->theLockingInset()) {
-               screen_->cursorToggle(bv_->text, bv_);
+               screen_->cursorToggle(bv_);
        } else {
                bv_->theLockingInset()->toggleInsetCursor(bv_);
        }
@@ -2985,8 +3000,6 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
        case LFUN_INDEX_CREATE:
        {
                InsetCommandParams p("index");
-               LyXText * lt = bv_->getLyXText();
-               
                if (argument.empty()) {
                        string const idxstring(bv_->getLyXText()->getStringToIndex(bv_));
                        if (!idxstring.empty()) 
index d5c9bb86e44181268693c312566e54f906647f7b..ed6062e6b1eec8719351b1839cb16713c0bd74d6 100644 (file)
@@ -37,7 +37,7 @@ struct BufferView::Pimpl : public SigC::Object {
        ///
        void redraw();
        /// Return true if the cursor was fitted.
-       bool fitCursor(LyXText *);
+       bool fitCursor();
        ///
        void redoCurrentBuffer();
        ///
index b2264bacbf8371812553cd33581548a10d4b7788..2149f962e99b0e2f5c6ca8ed7cc79275a91ed251 100644 (file)
@@ -1,3 +1,13 @@
+2001-08-02  Juergen Vigna  <jug@sad.it>
+
+       * BufferView_pimpl.C (update): redone this function so that we
+       update the text again if there was a CHANGE_IN_DRAW.
+
+       * screen.C (cursorToggle): removed LyXText parameter and recoded.
+       (drawFromTo): added a new internal bool which is used by draw() and
+       redraw() function.
+       (general): some cursor drawing problems fixed.
+
 2001-08-01  Juergen Vigna  <jug@sad.it>
 
        * lyxfind.C (LyXFind): fixed
index dbe54248bcfffd30cb74e4609ad1895435f1973d..9246a6bc808642c9e2088e5fefd1db9a78eaacac 100644 (file)
@@ -3454,7 +3454,7 @@ int Buffer::runChktex()
        // error insets after we ran chktex, this must be run:
        if (removedErrorInsets || res){
                users->redraw();
-               users->fitCursor(users->text);
+               users->fitCursor();
        }
        users->owner()->allowInput();
 
@@ -3761,7 +3761,7 @@ void Buffer::resizeInsets(BufferView * bv)
 void Buffer::redraw()
 {
        users->redraw(); 
-       users->fitCursor(users->text); 
+       users->fitCursor(); 
 }
 
 
index ffd4f38a19900f6063017bdc18ffa27ff42ca761..ced4400b1104b6eed346ca29b573cc8cd5861ba2 100644 (file)
@@ -800,7 +800,7 @@ bool Converters::scanLog(Buffer const * buffer, string const & command,
                }
                if (need_redraw) {
                        bv->redraw();
-                       bv->fitCursor(bv->text);
+                       bv->fitCursor();
                }
                bv->owner()->allowInput();
        }
@@ -867,7 +867,7 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command)
                // error insets after we ran LaTeX this must be run:
                if (need_redraw) {
                        bv->redraw();
-                       bv->fitCursor(bv->text);
+                       bv->fitCursor();
                }
        }
 
index 0433149d138528ac92797e5bf0c48ace1fd2168d..2f57feb3872fb067583947fe0a3381f282ba44c2 100644 (file)
@@ -50,5 +50,5 @@ void ControlBibitem::applyParamsToInset()
        // We need to do a redraw because the maximum
        // InsetBibKey width could have changed
        lv_.view()->redraw();
-       lv_.view()->fitCursor(lv_.view()->getLyXText());
+       lv_.view()->fitCursor();
 }
index 9cfa01fcf6eaccf7a5c23968bce79223b666c019..7da42cd5f8f8a4d571079a28bef3f81e324d57aa 100644 (file)
@@ -47,7 +47,7 @@ void ControlBibtex::applyParamsToInset()
        // We need to do a redraw because the maximum
        // InsetBibKey width could have changed
        lv_.view()->redraw();
-       lv_.view()->fitCursor(lv_.view()->getLyXText());
+       lv_.view()->fitCursor();
 }
 
 
index f94142d6558b77913501f58ff38a9b71bb8a78d6..5abd08ff411e3d5126903b10e3ffa344c4e51f86 100644 (file)
@@ -1,3 +1,12 @@
+2001-08-02  Juergen Vigna  <jug@sad.it>
+
+       * insettext.C (draw): clear the background with the right color if
+       needed. Update myself if x&max-width changed and return without doing
+       anything. Let the update code handle the right stuff.
+
+       * insetminipage.C (getMaxWidth): fixed returning of maxwidth when
+       inside another inset.
+
 2001-08-01  Juergen Vigna  <jug@sad.it>
 
        * insetcollapsable.C (update): added an in_update bool so we avoid
index f2401c96fe09410b482493a1ce1789e1c5143981..4b25ed44e72e331dcff3f8ccc429738c65edd052 100644 (file)
@@ -98,7 +98,7 @@ public:
        void insetKeyPress(XKeyEvent *);
        ///
        UpdatableInset::RESULT localDispatch(BufferView *, kb_action,
-                                            string const &);
+                                            string const &);
        ///
        int latex(Buffer const *, std::ostream &,
                  bool fragile, bool free_spc) const;
index 5e204277eefe29d6d79e7a866ae8879fc5af535f..c4134be27223ea4693dfd69c0a46e397ce17fda3 100644 (file)
@@ -61,7 +61,7 @@ void InsetLabel::edit(BufferView * bv, int, int, unsigned int)
                        bv->text->redoParagraph(bv);
                        if (flag) {
                                bv->redraw();
-                               bv->fitCursor(getLyXText(bv));
+                               bv->fitCursor();
                        } else
                                bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
                }
index 394649240e7ac35d9e07b1c9dbf31965570e5a79..6ee1e765f7ae83acdd1fe017b8d968ba5ad8f5ab 100644 (file)
@@ -321,7 +321,7 @@ bool InsetMinipage::showInsetDialog(BufferView * bv) const
 
 
 void InsetMinipage::insetButtonRelease(BufferView * bv, int x, int y,
-                                      int button)
+                                       int button)
 {
        if (button == 3) {
                showInsetDialog(bv);
@@ -334,8 +334,13 @@ void InsetMinipage::insetButtonRelease(BufferView * bv, int x, int y,
 int InsetMinipage::getMaxWidth(BufferView * bv, UpdatableInset const * inset)
        const
 {
-       if (!width_.empty())
-               return VSpace(width_).inPixels(bv);
+       if (!width_.empty()) {
+               int ww1 = VSpace(width_).inPixels(bv);
+               int ww2 = InsetCollapsable::getMaxWidth(bv, inset);
+               if (ww2 > 0 && ww2 < ww1)
+                       return ww2;
+               return ww1;
+       }
        // this should not happen!
        return InsetCollapsable::getMaxWidth(bv, inset);
 }
index 3d21be31783b12a0d4f9bc30928aae4d28da8cab..bbe84be37ab8196283afad708f31cfdf369e4d7b 100644 (file)
@@ -80,6 +80,7 @@ void InsetText::saveLyXTextState(LyXText * t) const
        sstate.selendboundary = t->selection.end.boundary();
        sstate.selection = t->selection.set();
        sstate.mark_set = t->selection.mark();
+       sstate.refresh = t->refresh_row != 0;
 }
 
 void InsetText::restoreLyXTextState(BufferView * bv, LyXText * t) const
@@ -102,6 +103,8 @@ void InsetText::restoreLyXTextState(BufferView * bv, LyXText * t) const
                        t->selection.cursor = t->cursor;
                        t->selection.set(false);
                }
+               if (sstate.refresh) {
+               }
        }
 }
 
@@ -317,6 +320,32 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
                return;
 
        Painter & pain = bv->painter();
+       
+       // this is the first thing we have to ask because if the x pos
+       // changed we have to do a complete rebreak of the text as we
+       // may have few space to draw in. Well we should check on this too
+       if (top_x != int(x)) {
+               int old_x = top_x;
+               top_x = int(x);
+               int nw = getMaxWidth(bv, this);
+               if (nw > 0 && old_max_width != nw) {
+                       need_update = INIT;
+                       old_max_width = nw;
+                       bv->text->status(bv, LyXText::CHANGED_IN_DRAW);
+                       return;
+               } else {
+                       top_x = old_x;
+               }
+               // dummy calls so that the values are again right
+               (void)ascent(bv, f);
+               (void)descent(bv, f);
+               (void)width(bv, f);
+       }
+
+       // repaint the background if needed
+       if (cleared && backgroundColor() != LColor::background) {
+               clearInset(pain, baseline, cleared);
+       }
 
        // no draw is necessary !!!
        if ((drawFrame_ == LOCKED) && !locked && !par->size()) {
@@ -341,24 +370,13 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
                 (last_drawn_width!=insetWidth))) {
                clearInset(pain, baseline, cleared);
        }
+       top_x = int(x);
        if (cleared)
                frame_is_visible = false;
 
        if (!cleared && (need_update == NONE))
                return;
 
-       if (top_x != int(x)) {
-               if ((getMaxWidth(bv, this) > 0) &&
-                       (getLyXText(bv)->width != old_max_width)) {
-                       resizeLyXText(bv);
-                       need_update |= FULL;
-                       old_max_width = getLyXText(bv)->width;
-                       bv->text->status(bv, LyXText::CHANGED_IN_DRAW);
-               }
-               top_x = int(x);
-               clearInset(pain, baseline, cleared);
-       }
-
 //     lyxerr << "InsetText::draw[" << this << "](" << need_update << ":" << int(x) << ":" << top_x << ")\n";
 
        if (cleared || (last_drawn_width != insetWidth)) {
@@ -377,7 +395,8 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
                inset_y = cy(bv) + drawTextYOffset;
        }
        if (!cleared && (need_update == CURSOR)
-               && !getLyXText(bv)->selection.set()) {
+               && !getLyXText(bv)->selection.set())
+       {
                drawFrame(pain, cleared);
                x += last_width; // was width(bv, f);
                need_update = NONE;
@@ -404,7 +423,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
        if (y_offset < 0)
                y_offset = y;
        lt->first = first;
-       if (cleared) {
+       if (cleared || (need_update&=(INIT|FULL))) {
                int yf = y_offset;
                y = 0;
                while ((row != 0) && (yf < ph)) {
@@ -454,10 +473,10 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
 void InsetText::drawFrame(Painter & pain, bool cleared) const
 {
        if (!frame_is_visible || cleared) {
-               frame_x = top_x + 1;
-               frame_y = top_baseline - insetAscent + 1;
-               frame_w = insetWidth - 1;
-               frame_h = insetAscent + insetDescent - 1;
+               frame_x = top_x; // + 1;
+               frame_y = top_baseline - insetAscent; // + 1;
+               frame_w = last_width; // - 2;
+               frame_h = insetAscent + insetDescent; // - 2;
                pain.rectangle(frame_x, frame_y, frame_w, frame_h,
                               frame_color);
                frame_is_visible = true;
@@ -1501,7 +1520,7 @@ bool InsetText::insertInset(BufferView * bv, Inset * inset)
                (cpar(bv)->getInset(cpos(bv)) != inset))
                lt->cursorLeft(bv);
 #endif
-       bv->fitCursor(lt);
+       bv->fitCursor();
        updateLocal(bv, CURSOR_PAR|CURSOR, true);
        showInsetCursor(bv);
        if (clear)
@@ -1578,14 +1597,10 @@ void InsetText::setFont(BufferView * bv, LyXFont const & font, bool toggleall,
        }
        if (selectall)
                selectAll(bv);
-#if 1
        lt->toggleFree(bv, font, toggleall);
-#else
-       lt->setFont(bv, font, toggleall);
-#endif
        if (selectall)
                lt->clearSelection();
-       bv->fitCursor(lt);
+       bv->fitCursor();
        if (selectall || lt->selection.set())
                updateLocal(bv, FULL, true);
        else
@@ -1662,7 +1677,6 @@ int InsetText::getMaxWidth(BufferView * bv, UpdatableInset const * inset) const
        }
        w -= (2 * TEXT_TO_INSET_OFFSET);
        return w - top_x;
-//    return  w - (2*TEXT_TO_INSET_OFFSET);
 }
 
 
@@ -1878,7 +1892,7 @@ void InsetText::resizeLyXText(BufferView * bv, bool force) const
        if (!owner())
                updateLocal(bv, FULL, false);
        else
-               need_update = FULL;
+               need_update |= FULL;
        // this will scroll the screen such that the cursor becomes visible 
        bv->updateScrollbar();
 }
@@ -1980,8 +1994,7 @@ void InsetText::clearInset(Painter & pain, int baseline, bool & cleared) const
                h = pain.paperHeight();
        if ((top_x + drawTextXOffset + w) > pain.paperWidth())
                w = pain.paperWidth();
-       pain.fillRectangle(top_x+drawTextXOffset, ty, w, h, 
-                          backgroundColor());
+       pain.fillRectangle(top_x+drawTextXOffset, ty, w, h, backgroundColor());
        cleared = true;
        need_update = FULL;
 }
index 9c67d1e86ffe024b23f02ba524bc04d7b9f3e536..6f49473ec722a8f9a3925f260f7a573b674fd8e0 100644 (file)
@@ -350,7 +350,7 @@ private:
        ///
        mutable int inset_y;
        ///
-       mutable unsigned int old_max_width;
+       mutable int old_max_width;
        ///
        bool no_selection;
        ///
@@ -382,6 +382,7 @@ private:
                bool selendboundary;
                bool selection;
                bool mark_set;
+               bool refresh;
        } sstate;
        ///
        // this is needed globally so we know that we're using it actually and
index a93a26c4834b1fe6b2cb3e5b2e16e429cffee05d..6411a80b6e0547affb39de4ab71554f22351d5d6 100644 (file)
@@ -1132,7 +1132,7 @@ string const LyXFunc::dispatch(int ac,
        case LFUN_REMOVEERRORS:
                if (owner->view()->removeAutoInsets()) {
                        owner->view()->redraw();
-                       owner->view()->fitCursor(TEXT());
+                       owner->view()->fitCursor();
                }
                break;
 
index 7501f67e3b384efda47ce1e38df0f0b297e7eeb1..e79c053b0c224084b6c3a20749f384043f75983e 100644 (file)
@@ -71,7 +71,7 @@ public:
        ///
        void hideCursor();
        ///
-       void cursorToggle(LyXText const *, BufferView const *);
+       void cursorToggle(BufferView *) const;
        ///
        void showManualCursor(LyXText const *, int x, int y,
                              int asc, int desc,
@@ -102,7 +102,7 @@ private:
 
        /// y1 and y2 are coordinates of the screen
        void drawFromTo(LyXText *, BufferView *, int y1, int y2,
-                       int y_offset = 0, int x_offset = 0);
+                       int y_offset = 0, int x_offset = 0, bool internal=false);
 
        /// y is a coordinate of the text
        void drawOneRow(LyXText *, BufferView *, Row * row,
index 384efd0f2ad8fcc8c01bb77c64ba4a2819ded209..2744cf8676d604988db6d30041c461e1d1ca5d70 100644 (file)
@@ -174,10 +174,10 @@ public:
    
        /** Completes the insertion with a full rebreak.
            Returns true if something was broken. */
-        bool fullRebreak(BufferView *);
+       bool fullRebreak(BufferView *);
 
        ///
-       Row * need_break_row;
+       mutable Row * need_break_row;
        ///
        mutable int refresh_y;
        ///
index d09e3d42ed0767a8d5986c971618804574a4041e..f2c195a559f3883e4b0d5233a4fc1595f32e255f 100644 (file)
@@ -89,11 +89,11 @@ void LyXScreen::setCursorColor()
 
 void LyXScreen::redraw(LyXText * text, BufferView * bv)
 {
-       drawFromTo(text, bv, 0, owner.height());
+       drawFromTo(text, bv, 0, owner.height(), 0, 0, text == bv->text);
        expose(0, 0, owner.workWidth(), owner.height());
        if (cursor_visible) {
                cursor_visible = false;
-               showCursor(text, bv);
+               bv->showCursor();
        }
 }
 
@@ -112,7 +112,8 @@ void LyXScreen::expose(int x, int y, int exp_width, int exp_height)
 
 
 void LyXScreen::drawFromTo(LyXText * text, BufferView * bv,
-                          int y1, int y2, int y_offset, int x_offset)
+                           int y1, int y2, int y_offset, int x_offset,
+                           bool internal)
 {
        int y_text = text->first + y1;
    
@@ -124,13 +125,19 @@ void LyXScreen::drawFromTo(LyXText * text, BufferView * bv,
        // y1 is now the real beginning of row on the screen
        
        while (row != 0 && y < y2) {
-               LyXText::text_status st = bv->text->status();
-               do {
-                       bv->text->status(bv, st);
+               LyXText::text_status st = text->status();
+               text->getVisibleRow(bv, y + y_offset,
+                                   x_offset, row, y + text->first);
+               while(internal && text->status() == LyXText::CHANGED_IN_DRAW) {
+                       if (text->fullRebreak(bv)) {
+                               st = LyXText::NEED_MORE_REFRESH;
+                               text->setCursor(bv, text->cursor.par(), text->cursor.pos());
+                               bv->fitCursor();
+                       }
+                       text->status(bv, st);
                        text->getVisibleRow(bv, y + y_offset,
-                                           x_offset, row, y + text->first);
-               } while (bv->text->status() == LyXText::CHANGED_IN_DRAW);
-               bv->text->status(bv, st);
+                                           x_offset, row, y + text->first);
+               }
                y += row->height();
                row = row->next();
        }
@@ -154,32 +161,39 @@ void LyXScreen::drawOneRow(LyXText * text, BufferView * bv, Row * row,
        if (((y + row->height()) > 0) &&
            ((y - row->height()) <= static_cast<int>(owner.height()))) {
                // ok there is something visible
+#if 0
                LyXText::text_status st = bv->text->status();
                do {
                        bv->text->status(bv, st);
                        text->getVisibleRow(bv, y, x_offset, row,
                                            y + text->first);
-               } while (bv->text->status() == LyXText::CHANGED_IN_DRAW);
+               } while (!text->inset_owner &&
+                        text->status() == LyXText::CHANGED_IN_DRAW);
                bv->text->status(bv, st);
+#else
+               text->getVisibleRow(bv, y, x_offset, row, y + text->first);
+#endif
        }
        force_clear = false;
 }
 
 
 /* draws the screen, starting with textposition y. uses as much already
-* printed pixels as possible */
+ * printed pixels as possible */
 void LyXScreen::draw(LyXText * text, BufferView * bv, unsigned int y)
 {
        if (cursor_visible) hideCursor();
 
        int const old_first = text->first;
+       bool internal = (text == bv->text);
        text->first = y;
 
        // is any optimiziation possible?
        if ((y - old_first) < owner.height()
-           && (old_first - y) < owner.height()) {
+           && (old_first - y) < owner.height())
+       {
                if (text->first < old_first) {
-                       drawFromTo(text, bv, 0, old_first - text->first);
+                       drawFromTo(text, bv, 0, old_first - text->first, 0, 0, internal);
                        XCopyArea (fl_get_display(),
                                   owner.getWin(),
                                   owner.getWin(),
@@ -197,8 +211,8 @@ void LyXScreen::draw(LyXText * text, BufferView * bv, unsigned int y)
                               old_first - text->first);
                } else  {
                        drawFromTo(text, bv,
-                                  owner.height() + old_first - text->first,
-                                  owner.height());
+                                  owner.height() + old_first - text->first,
+                                  owner.height(), 0, 0, internal);
                        XCopyArea (fl_get_display(),
                                   owner.getWin(),
                                   owner.getWin(),
@@ -215,7 +229,7 @@ void LyXScreen::draw(LyXText * text, BufferView * bv, unsigned int y)
                }
        } else {
                // make a dumb new-draw 
-               drawFromTo(text, bv, 0, owner.height());
+               drawFromTo(text, bv, 0, owner.height(), 0, 0, internal);
                expose(0, 0, owner.workWidth(), owner.height());
        }
 }
@@ -360,12 +374,12 @@ void LyXScreen::hideCursor()
 }
 
 
-void LyXScreen::cursorToggle(LyXText const * text, BufferView const * bv)
+void LyXScreen::cursorToggle(BufferView * bv) const
 {
        if (cursor_visible)
-               hideCursor();
+               bv->hideCursor();
        else
-               showCursor(text, bv);
+               bv->showCursor();
 }
 
 
@@ -435,9 +449,13 @@ void LyXScreen::update(LyXText * text, BufferView * bv,
                // ok I will update the current cursor row
                drawOneRow(text, bv, text->refresh_row, text->refresh_y,
                           y_offset, x_offset);
-               text->status(bv, LyXText::UNCHANGED);
-               expose(0, text->refresh_y - text->first + y_offset,
-                      owner.workWidth(), text->refresh_row->height());
+               // this because if we had a major update the refresh_row could
+               // have been set to 0!
+               if (text->refresh_row) {
+                       text->status(bv, LyXText::UNCHANGED);
+                       expose(0, text->refresh_y - text->first + y_offset,
+                                  owner.workWidth(), text->refresh_row->height());
+               }
        }
        break;
        case LyXText::CHANGED_IN_DRAW: // just to remove the warning
index f087cb38160b07c7224e5b4e881c713c37abee8f..b71245a4858aff55a92899b1c59e9b669040e1e8 100644 (file)
@@ -440,12 +440,14 @@ void LyXText::draw(BufferView * bview, Row const * row,
                        tmpinset->update(bview, font, false);
                        tmpinset->draw(bview, font, offset+row->baseline(), x,
                                       cleared);
-#ifdef SEEMS_TO_BE_NOT_NEEDED
-                       if (status_ == CHANGED_IN_DRAW) {
-                               UpdateInset(bview, tmpinset);
-                               status(bview, CHANGED_IN_DRAW);
+                       if (!need_break_row &&
+                           bview->text->status() == CHANGED_IN_DRAW)
+                       {
+                               if (row->previous() && row->previous()->par() == row->par())
+                                       breakAgainOneRow(bview, row->previous());
+                               setCursor(bview, cursor.par(), cursor.pos());
+                               need_break_row = const_cast<Row *>(row);
                        }
-#endif
                }
                ++vpos;
 
index 749d8a9bbeea7564fb7653bbda3483e2d7feb40c..938d9fd3a201fea559db7fc53fa9f8fff6538588 100644 (file)
@@ -779,7 +779,7 @@ void LyXText::redoDrawingOfParagraph(BufferView * bview, LyXCursor const & cur)
 // and the specified par 
 // This function is needed after SetLayout and SetFont etc.
 void LyXText::redoParagraphs(BufferView * bview, LyXCursor const & cur,
-                            Paragraph const * endpar) const
+                             Paragraph const * endpar) const
 {
        Row * tmprow2;
        Paragraph * tmppar = 0;
@@ -797,7 +797,8 @@ void LyXText::redoParagraphs(BufferView * bview, LyXCursor const & cur,
        } else {
                first_phys_par = tmprow->par();
                while (tmprow->previous()
-                      && tmprow->previous()->par() == first_phys_par) {
+                      && tmprow->previous()->par() == first_phys_par)
+               {
                        tmprow = tmprow->previous();
                        y -= tmprow->height();
                }
@@ -807,8 +808,8 @@ void LyXText::redoParagraphs(BufferView * bview, LyXCursor const & cur,
        status(bview, LyXText::NEED_MORE_REFRESH);
        refresh_y = y;
        refresh_row = tmprow->previous();        /* the real refresh row will
-                                                   be deleted, so I store
-                                                   the previous here */ 
+                                               be deleted, so I store
+                                               the previous here */ 
        // remove it
        if (tmprow->next())
                tmppar = tmprow->next()->par();
@@ -824,7 +825,7 @@ void LyXText::redoParagraphs(BufferView * bview, LyXCursor const & cur,
    
        // remove the first one
        tmprow2 = tmprow;     /* this is because tmprow->previous()
-                                can be 0 */
+                                can be 0 */
        tmprow = tmprow->previous();
        removeRow(tmprow2);