static Cursor cursor;
static bool cursor_undefined = true;
if (cursor_undefined){
- cursor = XCreateFontCursor(fl_display, XC_xterm);
- XFlush(fl_display);
+ cursor = XCreateFontCursor(fl_get_display(), XC_xterm);
+ XFlush(fl_get_display());
cursor_undefined = false;
}
- XDefineCursor(fl_display, win, cursor);
- XFlush(fl_display);
+ XDefineCursor(fl_get_display(), win, cursor);
+ XFlush(fl_get_display());
}
bv_->text->first = screen_->TopCursorVisible(bv_->text);
owner_->updateMenubar();
owner_->updateToolbar();
- redraw();
+ // Similarly, buffer-dependent dialogs should be updated or
+ // hidden. This should go here because some dialogs (eg ToC)
+ // require bv_->text.
owner_->getDialogs()->updateBufferDependent();
+ redraw();
bv_->insetWakeup();
} else {
lyxerr[Debug::INFO] << " No Buffer!" << endl;
owner_->updateMenubar();
owner_->updateToolbar();
+ owner_->getDialogs()->hideBufferDependent();
updateScrollbar();
workarea_->redraw();
// Callback for scrollbar slider
void BufferView::Pimpl::scrollCB(double value)
{
- extern bool cursor_follows_scrollbar;
-
if (buffer_ == 0) return;
current_scrollbar_value = long(value);
screen_->Draw(bv_->text, current_scrollbar_value);
- if (cursor_follows_scrollbar) {
+ if (lyxrc.cursor_follows_scrollbar) {
LyXText * vbt = bv_->text;
- unsigned int height = vbt->DefaultHeight();
+ int height = vbt->DefaultHeight();
if (vbt->cursor.y() < (int)(bv_->text->first + height)) {
vbt->SetCursorFromCoordinates(bv_, 0,
void BufferView::Pimpl::leaveView()
{
if (using_xterm_cursor) {
- XUndefineCursor(fl_display, workarea_->getWin());
+ XUndefineCursor(fl_get_display(), workarea_->getWin());
using_xterm_cursor = false;
}
}
LyXFont font = text->GetFont(bv_->buffer(),
cursor.par(), cursor.pos());
bool is_rtl = font.isVisibleRightToLeft();
- int start_x, end_x;
+ int start_x;
+ int end_x;
if (is_rtl) {
start_x = cursor.x() - tmpinset->width(bv_, font) + tmpinset->scroll();
LyXFont font = text->GetFont(bv_->buffer(), cursor.par(),
cursor.pos()-1);
bool is_rtl = font.isVisibleRightToLeft();
- int start_x, end_x;
+ int start_x;
+ int end_x;
if (!is_rtl) {
start_x = cursor.x() - tmpinset->width(bv_, font) +
}
-void BufferView::Pimpl::cursorPrevious()
+void BufferView::Pimpl::cursorPrevious(LyXText * text)
{
- if (!bv_->text->cursor.row()->previous()) return;
+ if (!text->cursor.row()->previous())
+ return;
- int y = bv_->text->first;
- Row * cursorrow = bv_->text->cursor.row();
- bv_->text->SetCursorFromCoordinates(bv_, bv_->text->cursor.x_fix(), y);
+ int y = text->first;
+ if (text->inset_owner)
+ y += bv_->text->first;
+ Row * cursorrow = text->cursor.row();
+ text->SetCursorFromCoordinates(bv_, bv_->text->cursor.x_fix(), y);
bv_->text->FinishUndo();
// This is to allow jumping over large insets
- if ((cursorrow == bv_->text->cursor.row()))
- bv_->text->CursorUp(bv_);
+ if ((cursorrow == text->cursor.row()))
+ text->CursorUp(bv_);
- if (bv_->text->cursor.row()->height() < workarea_->height())
+ if (text->inset_owner ||
+ text->cursor.row()->height() < workarea_->height())
screen_->Draw(bv_->text,
- bv_->text->cursor.y()
- - bv_->text->cursor.row()->baseline()
- + bv_->text->cursor.row()->height()
+ text->cursor.y()
+ - text->cursor.row()->baseline()
+ + text->cursor.row()->height()
- workarea_->height() + 1 );
updateScrollbar();
}
-void BufferView::Pimpl::cursorNext()
+void BufferView::Pimpl::cursorNext(LyXText * text)
{
- if (!bv_->text->cursor.row()->next()) return;
+ if (!text->cursor.row()->next())
+ return;
- int y = bv_->text->first;
- bv_->text->GetRowNearY(y);
- Row * cursorrow = bv_->text->cursor.row();
- bv_->text->SetCursorFromCoordinates(bv_, bv_->text->cursor.x_fix(), y
+ int y = text->first;
+// if (text->inset_owner)
+// y += bv_->text->first;
+ text->GetRowNearY(y);
+ Row * cursorrow = text->cursor.row();
+ text->SetCursorFromCoordinates(bv_, text->cursor.x_fix(), y
+ workarea_->height());
bv_->text->FinishUndo();
// This is to allow jumping over large insets
if ((cursorrow == bv_->text->cursor.row()))
- bv_->text->CursorDown(bv_);
+ text->CursorDown(bv_);
- if (bv_->text->cursor.row()->height() < workarea_->height())
- screen_->Draw(bv_->text, bv_->text->cursor.y()
- - bv_->text->cursor.row()->baseline());
+ if (text->inset_owner ||
+ text->cursor.row()->height() < workarea_->height())
+ screen_->Draw(bv_->text, text->cursor.y() -
+ text->cursor.row()->baseline());
updateScrollbar();
}