From 92e53dc01bc00bef85c9b523841b2649cc96f970 Mon Sep 17 00:00:00 2001 From: John Levon Date: Tue, 11 Jun 2002 23:47:58 +0000 Subject: [PATCH] Rename screen, and don't re-construct it on a buffer change (that is far too nosy of the core), and use an accessor ... git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4372 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView.C | 4 +- src/BufferView.h | 4 +- src/BufferView2.C | 6 +- src/BufferView_pimpl.C | 127 +++++++++++++++++----------------------- src/BufferView_pimpl.h | 6 +- src/ChangeLog | 11 ++++ src/frontends/ChangeLog | 5 ++ src/frontends/screen.C | 52 ++++++++++------ src/frontends/screen.h | 10 ++-- src/insets/ChangeLog | 5 ++ src/insets/insettext.C | 20 +++---- src/insets/insettext.h | 1 - src/lyxrc.C | 1 - src/lyxtext.h | 2 +- src/text.C | 2 +- 15 files changed, 136 insertions(+), 120 deletions(-) diff --git a/src/BufferView.C b/src/BufferView.C index 3f13e556c2..5a2047f315 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -42,9 +42,9 @@ Buffer * BufferView::buffer() const } -LyXScreen * BufferView::screen() const +LScreen & BufferView::screen() const { - return pimpl_->screen_.get(); + return pimpl_->screen(); } diff --git a/src/BufferView.h b/src/BufferView.h index 761e34ab06..da22d8781a 100644 --- a/src/BufferView.h +++ b/src/BufferView.h @@ -25,7 +25,7 @@ class LyXView; class LyXText; class TeXErrors; class Buffer; -class LyXScreen; +class LScreen; class Language; class Painter; class UpdatableInset; @@ -54,7 +54,7 @@ public: /// Painter & painter(); /// - LyXScreen * screen() const; + LScreen & screen() const; /// void buffer(Buffer * b); /// diff --git a/src/BufferView2.C b/src/BufferView2.C index fb7c29762d..9f069b1905 100644 --- a/src/BufferView2.C +++ b/src/BufferView2.C @@ -564,7 +564,7 @@ void BufferView::showLockedInsetCursor(int x, int y, int asc, int desc) locking_inset)) text->setCursor(this, cursor, cursor.par(), cursor.pos() - 1); - LyXScreen::Cursor_Shape shape = LyXScreen::BAR_SHAPE; + LScreen::Cursor_Shape shape = LScreen::BAR_SHAPE; LyXText * txt = getLyXText(); if (locking_inset->isTextInset() && locking_inset->lyxCode() != Inset::ERT_CODE && @@ -573,8 +573,8 @@ void BufferView::showLockedInsetCursor(int x, int y, int asc, int desc) || txt->real_current_font.isVisibleRightToLeft() != buffer()->params.language->RightToLeft())) shape = (txt->real_current_font.isVisibleRightToLeft()) - ? LyXScreen::REVERSED_L_SHAPE - : LyXScreen::L_SHAPE; + ? LScreen::REVERSED_L_SHAPE + : LScreen::L_SHAPE; y += cursor.iy() + theLockingInset()->insetInInsetY(); pimpl_->screen_->showManualCursor(text, x, y, asc, desc, shape); diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 0667bfbeb2..669255ad92 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -139,6 +139,7 @@ BufferView::Pimpl::Pimpl(BufferView * b, LyXView * o, using_xterm_cursor(false), inset_slept(false) { workarea_.reset(new WorkArea(xpos, ypos, width, height)); + screen_.reset(new LScreen(workarea())); // Setup the signals workarea().scrollCB.connect(boost::bind(&BufferView::Pimpl::scrollCB, this, _1)); @@ -178,6 +179,12 @@ WorkArea & BufferView::Pimpl::workarea() const } +LScreen & BufferView::Pimpl::screen() const +{ + return *screen_.get(); +} + + Painter & BufferView::Pimpl::painter() { return workarea().getPainter(); @@ -210,10 +217,6 @@ void BufferView::Pimpl::buffer(Buffer * b) if (bufferlist.getState() == BufferList::CLOSING) return; - // Nuke old image - // screen is always deleted when the buffer is changed. - screen_.reset(0); - // If we are closing the buffer, use the first buffer as current if (!buffer_) { buffer_ = bufferlist.first(); @@ -229,7 +232,7 @@ void BufferView::Pimpl::buffer(Buffer * b) updateScreen(); updateScrollbar(); } - bv_->text->first_y = screen_->topCursorVisible(bv_->text); + bv_->text->first_y = screen().topCursorVisible(bv_->text); owner_->updateMenubar(); owner_->updateToolbar(); // Similarly, buffer-dependent dialogs should be updated or @@ -286,15 +289,13 @@ void BufferView::Pimpl::redraw() bool BufferView::Pimpl::fitCursor() { - lyx::Assert(screen_.get()); - bool ret; if (bv_->theLockingInset()) { bv_->theLockingInset()->fitInsetCursor(bv_); ret = true; } else { - ret = screen_->fitCursor(bv_->text, bv_); + ret = screen().fitCursor(bv_->text, bv_); } bv_->owner()->getDialogs()->updateParagraph(); @@ -391,7 +392,7 @@ int BufferView::Pimpl::resizeCurrentBuffer() bv_->theLockingInset(the_locking_inset); } - bv_->text->first_y = screen_->topCursorVisible(bv_->text); + bv_->text->first_y = screen().topCursorVisible(bv_->text); // this will scroll the screen such that the cursor becomes visible updateScrollbar(); @@ -410,7 +411,7 @@ int BufferView::Pimpl::resizeCurrentBuffer() void BufferView::Pimpl::updateScreen() { // Regenerate the screen. - screen_.reset(new LyXScreen(workarea())); + screen().reset(); } @@ -462,10 +463,7 @@ void BufferView::Pimpl::scrollCB(double value) if (current_scrollbar_value < 0) current_scrollbar_value = 0; - if (!screen_.get()) - return; - - screen_->draw(bv_->text, bv_, current_scrollbar_value); + screen().draw(bv_->text, bv_, current_scrollbar_value); if (!lyxrc.cursor_follows_scrollbar) { waitForX(); @@ -489,7 +487,7 @@ void BufferView::Pimpl::scrollCB(double value) int BufferView::Pimpl::scrollUp(long time) { - if (!buffer_ || !screen_.get()) + if (!buffer_) return 0; double value = workarea().getScrollbarValue(); @@ -522,7 +520,7 @@ int BufferView::Pimpl::scrollUp(long time) int BufferView::Pimpl::scrollDown(long time) { - if (!buffer_ || !screen_.get()) + if (!buffer_) return 0; double value = workarea().getScrollbarValue(); @@ -567,7 +565,8 @@ void BufferView::Pimpl::workAreaMotionNotify(int x, int y, mouse_button::state s if (!(state & mouse_button::button1)) return; - if (!buffer_ || !screen_.get()) return; + if (!buffer_) + return; // Check for inset locking if (bv_->theLockingInset()) { @@ -592,7 +591,7 @@ void BufferView::Pimpl::workAreaMotionNotify(int x, int y, mouse_button::state s if (!selection_possible) return; - screen_->hideCursor(); + screen().hideCursor(); #if 0 int y_before = bv_->text->cursor.y(); #endif @@ -619,7 +618,7 @@ void BufferView::Pimpl::workAreaMotionNotify(int x, int y, mouse_button::state s update(bv_->text, BufferView::UPDATE); // Maybe an empty line was deleted bv_->text->setSelection(bv_); - screen_->toggleToggle(bv_->text, bv_); + screen().toggleToggle(bv_->text, bv_); fitCursor(); showCursor(); } @@ -629,7 +628,7 @@ void BufferView::Pimpl::workAreaMotionNotify(int x, int y, mouse_button::state s void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos, mouse_button::state button) { - if (!buffer_ || !screen_.get()) + if (!buffer_) return; // ok ok, this is a hack. @@ -678,10 +677,10 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos, if (!inset_hit) selection_possible = true; - screen_->hideCursor(); + screen().hideCursor(); // Clear the selection - screen_->toggleSelection(bv_->text, bv_); + screen().toggleSelection(bv_->text, bv_); bv_->text->clearSelection(); bv_->text->fullRebreak(bv_); update(); @@ -747,12 +746,12 @@ void BufferView::Pimpl::doubleClick(int /*x*/, int /*y*/, mouse_button::state bu if (text->bv_owner && bv_->theLockingInset()) return; - if (screen_.get() && button == mouse_button::button1) { + if (button == mouse_button::button1) { if (text->bv_owner) { - screen_->hideCursor(); - screen_->toggleSelection(text, bv_); + screen().hideCursor(); + screen().toggleSelection(text, bv_); text->selectWord(bv_, LyXText::WHOLE_WORD_STRICT); - screen_->toggleSelection(text, bv_, false); + screen().toggleSelection(text, bv_, false); } else { text->selectWord(bv_, LyXText::WHOLE_WORD_STRICT); } @@ -773,17 +772,17 @@ void BufferView::Pimpl::tripleClick(int /*x*/, int /*y*/, mouse_button::state bu if (text->bv_owner && bv_->theLockingInset()) return; - if (screen_.get() && (button == mouse_button::button1)) { + if (button == mouse_button::button1) { if (text->bv_owner) { - screen_->hideCursor(); - screen_->toggleSelection(text, bv_); + screen().hideCursor(); + screen().toggleSelection(text, bv_); } text->cursorHome(bv_); text->selection.cursor = text->cursor; text->cursorEnd(bv_); text->setSelection(bv_); if (text->bv_owner) { - screen_->toggleSelection(text, bv_, false); + screen().toggleSelection(text, bv_, false); } /* This will fit the cursor on the screen * if necessary */ @@ -852,7 +851,7 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y, mouse_button::state button) { // do nothing if we used the mouse wheel - if (!buffer_ || !screen_.get() || button == mouse_button::button4 || button == mouse_button::button5) + if (!buffer_ || button == mouse_button::button4 || button == mouse_button::button5) return; // If we hit an inset, we have the inset coordinates in these @@ -1011,9 +1010,6 @@ Inset * BufferView::Pimpl::checkInset(LyXText const & text, Inset * BufferView::Pimpl::checkInsetHit(LyXText * text, int & x, int & y) { - if (!screen_.get()) - return 0; - int y_tmp = y + text->first_y; LyXCursor cursor; @@ -1079,8 +1075,9 @@ void BufferView::Pimpl::workAreaExpose() // The main window size has changed, repaint most stuff redraw(); - } else if (screen_.get()) - screen_->redraw(bv_->text, bv_); + } else { + screen().redraw(bv_->text, bv_); + } } else { // Grey box when we don't have a buffer workarea().greyOut(); @@ -1095,11 +1092,9 @@ void BufferView::Pimpl::workAreaExpose() void BufferView::Pimpl::update() { - if (screen_.get() && - (!bv_->theLockingInset() || !bv_->theLockingInset()->nodraw())) - { + if (!bv_->theLockingInset() || !bv_->theLockingInset()->nodraw()) { LyXText::text_status st = bv_->text->status(); - screen_->update(bv_->text, bv_); + screen().update(bv_->text, bv_); bool fitc = false; while (bv_->text->status() == LyXText::CHANGED_IN_DRAW) { bv_->text->fullRebreak(bv_); @@ -1116,7 +1111,7 @@ void BufferView::Pimpl::update() } fitc = true; bv_->text->status(bv_, st); - screen_->update(bv_->text, bv_); + screen().update(bv_->text, bv_); } // do this here instead of in the screen::update because of // the above loop! @@ -1199,17 +1194,12 @@ void BufferView::Pimpl::cursorToggle() return; } - if (!screen_.get()) { - cursor_timeout.restart(); - return; - } - /* FIXME */ extern void reapSpellchecker(void); reapSpellchecker(); if (!bv_->theLockingInset()) { - screen_->cursorToggle(bv_); + screen().cursorToggle(bv_); } else { bv_->theLockingInset()->toggleInsetCursor(bv_); } @@ -1223,7 +1213,7 @@ void BufferView::Pimpl::cursorPrevious(LyXText * text) if (!text->cursor.row()->previous()) { if (text->first_y > 0) { int new_y = bv_->text->first_y - workarea().height(); - screen_->draw(bv_->text, bv_, new_y < 0 ? 0 : new_y); + screen().draw(bv_->text, bv_, new_y < 0 ? 0 : new_y); updateScrollbar(); } return; @@ -1256,7 +1246,7 @@ void BufferView::Pimpl::cursorPrevious(LyXText * text) - workarea().height() + 1; } } - screen_->draw(bv_->text, bv_, new_y < 0 ? 0 : new_y); + screen().draw(bv_->text, bv_, new_y < 0 ? 0 : new_y); if (text->cursor.row()->previous()) { LyXCursor cur; text->setCursor(bv_, cur, text->cursor.row()->previous()->par(), @@ -1275,7 +1265,7 @@ void BufferView::Pimpl::cursorNext(LyXText * text) int y = text->cursor.y() - text->cursor.row()->baseline() + text->cursor.row()->height(); if (y > int(text->first_y + workarea().height())) { - screen_->draw(bv_->text, bv_, + screen().draw(bv_->text, bv_, bv_->text->first_y + workarea().height()); updateScrollbar(); } @@ -1310,7 +1300,7 @@ void BufferView::Pimpl::cursorNext(LyXText * text) new_y = text->cursor.y() - text->cursor.row()->baseline(); } } - screen_->draw(bv_->text, bv_, new_y); + screen().draw(bv_->text, bv_, new_y); if (text->cursor.row()->next()) { LyXCursor cur; text->setCursor(bv_, cur, text->cursor.row()->next()->par(), @@ -1460,40 +1450,31 @@ void BufferView::Pimpl::focus(bool f) void BufferView::Pimpl::showCursor() { - if (screen_.get()) { - if (bv_->theLockingInset()) - bv_->theLockingInset()->showInsetCursor(bv_); - else - screen_->showCursor(bv_->text, bv_); - } + if (bv_->theLockingInset()) + bv_->theLockingInset()->showInsetCursor(bv_); + else + screen().showCursor(bv_->text, bv_); } void BufferView::Pimpl::hideCursor() { - if (screen_.get()) { - if (!bv_->theLockingInset()) -// bv_->theLockingInset()->hideInsetCursor(bv_); -// else - screen_->hideCursor(); - } + if (!bv_->theLockingInset()) + screen().hideCursor(); } void BufferView::Pimpl::toggleSelection(bool b) { - if (screen_.get()) { - if (bv_->theLockingInset()) - bv_->theLockingInset()->toggleSelection(bv_, b); - screen_->toggleSelection(bv_->text, bv_, b); - } + if (bv_->theLockingInset()) + bv_->theLockingInset()->toggleSelection(bv_, b); + screen().toggleSelection(bv_->text, bv_, b); } void BufferView::Pimpl::toggleToggle() { - if (screen_.get()) - screen_->toggleToggle(bv_->text, bv_); + screen().toggleToggle(bv_->text, bv_); } @@ -1501,9 +1482,9 @@ void BufferView::Pimpl::center() { beforeChange(bv_->text); if (bv_->text->cursor.y() > static_cast((workarea().height() / 2))) { - screen_->draw(bv_->text, bv_, bv_->text->cursor.y() - workarea().height() / 2); + screen().draw(bv_->text, bv_, bv_->text->cursor.y() - workarea().height() / 2); } else { - screen_->draw(bv_->text, bv_, 0); + screen().draw(bv_->text, bv_, 0); } update(bv_->text, BufferView::SELECT|BufferView::FITCUR); redraw(); @@ -1515,7 +1496,7 @@ void BufferView::Pimpl::pasteClipboard(bool asPara) if (!buffer_) return; - screen_->hideCursor(); + screen().hideCursor(); beforeChange(bv_->text); string const clip(workarea().getClipboard()); diff --git a/src/BufferView_pimpl.h b/src/BufferView_pimpl.h index a2f41d2221..ee9ee98e34 100644 --- a/src/BufferView_pimpl.h +++ b/src/BufferView_pimpl.h @@ -21,7 +21,7 @@ class LyXView; class WorkArea; -class LyXScreen; +class LScreen; // FIXME: remove #include @@ -35,6 +35,8 @@ struct BufferView::Pimpl : public boost::signals::trackable { Painter & painter(); /// return the work area for this bview WorkArea & workarea() const; + /// return the screen for this bview + LScreen & screen() const; /// void buffer(Buffer *); /// @@ -175,7 +177,7 @@ private: /// Buffer * buffer_; /// - boost::scoped_ptr screen_; + boost::scoped_ptr screen_; /// boost::scoped_ptr workarea_; /// diff --git a/src/ChangeLog b/src/ChangeLog index 041b4b2c5f..3e83ded21f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2002-06-12 John Levon + + * BufferView.h: + * BufferView.C: + * BufferView2.C: + * BufferView_pimpl.h: + * BufferView_pimpl.C: only construct screen once, + rename + + * lyxrc.C: remove pointless comment + 2002-06-11 John Levon * BufferView.h: diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index bb8585aa8a..45ef546754 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -1,3 +1,8 @@ +2002-06-12 John Levon + + * screen.h: + * screen.C: rename, add reset() + 2002-06-11 John Levon * font_metrics.h: move X-specific stuff out of namespace diff --git a/src/frontends/screen.C b/src/frontends/screen.C index cd4d1d4162..9262d4bb79 100644 --- a/src/frontends/screen.C +++ b/src/frontends/screen.C @@ -52,7 +52,7 @@ GC createGC() // Constructor -LyXScreen::LyXScreen(WorkArea & o) +LScreen::LScreen(WorkArea & o) : owner(o), force_clear(true) { // the cursor isnt yet visible @@ -68,13 +68,29 @@ LyXScreen::LyXScreen(WorkArea & o) } -LyXScreen::~LyXScreen() +LScreen::~LScreen() { XFreeGC(fl_get_display(), gc_copy); } -void LyXScreen::setCursorColor() +void LScreen::reset() +{ + XFreeGC(fl_get_display(), gc_copy); + // the cursor isnt yet visible + cursor_visible = false; + cursor_pixmap = 0; + cursor_pixmap_x = 0; + cursor_pixmap_y = 0; + cursor_pixmap_w = 0; + cursor_pixmap_h = 0; + + // We need this GC + gc_copy = createGC(); +} + + +void LScreen::setCursorColor() { if (!lyxColorHandler.get()) return; @@ -87,7 +103,7 @@ void LyXScreen::setCursorColor() } -void LyXScreen::redraw(LyXText * text, BufferView * bv) +void LScreen::redraw(LyXText * text, BufferView * bv) { drawFromTo(text, bv, 0, owner.height(), 0, 0, text == bv->text); expose(0, 0, owner.workWidth(), owner.height()); @@ -98,7 +114,7 @@ void LyXScreen::redraw(LyXText * text, BufferView * bv) } -void LyXScreen::expose(int x, int y, int exp_width, int exp_height) +void LScreen::expose(int x, int y, int exp_width, int exp_height) { XCopyArea(fl_get_display(), owner.getPixmap(), @@ -111,7 +127,7 @@ void LyXScreen::expose(int x, int y, int exp_width, int exp_height) } -void LyXScreen::drawFromTo(LyXText * text, BufferView * bv, +void LScreen::drawFromTo(LyXText * text, BufferView * bv, int y1, int y2, int y_offset, int x_offset, bool internal) { @@ -158,7 +174,7 @@ void LyXScreen::drawFromTo(LyXText * text, BufferView * bv, } -void LyXScreen::drawOneRow(LyXText * text, BufferView * bv, Row * row, +void LScreen::drawOneRow(LyXText * text, BufferView * bv, Row * row, int y_text, int y_offset, int x_offset) { int const y = y_text - text->first_y + y_offset; @@ -174,7 +190,7 @@ void LyXScreen::drawOneRow(LyXText * text, BufferView * bv, Row * row, /* draws the screen, starting with textposition y. uses as much already * printed pixels as possible */ -void LyXScreen::draw(LyXText * text, BufferView * bv, unsigned int y) +void LScreen::draw(LyXText * text, BufferView * bv, unsigned int y) { if (cursor_visible) hideCursor(); @@ -230,7 +246,7 @@ void LyXScreen::draw(LyXText * text, BufferView * bv, unsigned int y) } -void LyXScreen::showCursor(LyXText const * text, BufferView const * bv) +void LScreen::showCursor(LyXText const * text, BufferView const * bv) { if (!cursor_visible) { Cursor_Shape shape = BAR_SHAPE; @@ -249,7 +265,7 @@ void LyXScreen::showCursor(LyXText const * text, BufferView const * bv) /* returns true if first has changed, otherwise false */ -bool LyXScreen::fitManualCursor(LyXText * text, BufferView * bv, +bool LScreen::fitManualCursor(LyXText * text, BufferView * bv, int /*x*/, int y, int asc, int desc) { int newtop = text->first_y; @@ -272,7 +288,7 @@ bool LyXScreen::fitManualCursor(LyXText * text, BufferView * bv, } -void LyXScreen::showManualCursor(LyXText const * text, int x, int y, +void LScreen::showManualCursor(LyXText const * text, int x, int y, int asc, int desc, Cursor_Shape shape) { // Update the cursor color. @@ -351,7 +367,7 @@ void LyXScreen::showManualCursor(LyXText const * text, int x, int y, } -void LyXScreen::hideCursor() +void LScreen::hideCursor() { if (!cursor_visible) return; @@ -369,7 +385,7 @@ void LyXScreen::hideCursor() } -void LyXScreen::cursorToggle(BufferView * bv) const +void LScreen::cursorToggle(BufferView * bv) const { if (cursor_visible) bv->hideCursor(); @@ -379,7 +395,7 @@ void LyXScreen::cursorToggle(BufferView * bv) const /* returns a new top so that the cursor is visible */ -unsigned int LyXScreen::topCursorVisible(LyXText const * text) +unsigned int LScreen::topCursorVisible(LyXText const * text) { int newtop = text->first_y; @@ -422,7 +438,7 @@ unsigned int LyXScreen::topCursorVisible(LyXText const * text) /* scrolls the screen so that the cursor is visible, if necessary. * returns true if a change was made, otherwise false */ -bool LyXScreen::fitCursor(LyXText * text, BufferView * bv) +bool LScreen::fitCursor(LyXText * text, BufferView * bv) { // Is a change necessary? int const newtop = topCursorVisible(text); @@ -433,7 +449,7 @@ bool LyXScreen::fitCursor(LyXText * text, BufferView * bv) } -void LyXScreen::update(LyXText * text, BufferView * bv, +void LScreen::update(LyXText * text, BufferView * bv, int y_offset, int x_offset) { switch (text->status()) { @@ -474,7 +490,7 @@ void LyXScreen::update(LyXText * text, BufferView * bv, } -void LyXScreen::toggleSelection(LyXText * text, BufferView * bv, +void LScreen::toggleSelection(LyXText * text, BufferView * bv, bool kill_selection, int y_offset, int x_offset) { @@ -503,7 +519,7 @@ void LyXScreen::toggleSelection(LyXText * text, BufferView * bv, } -void LyXScreen::toggleToggle(LyXText * text, BufferView * bv, +void LScreen::toggleToggle(LyXText * text, BufferView * bv, int y_offset, int x_offset) { if (text->toggle_cursor.par() == text->toggle_end_cursor.par() diff --git a/src/frontends/screen.h b/src/frontends/screen.h index f611e8a6e1..b1c8dba237 100644 --- a/src/frontends/screen.h +++ b/src/frontends/screen.h @@ -25,12 +25,12 @@ class BufferView; struct Row; -/** The class LyXScreen is used for the main Textbody. +/** The class LScreen is used for the main Textbody. Concretely, the screen is held in a pixmap. This pixmap is kept up to date and used to optimize drawing on the screen. This class also handles the drawing of the cursor and partly the selection. */ -class LyXScreen { +class LScreen { public: /// enum Cursor_Shape { @@ -43,11 +43,13 @@ public: }; /// - LyXScreen(WorkArea &); + LScreen(WorkArea &); /// - ~LyXScreen(); + ~LScreen(); + void reset(); + /// Sets the cursor color to LColor::cursor. void setCursorColor(); diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index b35fbbcf5d..cc3fc13921 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,8 @@ +2002-06-12 John Levon + + * insettext.h: + * insettext.C: rename/change of LyXScreen + 2002-06-07 Angus Leeming Fixes needed to compile with Compaq cxx 6.5. diff --git a/src/insets/insettext.C b/src/insets/insettext.C index d91d9bd204..3592cb546e 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -486,21 +486,21 @@ void InsetText::draw(BufferView * bv, LyXFont const & f, } } else if (!locked) { if (need_update & CURSOR) { - bv->screen()->toggleSelection(lt, bv, true, y_offset,int(x)); + bv->screen().toggleSelection(lt, bv, true, y_offset,int(x)); lt->clearSelection(); lt->selection.cursor = lt->cursor; } - bv->screen()->update(lt, bv, y_offset, int(x)); + bv->screen().update(lt, bv, y_offset, int(x)); } else { locked = false; if (need_update & SELECTION) { - bv->screen()->toggleToggle(lt, bv, y_offset, int(x)); + bv->screen().toggleToggle(lt, bv, y_offset, int(x)); } else if (need_update & CURSOR) { - bv->screen()->toggleSelection(lt, bv, true, y_offset,int(x)); + bv->screen().toggleSelection(lt, bv, true, y_offset,int(x)); lt->clearSelection(); lt->selection.cursor = lt->cursor; } - bv->screen()->update(lt, bv, y_offset, int(x)); + bv->screen().update(lt, bv, y_offset, int(x)); locked = true; } @@ -2374,9 +2374,7 @@ void InsetText::resizeLyXText(BufferView * bv, bool force) const inset_y = ciy(bv) + drawTextYOffset; } - if (bv->screen()) { - t->first_y = bv->screen()->topCursorVisible(t); - } + t->first_y = bv->screen().topCursorVisible(t); if (!owner()) { updateLocal(bv, FULL, false); // this will scroll the screen such that the cursor becomes visible @@ -2414,9 +2412,7 @@ void InsetText::reinitLyXText() const inset_x = cix(bv) - top_x + drawTextXOffset; inset_y = ciy(bv) + drawTextYOffset; } - if (bv->screen()) { - t->first_y = bv->screen()->topCursorVisible(t); - } + t->first_y = bv->screen().topCursorVisible(t); if (!owner()) { updateLocal(bv, FULL, false); // this will scroll the screen such that the cursor becomes visible @@ -2677,7 +2673,7 @@ void InsetText::toggleSelection(BufferView * bv, bool kill_selection) if (need_update & SELECTION) need_update = NONE; - bv->screen()->toggleSelection(lt, bv, kill_selection, y_offset, x); + bv->screen().toggleSelection(lt, bv, kill_selection, y_offset, x); if (clear) lt = 0; } diff --git a/src/insets/insettext.h b/src/insets/insettext.h index de1e96c9fb..9655cec4b7 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -33,7 +33,6 @@ class Buffer; class BufferParams; class LyXCursor; class LyXText; -class LyXScreen; class Row; /** diff --git a/src/lyxrc.C b/src/lyxrc.C index 310eac244a..5e801533ff 100644 --- a/src/lyxrc.C +++ b/src/lyxrc.C @@ -149,7 +149,6 @@ keyword_item lyxrcTags[] = { { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP } }; -/* Let the range depend of the size of lyxrcTags. Alejandro 240596 */ const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item); } // namespace anon diff --git a/src/lyxtext.h b/src/lyxtext.h index bd27342e77..47746fd127 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -83,7 +83,7 @@ public: mutable LyXFont current_font; /// the current font mutable LyXFont real_current_font; - /// first visible pixel-row is set from LyXScreen!!! + /// first visible pixel-row is set from LScreen!!! // unsigned is wrong here for text-insets! int first_y; /// diff --git a/src/text.C b/src/text.C index 214207ca0a..6ee0977546 100644 --- a/src/text.C +++ b/src/text.C @@ -3034,7 +3034,7 @@ bool LyXText::paintRowBackground(DrawRowParams & p) pos_type const last = rowLastPrintable(p.row); - if (!p.bv->screen()->forceClear() && last == p.row->pos() + if (!p.bv->screen().forceClear() && last == p.row->pos() && p.row->par()->isInset(p.row->pos())) { inset = p.row->par()->getInset(p.row->pos()); if (inset) { -- 2.39.2