x = 0;
y = 0;
if (!empty())
- inset().getCursorPos(back(), x, y);
+ inset().getCursorPos(*this, x, y);
}
// avoid invalid nesting when selecting
if (!selection() || positionable(it, anchor_)) {
int xo = 0, yo = 0;
- CursorSlice & cur = it.back();
+ LCursor cur = *this;
+ cur.setCursor(it, false);
cur.inset().getCursorPos(cur, xo, yo);
if (xlow <= xo && xo <= xhigh && ylow <= yo && yo <= yhigh) {
double d = (x - xo) * (x - xo) + (y - yo) * (y - yo);
et.back().pos() = et.back().asMathInset()->cell(et.back().idx()).size();
for (int i = 0; ; ++i) {
int xo, yo;
- CursorSlice & cur = it.back();
+ LCursor cur = *this;
+ cur.setCursor(it, false);
cur.inset().getCursorPos(cur, xo, yo);
double d = (x - xo) * (x - xo) + (y - yo) * (y - yo);
// '<=' in order to take the last possible position
{}
-void InsetBase::getCursorPos(CursorSlice const &, int & x, int & y) const
+void InsetBase::getCursorPos(LCursor const &, int & x, int & y) const
{
lyxerr << "InsetBase::getCursorPos called directly" << std::endl;
x = 100;
/// do we cover screen position x/y?
virtual bool covers(int x, int y) const;
/// get the screen positions of the cursor (see note in cursor.C)
- virtual void getCursorPos(CursorSlice const & cur, int & x, int & y) const;
+ virtual void getCursorPos(LCursor const & cur, int & x, int & y) const;
/// is this an inset that can be moved into?
virtual bool isActive() const { return nargs() > 0; }
}
-void InsetTabular::getCursorPos(CursorSlice const & cur, int & x, int & y) const
+void InsetTabular::getCursorPos(LCursor const & cur, int & x, int & y) const
{
cell(cur.idx()).getCursorPos(cur, x, y);
}
///
void validate(LaTeXFeatures & features) const;
///
- InsetOld::Code lyxCode() const { return InsetOld::TABULAR_CODE; }
+ Code lyxCode() const { return InsetOld::TABULAR_CODE; }
/// get the absolute screen x,y of the cursor
- void getCursorPos(CursorSlice const & cur, int & x, int & y) const;
+ void getCursorPos(LCursor const & cur, int & x, int & y) const;
///
bool tabularFeatures(LCursor & cur, std::string const & what);
///
}
-void InsetText::getCursorPos(CursorSlice const & cur, int & x, int & y) const
+void InsetText::getCursorPos(LCursor const & cur, int & x, int & y) const
{
- x = text_.cursorX(cur);
- y = text_.cursorY(cur);
+ x = text_.cursorX(cur.top());
+ y = text_.cursorY(cur.top());
}
///
InsetOld::Code lyxCode() const { return InsetOld::TEXT_CODE; }
/// FIXME, document
- void getCursorPos(CursorSlice const & cur, int & x, int & y) const;
+ void getCursorPos(LCursor const & cur, int & x, int & y) const;
///
void setFont(BufferView *, LyXFont const &,
bool toggleall = false,
#include "BufferView.h"
#include "buffer.h"
#include "bufferparams.h"
+#include "cursor.h"
#include "debug.h"
#include "metricsinfo.h"
#include "output_latex.h"
}
-void MathMBoxInset::getCursorPos(CursorSlice const & cur, int & x, int & y) const
+void MathMBoxInset::getCursorPos(LCursor const & cur, int & x, int & y) const
{
- x = text_.cursorX(cur);
- y = text_.cursorY(cur);
+ x = text_.cursorX(cur.top());
+ y = text_.cursorY(cur.top());
}
///
LyXText * getText(int) const;
///
- void getCursorPos(CursorSlice const & cur, int & x, int & y) const;
+ void getCursorPos(LCursor const & cur, int & x, int & y) const;
protected:
///
mutable LyXText text_;
}
-void MathNestInset::getCursorPos(CursorSlice const & cur,
- int & x, int & y) const
+void MathNestInset::getCursorPos(LCursor const & cur, int & x, int & y) const
{
BOOST_ASSERT(ptr_cmp(&cur.inset(), this));
MathArray const & ar = cur.cell();
x = ar.xo() + ar.pos2x(cur.pos());
- y = ar.yo();
+ y = ar.yo() + cur.bv().top_y();
// move cursor visually into empty cells ("blue rectangles");
if (cur.cell().empty())
x += 2;
/// identifies NestInsets
MathNestInset const * asNestInset() const { return this; }
/// get cursor position
- void getCursorPos(CursorSlice const & cur, int & x, int & y) const;
+ void getCursorPos(LCursor const & cur, int & x, int & y) const;
///
void edit(LCursor & cur, bool left);
///
#include "math_textinset.h"
#include "math_data.h"
-#include "cursor_slice.h"
+#include "cursor.h"
#include "debug.h"
#include "metricsinfo.h"
}
-void MathTextInset::getCursorPos(CursorSlice const & cur, int & x, int & y) const
+void MathTextInset::getCursorPos(LCursor const & cur, int & x, int & y) const
{
- CursorSlice c = cur;
+ LCursor c = cur;
c.idx() = pos2row(cur.pos());
c.pos() -= cache_.cellinfo_[c.idx()].begin_;
cache_.getCursorPos(c, x, y);
///
MathTextInset();
///
- virtual std::auto_ptr<InsetBase> clone() const;
+ std::auto_ptr<InsetBase> clone() const;
/// get cursor position
- void getCursorPos(CursorSlice const & cur, int & x, int & y) const;
+ void getCursorPos(LCursor const & cur, int & x, int & y) const;
/// this stores metrics information in cache_
void metrics(MetricsInfo & mi, Dimension & dim) const;
/// draw according to cached metrics