]> git.lyx.org Git - features.git/commitdiff
Rename screen, and don't re-construct it on a buffer change (that is far too
authorJohn Levon <levon@movementarian.org>
Tue, 11 Jun 2002 23:47:58 +0000 (23:47 +0000)
committerJohn Levon <levon@movementarian.org>
Tue, 11 Jun 2002 23:47:58 +0000 (23:47 +0000)
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

15 files changed:
src/BufferView.C
src/BufferView.h
src/BufferView2.C
src/BufferView_pimpl.C
src/BufferView_pimpl.h
src/ChangeLog
src/frontends/ChangeLog
src/frontends/screen.C
src/frontends/screen.h
src/insets/ChangeLog
src/insets/insettext.C
src/insets/insettext.h
src/lyxrc.C
src/lyxtext.h
src/text.C

index 3f13e556c2bf7e299d05c056f8e732e9d937320f..5a2047f3152726f7ef89af2394f7d69abe3a4d08 100644 (file)
@@ -42,9 +42,9 @@ Buffer * BufferView::buffer() const
 }
 
 
-LyXScreen * BufferView::screen() const
+LScreen & BufferView::screen() const
 {
-       return pimpl_->screen_.get();
+       return pimpl_->screen();
 }
 
 
index 761e34ab06949c2faf1db5a03ca7a62f9e5fbcd7..da22d8781a682953241d8962ca91b69123d7dfd9 100644 (file)
@@ -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);
        ///
index fb7c29762da5137bc16ff119a6c82eabc50df4f6..9f069b190503e60f4f4943d051bbe8d55fe65997 100644 (file)
@@ -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);
index 0667bfbeb29b293ccd24370ea3dd04377e416568..669255ad92472512565efe042b075a2c94c21c2c 100644 (file)
@@ -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<int>((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());
index a2f41d22212ffec7c9aee905b723bb3ce6557339..ee9ee98e340d304f91ed37c4f4f6c9bc13af3bf4 100644 (file)
@@ -21,7 +21,7 @@
 
 class LyXView;
 class WorkArea;
-class LyXScreen;
+class LScreen;
 
 // FIXME: remove
 #include <X11/Xlib.h>
@@ -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<LyXScreen> screen_;
+       boost::scoped_ptr<LScreen> screen_;
        ///
        boost::scoped_ptr<WorkArea> workarea_;
        ///
index 041b4b2c5f12c671a52cf66ab5bdaaab857f6a99..3e83ded21f0e06d77afb403362f32bec58c2068a 100644 (file)
@@ -1,3 +1,14 @@
+2002-06-12  John Levon  <moz@compsoc.man.ac.uk>
+
+       * 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  <moz@compsoc.man.ac.uk>
 
        * BufferView.h: 
index bb8585aa8a8b5f643999c1dcea58d142d3112f52..45ef5467544db7945d5cc2abcd5799483ebd71b7 100644 (file)
@@ -1,3 +1,8 @@
+2002-06-12  John Levon  <moz@compsoc.man.ac.uk>
+
+       * screen.h:
+       * screen.C: rename, add reset()
 2002-06-11  John Levon  <moz@compsoc.man.ac.uk>
 
        * font_metrics.h: move X-specific stuff out of namespace
index cd4d1d416282c471a61f76cb612e24b81f15abc9..9262d4bb79bf6085a2beb4b97a4966c512d573c4 100644 (file)
@@ -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()
index f611e8a6e118411a27a5f9c955c68c1dc611a5d7..b1c8dba237df1f940439b3ccd1a544b732d295a6 100644 (file)
@@ -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();
 
index b35fbbcf5d3642b2de3eb25ca82bd9b1abd5aeae..cc3fc13921d196d3153d8e98be14f12e5d848310 100644 (file)
@@ -1,3 +1,8 @@
+2002-06-12  John Levon  <moz@compsoc.man.ac.uk>
+
+       * insettext.h:
+       * insettext.C: rename/change of LyXScreen
 2002-06-07  Angus Leeming  <leeming@lyx.org>
 
        Fixes needed to compile with Compaq cxx 6.5.
index d91d9bd2045ee49680520e1762b272c1a3ed3f83..3592cb546e791729e72fd34f01ea343bcb9c5f28 100644 (file)
@@ -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;
 }
index de1e96c9fb73d047c3bee15fa64104c6514799e5..9655cec4b72251487e91194a987465da4c58c4e6 100644 (file)
@@ -33,7 +33,6 @@ class Buffer;
 class BufferParams;
 class LyXCursor;
 class LyXText;
-class LyXScreen;
 class Row;
 
 /**
index 310eac244a8e8d6a7892f631e35187b2863d1a6d..5e801533ff0eed2beca7ec175fdbc1503dcd24ff 100644 (file)
@@ -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
index bd27342e775724bba3d0e179e674273cd85fee13..47746fd1275771d92e23d5698dc57c993510d349 100644 (file)
@@ -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;
        ///
index 214207ca0aaf3b51aa8a47c150e3fbdfdc295742..6ee09775462a58457e15366198ffa605fd1ef4c3 100644 (file)
@@ -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) {