}
+void BufferView::mouseSetCursor(LCursor & cur)
+{
+ BOOST_ASSERT(&cur.bv() == this);
+
+ // Has the cursor just left the inset?
+ if (&cursor().inset() != &cur.inset())
+ cursor().inset().notifyCursorLeaves(cursor());
+
+ // do the dEPM magic if needed
+ if (cursor().inTexted())
+ cursor().text()->deleteEmptyParagraphMechanism(cur, cursor());
+
+ cursor() = cur;
+ cursor().resetAnchor();
+ cursor().setTargetX();
+ finishUndo();
+
+}
+
+
void BufferView::putSelectionAt(DocIterator const & cur,
int length, bool backwards)
{
LCursor const & cursor() const;
///
LyXText * text() const;
- ///
+ /// sets cursor and open all relevant collapsable insets.
void setCursor(DocIterator const &);
+ /// sets cursor; this is used when handling LFUN_MOUSE_PRESS.
+ void mouseSetCursor(LCursor & cur);
+
/* Sets the selection. When \c backwards == false, set anchor
* to \c cur and cursor to \c cur + \c length. When \c
* backwards == true, set anchor to \c cur and cursor to \c
-2005-11-29 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
+2005-11-30 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
+
+ * BufferView.C (mouseSetCursor): new method. Calls
+ deleteEmptyParagraphMechanism if necessary.
+
+ * lyxtext.h: make deleteEmptyParagraphMechanism public.
+
+ * text3.C (dispatch/LFUN_MOUSE_PRESS): use
+ BufferView::mouseSetCursor (bug 2109).
+ (dispatch/LFUN_PASTE): remove #warning that is now irrelevant.
+
+2005-11-29 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* text3.C (dispatch/LFUN_INDEX_INSERT): when a selection is set,
do not remove it (this inset behaves differently from the others).
///
int cursorY(CursorSlice const & cursor, bool boundary) const;
+ /// delete double space or empty paragraphs around old cursor
+ bool deleteEmptyParagraphMechanism(LCursor & cur, LCursor & old);
+
///
friend class LyXScreen;
// position. Called by deleteEmptyParagraphMechanism
void fixCursorAfterDelete(CursorSlice & cur, CursorSlice const & where);
- /// delete double space or empty paragraphs around old cursor
- bool deleteEmptyParagraphMechanism(LCursor & cur, LCursor & old);
-
///
void deleteWordForward(LCursor & cur);
///
+2005-11-30 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
+
+ * math_nestinset.C (lfunMousePress): use mouseSetCursor (bug 2109).
+
+ * math_hullinset.C (doDispatch): comment out some annoying debug
+ messages.
+
2005-11-28 Martin Vermeer <martin.vermeer@hut.fi>
* math_deliminset.h:
void MathHullInset::doDispatch(LCursor & cur, FuncRequest & cmd)
{
- lyxerr << "action: " << cmd.action << endl;
+ //lyxerr << "action: " << cmd.action << endl;
switch (cmd.action) {
case LFUN_FINISHED_LEFT:
case LFUN_FINISHED_RIGHT:
case LFUN_FINISHED_UP:
case LFUN_FINISHED_DOWN:
- lyxerr << "action: " << cmd.action << endl;
+ //lyxerr << "action: " << cmd.action << endl;
MathGridInset::doDispatch(cur, cmd);
notifyCursorLeaves(cur);
cur.undispatched();
//lyxerr << "## lfunMousePress: buttons: " << cmd.button() << endl;
if (cmd.button() == mouse_button::button1) {
//lyxerr << "## lfunMousePress: setting cursor to: " << cur << endl;
- cur.resetAnchor();
- cur.bv().cursor() = cur;
+ cur.bv().mouseSetCursor(cur);
}
if (cmd.button() == mouse_button::button2) {
case LFUN_PASTE:
cur.message(_("Paste"));
lyx::cap::replaceSelection(cur);
-#ifdef WITH_WARNINGS
-#warning FIXME Check if the arg is in the domain of available selections.
-#endif
if (isStrUnsignedInt(cmd.argument))
pasteSelection(cur, convert<unsigned int>(cmd.argument));
else
paste_internally = true;
}
- // Clear the selection
- cur.clearSelection();
-
- setCursorFromCoordinates(cur, cmd.x, cmd.y);
- cur.resetAnchor();
- finishUndo();
- cur.setTargetX();
-
- // Has the cursor just left the inset?
- if (bv->cursor().inMathed() && !cur.inMathed())
- bv->cursor().inset().notifyCursorLeaves(bv->cursor());
-
- // Set cursor here.
- bv->cursor() = cur;
+ bv->mouseSetCursor(cur);
// Insert primary selection with middle mouse
// if there is a local selection in the current buffer,