#include "rowpainter.h"
#include "insets/updatableinset.h"
#include "mathed/formulabase.h"
+#include "lyx_gui.h"
// Splash screen-specific stuff
#include "lyxfont.h"
#include <boost/bind.hpp>
#include <boost/signals/trackable.hpp>
+using namespace lyx::support;
+
using std::min;
using std::max;
using std::endl;
+namespace grfx = lyx::graphics;
+
namespace {
class SplashScreen : boost::noncopyable, boost::signals::trackable {
void LyXScreen::showCursor(BufferView & bv)
{
+ // this is needed to make sure we copy back the right
+ // pixmap on the hide for the Qt frontend
+ lyx_gui::sync_events();
+
if (cursor_visible_)
return;
if (y < 0 || y + h > workarea().workHeight())
return;
- showCursor(x, y, h, shape);
-
cursor_visible_ = true;
+ showCursor(x, y, h, shape);
}
if (!cursor_visible_)
return;
- removeCursor();
cursor_visible_ = false;
+ removeCursor();
}
}
-unsigned int LyXScreen::topCursorVisible(LyXCursor const & cursor, int top_y)
+unsigned int LyXScreen::topCursorVisible(LyXText * text)
{
- int const vheight = workarea().workHeight();
+ LyXCursor const & cursor = text->cursor;
+ int top_y = text->top_y();
int newtop = top_y;
+ int const vheight = workarea().workHeight();
- RowList::iterator row = cursor.row();
+ RowList::iterator row = text->cursorRow();
#warning SUPER HACK DISABLED (Lgb)
#if 0
+ row->height()
- row->baseline() - vheight;
} else {
- // scroll down
- newtop = cursor.y()
- - vheight / 2; /* the scroll region must be so big!! */
+ // scroll down, the scroll region must be so big!!
+ newtop = cursor.y() - vheight / 2;
}
} else if (static_cast<int>((cursor.y()) - row->baseline()) <
bool LyXScreen::fitCursor(LyXText * text, BufferView * bv)
{
// Is a change necessary?
- int const newtop = topCursorVisible(text->cursor, text->top_y());
+ int const newtop = topCursorVisible(text);
bool const result = (newtop != text->top_y());
if (result) {
draw(text, bv, newtop);
int const bottom = min(
max(static_cast<int>(text->selection.end.y()
- - text->selection.end.row()->baseline()
- + text->selection.end.row()->height()),
+ - 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->selection.start.row()->baseline()),
+ text->getRow(text->selection.start)->baseline()),
text->top_y()),
static_cast<int>(text->top_y() + workarea().workHeight()));
return;
int const top_tmp = text->toggle_cursor.y()
- - text->toggle_cursor.row()->baseline();
+ - text->getRow(text->toggle_cursor)->baseline();
int const bottom_tmp = text->toggle_end_cursor.y()
- - text->toggle_end_cursor.row()->baseline()
- + text->toggle_end_cursor.row()->height();
+ - text->getRow(text->toggle_end_cursor)->baseline()
+ + text->getRow(text->toggle_end_cursor)->height();
int const offset = yo < 0 ? yo : 0;
int const bottom = min(max(bottom_tmp, text->top_y()),