+2004-08-13 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
+
+ * text2.C (editXY):
+ * text3.C (checkInsetHit): constify
+
2004-08-13 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* LyXAction.C (init): mark LFUN_WORD_FIND as working in read-only
2004-08-13 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
+ * insettext.C (editXY):
+
+ * insettabular.C (editXY):
+ * insetcollapsable.C (editXY):
+ * insetbase.C (editXY): constify
+
* insetcollapsable.C (priv_dispatch): on a mouse press event, do
not ask for an update if we did nothing; on a mouse release, make
sure that the cursor is moved to the right position; on a mouse
}
-InsetBase * InsetBase::editXY(LCursor &, int x, int y)
+InsetBase * InsetBase::editXY(LCursor &, int x, int y) const
{
lyxerr << "InsetBase: editXY x:" << x << " y: " << y << std::endl;
- return this;
+ return const_cast<InsetBase*>(this);
}
/// cursor enters
virtual void edit(LCursor & cur, bool left);
/// cursor enters
- virtual InsetBase * editXY(LCursor & cur, int x, int y);
+ virtual InsetBase * editXY(LCursor & cur, int x, int y) const;
/// compute the size of the object returned in dim
virtual void metrics(MetricsInfo & mi, Dimension & dim) const = 0;
}
-InsetBase * InsetCollapsable::editXY(LCursor & cur, int x, int y)
+InsetBase * InsetCollapsable::editXY(LCursor & cur, int x, int y) const
{
- cur.push(*this);
+ cur.push(const_cast<InsetCollapsable&>(*this));
//lyxerr << "InsetCollapsable: edit xy" << endl;
if (status_ == Collapsed) {
- return this;
+ return const_cast<InsetCollapsable*>(this);
}
return InsetText::editXY(cur, x, y);
}
///
void edit(LCursor & cur, bool left);
///
- InsetBase * editXY(LCursor & cur, int x, int y);
+ InsetBase * editXY(LCursor & cur, int x, int y) const;
protected:
///
}
-InsetBase * InsetTabular::editXY(LCursor & cur, int x, int y)
+InsetBase * InsetTabular::editXY(LCursor & cur, int x, int y) const
{
//lyxerr << "InsetTabular::editXY: " << this << endl;
cur.selection() = false;
- cur.push(*this);
+ cur.push(const_cast<InsetTabular&>(*this));
return setPos(cur, x, y);
//int xx = cursorx_ - xo_ + tabular.getBeginningOfTextInCell(actcell);
}
/// lock cell with given index
void edit(LCursor & cur, bool left);
///
- InsetBase * editXY(LCursor & cur, int x, int y);
+ InsetBase * editXY(LCursor & cur, int x, int y) const;
/// can we go further down on mouse click?
bool descendable() const { return true; }
}
-InsetBase * InsetText::editXY(LCursor & cur, int x, int y)
+InsetBase * InsetText::editXY(LCursor & cur, int x, int y) const
{
lyxerr << "InsetText::edit xy" << endl;
old_par = -1;
///
void edit(LCursor & cur, bool left);
///
- InsetBase * editXY(LCursor & cur, int x, int y);
+ InsetBase * editXY(LCursor & cur, int x, int y) const;
/// number of cells in this inset
size_t nargs() const { return 1; }
///
void setCursorFromCoordinates(LCursor & cur, int x, int y);
///
- InsetBase * editXY(LCursor & cur, int x, int y);
+ InsetBase * editXY(LCursor & cur, int x, int y) const;
///
void cursorUp(LCursor & cur);
///
/// updates all counters
void updateCounters();
/// Returns an inset if inset was hit, or 0 if not.
- InsetBase * checkInsetHit(int x, int y);
+ InsetBase * checkInsetHit(int x, int y) const;
///
int singleWidth(par_type pit, pos_type pos) const;
+2004-08-13 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
+
+ * math_nestinset.C (editXY): constify
+
2004-08-13 José Matos <jamatos@lyx.org>
* math_hullinset.C (docbook): add awareness of the distinction
}
-InsetBase * MathNestInset::editXY(LCursor & cur, int x, int y)
+InsetBase * MathNestInset::editXY(LCursor & cur, int x, int y) const
{
int idx_min = 0;
int dist_min = 1000000;
idx_min = i;
}
}
- MathArray & ar = cell(idx_min);
- cur.push(*this);
+ MathArray const & ar = cell(idx_min);
+ cur.push(const_cast<MathNestInset&>(*this));
cur.idx() = idx_min;
cur.pos() = ar.x2pos(x - ar.xo());
lyxerr << "found cell : " << idx_min << " pos: " << cur.pos() << endl;
if (ar[i]->covers(x, y))
return ar[i].nucleus()->editXY(cur, x, y);
}
- return this;
+ return const_cast<MathNestInset*>(this);
}
///
void edit(LCursor & cur, bool left);
///
- InsetBase * editXY(LCursor & cur, int x, int y);
+ InsetBase * editXY(LCursor & cur, int x, int y) const;
/// order of movement through the cells when pressing the left key
bool idxLeft(LCursor &) const;
// x,y are absolute screen coordinates
-InsetBase * LyXText::editXY(LCursor & cur, int x, int y)
+InsetBase * LyXText::editXY(LCursor & cur, int x, int y) const
{
par_type pit;
Row const & row = getRowNearY(y - yo_, pit);
//takes absolute x,y coordinates
-InsetBase * LyXText::checkInsetHit(int x, int y)
+InsetBase * LyXText::checkInsetHit(int x, int y) const
{
par_type pit;
par_type end;
lyxerr << "checkInsetHit: x: " << x << " y: " << y << endl;
lyxerr << " pit: " << pit << " end: " << end << endl;
for (; pit != end; ++pit) {
- InsetList::iterator iit = pars_[pit].insetlist.begin();
- InsetList::iterator iend = pars_[pit].insetlist.end();
+ InsetList::const_iterator iit = pars_[pit].insetlist.begin();
+ InsetList::const_iterator iend = pars_[pit].insetlist.end();
for (; iit != iend; ++iit) {
InsetBase * inset = iit->inset;
#if 0