}
-void BufferView::showCursor()
-{
- pimpl_->showCursor();
-}
-
-
-void BufferView::hideCursor()
-{
- pimpl_->hideCursor();
-}
-
-
void BufferView::toggleSelection(bool b)
{
pimpl_->toggleSelection(b);
return;
owner()->message(_("Undo"));
- hideCursor();
beforeChange(text);
update(text, BufferView::SELECT);
if (!textUndo(this))
return;
owner()->message(_("Redo"));
- hideCursor();
beforeChange(text);
update(text, BufferView::SELECT);
if (!textRedo(this))
return;
LyXCursor cur = text->selection.cursor;
- hideCursor();
beforeChange(text);
text->selection.cursor = cur;
text->selectSelectedWord();
{
if (!available()) return;
- hideCursor();
beforeChange(text);
text->selectSelectedWord();
text->clearSelection();
return;
LyXText * tt = getLyXText();
- hideCursor();
update(tt, BufferView::SELECT);
// clear the selection (if there is any)
}
-void BufferView::showLockedInsetCursor(int x, int y, int asc, int desc)
-{
- if (available() && theLockingInset() && !theLockingInset()->nodraw()) {
- LyXCursor cursor = text->cursor;
- Inset * locking_inset = theLockingInset()->getLockingInset();
-
- if ((cursor.pos() - 1 >= 0) &&
- cursor.par()->isInset(cursor.pos() - 1) &&
- (cursor.par()->getInset(cursor.pos() - 1) ==
- locking_inset))
- text->setCursor(cursor,
- cursor.par(), cursor.pos() - 1);
- LyXScreen::Cursor_Shape shape = LyXScreen::BAR_SHAPE;
- LyXText * txt = getLyXText();
- if (locking_inset->isTextInset() &&
- locking_inset->lyxCode() != Inset::ERT_CODE &&
- (txt->real_current_font.language() !=
- buffer()->params.language
- || txt->real_current_font.isVisibleRightToLeft()
- != buffer()->params.language->RightToLeft()))
- shape = (txt->real_current_font.isVisibleRightToLeft())
- ? LyXScreen::REVERSED_L_SHAPE
- : LyXScreen::L_SHAPE;
- y += cursor.iy() + theLockingInset()->insetInInsetY();
- screen().showManualCursor(text, x, y, asc, desc,
- shape);
- }
-}
-
-
-void BufferView::hideLockedInsetCursor()
-{
- if (theLockingInset() && available()) {
- screen().hideCursor();
- }
-}
-
-
bool BufferView::fitLockedInsetCursor(int x, int y, int asc, int desc)
{
if (theLockingInset() && available()) {
}
+void BufferView::hideCursor()
+{
+ screen().hideCursor();
+}
+
+
int BufferView::unlockInset(UpdatableInset * inset)
{
if (!inset)
/// Inserts a lyx file at cursor position. return false if it fails
bool insertLyXFile(string const & file);
- /// show the user cursor
- void showCursor();
- /// hide the user cursor
- void hideCursor();
- /// FIXME
- void showLockedInsetCursor(int x, int y, int asc, int desc);
- /// FIXME
- void hideLockedInsetCursor();
/// FIXME
bool fitLockedInsetCursor(int x, int y, int asc, int desc);
/// FIXME
/// FIXME: my word !
void toggleToggle();
+ /// hide the cursor if it is visible
+ void hideCursor();
+
/// center the document view around the cursor
void center();
/// scroll document by the given number of lines of default height
if (!buffer_)
return;
+ screen().hideCursor();
+
screen().draw(bv_->text, bv_, value);
if (!lyxrc.cursor_follows_scrollbar)
key_modifier::state state)
{
bv_->owner()->getLyXFunc().processKeySym(key, state);
+
+ /* This is perhaps a bit of a hack. When we move
+ * around, or type, it's nice to be able to see
+ * the cursor immediately after the keypress. So
+ * we reset the toggle timeout and force the visibility
+ * of the cursor. Note we cannot do this inside
+ * dispatch() itself, because that's called recursively.
+ */
+ if (available()) {
+ cursor_timeout.restart();
+ screen().showCursor(*bv_);
+ }
}
void BufferView::Pimpl::selectionLost()
{
if (available()) {
- hideCursor();
+ screen().hideCursor();
toggleSelection();
bv_->getLyXText()->clearSelection();
- showCursor();
bv_->text->xsel_cache.set(false);
}
}
return;
}
- if (!bv_->theLockingInset()) {
- screen().cursorToggle(bv_);
- } else {
- bv_->theLockingInset()->toggleInsetCursor(bv_);
- }
+ screen().toggleCursor(*bv_);
cursor_timeout.restart();
}
}
-void BufferView::Pimpl::showCursor()
-{
- if (bv_->theLockingInset())
- bv_->theLockingInset()->showInsetCursor(bv_);
- else
- screen().showCursor(bv_->text, bv_);
-}
-
-
-void BufferView::Pimpl::hideCursor()
-{
- if (!bv_->theLockingInset())
- screen().hideCursor();
-}
-
-
void BufferView::Pimpl::toggleSelection(bool b)
{
if (bv_->theLockingInset())
if (!available())
return false;
+ screen().hideCursor();
+
bool const res = dispatch(ev_in);
+ // see workAreaKeyPress
+ cursor_timeout.restart();
+ screen().showCursor(*bv_);
+
// FIXME: we should skip these when selecting
bv_->owner()->updateLayoutChoice();
bv_->owner()->updateToolbar();
Inset * tl_inset = inset;
while (tl_inset->owner())
tl_inset = tl_inset->owner();
- hideCursor();
if (tl_inset == inset) {
update(BufferView::UPDATE);
if (bv_->text->updateInset(inset)) {
///
void insetUnlock();
///
- void showCursor();
- ///
- void hideCursor();
- ///
void toggleSelection(bool = true);
///
void toggleToggle();
+2003-05-03 John Levon <levon@movementarian.org>
+
+ * BufferView.h:
+ * BufferView.C: remove showLockedInsetCursor(), showCursor(),
+ explicit cursor show/hide
+
+ * BufferView_pimpl.h:
+ * BufferView_pimpl.C: hide cursor before dispatching. Show cursor
+ after a cursor move lfun. Simplify cursorToggle(). Remove show/hideCursor().
+
+ * lyxfunc.C: hide cursor before dispatching.
+
+ * lyx_cb.C:
+ * lyxfind.C:
+ * text.C:
+ * text3.C: remove explicit cursor hides
2003-05-02 André Pönitz <poenitz@gmx.net>
if (test_only)
return text->changeDepth(type, true);
- bv->hideCursor();
bv->update(BufferView::SELECT);
bool const changed = text->changeDepth(type, false);
if (text->inset_owner)
if (!text)
return;
- bv->hideCursor();
bv->update(text, BufferView::SELECT);
text->toggleFree(font, toggleall);
bv->update(text, BufferView::SELECT);
+2003-05-03 John Levon <levon@movementarian.org>
+
+ * screen.h:
+ * screen.C: replace cursor code with simpler variant
+ that calculates the cursor pos via inset inspector. Hide
+ the cursor before a paint. Make Cursor_Shape protected.
+
2003-04-27 John Levon <levon@movementarian.org>
* Alert.h:
+2003-05-03 John Levon <levon@movementarian.org>
+
+ * qscreen.h:
+ * qscreen.C: implement new cursor API
+
2003-04-29 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* QPrefs.C (apply): only set colors if they are different from
}
-void QScreen::showManualCursor(LyXText const * text, int x, int y,
- int asc, int desc, Cursor_Shape shape)
-{
- if (!qApp->focusWidget())
- return;
-
- int const y1 = max(y - text->top_y() - asc, 0);
- int const y_tmp = min(y - text->top_y() + desc, owner_.height());
-
- // secure against very strange situations
- // which would be when .... ?
- int const y2 = max(y_tmp, y1);
-
- if (y2 > 0 && y1 < owner_.height()) {
- cursor_h_ = y2 - y1 + 1;
- cursor_y_ = y1;
-
- switch (shape) {
- case BAR_SHAPE:
- cursor_w_ = 1;
- cursor_x_ = x;
- break;
- case L_SHAPE:
- cursor_w_ = cursor_h_ / 3;
- cursor_x_ = x;
- break;
- case REVERSED_L_SHAPE:
- cursor_w_ = cursor_h_ / 3;
- cursor_x_ = x - cursor_w_ + 1;
- break;
- }
-
- if (!nocursor_pixmap_.get()
- || cursor_w_ != nocursor_pixmap_->width()
- || cursor_h_ != nocursor_pixmap_->height()) {
- nocursor_pixmap_.reset(new QPixmap(cursor_w_, cursor_h_));
- }
-
- owner_.getPainter().start();
-
- // save old area
- bitBlt(nocursor_pixmap_.get(), 0, 0, owner_.getPixmap(),
- cursor_x_, cursor_y_, cursor_w_, cursor_h_);
-
- owner_.getPainter().line(x, y1, x, y2, LColor::cursor);
- switch (shape) {
- case BAR_SHAPE:
- break;
- case L_SHAPE:
- case REVERSED_L_SHAPE:
- int const rectangle_h = (cursor_h_ + 10) / 20;
- owner_.getPainter().fillRectangle(
- cursor_x_, y2 - rectangle_h + 1,
- cursor_w_ - 1, rectangle_h, LColor::cursor);
- break;
- }
-
- owner_.getPainter().end();
-
- owner_.getContent()->repaint(
- cursor_x_, cursor_y_,
- cursor_w_, cursor_h_);
-
- }
- cursor_visible_ = true;
-}
-
-
-void QScreen::hideCursor()
-{
- if (!cursor_visible_)
- return;
-
- bitBlt(owner_.getPixmap(), cursor_x_, cursor_y_,
- nocursor_pixmap_.get(), 0, 0, cursor_w_, cursor_h_);
-
- owner_.getContent()->repaint(
- cursor_x_, cursor_y_,
- cursor_w_, cursor_h_);
-
- cursor_visible_ = false;
-}
-
-
void QScreen::repaint()
{
QWidget * content(owner_.getContent());
owner_.getPainter().start();
- if (cursor_visible_) hideCursor();
-
int const old_first = text->top_y();
text->top_y(y);
owner_.getPainter().end();
}
+
+
+void QScreen::showCursor(int x, int y, int h, Cursor_Shape shape)
+{
+ cursor_x_ = x;
+ cursor_y_ = y;
+ cursor_h_ = h;
+
+ switch (shape) {
+ case BAR_SHAPE:
+ cursor_w_ = 1;
+ break;
+ case L_SHAPE:
+ cursor_w_ = cursor_h_ / 3;
+ break;
+ case REVERSED_L_SHAPE:
+ cursor_w_ = cursor_h_ / 3;
+ cursor_x_ = x - cursor_w_ + 1;
+ break;
+ }
+
+ if (!nocursor_pixmap_.get()
+ || cursor_w_ != nocursor_pixmap_->width()
+ || cursor_h_ != nocursor_pixmap_->height()) {
+ nocursor_pixmap_.reset(new QPixmap(cursor_w_, cursor_h_));
+ }
+
+ // save old area
+ bitBlt(nocursor_pixmap_.get(), 0, 0, owner_.getPixmap(),
+ cursor_x_, cursor_y_, cursor_w_, cursor_h_);
+
+ if (!qApp->focusWidget())
+ return;
+
+ Painter & pain(owner_.getPainter());
+ pain.start();
+ pain.line(x, y, x, y + h - 1, LColor::cursor);
+
+ switch (shape) {
+ case BAR_SHAPE:
+ break;
+ case REVERSED_L_SHAPE:
+ case L_SHAPE:
+ pain.line(cursor_x_, y + h - 1, cursor_x_ + cursor_w_ - 1,
+ y + h - 1, LColor::cursor);
+ break;
+ }
+
+ pain.end();
+
+ owner_.getContent()->repaint(
+ cursor_x_, cursor_y_,
+ cursor_w_, cursor_h_);
+}
+
+
+void QScreen::removeCursor()
+{
+ // before first showCursor
+ if (!nocursor_pixmap_.get())
+ return;
+
+ bitBlt(owner_.getPixmap(), cursor_x_, cursor_y_,
+ nocursor_pixmap_.get(), 0, 0, cursor_w_, cursor_h_);
+
+ owner_.getContent()->repaint(
+ cursor_x_, cursor_y_,
+ cursor_w_, cursor_h_);
+}
*/
virtual void draw(LyXText *, BufferView *, unsigned int y);
- /**
- * showManualCursor - display the caret on the work area
- * @param text the lyx text containing the cursor
- * @param x the x position of the cursor
- * @param y the y position of the row's baseline
- * @param asc ascent of the row
- * @param desc descent of the row
- * @param shape the current shape
- */
- virtual void showManualCursor(LyXText const *, int x, int y,
- int asc, int desc,
- Cursor_Shape shape);
-
- /// unpaint the cursor painted by showManualCursor()
- virtual void hideCursor();
-
protected:
/// get the work area
virtual WorkArea & workarea() const { return owner_; }
/// copies specified area of pixmap to screen
virtual void expose(int x, int y, int exp_width, int exp_height);
+ /// paint the cursor and store the background
+ virtual void showCursor(int x, int y, int h, Cursor_Shape shape);
+
+ /// hide the cursor
+ virtual void removeCursor();
+
private:
/// our owning widget
QWorkArea & owner_;
- /// the mini-pixmap used for backing store for the blinking cursor
boost::scoped_ptr<QPixmap> nocursor_pixmap_;
//@{ the cursor pixmap position/size
#include "language.h"
#include "debug.h"
#include "rowpainter.h"
+#include "insets/updatableinset.h"
+#include "mathed/formulabase.h"
// Splash screen-specific stuff
#include "lyxfont.h"
{
}
-// FIXME: GUII these cursor methods need to decide
-// whether the workarea is focused or not
-void LyXScreen::showCursor(LyXText const * text, BufferView const * bv)
+void LyXScreen::showCursor(BufferView & bv)
{
if (cursor_visible_)
return;
- workarea().getPainter().start();
+ if (!bv.available())
+ return;
Cursor_Shape shape = BAR_SHAPE;
- BufferParams const & bp(bv->buffer()->params);
- LyXFont const & realfont(text->real_current_font);
-
- if (realfont.language() != bp.language
- || realfont.isVisibleRightToLeft()
- != bp.language->RightToLeft()) {
- shape = (realfont.isVisibleRightToLeft())
- ? REVERSED_L_SHAPE : L_SHAPE;
+
+ LyXText const & text = *bv.getLyXText();
+ LyXFont const & realfont(text.real_current_font);
+ BufferParams const & bp(bv.buffer()->params);
+ bool const samelang = realfont.language() == bp.language;
+ bool const isrtl = realfont.isVisibleRightToLeft();
+
+ if (!samelang || isrtl != bp.language->RightToLeft()) {
+ shape = L_SHAPE;
+ if (isrtl)
+ shape = REVERSED_L_SHAPE;
}
- showManualCursor(text, text->cursor.x(), text->cursor.y(),
- font_metrics::maxAscent(realfont),
- font_metrics::maxDescent(realfont),
- shape);
+ int ascent = font_metrics::maxAscent(realfont);
+ int descent = font_metrics::maxDescent(realfont);
+ int h = ascent + descent;
+ int x = 0;
+ int y = 0;
+ int const top_y = bv.text->top_y();
+
+ if (bv.theLockingInset()) {
+ // Would be nice to clean this up to make some understandable sense...
+ UpdatableInset * inset = bv.theLockingInset();
+ inset->getCursor(bv, x, y);
+
+ // Non-obvious. The reason we have to have these
+ // extra checks is that the ->getCursor() calls rely
+ // on the inset's own knowledge of its screen position.
+ // If we scroll up or down in a big enough increment, the
+ // inset->draw() is not called: this doesn't update
+ // inset.top_baseline, so getCursor() returns an old value.
+ // Ugly as you like.
+ int bx, by;
+ inset->getCursorPos(&bv, bx, by);
+ by += inset->insetInInsetY() + bv.text->cursor.iy();
+ if (by < top_y)
+ return;
+ if (by > top_y + workarea().workHeight())
+ return;
+ } else {
+ x = bv.text->cursor.x();
+ y = bv.text->cursor.y();
+ y -= top_y;
+ }
- workarea().getPainter().end();
+ y -= ascent;
+
+ // if it doesn't fit entirely on the screen, don't try to show it
+ if (y < 0 || y + h > workarea().workHeight())
+ return;
+
+ showCursor(x, y, h, shape);
+
+ cursor_visible_ = true;
+}
+
+
+void LyXScreen::hideCursor()
+{
+ if (!cursor_visible_)
+ return;
+
+ removeCursor();
+ cursor_visible_ = false;
+}
+
+
+void LyXScreen::toggleCursor(BufferView & bv)
+{
+ if (cursor_visible_)
+ hideCursor();
+ else
+ showCursor(bv);
}
}
-void LyXScreen::cursorToggle(BufferView * bv) const
-{
- if (cursor_visible_)
- bv->hideCursor();
- else
- bv->showCursor();
-}
-
-
unsigned int LyXScreen::topCursorVisible(LyXCursor const & cursor, int top_y)
{
int const vheight = workarea().workHeight();
expose(0, 0, workarea().workWidth(), workarea().workHeight());
workarea().getPainter().end();
-
- if (cursor_visible_) {
- cursor_visible_ = false;
- bv->showCursor();
- }
}
int y = y_text - topy;
// y1 is now the real beginning of row on the screen
+ hideCursor();
+
RowList::iterator const rend = text->rows().end();
while (rit != rend && y < y2) {
RowPainter rp(*bv, *text, rit);
if (y - row->height() > workarea().workHeight())
return;
+ hideCursor();
+
RowPainter rp(*bv, *text, row);
rp.paint(y, xo, y + text->top_y());
}
*/
class LyXScreen {
public:
- /// types of cursor in work area
- enum Cursor_Shape {
- /// normal I-beam
- BAR_SHAPE,
- /// L-shape for locked insets of a different language
- L_SHAPE,
- /// reverse L-shape for RTL text
- REVERSED_L_SHAPE
- };
-
LyXScreen();
virtual ~LyXScreen();
*/
virtual void draw(LyXText *, BufferView *, unsigned int y) = 0;
- /**
- * showManualCursor - display the cursor on the work area
- * @param text the lyx text containing the cursor
- * @param x the x position of the cursor
- * @param y the y position of the row's baseline
- * @param asc ascent of the row
- * @param desc descent of the row
- * @param shape the current shape
- */
- virtual void showManualCursor(LyXText const *, int x, int y,
- int asc, int desc,
- Cursor_Shape shape) = 0;
-
- /// unpaint the cursor painted by showManualCursor()
- virtual void hideCursor() = 0;
-
/**
* fit the cursor onto the visible work area, scrolling if necessary
* @param bv the buffer view
/// redraw the screen, without using existing pixmap
virtual void redraw(LyXText *, BufferView *);
- /// draw the cursor if it's not already shown
- virtual void showCursor(LyXText const *, BufferView const *);
-
/**
* topCursorVisible - get a new "top" to make the cursor visible
* @param c the cursor
*/
virtual bool fitCursor(LyXText *, BufferView *);
- /// show the cursor if it's not, and vice versa
- virtual void cursorToggle(BufferView *) const;
-
/**
* update - update part of the screen rendering
* @param bv the bufferview
*/
virtual void update(BufferView & bv, int yo = 0, int xo = 0);
+ /// hide the visible cursor, if it is visible
+ void hideCursor();
+
+ /// show the cursor if it is not visible
+ void showCursor(BufferView & bv);
+
+ /// toggle the cursor's visibility
+ void toggleCursor(BufferView & bv);
+
/// FIXME
virtual void toggleSelection(LyXText *, BufferView *, bool = true,
int y_offset = 0, int x_offset = 0);
/// get the work area
virtual WorkArea & workarea() const = 0;
+ /// types of cursor in work area
+ enum Cursor_Shape {
+ /// normal I-beam
+ BAR_SHAPE,
+ /// L-shape for locked insets of a different language
+ L_SHAPE,
+ /// reverse L-shape for RTL text
+ REVERSED_L_SHAPE
+ };
+
+ /// paint the cursor and store the background
+ virtual void showCursor(int x, int y, int h, Cursor_Shape shape) = 0;
+
+ /// hide the cursor
+ virtual void removeCursor() = 0;
+
/// y1 and y2 are coordinates of the screen
void drawFromTo(LyXText *, BufferView *, int y1, int y2,
int y_offset = 0, int x_offset = 0);
RowList::iterator row,
int y_text, int y_offset = 0, int x_offset = 0);
- /// is the blinking cursor currently drawn
- bool cursor_visible_;
-
private:
/// grey out (no buffer)
void greyOut();
+ /// is the cursor currently displayed
+ bool cursor_visible_;
+
/// is the screen displaying text or the splash screen?
bool greyed_out_;
};
+2003-05-03 John Levon <levon@movementarian.org>
+
+ * xscreen.h:
+ * xscreen.C: implement new cursor API
+
2003-04-30 John Levon <levon@movementarian.org>
* Form<Various>: fix dialog titles to match new menus
XScreen::XScreen(XWorkArea & o)
- : LyXScreen(), owner_(o)
+ : LyXScreen(), owner_(o), nocursor_pixmap_(0),
+ cursor_x_(0), cursor_y_(0), cursor_w_(0), cursor_h_(0)
{
- // the cursor isnt yet visible
- 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 XScreen::showManualCursor(LyXText const * text, int x, int y,
- int asc, int desc, Cursor_Shape shape)
+void XScreen::showCursor(int x, int y, int h, Cursor_Shape shape)
{
- // Update the cursor color.
+ // Update the cursor color. (a little slow dooing it like this ??)
setCursorColor();
- int const y1 = max(y - text->top_y() - asc, 0);
- int const y_tmp = min(y - text->top_y() + desc,
- static_cast<int>(owner_.workHeight()));
-
- // Secure against very strange situations
- int const y2 = max(y_tmp, y1);
-
- if (cursor_pixmap) {
- XFreePixmap(fl_get_display(), cursor_pixmap);
- cursor_pixmap = 0;
- }
-
- if (y2 > 0 && y1 < int(owner_.workHeight())) {
- cursor_pixmap_h = y2 - y1 + 1;
- cursor_pixmap_y = y1;
+ cursor_x_ = x;
+ cursor_y_ = y;
+ cursor_h_ = h;
- switch (shape) {
+ switch (shape) {
case BAR_SHAPE:
- cursor_pixmap_w = 1;
- cursor_pixmap_x = x;
+ cursor_w_ = 1;
break;
case L_SHAPE:
- cursor_pixmap_w = cursor_pixmap_h/3;
- cursor_pixmap_x = x;
+ cursor_w_ = cursor_h_ / 3;
break;
case REVERSED_L_SHAPE:
- cursor_pixmap_w = cursor_pixmap_h/3;
- cursor_pixmap_x = x - cursor_pixmap_w + 1;
+ cursor_w_ = cursor_h_ / 3;
+ cursor_x_ = x - cursor_w_ + 1;
break;
- }
+ }
+
+ if (nocursor_pixmap_) {
+ XFreePixmap(fl_get_display(), nocursor_pixmap_);
+ nocursor_pixmap_ = 0;
+ }
+ nocursor_pixmap_ = XCreatePixmap(fl_get_display(),
+ fl_root, cursor_w_, cursor_h_, fl_get_visual_depth());
- cursor_pixmap =
- XCreatePixmap (fl_get_display(),
- fl_root,
- cursor_pixmap_w,
- cursor_pixmap_h,
- fl_get_visual_depth());
- XCopyArea (fl_get_display(),
- owner_.getWin(),
- cursor_pixmap,
- gc_copy,
- owner_.xpos() + cursor_pixmap_x,
- owner_.ypos() + cursor_pixmap_y,
- cursor_pixmap_w,
- cursor_pixmap_h,
- 0, 0);
- XDrawLine(fl_get_display(),
- owner_.getWin(),
- gc_copy,
- x + owner_.xpos(),
- y1 + owner_.ypos(),
- x + owner_.xpos(),
- y2 + owner_.ypos());
- switch (shape) {
+ // save old area
+ XCopyArea(fl_get_display(),
+ owner_.getWin(), nocursor_pixmap_, gc_copy,
+ owner_.xpos() + cursor_x_,
+ owner_.ypos() + cursor_y_,
+ cursor_w_, cursor_h_, 0, 0);
+
+// xforms equivalent needed here
+#if 0
+ if (!qApp->focusWidget())
+ return;
+#endif
+
+ XDrawLine(fl_get_display(), owner_.getWin(), gc_copy,
+ owner_.xpos() + x, owner_.ypos() + y,
+ owner_.xpos() + x, owner_.ypos() + y + h - 1);
+
+ switch (shape) {
case BAR_SHAPE:
break;
- case L_SHAPE:
case REVERSED_L_SHAPE:
- int const rectangle_h = (cursor_pixmap_h + 10) / 20;
- XFillRectangle(fl_get_display(),
- owner_.getWin(),
- gc_copy,
- cursor_pixmap_x + owner_.xpos(),
- y2 - rectangle_h + 1 + owner_.ypos(),
- cursor_pixmap_w - 1, rectangle_h);
+ case L_SHAPE:
+ XDrawLine(fl_get_display(), owner_.getWin(), gc_copy,
+ owner_.xpos() + cursor_x_,
+ owner_.ypos() + y + h - 1,
+ owner_.xpos() + cursor_x_ + cursor_w_ - 1,
+ owner_.ypos() + y + h - 1);
break;
- }
-
}
- cursor_visible_ = true;
}
-void XScreen::hideCursor()
+void XScreen::removeCursor()
{
- if (!cursor_visible_) return;
-
- if (cursor_pixmap) {
- XCopyArea (fl_get_display(),
- cursor_pixmap,
- owner_.getWin(),
- gc_copy,
- 0, 0,
- cursor_pixmap_w, cursor_pixmap_h,
- cursor_pixmap_x + owner_.xpos(),
- cursor_pixmap_y + owner_.ypos());
- }
- cursor_visible_ = false;
+ // before first showCursor
+ if (!nocursor_pixmap_)
+ return;
+
+ XCopyArea(fl_get_display(), nocursor_pixmap_, owner_.getWin(),
+ gc_copy, 0, 0, cursor_w_, cursor_h_,
+ owner_.xpos() + cursor_x_,
+ owner_.ypos() + cursor_y_);
}
void XScreen::draw(LyXText * text, BufferView * bv, unsigned int y)
{
- if (cursor_visible_)
- hideCursor();
-
int const old_first = text->top_y();
text->top_y(y);
/// Sets the cursor color to LColor::cursor.
virtual void setCursorColor();
- ///
- virtual void hideCursor();
- ///
- virtual void showManualCursor(LyXText const *, int x, int y,
- int asc, int desc,
- Cursor_Shape shape);
/** Draws the screen form textposition y. Uses as much of
the already printed pixmap as possible */
/// Copies specified area of pixmap to screen
virtual void expose(int x, int y, int w, int h);
+ /// paint the cursor and store the background
+ virtual void showCursor(int x, int y, int h, Cursor_Shape shape);
+
+ /// hide the cursor
+ virtual void removeCursor();
+
private:
/// our owning widget
XWorkArea & owner_;
- ///
- Pixmap cursor_pixmap;
- ///
- int cursor_pixmap_x;
- ///
- int cursor_pixmap_y;
- ///
- int cursor_pixmap_w;
- ///
- int cursor_pixmap_h;
- ///
+ /// backing pixmap for cursor
+ Pixmap nocursor_pixmap_;
+ /// x of backing pixmap
+ int cursor_x_;
+ /// y of backing pixmap
+ int cursor_y_;
+ /// width of backing pixmap
+ int cursor_w_;
+ /// height of backing pixmap
+ int cursor_h_;
+ /// cursor cs
GC gc_copy;
};
+2003-05-03 John Levon <levon@movementarian.org>
+
+ * insetcollapsable.h:
+ * insetcollapsable.C:
+ * insettabular.h:
+ * insettabular.C:
+ * insettext.h:
+ * insettext.C:
+ * updatableinset.h:
+ * updatableinset.C: remove cursor_visible_, showInsetCursor(),
+ hideInsetCursor(), toggleInsetCursor(), isCursorVisible(). Add
+ getCursor(). Remove explicit cursor hides.
+
2003-05-02 André Pönitz <poenitz@gmx.net>
* insettext.C: remove unneeded &*
}
-void InsetCollapsable::getCursorPos(BufferView * bv, int & x, int & y) const
-{
- inset.getCursorPos(bv, x , y);
-}
-
-
-void InsetCollapsable::toggleInsetCursor(BufferView * bv)
+void InsetCollapsable::getCursor(BufferView & bv, int & x, int & y) const
{
- inset.toggleInsetCursor(bv);
+ inset.getCursor(bv, x, y);
}
-void InsetCollapsable::showInsetCursor(BufferView * bv, bool show)
-{
- inset.showInsetCursor(bv, show);
-}
-
-
-void InsetCollapsable::hideInsetCursor(BufferView * bv)
+void InsetCollapsable::getCursorPos(BufferView * bv, int & x, int & y) const
{
- inset.hideInsetCursor(bv);
+ inset.getCursorPos(bv, x , y);
}
int docbook(Buffer const *, std::ostream &, bool mixcont) const;
///
void validate(LaTeXFeatures & features) const;
- ///
+ /// FIXME, document
void getCursorPos(BufferView *, int & x, int & y) const;
- ///
- void toggleInsetCursor(BufferView *);
- ///
- void showInsetCursor(BufferView *, bool show = true);
- ///
- void hideInsetCursor(BufferView *);
+ /// Get the absolute document x,y of the cursor
+ virtual void getCursor(BufferView &, int &, int &) const;
///
void fitInsetCursor(BufferView * bv) const {
inset.fitInsetCursor(bv);
updateLocal(bv, CELL);
the_locking_inset = 0;
}
- hideInsetCursor(bv);
actcell = 0;
oldcell = -1;
locked = false;
updateLocal(bv, CELL);
// this has to be here otherwise we don't redraw the cell!
the_locking_inset = 0;
-// showInsetCursor(bv, false);
return true;
}
if (the_locking_inset->unlockInsetInInset(bv, inset, lr)) {
int const orow = actrow;
BufferView * bv = cmd.view();
- hideInsetCursor(bv);
if (!locked) {
locked = true;
the_locking_inset = 0;
updateLocal(bv, CELL);
the_locking_inset = 0;
}
- showInsetCursor(bv);
return;
}
#endif
the_locking_inset->localDispatch(cmd1);
return;
}
- showInsetCursor(bv);
}
}
BufferView * bv = cmd.view();
- hideInsetCursor(bv);
int const old_cell = actcell;
setPos(bv, cmd.x, cmd.y);
setSelection(sel_cell_start, actcell);
updateLocal(bv, SELECTION);
}
- showInsetCursor(bv);
}
case LFUN_CELL_BACKWARD:
case LFUN_CELL_FORWARD:
- hideInsetCursor(bv);
unlockInsetInInset(bv, the_locking_inset);
if (cmd.action == LFUN_CELL_FORWARD)
moveNextCell(bv, old_locking_inset != 0);
if (hs)
updateLocal(bv, SELECTION);
if (!the_locking_inset) {
- showInsetCursor(bv);
return DISPATCHED_NOUPDATE;
}
return result;
int sc = scroll();
resetPos(bv);
if (sc != scroll()) { // inset has been scrolled
- the_locking_inset->toggleInsetCursor(bv);
updateLocal(bv, FULL);
- the_locking_inset->toggleInsetCursor(bv);
}
return result;
} else if (result == DISPATCHED) {
- the_locking_inset->toggleInsetCursor(bv);
updateLocal(bv, CELL);
- the_locking_inset->toggleInsetCursor(bv);
return result;
} else if (result == FINISHED_UP) {
action = LFUN_UP;
}
}
- hideInsetCursor(bv);
result = DISPATCHED;
switch (action) {
// --- Cursor Movements ----------------------------------
if (!the_locking_inset) {
if (bv->fitCursor())
updateLocal(bv, FULL);
- if (locked)
- showInsetCursor(bv);
}
} else
bv->unlockInset(this);
}
-void InsetTabular::getCursorPos(BufferView * bv, int & x, int & y) const
-{
- if (the_locking_inset) {
- the_locking_inset->getCursorPos(bv, x, y);
- return;
- }
- x = cursor_.x() - top_x;
- y = cursor_.y();
-}
-
-
-void InsetTabular::toggleInsetCursor(BufferView * bv)
+void InsetTabular::getCursor(BufferView & bv, int & x, int & y) const
{
- if (nodraw()) {
- if (isCursorVisible())
- bv->hideLockedInsetCursor();
- return;
- }
if (the_locking_inset) {
- the_locking_inset->toggleInsetCursor(bv);
+ the_locking_inset->getCursor(bv, x, y);
return;
}
- LyXFont font; // = the_locking_inset->GetFont(par, cursor.pos);
+ x = cursor_.x();
+ y = cursor_.y() + InsetTabular::y();
- int const asc = font_metrics::maxAscent(font);
- int const desc = font_metrics::maxDescent(font);
-
- if (isCursorVisible())
- bv->hideLockedInsetCursor();
- else
- bv->showLockedInsetCursor(cursor_.x(), cursor_.y(), asc, desc);
- toggleCursorVisible();
+ // Fun stuff
+ int desc = tabular->GetDescentOfRow(actrow);
+ y += desc;
+ int ascdesc = tabular->GetAscentOfRow(actrow) + desc;
+ y -= ascdesc / 2;
+ y += ADD_TO_HEIGHT * 2;
+ y += TEXT_TO_INSET_OFFSET;
}
-void InsetTabular::showInsetCursor(BufferView * bv, bool show)
+void InsetTabular::getCursorPos(BufferView * bv, int & x, int & y) const
{
- if (nodraw())
+ if (the_locking_inset) {
+ the_locking_inset->getCursorPos(bv, x, y);
return;
- if (!isCursorVisible()) {
- LyXFont font; // = GetFont(par, cursor.pos);
-
- int const asc = font_metrics::maxAscent(font);
- int const desc = font_metrics::maxDescent(font);
- bv->fitLockedInsetCursor(cursor_.x(), cursor_.y(), asc, desc);
- if (show)
- bv->showLockedInsetCursor(cursor_.x(), cursor_.y(), asc, desc);
- setCursorVisible(true);
- }
-}
-
-
-void InsetTabular::hideInsetCursor(BufferView * bv)
-{
- if (isCursorVisible()) {
- bv->hideLockedInsetCursor();
- setCursorVisible(false);
}
+ x = cursor_.x() - top_x;
+ y = cursor_.y();
}
void validate(LaTeXFeatures & features) const;
///
Inset::Code lyxCode() const { return Inset::TABULAR_CODE; }
- ///
+ /// FIXME, document
void getCursorPos(BufferView *, int & x, int & y) const;
- ///
- void toggleInsetCursor(BufferView *);
+ /// Get the absolute document x,y of the cursor
+ virtual void getCursor(BufferView &, int &, int &) const;
///
bool tabularFeatures(BufferView * bv, string const & what);
///
void drawCellSelection(Painter &, int x, int baseline,
int row, int column, int cell) const;
///
- void showInsetCursor(BufferView *, bool show=true);
- ///
- void hideInsetCursor(BufferView *);
- ///
void fitInsetCursor(BufferView *) const;
///
void setPos(BufferView *, int x, int y) const;
int yf = y_offset + first;
y = 0;
+
+ bv->hideCursor();
+
while ((rowit != end) && (yf < ph)) {
RowPainter rp(*bv, *lt, rowit);
rp.paint(y + y_offset + first, int(x), y + lt->top_y());
if (drawFrame_ == LOCKED)
code = CURSOR|DRAW_FRAME;
updateLocal(bv, code, false);
- showInsetCursor(bv);
// Tell the paragraph dialog that we've entered an insettext.
bv->dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
if (drawFrame_ == LOCKED)
code = CURSOR|DRAW_FRAME;
updateLocal(bv, code, false);
- showInsetCursor(bv);
}
the_locking_inset = 0;
updateLocal(bv, CURSOR_PAR, false);
}
- hideInsetCursor(bv);
no_selection = true;
locked = false;
int code = NONE;
int tmp_y = cmd.y + insetAscent - getLyXText(bv)->top_y();
Inset * inset = getLyXText(bv)->checkInsetHit(tmp_x, tmp_y);
- hideInsetCursor(bv);
if (the_locking_inset) {
if (the_locking_inset == inset) {
the_locking_inset->localDispatch(cmd1);
} else {
getLyXText(bv)->clearSelection();
}
- showInsetCursor(bv);
}
lt = getLyXText(bv);
clear = true;
}
- hideInsetCursor(bv);
LyXCursor cur = lt->cursor;
lt->setCursorFromCoordinates
(cmd.x - drawTextXOffset, cmd.y + insetAscent);
if (flag) {
updateLocal(bv, SELECTION, false);
}
- showInsetCursor(bv);
}
return result;
}
}
- hideInsetCursor(bv);
bool clear = false;
if (!lt) {
lt = getLyXText(bv);
}
+void InsetText::getCursor(BufferView & bv, int & x, int & y) const
+{
+ if (the_locking_inset) {
+ the_locking_inset->getCursor(bv, x, y);
+ return;
+ }
+ x = cx(&bv);
+ y = cy(&bv) + InsetText::y();
+}
+
+
void InsetText::getCursorPos(BufferView * bv, int & x, int & y) const
{
if (the_locking_inset) {
}
-void InsetText::toggleInsetCursor(BufferView * bv)
-{
- if (the_locking_inset) {
- the_locking_inset->toggleInsetCursor(bv);
- return;
- }
-
- LyXFont const font(getLyXText(bv)->getFont(bv->buffer(), cpar(bv), cpos(bv)));
-
- int const asc = font_metrics::maxAscent(font);
- int const desc = font_metrics::maxDescent(font);
-
- if (isCursorVisible())
- bv->hideLockedInsetCursor();
- else
- bv->showLockedInsetCursor(cx(bv), cy(bv), asc, desc);
- toggleCursorVisible();
-}
-
-
-void InsetText::showInsetCursor(BufferView * bv, bool show)
-{
- if (the_locking_inset) {
- the_locking_inset->showInsetCursor(bv, show);
- return;
- }
- if (!isCursorVisible()) {
- LyXFont const font =
- getLyXText(bv)->getFont(bv->buffer(), cpar(bv), cpos(bv));
-
- int const asc = font_metrics::maxAscent(font);
- int const desc = font_metrics::maxDescent(font);
-
- bv->fitLockedInsetCursor(cx(bv), cy(bv), asc, desc);
- if (show)
- bv->showLockedInsetCursor(cx(bv), cy(bv), asc, desc);
- setCursorVisible(true);
- }
-}
-
-
-void InsetText::hideInsetCursor(BufferView * bv)
-{
- if (isCursorVisible()) {
- bv->hideLockedInsetCursor();
- setCursorVisible(false);
- }
- if (the_locking_inset)
- the_locking_inset->hideInsetCursor(bv);
-}
-
-
void InsetText::fitInsetCursor(BufferView * bv) const
{
if (the_locking_inset) {
return false;
}
inset->setOwner(this);
- hideInsetCursor(bv);
getLyXText(bv)->insertInset(inset);
bv->fitCursor();
updateLocal(bv, CURSOR_PAR|CURSOR, true);
void validate(LaTeXFeatures & features) const;
///
Inset::Code lyxCode() const { return Inset::TEXT_CODE; }
- ///
+ /// FIXME, document
void getCursorPos(BufferView *, int & x, int & y) const;
+ /// Get the absolute document x,y of the cursor
+ virtual void getCursor(BufferView &, int &, int &) const;
///
int insetInInsetY() const;
///
- void toggleInsetCursor(BufferView *);
- ///
- void showInsetCursor(BufferView *, bool show = true);
- ///
- void hideInsetCursor(BufferView *);
- ///
void fitInsetCursor(BufferView *) const;
///
bool insertInset(BufferView *, Inset *);
// some stuff for inset locking
UpdatableInset::UpdatableInset()
- : Inset(), cursor_visible_(false), block_drawing_(false)
+ : Inset(), block_drawing_(false)
{}
UpdatableInset::UpdatableInset(UpdatableInset const & in, bool same_id)
- : Inset(in, same_id), cursor_visible_(false), block_drawing_(false)
+ : Inset(in, same_id), block_drawing_(false)
{}
}
-void UpdatableInset::toggleInsetCursor(BufferView *)
-{}
-
-
-void UpdatableInset::showInsetCursor(BufferView *, bool)
-{}
-
-
-void UpdatableInset::hideInsetCursor(BufferView *)
-{}
-
-
void UpdatableInset::fitInsetCursor(BufferView *) const
{}
///
virtual EDITABLE editable() const;
- ///
- virtual void toggleInsetCursor(BufferView *);
- ///
- virtual void showInsetCursor(BufferView *, bool show = true);
- ///
- virtual void hideInsetCursor(BufferView *);
///
virtual void fitInsetCursor(BufferView *) const;
- ///
+ /// FIXME
virtual void getCursorPos(BufferView *, int &, int &) const {}
+ /// Get the absolute document x,y of the cursor
+ virtual void getCursor(BufferView &, int &, int &) const = 0;
///
virtual void insetUnlock(BufferView *);
///
/// An updatable inset could handle lyx editing commands
virtual RESULT localDispatch(FuncRequest const & cmd);
///
- bool isCursorVisible() const { return cursor_visible_; }
- ///
virtual int getMaxWidth(BufferView * bv, UpdatableInset const *) const;
///
int scroll(bool recursive = true) const {
bool = true, bool = false);
protected:
- ///
- void toggleCursorVisible() const {
- cursor_visible_ = !cursor_visible_;
- }
- ///
- void setCursorVisible(bool b) const {
- cursor_visible_ = b;
- }
/// scrolls to absolute position in bufferview-workwidth * sx units
void scroll(BufferView *, float sx) const;
/// scrolls offset pixels
void scroll(BufferView *, int offset) const;
private:
- ///
- mutable bool cursor_visible_;
///
mutable bool block_drawing_;
};
if (tmpstr.empty())
return;
- // insert the string
- bv->hideCursor();
-
// clear the selection
bool flag = (bv->text == bv->getLyXText());
if (flag)
if (!bv->theLockingInset() ||
((text != bv->text) &&
(text->inset_owner == text->inset_owner->getLockingInset()))) {
- bv->hideCursor();
bv->update(text, BufferView::SELECT);
bv->toggleSelection(false);
text->replaceSelectionWithString(replacestr);
if (!bv->available() || searchstr.empty())
return false;
- bv->hideCursor();
bv->update(bv->getLyXText(), BufferView::SELECT);
if (bv->theLockingInset()) {
if (!bv->available())
return false;
- bv->hideCursor();
bv->update(bv->getLyXText(), BufferView::SELECT);
pos_type length;
view()->toggleToggle();
}
view()->update(TEXT(flag), BufferView::SELECT);
- view()->showCursor();
view()->switchKeyMap();
}
selection_possible = false;
- if (view()->available())
- view()->hideCursor();
-
string argument = ev.argument;
kb_action action = ev.action;
goto exit_with_message;
}
+ if (view()->available())
+ view()->hideCursor();
+
if (view()->available() && view()->theLockingInset()) {
Inset::RESULT result;
if ((action > 1) || ((action == LFUN_UNKNOWN_ACTION) &&
if (!searched_string.empty()) {
lyxfind::LyXFind(view(), searched_string, fw);
}
-// view()->showCursor();
}
break;
+2003-05-03 John Levon <levon@movementarian.org>
+
+ * formula.C:
+ * formulabase.C:
+ * formulabase.h:
+ * formulamacro.C:
+ * math_cursor.C: remove showInsetCursor(),
+ isCursorVisible(), hideInsetCursor(), toggleInsetCursor(),
+ explicit cursor hides. Add getCursor()
2003-05-02 André Pönitz <poenitz@gmx.net>
xx += w;
xo_ = x;
yo_ = y;
-
- setCursorVisible(false);
}
}
+void InsetFormulaBase::getCursor(BufferView &, int & x, int & y) const
+{
+ mathcursor->getPos(x, y);
+}
+
+
void InsetFormulaBase::getCursorPos(BufferView *, int & x, int & y) const
{
// calling metrics here destroys the cached xo,yo positions e.g. in
}
-void InsetFormulaBase::toggleInsetCursor(BufferView * bv)
-{
- if (!mathcursor) {
- lyxerr[Debug::MATHED] << "toggleInsetCursor impossible" << endl;
- return;
- }
- //lyxerr << "toggleInsetCursor: " << isCursorVisible() << endl;
- if (isCursorVisible())
- hideInsetCursor(bv);
- else
- showInsetCursor(bv);
-}
-
-
-void InsetFormulaBase::showInsetCursor(BufferView * bv, bool)
-{
- if (!mathcursor) {
- lyxerr << "showInsetCursor impossible" << endl;
- return;
- }
- if (isCursorVisible())
- return;
- int x, y, asc, des;
- mathcursor->getPos(x, y);
- math_font_max_dim(font_, asc, des);
- bv->showLockedInsetCursor(x, y - yo_, asc, des);
- setCursorVisible(true);
- //lyxerr << "showInsetCursor: " << x << ' ' << y << endl;
-}
-
-
-void InsetFormulaBase::hideInsetCursor(BufferView * bv)
-{
- if (!mathcursor)
- return;
- if (!isCursorVisible())
- return;
- bv->hideLockedInsetCursor();
- setCursorVisible(false);
- //lyxerr << "hideInsetCursor: " << endl;
-}
-
-
void InsetFormulaBase::fitInsetCursor(BufferView * bv) const
{
if (!mathcursor)
return UNDISPATCHED;
BufferView * bv = cmd.view();
- hideInsetCursor(bv);
- showInsetCursor(bv);
bv->updateInset(this);
//lyxerr << "lfunMouseRelease: buttons: " << cmd.button() << endl;
mathcursor->selStart();
BufferView * bv = cmd.view();
- hideInsetCursor(bv);
mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
- showInsetCursor(bv);
bv->updateInset(this);
return DISPATCHED;
}
bool was_macro = mathcursor->inMacroMode();
bool was_selection = mathcursor->selection();
- hideInsetCursor(bv);
-
mathcursor->normalize();
mathcursor->touch();
if (result == DISPATCHED || result == DISPATCHED_NOUPDATE ||
result == UNDISPATCHED) {
fitInsetCursor(bv);
- showInsetCursor(bv);
revealCodes(bv);
cmd.view()->stuffClipboard(mathcursor->grabSelection());
} else {
///
virtual void edit(BufferView *, bool front = true);
///
- virtual void toggleInsetCursor(BufferView *);
- ///
- virtual void showInsetCursor(BufferView *, bool show = true);
- ///
- virtual void hideInsetCursor(BufferView *);
- ///
virtual void fitInsetCursor(BufferView *) const;
- ///
+ /// FIXME
virtual void getCursorPos(BufferView *, int &, int &) const;
+ /// get the absolute document x,y of the cursor
+ virtual void getCursor(BufferView & bv, int & x, int & y) const;
///
virtual void toggleInsetSelection(BufferView * bv);
///
xx += w + 2;
xo_ = x;
yo_ = y;
-
- setCursorVisible(false);
}
{
if (mathcursor) {
InsetFormulaBase * f = mathcursor->formula();
- f->hideInsetCursor(bv);
delete mathcursor;
mathcursor = 0;
f->insetUnlock(bv);
if (!selection.set() && cursor.par()->size())
return;
- bv()->hideCursor();
-
if (selection.start.par() == selection.end.par()) {
LyXCursor & startc = selection.start;
LyXCursor & endc = selection.end;
if (!selection.set() && cursor.par()->size())
return;
- bv()->hideCursor();
-
if (selection.start.par() == selection.end.par()) {
LyXCursor & startc = selection.start;
LyXCursor & endc = selection.end;
}
if (!lt->isInInset()) {
bv->update(lt, BufferView::SELECT);
- bv->showCursor();
} else if (bv->text->refreshStatus() != LyXText::REFRESH_NONE) {
- bv->theLockingInset()->hideInsetCursor(bv);
bv->update(BufferView::SELECT);
- bv->showCursor();
}
if (!lt->selection.set())
void LyXText::gotoInset(vector<Inset::Code> const & codes,
bool same_content)
{
- bv()->hideCursor();
bv()->beforeChange(this);
update();
void specialChar(LyXText * lt, BufferView * bv, InsetSpecialChar::Kind kind)
{
- bv->hideCursor();
lt->update();
InsetSpecialChar * new_inset = new InsetSpecialChar(kind);
if (!bv->insertInset(new_inset))
update();
// It is possible to make it a lot faster still
// just comment out the line below...
- bv->showCursor();
} else {
update();
cutSelection(bv, true);
update();
// It is possible to make it a lot faster still
// just comment out the line below...
- bv->showCursor();
}
} else {
update();
break;
case LFUN_INSET_TOGGLE:
- bv->hideCursor();
bv->beforeChange(this);
update();
toggleInset();
case LFUN_PASTE:
cmd.message(_("Paste"));
- bv->hideCursor();
// clear the selection
bv->toggleSelection();
clearSelection();
break;
case LFUN_CUT:
- bv->hideCursor();
update();
cutSelection(bv, true);
update();
}
}
if (change_layout) {
- bv->hideCursor();
current_layout = layout;
update();
setLayout(layout);
case LFUN_PASTESELECTION: {
if (!bv->buffer())
break;
- bv->hideCursor();
// this was originally a beforeChange(bv->text), i.e
// the outermost LyXText!
bv->beforeChange(this);
else
c = pit->getChar(pos - 1);
- bv->hideCursor();
LyXLayout_ptr const & style = pit->layout();
if (style->pass_thru ||
break;
if (cmd.button() == mouse_button::button1) {
if (!isInInset()) {
- bv->screen().hideCursor();
bv->screen().toggleSelection(this, bv);
}
cursorHome();
break;
if (cmd.button() == mouse_button::button1) {
if (!isInInset()) {
- bv->screen().hideCursor();
bv->screen().toggleSelection(this, bv);
selectWord(LyXText::WHOLE_WORD_STRICT);
bv->screen().toggleSelection(this, bv, false);
break;
}
- bv->screen().hideCursor();
-
RowList::iterator cursorrow = bv->text->cursor.row();
bv->text->setCursorFromCoordinates(cmd.x, cmd.y + bv->text->top_y());
#if 0
bv->text->setSelection();
bv->screen().toggleToggle(bv->text, bv);
bv->fitCursor();
- bv->showCursor();
break;
}
if (!inset_hit)
selection_possible = true;
- bv->screen().hideCursor();
// Clear the selection
bv->screen().toggleSelection(bv->text, bv);