mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-05 13:26:21 +00:00
cursor.diff, bug 1095
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6930 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
dd7805dad9
commit
c7b495326e
@ -223,18 +223,6 @@ int BufferView::workWidth() const
|
||||
}
|
||||
|
||||
|
||||
void BufferView::showCursor()
|
||||
{
|
||||
pimpl_->showCursor();
|
||||
}
|
||||
|
||||
|
||||
void BufferView::hideCursor()
|
||||
{
|
||||
pimpl_->hideCursor();
|
||||
}
|
||||
|
||||
|
||||
void BufferView::toggleSelection(bool b)
|
||||
{
|
||||
pimpl_->toggleSelection(b);
|
||||
@ -585,7 +573,6 @@ void BufferView::undo()
|
||||
return;
|
||||
|
||||
owner()->message(_("Undo"));
|
||||
hideCursor();
|
||||
beforeChange(text);
|
||||
update(text, BufferView::SELECT);
|
||||
if (!textUndo(this))
|
||||
@ -602,7 +589,6 @@ void BufferView::redo()
|
||||
return;
|
||||
|
||||
owner()->message(_("Redo"));
|
||||
hideCursor();
|
||||
beforeChange(text);
|
||||
update(text, BufferView::SELECT);
|
||||
if (!textRedo(this))
|
||||
@ -631,7 +617,6 @@ void BufferView::selectLastWord()
|
||||
return;
|
||||
|
||||
LyXCursor cur = text->selection.cursor;
|
||||
hideCursor();
|
||||
beforeChange(text);
|
||||
text->selection.cursor = cur;
|
||||
text->selectSelectedWord();
|
||||
@ -644,7 +629,6 @@ void BufferView::endOfSpellCheck()
|
||||
{
|
||||
if (!available()) return;
|
||||
|
||||
hideCursor();
|
||||
beforeChange(text);
|
||||
text->selectSelectedWord();
|
||||
text->clearSelection();
|
||||
@ -658,7 +642,6 @@ void BufferView::replaceWord(string const & replacestring)
|
||||
return;
|
||||
|
||||
LyXText * tt = getLyXText();
|
||||
hideCursor();
|
||||
update(tt, BufferView::SELECT);
|
||||
|
||||
// clear the selection (if there is any)
|
||||
@ -729,44 +712,6 @@ bool BufferView::lockInset(UpdatableInset * inset)
|
||||
}
|
||||
|
||||
|
||||
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()) {
|
||||
@ -780,6 +725,12 @@ bool BufferView::fitLockedInsetCursor(int x, int y, int asc, int desc)
|
||||
}
|
||||
|
||||
|
||||
void BufferView::hideCursor()
|
||||
{
|
||||
screen().hideCursor();
|
||||
}
|
||||
|
||||
|
||||
int BufferView::unlockInset(UpdatableInset * inset)
|
||||
{
|
||||
if (!inset)
|
||||
|
@ -167,14 +167,6 @@ public:
|
||||
/// 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
|
||||
@ -184,6 +176,9 @@ public:
|
||||
/// 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
|
||||
|
@ -377,6 +377,8 @@ void BufferView::Pimpl::scrollDocView(int value)
|
||||
if (!buffer_)
|
||||
return;
|
||||
|
||||
screen().hideCursor();
|
||||
|
||||
screen().draw(bv_->text, bv_, value);
|
||||
|
||||
if (!lyxrc.cursor_follows_scrollbar)
|
||||
@ -424,6 +426,18 @@ void BufferView::Pimpl::workAreaKeyPress(LyXKeySymPtr key,
|
||||
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_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -456,10 +470,9 @@ void BufferView::Pimpl::selectionRequested()
|
||||
void BufferView::Pimpl::selectionLost()
|
||||
{
|
||||
if (available()) {
|
||||
hideCursor();
|
||||
screen().hideCursor();
|
||||
toggleSelection();
|
||||
bv_->getLyXText()->clearSelection();
|
||||
showCursor();
|
||||
bv_->text->xsel_cache.set(false);
|
||||
}
|
||||
}
|
||||
@ -565,11 +578,7 @@ void BufferView::Pimpl::cursorToggle()
|
||||
return;
|
||||
}
|
||||
|
||||
if (!bv_->theLockingInset()) {
|
||||
screen().cursorToggle(bv_);
|
||||
} else {
|
||||
bv_->theLockingInset()->toggleInsetCursor(bv_);
|
||||
}
|
||||
screen().toggleCursor(*bv_);
|
||||
|
||||
cursor_timeout.restart();
|
||||
}
|
||||
@ -698,22 +707,6 @@ void BufferView::Pimpl::insetUnlock()
|
||||
}
|
||||
|
||||
|
||||
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())
|
||||
@ -935,8 +928,14 @@ bool BufferView::Pimpl::workAreaDispatch(FuncRequest const & ev_in)
|
||||
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();
|
||||
@ -1367,7 +1366,6 @@ void BufferView::Pimpl::updateInset(Inset * inset)
|
||||
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)) {
|
||||
|
@ -89,10 +89,6 @@ struct BufferView::Pimpl : public boost::signals::trackable {
|
||||
///
|
||||
void insetUnlock();
|
||||
///
|
||||
void showCursor();
|
||||
///
|
||||
void hideCursor();
|
||||
///
|
||||
void toggleSelection(bool = true);
|
||||
///
|
||||
void toggleToggle();
|
||||
|
@ -1,3 +1,19 @@
|
||||
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>
|
||||
|
||||
|
@ -226,7 +226,6 @@ bool changeDepth(BufferView * bv, LyXText * text, DEPTH_CHANGE type, bool test_o
|
||||
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)
|
||||
@ -390,7 +389,6 @@ void toggleAndShow(BufferView * bv, LyXFont const & font, bool toggleall)
|
||||
if (!text)
|
||||
return;
|
||||
|
||||
bv->hideCursor();
|
||||
bv->update(text, BufferView::SELECT);
|
||||
text->toggleFree(font, toggleall);
|
||||
bv->update(text, BufferView::SELECT);
|
||||
|
@ -1,3 +1,10 @@
|
||||
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:
|
||||
|
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
@ -52,90 +52,6 @@ QScreen::~QScreen()
|
||||
}
|
||||
|
||||
|
||||
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());
|
||||
@ -158,8 +74,6 @@ void QScreen::draw(LyXText * text, BufferView * bv, unsigned int y)
|
||||
|
||||
owner_.getPainter().start();
|
||||
|
||||
if (cursor_visible_) hideCursor();
|
||||
|
||||
int const old_first = text->top_y();
|
||||
text->top_y(y);
|
||||
|
||||
@ -188,3 +102,72 @@ void QScreen::draw(LyXText * text, BufferView * bv, unsigned int 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_);
|
||||
}
|
||||
|
@ -37,22 +37,6 @@ public:
|
||||
*/
|
||||
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_; }
|
||||
@ -63,11 +47,16 @@ protected:
|
||||
/// 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
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include "language.h"
|
||||
#include "debug.h"
|
||||
#include "rowpainter.h"
|
||||
#include "insets/updatableinset.h"
|
||||
#include "mathed/formulabase.h"
|
||||
|
||||
// Splash screen-specific stuff
|
||||
#include "lyxfont.h"
|
||||
@ -126,33 +128,89 @@ LyXScreen::~LyXScreen()
|
||||
{
|
||||
}
|
||||
|
||||
// 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();
|
||||
|
||||
workarea().getPainter().end();
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -181,15 +239,6 @@ bool LyXScreen::fitManualCursor(BufferView * bv, LyXText * text,
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
@ -365,11 +414,6 @@ void LyXScreen::redraw(LyXText * text, BufferView * bv)
|
||||
expose(0, 0, workarea().workWidth(), workarea().workHeight());
|
||||
|
||||
workarea().getPainter().end();
|
||||
|
||||
if (cursor_visible_) {
|
||||
cursor_visible_ = false;
|
||||
bv->showCursor();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -421,6 +465,8 @@ void LyXScreen::drawFromTo(LyXText * text, BufferView * bv,
|
||||
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);
|
||||
@ -450,6 +496,8 @@ void LyXScreen::drawOneRow(LyXText * text, BufferView * bv,
|
||||
if (y - row->height() > workarea().workHeight())
|
||||
return;
|
||||
|
||||
hideCursor();
|
||||
|
||||
RowPainter rp(*bv, *text, row);
|
||||
rp.paint(y, xo, y + text->top_y());
|
||||
}
|
||||
|
@ -34,16 +34,6 @@ class BufferView;
|
||||
*/
|
||||
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();
|
||||
@ -56,22 +46,6 @@ public:
|
||||
*/
|
||||
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
|
||||
@ -89,9 +63,6 @@ public:
|
||||
/// 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
|
||||
@ -113,9 +84,6 @@ public:
|
||||
*/
|
||||
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
|
||||
@ -130,6 +98,15 @@ public:
|
||||
*/
|
||||
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);
|
||||
@ -145,6 +122,22 @@ protected:
|
||||
/// 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);
|
||||
@ -154,13 +147,13 @@ protected:
|
||||
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_;
|
||||
};
|
||||
|
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
@ -55,15 +55,9 @@ GC createGC()
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
@ -89,100 +83,77 @@ void XScreen::setCursorColor()
|
||||
}
|
||||
|
||||
|
||||
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()));
|
||||
cursor_x_ = x;
|
||||
cursor_y_ = y;
|
||||
cursor_h_ = h;
|
||||
|
||||
// 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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
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());
|
||||
|
||||
// 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;
|
||||
// before first showCursor
|
||||
if (!nocursor_pixmap_)
|
||||
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;
|
||||
XCopyArea(fl_get_display(), nocursor_pixmap_, owner_.getWin(),
|
||||
gc_copy, 0, 0, cursor_w_, cursor_h_,
|
||||
owner_.xpos() + cursor_x_,
|
||||
owner_.ypos() + cursor_y_);
|
||||
}
|
||||
|
||||
|
||||
@ -202,9 +173,6 @@ void XScreen::expose(int x, int y, int w, int h)
|
||||
|
||||
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);
|
||||
|
||||
|
@ -34,12 +34,6 @@ public:
|
||||
|
||||
/// 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 */
|
||||
@ -52,21 +46,27 @@ protected:
|
||||
/// 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;
|
||||
};
|
||||
|
||||
|
@ -1,3 +1,16 @@
|
||||
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 &*
|
||||
|
@ -491,30 +491,18 @@ void InsetCollapsable::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
void InsetCollapsable::getCursor(BufferView & bv, int & x, int & y) const
|
||||
{
|
||||
inset.getCursor(bv, x, y);
|
||||
}
|
||||
|
||||
|
||||
void InsetCollapsable::getCursorPos(BufferView * bv, int & x, int & y) const
|
||||
{
|
||||
inset.getCursorPos(bv, x , y);
|
||||
}
|
||||
|
||||
|
||||
void InsetCollapsable::toggleInsetCursor(BufferView * bv)
|
||||
{
|
||||
inset.toggleInsetCursor(bv);
|
||||
}
|
||||
|
||||
|
||||
void InsetCollapsable::showInsetCursor(BufferView * bv, bool show)
|
||||
{
|
||||
inset.showInsetCursor(bv, show);
|
||||
}
|
||||
|
||||
|
||||
void InsetCollapsable::hideInsetCursor(BufferView * bv)
|
||||
{
|
||||
inset.hideInsetCursor(bv);
|
||||
}
|
||||
|
||||
|
||||
UpdatableInset * InsetCollapsable::getLockingInset() const
|
||||
{
|
||||
UpdatableInset * in = inset.getLockingInset();
|
||||
|
@ -97,14 +97,10 @@ public:
|
||||
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);
|
||||
|
@ -499,7 +499,6 @@ void InsetTabular::insetUnlock(BufferView * bv)
|
||||
updateLocal(bv, CELL);
|
||||
the_locking_inset = 0;
|
||||
}
|
||||
hideInsetCursor(bv);
|
||||
actcell = 0;
|
||||
oldcell = -1;
|
||||
locked = false;
|
||||
@ -590,7 +589,6 @@ bool InsetTabular::unlockInsetInInset(BufferView * bv, UpdatableInset * inset,
|
||||
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)) {
|
||||
@ -672,7 +670,6 @@ void InsetTabular::lfunMousePress(FuncRequest const & cmd)
|
||||
int const orow = actrow;
|
||||
BufferView * bv = cmd.view();
|
||||
|
||||
hideInsetCursor(bv);
|
||||
if (!locked) {
|
||||
locked = true;
|
||||
the_locking_inset = 0;
|
||||
@ -690,7 +687,6 @@ void InsetTabular::lfunMousePress(FuncRequest const & cmd)
|
||||
updateLocal(bv, CELL);
|
||||
the_locking_inset = 0;
|
||||
}
|
||||
showInsetCursor(bv);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@ -730,7 +726,6 @@ void InsetTabular::lfunMousePress(FuncRequest const & cmd)
|
||||
the_locking_inset->localDispatch(cmd1);
|
||||
return;
|
||||
}
|
||||
showInsetCursor(bv);
|
||||
}
|
||||
|
||||
|
||||
@ -763,7 +758,6 @@ void InsetTabular::lfunMouseMotion(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
BufferView * bv = cmd.view();
|
||||
hideInsetCursor(bv);
|
||||
int const old_cell = actcell;
|
||||
|
||||
setPos(bv, cmd.x, cmd.y);
|
||||
@ -774,7 +768,6 @@ void InsetTabular::lfunMouseMotion(FuncRequest const & cmd)
|
||||
setSelection(sel_cell_start, actcell);
|
||||
updateLocal(bv, SELECTION);
|
||||
}
|
||||
showInsetCursor(bv);
|
||||
}
|
||||
|
||||
|
||||
@ -814,7 +807,6 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
|
||||
|
||||
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);
|
||||
@ -824,7 +816,6 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
|
||||
if (hs)
|
||||
updateLocal(bv, SELECTION);
|
||||
if (!the_locking_inset) {
|
||||
showInsetCursor(bv);
|
||||
return DISPATCHED_NOUPDATE;
|
||||
}
|
||||
return result;
|
||||
@ -842,15 +833,11 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
|
||||
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;
|
||||
@ -868,7 +855,6 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
|
||||
}
|
||||
}
|
||||
|
||||
hideInsetCursor(bv);
|
||||
result = DISPATCHED;
|
||||
switch (action) {
|
||||
// --- Cursor Movements ----------------------------------
|
||||
@ -1216,8 +1202,6 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
|
||||
if (!the_locking_inset) {
|
||||
if (bv->fitCursor())
|
||||
updateLocal(bv, FULL);
|
||||
if (locked)
|
||||
showInsetCursor(bv);
|
||||
}
|
||||
} else
|
||||
bv->unlockInset(this);
|
||||
@ -1336,6 +1320,26 @@ bool InsetTabular::calculate_dimensions_of_cells(BufferView * bv, bool reinit) c
|
||||
}
|
||||
|
||||
|
||||
void InsetTabular::getCursor(BufferView & bv, int & x, int & y) const
|
||||
{
|
||||
if (the_locking_inset) {
|
||||
the_locking_inset->getCursor(bv, x, y);
|
||||
return;
|
||||
}
|
||||
|
||||
x = cursor_.x();
|
||||
y = cursor_.y() + InsetTabular::y();
|
||||
|
||||
// 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::getCursorPos(BufferView * bv, int & x, int & y) const
|
||||
{
|
||||
if (the_locking_inset) {
|
||||
@ -1347,57 +1351,6 @@ void InsetTabular::getCursorPos(BufferView * bv, int & x, int & y) const
|
||||
}
|
||||
|
||||
|
||||
void InsetTabular::toggleInsetCursor(BufferView * bv)
|
||||
{
|
||||
if (nodraw()) {
|
||||
if (isCursorVisible())
|
||||
bv->hideLockedInsetCursor();
|
||||
return;
|
||||
}
|
||||
if (the_locking_inset) {
|
||||
the_locking_inset->toggleInsetCursor(bv);
|
||||
return;
|
||||
}
|
||||
|
||||
LyXFont font; // = the_locking_inset->GetFont(par, cursor.pos);
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
void InsetTabular::showInsetCursor(BufferView * bv, bool show)
|
||||
{
|
||||
if (nodraw())
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InsetTabular::fitInsetCursor(BufferView * bv) const
|
||||
{
|
||||
if (the_locking_inset) {
|
||||
|
@ -144,10 +144,10 @@ public:
|
||||
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);
|
||||
///
|
||||
@ -259,10 +259,6 @@ private:
|
||||
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;
|
||||
|
@ -419,6 +419,9 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
||||
|
||||
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());
|
||||
@ -643,7 +646,6 @@ void InsetText::edit(BufferView * bv, int x, int y, mouse_button::state button)
|
||||
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));
|
||||
@ -696,7 +698,6 @@ void InsetText::edit(BufferView * bv, bool front)
|
||||
if (drawFrame_ == LOCKED)
|
||||
code = CURSOR|DRAW_FRAME;
|
||||
updateLocal(bv, code, false);
|
||||
showInsetCursor(bv);
|
||||
}
|
||||
|
||||
|
||||
@ -707,7 +708,6 @@ void InsetText::insetUnlock(BufferView * bv)
|
||||
the_locking_inset = 0;
|
||||
updateLocal(bv, CURSOR_PAR, false);
|
||||
}
|
||||
hideInsetCursor(bv);
|
||||
no_selection = true;
|
||||
locked = false;
|
||||
int code = NONE;
|
||||
@ -932,7 +932,6 @@ void InsetText::lfunMousePress(FuncRequest const & cmd)
|
||||
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);
|
||||
@ -1007,7 +1006,6 @@ void InsetText::lfunMousePress(FuncRequest const & cmd)
|
||||
} else {
|
||||
getLyXText(bv)->clearSelection();
|
||||
}
|
||||
showInsetCursor(bv);
|
||||
}
|
||||
|
||||
|
||||
@ -1072,7 +1070,6 @@ void InsetText::lfunMouseMotion(FuncRequest const & cmd)
|
||||
lt = getLyXText(bv);
|
||||
clear = true;
|
||||
}
|
||||
hideInsetCursor(bv);
|
||||
LyXCursor cur = lt->cursor;
|
||||
lt->setCursorFromCoordinates
|
||||
(cmd.x - drawTextXOffset, cmd.y + insetAscent);
|
||||
@ -1090,7 +1087,6 @@ void InsetText::lfunMouseMotion(FuncRequest const & cmd)
|
||||
if (flag) {
|
||||
updateLocal(bv, SELECTION, false);
|
||||
}
|
||||
showInsetCursor(bv);
|
||||
}
|
||||
|
||||
|
||||
@ -1157,7 +1153,6 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
return result;
|
||||
}
|
||||
}
|
||||
hideInsetCursor(bv);
|
||||
bool clear = false;
|
||||
if (!lt) {
|
||||
lt = getLyXText(bv);
|
||||
@ -1689,6 +1684,17 @@ void InsetText::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
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) {
|
||||
@ -1709,58 +1715,6 @@ int InsetText::insetInInsetY() const
|
||||
}
|
||||
|
||||
|
||||
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) {
|
||||
@ -1863,7 +1817,6 @@ bool InsetText::insertInset(BufferView * bv, Inset * inset)
|
||||
return false;
|
||||
}
|
||||
inset->setOwner(this);
|
||||
hideInsetCursor(bv);
|
||||
getLyXText(bv)->insertInset(inset);
|
||||
bv->fitCursor();
|
||||
updateLocal(bv, CURSOR_PAR|CURSOR, true);
|
||||
|
@ -130,17 +130,13 @@ public:
|
||||
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 *);
|
||||
|
@ -26,12 +26,12 @@
|
||||
// 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)
|
||||
{}
|
||||
|
||||
|
||||
@ -48,18 +48,6 @@ Inset::EDITABLE UpdatableInset::editable() const
|
||||
}
|
||||
|
||||
|
||||
void UpdatableInset::toggleInsetCursor(BufferView *)
|
||||
{}
|
||||
|
||||
|
||||
void UpdatableInset::showInsetCursor(BufferView *, bool)
|
||||
{}
|
||||
|
||||
|
||||
void UpdatableInset::hideInsetCursor(BufferView *)
|
||||
{}
|
||||
|
||||
|
||||
void UpdatableInset::fitInsetCursor(BufferView *) const
|
||||
{}
|
||||
|
||||
|
@ -57,16 +57,12 @@ public:
|
||||
///
|
||||
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 *);
|
||||
///
|
||||
@ -100,8 +96,6 @@ public:
|
||||
/// 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 {
|
||||
@ -143,22 +137,12 @@ public:
|
||||
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_;
|
||||
};
|
||||
|
@ -366,9 +366,6 @@ void InsertAsciiFile(BufferView * bv, string const & f, bool asParagraph)
|
||||
if (tmpstr.empty())
|
||||
return;
|
||||
|
||||
// insert the string
|
||||
bv->hideCursor();
|
||||
|
||||
// clear the selection
|
||||
bool flag = (bv->text == bv->getLyXText());
|
||||
if (flag)
|
||||
|
@ -92,7 +92,6 @@ int LyXReplace(BufferView * bv,
|
||||
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);
|
||||
@ -119,7 +118,6 @@ bool LyXFind(BufferView * bv,
|
||||
if (!bv->available() || searchstr.empty())
|
||||
return false;
|
||||
|
||||
bv->hideCursor();
|
||||
bv->update(bv->getLyXText(), BufferView::SELECT);
|
||||
|
||||
if (bv->theLockingInset()) {
|
||||
@ -374,7 +372,6 @@ bool findNextChange(BufferView * bv)
|
||||
if (!bv->available())
|
||||
return false;
|
||||
|
||||
bv->hideCursor();
|
||||
bv->update(bv->getLyXText(), BufferView::SELECT);
|
||||
|
||||
pos_type length;
|
||||
|
@ -125,7 +125,6 @@ void LyXFunc::moveCursorUpdate(bool flag, bool selecting)
|
||||
view()->toggleToggle();
|
||||
}
|
||||
view()->update(TEXT(flag), BufferView::SELECT);
|
||||
view()->showCursor();
|
||||
|
||||
view()->switchKeyMap();
|
||||
}
|
||||
@ -815,9 +814,6 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
|
||||
selection_possible = false;
|
||||
|
||||
if (view()->available())
|
||||
view()->hideCursor();
|
||||
|
||||
string argument = ev.argument;
|
||||
kb_action action = ev.action;
|
||||
|
||||
@ -831,6 +827,9 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
goto exit_with_message;
|
||||
}
|
||||
|
||||
if (view()->available())
|
||||
view()->hideCursor();
|
||||
|
||||
if (view()->available() && view()->theLockingInset()) {
|
||||
Inset::RESULT result;
|
||||
if ((action > 1) || ((action == LFUN_UNKNOWN_ACTION) &&
|
||||
@ -991,7 +990,6 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
if (!searched_string.empty()) {
|
||||
lyxfind::LyXFind(view(), searched_string, fw);
|
||||
}
|
||||
// view()->showCursor();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1,3 +1,12 @@
|
||||
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>
|
||||
|
||||
|
@ -242,8 +242,6 @@ void InsetFormula::draw(BufferView * bv, LyXFont const & font,
|
||||
xx += w;
|
||||
xo_ = x;
|
||||
yo_ = y;
|
||||
|
||||
setCursorVisible(false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -208,6 +208,12 @@ void InsetFormulaBase::insetUnlock(BufferView * bv)
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
@ -226,49 +232,6 @@ void InsetFormulaBase::getCursorPos(BufferView *, int & x, int & y) const
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
@ -301,8 +264,6 @@ dispatch_result InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd)
|
||||
return UNDISPATCHED;
|
||||
|
||||
BufferView * bv = cmd.view();
|
||||
hideInsetCursor(bv);
|
||||
showInsetCursor(bv);
|
||||
bv->updateInset(this);
|
||||
//lyxerr << "lfunMouseRelease: buttons: " << cmd.button() << endl;
|
||||
|
||||
@ -394,9 +355,7 @@ dispatch_result InsetFormulaBase::lfunMouseMotion(FuncRequest const & cmd)
|
||||
mathcursor->selStart();
|
||||
|
||||
BufferView * bv = cmd.view();
|
||||
hideInsetCursor(bv);
|
||||
mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
|
||||
showInsetCursor(bv);
|
||||
bv->updateInset(this);
|
||||
return DISPATCHED;
|
||||
}
|
||||
@ -440,8 +399,6 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
|
||||
bool was_macro = mathcursor->inMacroMode();
|
||||
bool was_selection = mathcursor->selection();
|
||||
|
||||
hideInsetCursor(bv);
|
||||
|
||||
mathcursor->normalize();
|
||||
mathcursor->touch();
|
||||
|
||||
@ -805,7 +762,6 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
|
||||
if (result == DISPATCHED || result == DISPATCHED_NOUPDATE ||
|
||||
result == UNDISPATCHED) {
|
||||
fitInsetCursor(bv);
|
||||
showInsetCursor(bv);
|
||||
revealCodes(bv);
|
||||
cmd.view()->stuffClipboard(mathcursor->grabSelection());
|
||||
} else {
|
||||
|
@ -63,15 +63,11 @@ public:
|
||||
///
|
||||
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);
|
||||
///
|
||||
|
@ -201,6 +201,4 @@ void InsetFormulaMacro::draw(BufferView * bv, LyXFont const & f,
|
||||
xx += w + 2;
|
||||
xo_ = x;
|
||||
yo_ = y;
|
||||
|
||||
setCursorVisible(false);
|
||||
}
|
||||
|
@ -1499,7 +1499,6 @@ void releaseMathCursor(BufferView * bv)
|
||||
{
|
||||
if (mathcursor) {
|
||||
InsetFormulaBase * f = mathcursor->formula();
|
||||
f->hideInsetCursor(bv);
|
||||
delete mathcursor;
|
||||
mathcursor = 0;
|
||||
f->insetUnlock(bv);
|
||||
|
@ -2109,8 +2109,6 @@ void LyXText::acceptChange()
|
||||
if (!selection.set() && cursor.par()->size())
|
||||
return;
|
||||
|
||||
bv()->hideCursor();
|
||||
|
||||
if (selection.start.par() == selection.end.par()) {
|
||||
LyXCursor & startc = selection.start;
|
||||
LyXCursor & endc = selection.end;
|
||||
@ -2130,8 +2128,6 @@ void LyXText::rejectChange()
|
||||
if (!selection.set() && cursor.par()->size())
|
||||
return;
|
||||
|
||||
bv()->hideCursor();
|
||||
|
||||
if (selection.start.par() == selection.end.par()) {
|
||||
LyXCursor & startc = selection.start;
|
||||
LyXCursor & endc = selection.end;
|
||||
|
19
src/text3.C
19
src/text3.C
@ -68,11 +68,8 @@ namespace {
|
||||
}
|
||||
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())
|
||||
@ -203,7 +200,6 @@ bool LyXText::gotoNextInset(vector<Inset::Code> const & codes,
|
||||
void LyXText::gotoInset(vector<Inset::Code> const & codes,
|
||||
bool same_content)
|
||||
{
|
||||
bv()->hideCursor();
|
||||
bv()->beforeChange(this);
|
||||
update();
|
||||
|
||||
@ -365,7 +361,6 @@ namespace {
|
||||
|
||||
void specialChar(LyXText * lt, BufferView * bv, InsetSpecialChar::Kind kind)
|
||||
{
|
||||
bv->hideCursor();
|
||||
lt->update();
|
||||
InsetSpecialChar * new_inset = new InsetSpecialChar(kind);
|
||||
if (!bv->insertInset(new_inset))
|
||||
@ -733,7 +728,6 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
||||
update();
|
||||
// It is possible to make it a lot faster still
|
||||
// just comment out the line below...
|
||||
bv->showCursor();
|
||||
} else {
|
||||
update();
|
||||
cutSelection(bv, true);
|
||||
@ -791,7 +785,6 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
||||
update();
|
||||
// It is possible to make it a lot faster still
|
||||
// just comment out the line below...
|
||||
bv->showCursor();
|
||||
}
|
||||
} else {
|
||||
update();
|
||||
@ -924,7 +917,6 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_INSET_TOGGLE:
|
||||
bv->hideCursor();
|
||||
bv->beforeChange(this);
|
||||
update();
|
||||
toggleInset();
|
||||
@ -1024,7 +1016,6 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
||||
|
||||
case LFUN_PASTE:
|
||||
cmd.message(_("Paste"));
|
||||
bv->hideCursor();
|
||||
// clear the selection
|
||||
bv->toggleSelection();
|
||||
clearSelection();
|
||||
@ -1036,7 +1027,6 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_CUT:
|
||||
bv->hideCursor();
|
||||
update();
|
||||
cutSelection(bv, true);
|
||||
update();
|
||||
@ -1142,7 +1132,6 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
}
|
||||
if (change_layout) {
|
||||
bv->hideCursor();
|
||||
current_layout = layout;
|
||||
update();
|
||||
setLayout(layout);
|
||||
@ -1156,7 +1145,6 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
||||
case LFUN_PASTESELECTION: {
|
||||
if (!bv->buffer())
|
||||
break;
|
||||
bv->hideCursor();
|
||||
// this was originally a beforeChange(bv->text), i.e
|
||||
// the outermost LyXText!
|
||||
bv->beforeChange(this);
|
||||
@ -1200,7 +1188,6 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
||||
else
|
||||
c = pit->getChar(pos - 1);
|
||||
|
||||
bv->hideCursor();
|
||||
LyXLayout_ptr const & style = pit->layout();
|
||||
|
||||
if (style->pass_thru ||
|
||||
@ -1240,7 +1227,6 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
if (cmd.button() == mouse_button::button1) {
|
||||
if (!isInInset()) {
|
||||
bv->screen().hideCursor();
|
||||
bv->screen().toggleSelection(this, bv);
|
||||
}
|
||||
cursorHome();
|
||||
@ -1261,7 +1247,6 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
||||
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);
|
||||
@ -1308,8 +1293,6 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
}
|
||||
|
||||
bv->screen().hideCursor();
|
||||
|
||||
RowList::iterator cursorrow = bv->text->cursor.row();
|
||||
bv->text->setCursorFromCoordinates(cmd.x, cmd.y + bv->text->top_y());
|
||||
#if 0
|
||||
@ -1335,7 +1318,6 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
||||
bv->text->setSelection();
|
||||
bv->screen().toggleToggle(bv->text, bv);
|
||||
bv->fitCursor();
|
||||
bv->showCursor();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1389,7 +1371,6 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
||||
|
||||
if (!inset_hit)
|
||||
selection_possible = true;
|
||||
bv->screen().hideCursor();
|
||||
|
||||
// Clear the selection
|
||||
bv->screen().toggleSelection(bv->text, bv);
|
||||
|
Loading…
Reference in New Issue
Block a user