bool BufferView::Pimpl::workAreaDispatch(FuncRequest const & cmd0)
{
- lyxerr << BOOST_CURRENT_FUNCTION
- << "[ cmd0 " << cmd0 << "]" << endl;
+ //lyxerr << BOOST_CURRENT_FUNCTION << "[ cmd0 " << cmd0 << "]" << endl;
// This is only called for mouse related events including
// LFUN_FILE_OPEN generated by drag-and-drop.
// Build temporary cursor.
cmd.y = min(max(cmd.y,-1), workarea().workHeight());
InsetBase * inset = bv_->text()->editXY(cur, cmd.x, cmd.y);
- lyxerr << BOOST_CURRENT_FUNCTION
- << " * hit inset at tip: " << inset << endl;
- lyxerr << BOOST_CURRENT_FUNCTION
- << " * created temp cursor:" << cur << endl;
+ //lyxerr << BOOST_CURRENT_FUNCTION
+ // << " * hit inset at tip: " << inset << endl;
+ //lyxerr << BOOST_CURRENT_FUNCTION
+ // << " * created temp cursor:" << cur << endl;
// Put anchor at the same position.
cur.resetAnchor();
-2005-05-07 André Pönitz <poenitz@gmx.net>
+2005-07-14 André Pönitz <poenitz@gmx.net>
* undo.C (recordUndoFullBuffer): implement undo for
textclass switches
-2005-05-07 André Pönitz <poenitz@gmx.net>
+2005-07-14 André Pönitz <poenitz@gmx.net>
* cursor.C (setSelection): open insets when selection is set there
to avoid crashs with cold coord cache
-2005-05-07 André Pönitz <poenitz@gmx.net>
+2005-07-14 André Pönitz <poenitz@gmx.net>
* trans_mgr.C (insert): move cursor to the right after inserting
a char.
}
-InsetBase * InsetBase::editXY(LCursor &, int x, int y) const
+InsetBase * InsetBase::editXY(LCursor &, int x, int y)
{
lyxerr << "InsetBase: editXY x:" << x << " y: " << y << std::endl;
- return const_cast<InsetBase*>(this);
+ return this;
}
/// cursor enters
virtual void edit(LCursor & cur, bool left);
/// cursor enters
- virtual InsetBase * editXY(LCursor & cur, int x, int y) const;
+ virtual InsetBase * editXY(LCursor & cur, int x, int y);
/// 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) const
+InsetBase * InsetCollapsable::editXY(LCursor & cur, int x, int y)
{
//lyxerr << "InsetCollapsable: edit xy" << endl;
- if (status_ == Collapsed) {
- return const_cast<InsetCollapsable*>(this);
- }
- cur.push(const_cast<InsetCollapsable&>(*this));
+ if (status_ == Collapsed)
+ return this;
+ cur.push(*this);
return InsetText::editXY(cur, x, y);
}
///
void edit(LCursor & cur, bool left);
///
- InsetBase * editXY(LCursor & cur, int x, int y) const;
+ InsetBase * editXY(LCursor & cur, int x, int y);
///
void setInlined() { status_ = Inlined; }
}
-InsetBase * InsetTabular::editXY(LCursor & cur, int x, int y) const
+InsetBase * InsetTabular::editXY(LCursor & cur, int x, int y)
{
//lyxerr << "InsetTabular::editXY: " << this << endl;
cur.selection() = false;
- cur.push(const_cast<InsetTabular&>(*this));
+ cur.push(*this);
cur.idx() = getNearestCell(x, y);
resetPos(cur);
return cell(cur.idx())->text_.editXY(cur, x, y);
/// lock cell with given index
void edit(LCursor & cur, bool left);
///
- InsetBase * editXY(LCursor & cur, int x, int y) const;
+ InsetBase * editXY(LCursor & cur, int x, int y);
/// can we go further down on mouse click?
bool descendable() const { return true; }
}
-InsetBase * InsetText::editXY(LCursor & cur, int x, int y) const
+InsetBase * InsetText::editXY(LCursor & cur, int x, int y)
{
old_pit = -1;
return text_.editXY(cur, x, y);
///
void edit(LCursor & cur, bool left);
///
- InsetBase * editXY(LCursor & cur, int x, int y) const;
+ InsetBase * editXY(LCursor & cur, int x, int y);
/// 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) const;
+ InsetBase * editXY(LCursor & cur, int x, int y);
/// Move cursor one line up.
/**
* Returns true if an update is needed after the move.
-2005-07-16 André Pönitz <poenitz@lyx.org>
+2005-07-15 Andreas Vox <vox@arcor.de>
+
+ * math_hullinset.C (editXY): partial fix for #622
+
+2005-07-14 André Pönitz <poenitz@lyx.org>
* math_hullinset.C (BREAKLINE): choose between eqnarray and
align according to user preference
-2005-07-16 André Pönitz <poenitz@lyx.org>
+2005-07-14 André Pönitz <poenitz@lyx.org>
* math_charinset.C (mathmlize): escape <, >, and & on export
-2005-07-16 André Pönitz <poenitz@lyx.org>
+2005-07-14 André Pönitz <poenitz@lyx.org>
* math_gridinset.C (doDispatch): cur.undispatched on LFUN_ESCAPE
-2005-07-16 André Pönitz <poenitz@lyx.org>
+2005-07-14 André Pönitz <poenitz@lyx.org>
* math_gridinset.C (doDispatch): cur.undispatched on LFUN_NEXT/PRIOR
}
+InsetBase * MathHullInset::editXY(LCursor & cur, int x, int y)
+{
+ if (RenderPreview::status() == LyXRC::PREVIEW_ON) {
+ edit(cur, true);
+ return this;
+ }
+ return MathNestInset::editXY(cur, x, y);
+}
+
+
MathInset::mode_type MathHullInset::currentMode() const
{
if (type_ == "none")
///
void edit(LCursor & cur, bool left);
///
+ InsetBase * editXY(LCursor & cur, int x, int y);
+ ///
bool display() const;
///
Code lyxCode() const;
}
-InsetBase * MathNestInset::editXY(LCursor & cur, int x, int y) const
+InsetBase * MathNestInset::editXY(LCursor & cur, int x, int y)
{
int idx_min = 0;
int dist_min = 1000000;
- for (idx_type i = 0; i < nargs(); ++i) {
- int d = cell(i).dist(x, y);
+ for (idx_type i = 0, n = nargs(); i != n; ++i) {
+ int const d = cell(i).dist(x, y);
if (d < dist_min) {
dist_min = d;
idx_min = i;
}
}
- MathArray const & ar = cell(idx_min);
- cur.push(const_cast<MathNestInset&>(*this));
+ MathArray & ar = cell(idx_min);
+ cur.push(*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 const_cast<MathNestInset*>(this);
+ return this;
}
///
void edit(LCursor & cur, bool left);
///
- InsetBase * editXY(LCursor & cur, int x, int y) const;
+ InsetBase * editXY(LCursor & cur, int x, int y);
/// order of movement through the cells when pressing the left key
bool idxLeft(LCursor &) const;
// x,y are absolute screen coordinates
// sets cursor recursively descending into nested editable insets
-InsetBase * LyXText::editXY(LCursor & cur, int x, int y) const
+InsetBase * LyXText::editXY(LCursor & cur, int x, int y)
{
pit_type pit = getPitNearY(y);
BOOST_ASSERT(pit != -1);
if (!inset) {
// Either we deconst editXY or better we move current_font
// and real_current_font to LCursor
- const_cast<LyXText *>(this)->setCurrentFont(cur);
+ setCurrentFont(cur);
return 0;
}
--cur.pos();
inset = inset->editXY(cur, x, y);
if (cur.top().text() == this)
- const_cast<LyXText *>(this)->setCurrentFont(cur);
+ setCurrentFont(cur);
return inset;
}
void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
{
lyxerr[Debug::ACTION] << "LyXText::dispatch: cmd: " << cmd << endl;
- lyxerr << "*** LyXText::dispatch: cmd: " << cmd << endl;
BOOST_ASSERT(cur.text() == this);
BufferView * bv = &cur.bv();
// don't set anchor_
bvcur.setCursor(cur);
bvcur.selection() = true;
- lyxerr << "MOTION: " << bv->cursor() << endl;
+ //lyxerr << "MOTION: " << bv->cursor() << endl;
}
} else
undo.cursor = cur;
undo.bparams = bparams ;
undo.isFullBuffer = isFullBuffer;
- lyxerr << "recordUndo: cur: " << cur << endl;
- lyxerr << "recordUndo: pos: " << cur.pos() << endl;
+ //lyxerr << "recordUndo: cur: " << cur << endl;
+ //lyxerr << "recordUndo: pos: " << cur.pos() << endl;
//lyxerr << "recordUndo: cell: " << cell << endl;
undo.from = first_pit;
undo.end = cell.lastpit() - last_pit;