http://bugzilla.lyx.org/show_bug.cgi?id=4662
* InsetCollapsable.cpp (doDispatch): cleanup the handling of mouse-
related lfuns. The new behavior is as follows:
- everything that does not touch the button is sent to the insettext,
if it is visible, and delegated to enclosing inset instead
- mouse1-press is delegated to enclosing inset (which will set the
cursor)
- the rest is either acted upon or results on a mere cur.noUpdate().
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26122
a592a061-630c-0410-9148-
cb99ea01b6c8
Inset::EDITABLE InsetCollapsable::editable() const
{
Inset::EDITABLE InsetCollapsable::editable() const
{
- return geometry() != ButtonOnly? HIGHLY_EDITABLE : IS_EDITABLE;
+ return geometry() != ButtonOnly ? HIGHLY_EDITABLE : IS_EDITABLE;
switch (cmd.action) {
case LFUN_MOUSE_PRESS:
switch (cmd.action) {
case LFUN_MOUSE_PRESS:
- if (hitButton(cmd) && geometry() != NoButton) {
switch (cmd.button()) {
case mouse_button::button1:
switch (cmd.button()) {
case mouse_button::button1:
- // reset selection if necessary (see bug 3060)
- if (cur.selection())
- cur.bv().cursor().clearSelection();
- else
- cur.noUpdate();
- cur.dispatched();
- return;
+ // Pass the command to the enclosing InsetText,
+ // so that the cursor gets set.
+ cur.undispatched();
+ break;
case mouse_button::none:
case mouse_button::button2:
case mouse_button::button3:
case mouse_button::button4:
case mouse_button::button5:
// Nothing to do.
case mouse_button::none:
case mouse_button::button2:
case mouse_button::button3:
case mouse_button::button4:
case mouse_button::button5:
// Nothing to do.
- cur.undispatched();
- return;
+ cur.noUpdate();
+ break;
- }
- if (geometry() == NoButton
- || (geometry() != ButtonOnly && !hitButton(cmd)))
+ } else if (geometry() != ButtonOnly)
InsetText::doDispatch(cur, cmd);
else
cur.undispatched();
InsetText::doDispatch(cur, cmd);
else
cur.undispatched();
case LFUN_MOUSE_MOTION:
case LFUN_MOUSE_DOUBLE:
case LFUN_MOUSE_TRIPLE:
case LFUN_MOUSE_MOTION:
case LFUN_MOUSE_DOUBLE:
case LFUN_MOUSE_TRIPLE:
- if (geometry() == NoButton)
- InsetText::doDispatch(cur, cmd);
- else if (geometry() != ButtonOnly
- && !hitButton(cmd))
+ if (hitButton(cmd))
+ cur.noUpdate();
+ else if (geometry() != ButtonOnly)
InsetText::doDispatch(cur, cmd);
else
cur.undispatched();
break;
case LFUN_MOUSE_RELEASE:
InsetText::doDispatch(cur, cmd);
else
cur.undispatched();
break;
case LFUN_MOUSE_RELEASE:
- if (geometry() == NoButton
- || (geometry() != ButtonOnly && !hitButton(cmd))) {
// The mouse click has to be within the inset!
// The mouse click has to be within the inset!
- InsetText::doDispatch(cur, cmd);
+ if (geometry() != ButtonOnly)
+ InsetText::doDispatch(cur, cmd);
+ else
+ cur.undispatched();
break;
}
if (cmd.button() != mouse_button::button1) {
break;
}
if (cmd.button() != mouse_button::button1) {
+ // Nothing to do.
+ cur.noUpdate();
break;
}
// if we are selecting, we do not want to
break;
}
// if we are selecting, we do not want to
void cursorPos(BufferView const & bv, CursorSlice const & sl,
///
bool boundary, int & x, int & y) const;
void cursorPos(BufferView const & bv, CursorSlice const & sl,
///
bool boundary, int & x, int & y) const;
+ /// Returns true if (mouse) action is over the inset's button.
+ /// Always returns false when the inset does not have a
+ /// button.
bool hitButton(FuncRequest const &) const;
///
docstring const getNewLabel(docstring const & l) const;
bool hitButton(FuncRequest const &) const;
///
docstring const getNewLabel(docstring const & l) const;