mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
initial support for shift + right-mouse-click selection.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20903 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
70b938bf5a
commit
a800da1bfe
@ -1697,13 +1697,14 @@ bool BufferView::checkDepm(Cursor & cur, Cursor & old)
|
||||
}
|
||||
|
||||
|
||||
bool BufferView::mouseSetCursor(Cursor & cur)
|
||||
bool BufferView::mouseSetCursor(Cursor & cur, bool select)
|
||||
{
|
||||
BOOST_ASSERT(&cur.bv() == this);
|
||||
|
||||
// this event will clear selection so we save selection for
|
||||
// persistent selection
|
||||
cap::saveSelection(cursor());
|
||||
if (!select)
|
||||
// this event will clear selection so we save selection for
|
||||
// persistent selection
|
||||
cap::saveSelection(cursor());
|
||||
|
||||
// Has the cursor just left the inset?
|
||||
bool badcursor = false;
|
||||
@ -1711,12 +1712,15 @@ bool BufferView::mouseSetCursor(Cursor & cur)
|
||||
if (leftinset)
|
||||
badcursor = notifyCursorLeaves(d.cursor_, cur);
|
||||
|
||||
// FIXME: shift-mouse selection doesn't work well across insets.
|
||||
bool do_selection = select && &d.cursor_.anchor().inset() == &cur.inset();
|
||||
|
||||
// do the dEPM magic if needed
|
||||
// FIXME: (1) move this to InsetText::notifyCursorLeaves?
|
||||
// FIXME: (2) if we had a working InsetText::notifyCursorLeaves,
|
||||
// the leftinset bool would not be necessary (badcursor instead).
|
||||
bool update = leftinset;
|
||||
if (!badcursor && d.cursor_.inTexted())
|
||||
if (!do_selection && !badcursor && d.cursor_.inTexted())
|
||||
update |= checkDepm(cur, d.cursor_);
|
||||
|
||||
// if the cursor was in an empty script inset and the new
|
||||
@ -1738,7 +1742,11 @@ bool BufferView::mouseSetCursor(Cursor & cur)
|
||||
|
||||
d.cursor_.setCursor(dit);
|
||||
d.cursor_.boundary(cur.boundary());
|
||||
d.cursor_.clearSelection();
|
||||
if (do_selection)
|
||||
d.cursor_.setSelection();
|
||||
else
|
||||
d.cursor_.clearSelection();
|
||||
|
||||
finishUndo();
|
||||
return update;
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ public:
|
||||
bool checkDepm(Cursor & cur, Cursor & old);
|
||||
/// sets cursor.
|
||||
/// This is used when handling LFUN_MOUSE_PRESS.
|
||||
bool mouseSetCursor(Cursor & cur);
|
||||
bool mouseSetCursor(Cursor & cur, bool select = false);
|
||||
|
||||
/// sets the selection.
|
||||
/* When \c backwards == false, set anchor
|
||||
|
@ -922,11 +922,14 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
// Single-click on work area
|
||||
case LFUN_MOUSE_PRESS: {
|
||||
// Right click on a footnote flag opens float menu
|
||||
// FIXME: Why should we clear the selection in this case?
|
||||
if (cmd.button() == mouse_button::button3)
|
||||
cur.clearSelection();
|
||||
|
||||
bool do_selection = cmd.button() == mouse_button::button1
|
||||
&& cmd.argument() == "region-select";
|
||||
// Set the cursor
|
||||
bool update = bv->mouseSetCursor(cur);
|
||||
bool update = bv->mouseSetCursor(cur, do_selection);
|
||||
|
||||
// Insert primary selection with middle mouse
|
||||
// if there is a local selection in the current buffer,
|
||||
|
Loading…
Reference in New Issue
Block a user