]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/screen.C
missed this one yesterday.
[lyx.git] / src / frontends / screen.C
index a98e78b9498d45e5bdc8955f209227b109a668c5..9da9ef054543db7c6aa8358b6e5182007a7c53fa 100644 (file)
@@ -5,7 +5,7 @@
  *
  * \author John Levon
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  *
  * Splash screen code added by Angus Leeming
  */
@@ -220,7 +220,7 @@ void LyXScreen::toggleCursor(BufferView & bv)
 }
 
 
-bool LyXScreen::fitManualCursor(BufferView * bv, LyXText * text,
+bool LyXScreen::fitManualCursor(BufferView * /*bv*/, LyXText * text,
        int /*x*/, int y, int asc, int desc)
 {
        int const vheight = workarea().workHeight();
@@ -236,7 +236,6 @@ bool LyXScreen::fitManualCursor(BufferView * bv, LyXText * text,
        if (newtop == text->top_y())
                return false;
 
-       draw(text, bv, newtop);
        text->top_y(newtop);
        return true;
 }
@@ -251,13 +250,7 @@ unsigned int LyXScreen::topCursorVisible(LyXText * text)
 
        RowList::iterator row = text->cursorRow();
 
-#warning SUPER HACK DISABLED (Lgb)
-#if 0
-       // Is this a hack? Yes, probably... (Lgb)
-       if (!row)
-               return max(newtop, 0);
-#endif
-       if (cursor.y() - row->baseline() + row->height() - top_y >= vheight) {
+       if (int(cursor.y() - row->baseline() + row->height() - top_y) >= vheight) {
                if (row->height() < vheight
                    && row->height() > vheight / 4) {
                        newtop = cursor.y()
@@ -278,9 +271,7 @@ unsigned int LyXScreen::topCursorVisible(LyXText * text)
                }
        }
 
-       newtop = max(newtop, 0);
-
-       return newtop;
+       return max(newtop, 0);
 }
 
 
@@ -289,46 +280,11 @@ 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);
        return result;
 }
 
 
-void LyXScreen::toggleSelection(LyXText * text, BufferView * bv,
-                               bool kill_selection,
-                               int yo, int xo)
-{
-       // only if there is a selection
-       if (!text->selection.set())
-               return;
-
-       int const bottom = min(
-               max(int(text->selection.end.y()
-                                    - text->getRow(text->selection.end)->baseline()
-                                    + text->getRow(text->selection.end)->height()),
-                   text->top_y()),
-               int(text->top_y() + workarea().workHeight()));
-       int const top = min(
-               max(int(text->selection.start.y() -
-                                    text->getRow(text->selection.start)->baseline()),
-                   text->top_y()),
-               int(text->top_y() + workarea().workHeight()));
-
-       if (kill_selection)
-               text->selection.set(false);
-
-       workarea().getPainter().start();
-
-       drawFromTo(text, bv, top - text->top_y(), bottom - text->top_y(), yo, xo);
-       expose(0, top - text->top_y(), workarea().workWidth(), bottom - top);
-
-       workarea().getPainter().end();
-}
-
-
 void LyXScreen::redraw(BufferView & bv)
 {
        greyed_out_ = !bv.text;
@@ -340,8 +296,18 @@ void LyXScreen::redraw(BufferView & bv)
 
        workarea().getPainter().start();
 
-       bv.text->updateRowPositions();
-       drawFromTo(bv.text, &bv, 0, workarea().workHeight(), 0, 0);
+       hideCursor();
+
+       int const y = paintText(bv, *bv.text);
+
+       // maybe we have to clear the screen at the bottom
+       int const y2 = workarea().workHeight();
+       if (y < y2 && !bv.text->isInInset()) {
+               workarea().getPainter().fillRectangle(0, y,
+                       workarea().workWidth(), y2 - y,
+                       LColor::bottomarea);
+       }
+
        expose(0, 0, workarea().workWidth(), workarea().workHeight());
 
        workarea().getPainter().end();
@@ -372,36 +338,11 @@ 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)
-{
-       lyxerr[Debug::GUI] << "screen: drawFromTo " << y1 << '-' << y2 << endl;
-       hideCursor();
-
-       int const topy = text->top_y();
-       int y_text = topy + y1;
-       RowList::iterator rit = text->getRowNearY(y_text);
-       int y = y_text - topy;
-
-       y = paintRows(*bv, *text, rit, xo, y, y, y2, yo);
-
-       // maybe we have to clear the screen at the bottom
-       if (y < y2 && !text->isInInset()) {
-               workarea().getPainter().fillRectangle(0, y,
-                       workarea().workWidth(), y2 - y,
-                       LColor::bottomarea);
-       }
-}