*
* \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
*/
}
-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();
if (newtop == text->top_y())
return false;
- draw(text, bv, newtop);
text->top_y(newtop);
return true;
}
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()
}
}
- newtop = max(newtop, 0);
-
- return newtop;
+ return max(newtop, 0);
}
// 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::update(BufferView & bv, int yo, int xo)
+void LyXScreen::redraw(BufferView & bv)
{
- LyXText * text = bv.text;
-
- workarea().getPainter().start();
+ greyed_out_ = !bv.text;
- if (text->needRefresh()) {
- int const vwidth = workarea().workWidth();
- int const vheight = workarea().workHeight();
- text->updateRowPositions();
- int const y = 0;
- drawFromTo(text, &bv, y, vheight, yo, xo);
- expose(0, y, vwidth, vheight - y);
+ if (greyed_out_) {
+ greyOut();
+ return;
}
- workarea().getPainter().end();
-}
-
-
-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(static_cast<int>(text->selection.end.y()
- - text->getRow(text->selection.end)->baseline()
- + text->getRow(text->selection.end)->height()),
- text->top_y()),
- static_cast<int>(text->top_y() + workarea().workHeight()));
- int const top = min(
- max(static_cast<int>(text->selection.start.y() -
- text->getRow(text->selection.start)->baseline()),
- text->top_y()),
- static_cast<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 - text->top_y() - (top - text->top_y()));
-
- workarea().getPainter().end();
-}
+ hideCursor();
+ int const y = paintText(bv, *bv.text);
-void LyXScreen::redraw(BufferView * bv, LyXText * text)
-{
- greyed_out_ = !text;
-
- if (greyed_out_) {
- greyOut();
- return;
+ // 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);
}
- workarea().getPainter().start();
-
- text->updateRowPositions();
- drawFromTo(text, bv, 0, workarea().workHeight(), 0, 0);
expose(0, 0, workarea().workWidth(), workarea().workHeight());
workarea().getPainter().end();
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);
- }
-}