BufferView::BufferView(LyXView * owner, int xpos, int ypos,
int width, int height)
- : pimpl_(new Pimpl(this, owner, xpos, ypos, width, height))
+ : pimpl_(new Pimpl(this, owner, xpos, ypos, width, height)),
+ x_target_(0)
{
text = 0;
}
{
return pimpl_->workarea().workHeight();
}
+
+
+void BufferView::x_target(int x)
+{
+ x_target_ = x;
+}
+
+
+int BufferView::x_target() const
+{
+ return x_target_;
+}
/// execute the given function
bool dispatch(FuncRequest const & argument);
+
+ /// set target x position of cursor
+ void BufferView::x_target(int x);
+ /// return target x position of cursor
+ int BufferView::x_target() const;
private:
/// Set the current locking inset
friend struct BufferView::Pimpl;
Pimpl * pimpl_;
+
+ /**
+ * The target x position of the cursor. This is used for when
+ * we have text like :
+ *
+ * blah blah blah blah| blah blah blah
+ * blah blah blah
+ * blah blah blah blah blah blah
+ *
+ * When we move onto row 3, we would like to be vertically aligned
+ * with where we were in row 1, despite the fact that row 2 is
+ * shorter than x()
+ */
+ int x_target_;
+
};
#endif // BUFFERVIEW_H
* buffer.h:
* bufferview_funcs.C: remove getInsetFromId()
+ * lyxcursor.[Ch]:
+ * BufferView.[Ch]: move x_fix from LyXCursor to BufferView
+
+ * lyxfunc.C:
+ * text2.C:
+ * text3.C: adjust
+
2003-11-03 Alfredo Braunstein <abraunst@libero.it>
* PosIterator.C (distance, advance): new
text_.setCursorFromCoordinates(cmd.x, cmd.y + dim_.asc);
// set the selection cursor!
text_.selection.cursor = text_.cursor;
- text_.cursor.x_fix(text_.cursor.x());
+ bv->x_target(text_.cursor.x());
text_.clearSelection();
updateLocal(bv, false);
BufferView * bv = cmd.view();
LyXCursor cur = text_.cursor;
text_.setCursorFromCoordinates (cmd.x, cmd.y + dim_.asc);
- text_.cursor.x_fix(text_.cursor.x());
+ bv->x_target(text_.cursor.x());
if (cur == text_.cursor)
return;
text_.setSelection();
if (!checkAndActivateInset(bv, cmd.x, tmp_y, mouse_button::none)) {
text_.setCursorFromCoordinates(cmd.x, cmd.y + dim_.asc);
text_.cursor.x(text_.cursor.x());
- text_.cursor.x_fix(text_.cursor.x());
+ bv->x_target(text_.cursor.x());
}
}
LyXCursor::LyXCursor()
- : par_(-1), pos_(0), boundary_(false), x_(0), x_fix_(0), y_(0)
+ : par_(-1), pos_(0), boundary_(false), x_(0), y_(0)
{}
x_ = n;
}
+
int LyXCursor::x() const
{
return x_;
}
-void LyXCursor::x_fix(int i)
-{
- x_fix_ = i;
-}
-
-
-int LyXCursor::x_fix() const
-{
- return x_fix_;
-}
-
-
void LyXCursor::y(int i)
{
y_ = i;
void x(int i);
/// return the x position in pixels
int x() const;
- /// set the cached x position
- void x_fix(int i);
- /**
- * Return the cached x position of the cursor. This is used for when
- * we have text like :
- *
- * blah blah blah blah| blah blah blah
- * blah blah blah
- * blah blah blah blah blah blah
- *
- * When we move onto row 3, we would like to be vertically aligned
- * with where we were in row 1, despite the fact that row 2 is
- * shorter than x()
- */
- int x_fix() const;
/// set the y position in pixels
void y(int i);
/// return the y position in pixels
bool boundary_;
/// the pixel x position
int x_;
- /// the cached x position
- int x_fix_;
/// the pixel y position
int y_;
};
text->cursor.x() + inset_x,
text->cursor.y() -
row.baseline() - 1);
- text->cursor.x_fix(text->cursor.x());
+ view()->x_target(text->cursor.x());
#else
text->cursorUp(view());
#endif
text->cursor.y() -
row.baseline() +
row.height() + 1);
- text->cursor.x_fix(text->cursor.x());
+ view()->x_target(text->cursor.x());
#else
text->cursorDown(view());
#endif
BOOST_ASSERT(false);
}
// now get the cursors x position
- float x = getCursorX(pit, row, pos, boundary);
- cur.x(int(x));
- cur.x_fix(cur.x());
+ cur.x(int(getCursorX(pit, row, pos, boundary)));
+ bv()->x_target(cur.x());
}
ParagraphList::iterator cpit = cursorPar();
Row const & crow = *cpit->getRow(cursor.pos());
#if 1
- int x = cursor.x_fix();
+ int x = bv()->x_target();
int y = cursor.y() - crow.baseline() - 1;
setCursorFromCoordinates(x, y);
if (!selecting) {
#else
lyxerr << "cursorUp: y " << cursor.y() << " bl: " <<
crow.baseline() << endl;
- setCursorFromCoordinates(cursor.x_fix(),
+ setCursorFromCoordinates(bv()->x_target(),
cursor.y() - crow.baseline() - 1);
#endif
}
ParagraphList::iterator cpit = cursorPar();
Row const & crow = *cpit->getRow(cursor.pos());
#if 1
- int x = cursor.x_fix();
+ int x = bv()->x_target();
int y = cursor.y() - crow.baseline() + crow.height() + 1;
setCursorFromCoordinates(x, y);
if (!selecting) {
}
}
#else
- setCursorFromCoordinates(cursor.x_fix(),
+ setCursorFromCoordinates(bv()->x_target(),
cursor.y() - crow.baseline() + crow.height() + 1);
#endif
}
return;
}
- setCursorFromCoordinates(cursor.x_fix(), y);
+ setCursorFromCoordinates(bv()->x_target(), y);
finishUndo();
if (crit == bv()->text->cursorRow()) {
Row const & rr = *getRowNearY(y, dummypit);
y = dummypit->y + rr.y_offset();
- setCursorFromCoordinates(cursor.x_fix(), y);
+ setCursorFromCoordinates(bv()->x_target(), y);
// + bv->workHeight());
finishUndo();
bv->text->setCursorFromCoordinates(x, y + screen_first);
finishUndo();
bv->text->selection.cursor = bv->text->cursor;
- bv->text->cursor.x_fix(bv->text->cursor.x());
+ bv->x_target(bv->text->cursor.x());
if (bv->fitCursor())
selection_possible = false;