From: André Pönitz Date: Mon, 18 Aug 2003 08:23:03 +0000 (+0000) Subject: drop a few fitCursor() and draw() calls X-Git-Tag: 1.6.10~16272 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=7000451e000b7800677131368d8f132486219519;p=features.git drop a few fitCursor() and draw() calls git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7563 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/BufferView.C b/src/BufferView.C index 6850a52d6a..f5892cb272 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -444,7 +444,6 @@ void BufferView::replaceWord(string const & replacestring) // FIXME: should be done through LFUN buffer()->markDirty(); - fitCursor(); update(); } diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 0e711c24b9..222c5a0b71 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -489,7 +489,8 @@ void BufferView::Pimpl::scrollDocView(int value) screen().hideCursor(); - screen().draw(bv_->text, bv_, value); + bv_->text->top_y(value); + //screen().draw(); if (!lyxrc.cursor_follows_scrollbar) return; @@ -767,14 +768,14 @@ void BufferView::Pimpl::insetUnlock() void BufferView::Pimpl::center() { - LyXText * t = bv_->text; + LyXText * text = bv_->text; - beforeChange(t); + beforeChange(text); int const half_height = workarea().workHeight() / 2; int new_y = 0; - if (t->cursor.y() > half_height) - new_y = t->cursor.y() - half_height; + if (text->cursor.y() > half_height) + new_y = text->cursor.y() - half_height; // FIXME: look at this comment again ... @@ -787,8 +788,8 @@ void BufferView::Pimpl::center() // and also might have moved top_y() must make sure to call // updateScrollbar() currently. Never mind that this is a // pretty obfuscated way of updating t->top_y() - screen().draw(t, bv_, new_y); - + text->top_y(new_y); + //screen().draw(); update(); } @@ -817,7 +818,7 @@ InsetOld * BufferView::Pimpl::getInsetByCode(InsetOld::Code code) return it != buffer_->inset_iterator_end() ? (*it) : 0; #else // Ok, this is a little bit too brute force but it - // should work for now. Better infrastructure is comming. (Lgb) + // should work for now. Better infrastructure is coming. (Lgb) Buffer * b = bv_->buffer(); LyXCursor cursor = bv_->getLyXText()->cursor; @@ -1179,7 +1180,6 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in) if (name == "bibitem") { // We need to do a redraw because the maximum // InsetBibitem width could have changed - bv_->fitCursor(); #warning check whether the update() is needed at all bv_->update(); } @@ -1201,12 +1201,8 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in) break; case LFUN_LAYOUT_PARAGRAPH: { - Paragraph const * par = &*bv_->getLyXText()->cursor.par(); - if (!par) - break; - string data; - params2string(*par, data); + params2string(*bv_->getLyXText()->cursor.par(), data); data = "show\n" + data; bv_->owner()->getDialogs().show("paragraph", data); diff --git a/src/ChangeLog b/src/ChangeLog index 4a7891cba1..0b29baf950 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,17 +1,26 @@ +2003-08-18 André Pönitz + + * BufferView.C: + * BufferView_pimpl.C: + * lyxfind.C: + * paragraph_funcs.C: + * rowpainter.C: + * text3.C: remove LyXScreen::draw() and fitCursor calls + 2003-08-17 Martin Vermeer - * src/BranchList.[Ch]: - * src/InsetList.[Ch]: - * src/LColor.[Ch]: - * src/LyXAction.C: - * src/Makefile.am: - * src/MenuBackend.[Ch]: - * src/bufferparams.[Ch]: - * src/factory.C: - * src/lfuns.h: - * src/lyxfunc.C: - * src/text3.C: implements the 'branch inset' + * BranchList.[Ch]: + * InsetList.[Ch]: + * LColor.[Ch]: + * LyXAction.C: + * Makefile.am: + * MenuBackend.[Ch]: + * bufferparams.[Ch]: + * factory.C: + * lfuns.h: + * lyxfunc.C: + * text3.C: implements the 'branch inset' idea. This allows the output of various versions of a document from a single source version, selectively outputing or suppressing output of parts of the text. diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index 020cb74acf..ae67922f43 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -1,7 +1,11 @@ +2003-08-18 André Pönitz + + * screen.[Ch]: remove draw() + 2003-08-15 André Pönitz - * screen.[Ch]: remove toggle selection + * screen.[Ch]: remove toggleSelection() 2003-08-02 Jean-Marc Lasgouttes diff --git a/src/frontends/qt2/qscreen.C b/src/frontends/qt2/qscreen.C index 6afb4444ba..71cdb0f237 100644 --- a/src/frontends/qt2/qscreen.C +++ b/src/frontends/qt2/qscreen.C @@ -68,22 +68,6 @@ void QScreen::expose(int x, int y, int w, int h) } -void QScreen::draw(LyXText * text, BufferView * bv, unsigned int y) -{ - QPixmap * p = owner_.getPixmap(); - - owner_.getPainter().start(); - - text->top_y(y); - - // not needed in the xforms frontend anymore - //drawFromTo(text, bv, 0, owner_.height(), 0, 0); - repaint(); - - owner_.getPainter().end(); -} - - void QScreen::showCursor(int x, int y, int h, Cursor_Shape shape) { cursor_x_ = x; diff --git a/src/frontends/qt2/qscreen.h b/src/frontends/qt2/qscreen.h index 0ec97f94a9..e997633b5d 100644 --- a/src/frontends/qt2/qscreen.h +++ b/src/frontends/qt2/qscreen.h @@ -29,14 +29,6 @@ public: virtual ~QScreen(); - /** - * draw the screen from a given position - * @param y the text position to draw from - * - * Uses as much of the already printed pixmap as possible - */ - virtual void draw(LyXText *, BufferView *, unsigned int y); - protected: /// get the work area virtual WorkArea & workarea() const { return owner_; } diff --git a/src/frontends/screen.C b/src/frontends/screen.C index 33b3302b25..f2091f60f3 100644 --- a/src/frontends/screen.C +++ b/src/frontends/screen.C @@ -236,8 +236,8 @@ bool LyXScreen::fitManualCursor(BufferView * bv, LyXText * text, if (newtop == text->top_y()) return false; - draw(text, bv, newtop); text->top_y(newtop); + //draw(); return true; } @@ -289,10 +289,9 @@ bool LyXScreen::fitCursor(LyXText * text, BufferView * bv) // Is a change necessary? int const newtop = topCursorVisible(text); bool const result = (newtop != text->top_y()); - if (result) { - draw(text, bv, newtop); - } - + text->top_y(newtop); + //if (result) + // draw(); return result; } @@ -309,7 +308,7 @@ void LyXScreen::redraw(BufferView & bv) workarea().getPainter().start(); bv.text->updateRowPositions(); - drawFromTo(bv.text, &bv, 0, workarea().workHeight(), 0, 0); + drawFromTo(bv.text, &bv); expose(0, 0, workarea().workWidth(), workarea().workHeight()); workarea().getPainter().end(); @@ -340,32 +339,27 @@ void LyXScreen::greyOut() workarea().getPainter().image(x, y, w, h, *splash_image); - string const & splash_text = splash.text(); - LyXFont const & splash_font = splash.font(); - x += 260; y += 265; - workarea().getPainter().text(x, y, splash_text, splash_font); + workarea().getPainter().text(x, y, splash.text(), splash.font()); } expose(0, 0, workarea().workWidth(), workarea().workHeight()); workarea().getPainter().end(); } -void LyXScreen::drawFromTo(LyXText * text, BufferView * bv, - int y1, int y2, int yo, int xo) +void LyXScreen::drawFromTo(LyXText * text, BufferView * bv) { - lyxerr[Debug::GUI] << "screen: drawFromTo " << y1 << '-' << y2 << endl; hideCursor(); - + int const y2 = workarea().workHeight(); int const topy = text->top_y(); - int y_text = topy + y1; + int y_text = topy; ParagraphList::iterator dummypit; RowList::iterator rit = text->getRowNearY(y_text, dummypit); int y = y_text - topy; - y = paintRows(*bv, *text, rit, xo, y, y, y2, yo); + y = paintRows(*bv, *text, rit, 0, y, y, y2, 0); // maybe we have to clear the screen at the bottom if (y < y2 && !text->isInInset()) { diff --git a/src/frontends/screen.h b/src/frontends/screen.h index 434611a554..5ba7bbf222 100644 --- a/src/frontends/screen.h +++ b/src/frontends/screen.h @@ -38,14 +38,6 @@ public: virtual ~LyXScreen(); - /** - * draw the screen from a given position - * @param y the text position to draw from - * - * Uses as much of the already printed pixmap as possible - */ - virtual void draw(LyXText *, BufferView *, unsigned int y) = 0; - /** * fit the cursor onto the visible work area, scrolling if necessary * @param bv the buffer view @@ -115,11 +107,10 @@ protected: /// hide the cursor virtual void removeCursor() = 0; +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); + void drawFromTo(LyXText *, BufferView *); -private: /// grey out (no buffer) void greyOut(); diff --git a/src/frontends/xforms/xscreen.C b/src/frontends/xforms/xscreen.C index 3ad462e4e8..3679832219 100644 --- a/src/frontends/xforms/xscreen.C +++ b/src/frontends/xforms/xscreen.C @@ -169,15 +169,3 @@ void XScreen::expose(int x, int y, int w, int h) x + owner_.xpos(), y + owner_.ypos()); } - - -void XScreen::draw(LyXText * text, BufferView * bv, unsigned int y) -{ - text->top_y(y); - - // make a dumb new-draw - //drawFromTo(text, bv, 0, owner_.workHeight(), 0, 0); - //expose(0, 0, owner_.workWidth(), owner_.workHeight()); - - XSync(fl_get_display(), 0); -} diff --git a/src/frontends/xforms/xscreen.h b/src/frontends/xforms/xscreen.h index dbae69a21d..4bbf03efe8 100644 --- a/src/frontends/xforms/xscreen.h +++ b/src/frontends/xforms/xscreen.h @@ -35,10 +35,6 @@ public: /// Sets the cursor color to LColor::cursor. virtual void setCursorColor(); - /** Draws the screen form textposition y. Uses as much of - the already printed pixmap as possible */ - virtual void draw(LyXText *, BufferView *, unsigned int y); - protected: /// get the work area virtual WorkArea & workarea() const { return owner_; } diff --git a/src/lyxfind.C b/src/lyxfind.C index afc50357e8..3cb76dc0c5 100644 --- a/src/lyxfind.C +++ b/src/lyxfind.C @@ -208,7 +208,6 @@ int replace(BufferView * bv, // FIXME: should be called via an LFUN bv->buffer()->markDirty(); - bv->fitCursor(); bv->update(); return replace_count; @@ -263,7 +262,6 @@ bool find(BufferView * bv, bv->unlockInset(bv->theLockingInset()); found = false; } - bv->fitCursor(); bv->update(); return found; @@ -397,7 +395,6 @@ bool findNextChange(BufferView * bv) found = false; } - bv->fitCursor(); bv->update(); return found; diff --git a/src/paragraph_funcs.C b/src/paragraph_funcs.C index b002286030..1b0a6b2efd 100644 --- a/src/paragraph_funcs.C +++ b/src/paragraph_funcs.C @@ -472,8 +472,8 @@ TeXOnePar(Buffer const * buf, LatexRunParams const & runparams, string const & everypar) { - lyxerr[Debug::LATEX] << "TeXOnePar... " << &*pit << " '" << everypar -<< "'" << endl; + lyxerr[Debug::LATEX] << "TeXOnePar... " << &*pit << " '" + << everypar << "'" << endl; BufferParams const & bparams = buf->params; InsetOld const * in = pit->inInset(); @@ -481,10 +481,10 @@ TeXOnePar(Buffer const * buf, LyXLayout_ptr style; // well we have to check if we are in an inset with unlimited - // lenght (all in one row) if that is true then we don't allow + // length (all in one row) if that is true then we don't allow // any special options in the paragraph and also we don't allow // any environment other then "Standard" to be valid! - if ((in == 0) || !in->forceDefaultParagraphs(in)) { + if (in == 0 || !in->forceDefaultParagraphs(in)) { style = pit->layout(); if (pit->params().startOfAppendix()) { @@ -740,7 +740,7 @@ void latexParagraphs(Buffer const * buf, // length (all in one row) if that is true then we don't allow // any special options in the paragraph and also we don't allow // any environment other then "Standard" to be valid! - if ((in == 0) || !in->forceDefaultParagraphs(in)) { + if (in == 0 || !in->forceDefaultParagraphs(in)) { LyXLayout_ptr const & layout = par->layout(); if (layout->intitle) { diff --git a/src/rowpainter.C b/src/rowpainter.C index befec68a3e..bdf51b2912 100644 --- a/src/rowpainter.C +++ b/src/rowpainter.C @@ -1068,7 +1068,7 @@ int getLengthMarkerHeight(BufferView const & bv, VSpace const & vsp) int paintRows(BufferView const & bv, LyXText const & text, RowList::iterator rit, int xo, int y, int yf, int y2, int yo) { - //lyxerr << "paintRows: rit: " << &*rit << endl; + lyxerr << " paintRows: rit: " << &*rit << endl; const_cast(text).updateRowPositions(); int yy = yf - y; diff --git a/src/text3.C b/src/text3.C index f0786b7379..29c8d56813 100644 --- a/src/text3.C +++ b/src/text3.C @@ -1248,7 +1248,6 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd) bv->text->setSelection(); bv->update(); - bv->fitCursor(); break; } @@ -1424,7 +1423,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd) // stack. They don't *have* to // alter the document... // (Joacim) - // ...or maybe the SetCursorParUndo() + // ...or maybe the recordUndo() // below isn't necessary at all anylonger? if (inset_hit->lyxCode() == InsetOld::REF_CODE) recordUndo(bv, Undo::ATOMIC);