From 80228965b1d6be9dbc8afb10578f71fec671af37 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Fri, 10 Apr 2009 12:38:32 +0000 Subject: [PATCH] Move handling of LFUN_MOUSE_RELEASE up to Inset and remove the edit() functions for insets that do not derive from InsetCollapsable. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29184 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/Inset.cpp | 10 ++++++++++ src/insets/InsetCommand.cpp | 12 ------------ src/insets/InsetCommand.h | 3 --- src/insets/InsetExternal.cpp | 13 ------------- src/insets/InsetExternal.h | 2 -- src/insets/InsetGraphics.cpp | 11 ----------- src/insets/InsetGraphics.h | 2 -- src/insets/InsetSpace.cpp | 11 ----------- src/insets/InsetSpace.h | 3 --- src/insets/InsetVSpace.cpp | 12 ------------ src/insets/InsetVSpace.h | 3 --- 11 files changed, 10 insertions(+), 72 deletions(-) diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp index 91508608fb..29984f0679 100644 --- a/src/insets/Inset.cpp +++ b/src/insets/Inset.cpp @@ -220,10 +220,20 @@ void Inset::dispatch(Cursor & cur, FuncRequest & cmd) void Inset::doDispatch(Cursor & cur, FuncRequest &cmd) { switch (cmd.action) { + case LFUN_MOUSE_RELEASE: + // if the derived inset did not explicitly handle mouse_release, + // we assume we request the settings dialog + if (!cur.selection() && cmd.button() == mouse_button::button1) { + FuncRequest tmpcmd(LFUN_INSET_SETTINGS); + dispatch(cur, tmpcmd); + } + break; + case LFUN_INSET_SETTINGS: showInsetDialog(&cur.bv()); cur.dispatched(); break; + default: cur.noUpdate(); cur.undispatched(); diff --git a/src/insets/InsetCommand.cpp b/src/insets/InsetCommand.cpp index d4a03317a2..0e6b0df080 100644 --- a/src/insets/InsetCommand.cpp +++ b/src/insets/InsetCommand.cpp @@ -136,12 +136,6 @@ void InsetCommand::doDispatch(Cursor & cur, FuncRequest & cmd) break; } - case LFUN_MOUSE_RELEASE: { - if (!cur.selection() && cmd.button() != mouse_button::button3) - edit(cur, true); - break; - } - default: Inset::doDispatch(cur, cmd); break; @@ -186,12 +180,6 @@ docstring InsetCommand::contextMenu(BufferView const &, int, int) const } -void InsetCommand::edit(Cursor & cur, bool, EntryDirection) -{ - showInsetDialog(&cur.bv()); -} - - bool InsetCommand::showInsetDialog(BufferView * bv) const { if (!mailer_name_.empty()) diff --git a/src/insets/InsetCommand.h b/src/insets/InsetCommand.h index 30f690f6ba..a4dd7c3340 100644 --- a/src/insets/InsetCommand.h +++ b/src/insets/InsetCommand.h @@ -90,9 +90,6 @@ private: /// InsetCode lyxCode() const { return NO_CODE; } /// - void edit(Cursor & cur, bool front, - EntryDirection entry_from = ENTRY_DIRECTION_IGNORE); - /// RenderButton & button() const { return button_; } /// bool setMouseHover(bool mouse_hover); diff --git a/src/insets/InsetExternal.cpp b/src/insets/InsetExternal.cpp index 7aed200a47..e53ee55987 100644 --- a/src/insets/InsetExternal.cpp +++ b/src/insets/InsetExternal.cpp @@ -414,13 +414,6 @@ void InsetExternal::doDispatch(Cursor & cur, FuncRequest & cmd) params2string(params(), cur.bv().buffer())); break; - case LFUN_MOUSE_RELEASE: - if (!cur.selection() && cmd.button() == mouse_button::button1) - cur.bv().showDialog("external", - params2string(params(), cur.bv().buffer()), - this); - break; - default: Inset::doDispatch(cur, cmd); } @@ -445,12 +438,6 @@ bool InsetExternal::getStatus(Cursor & cur, FuncRequest const & cmd, } -void InsetExternal::edit(Cursor & cur, bool, EntryDirection) -{ - showInsetDialog(&cur.bv()); -} - - bool InsetExternal::showInsetDialog(BufferView * bv) const { bv->showDialog("external", params2string(params(), bv->buffer()), diff --git a/src/insets/InsetExternal.h b/src/insets/InsetExternal.h index 5572828489..490c6ed3c4 100644 --- a/src/insets/InsetExternal.h +++ b/src/insets/InsetExternal.h @@ -138,8 +138,6 @@ private: /// void addPreview(graphics::PreviewLoader &) const; /// - void edit(Cursor & cur, bool front, EntryDirection entry_from); - /// bool showInsetDialog(BufferView * bv) const; /// bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp index 1b809e1960..04955ab6a3 100644 --- a/src/insets/InsetGraphics.cpp +++ b/src/insets/InsetGraphics.cpp @@ -215,11 +215,6 @@ void InsetGraphics::doDispatch(Cursor & cur, FuncRequest & cmd) cur.bv().updateDialog("graphics", params2string(params(), buffer())); break; - case LFUN_MOUSE_RELEASE: - if (!cur.selection() && cmd.button() == mouse_button::button1) - cur.bv().showDialog("graphics", params2string(params(), buffer()), this); - break; - default: Inset::doDispatch(cur, cmd); break; @@ -244,12 +239,6 @@ bool InsetGraphics::getStatus(Cursor & cur, FuncRequest const & cmd, } -void InsetGraphics::edit(Cursor & cur, bool, EntryDirection) -{ - showInsetDialog(&cur.bv()); -} - - bool InsetGraphics::showInsetDialog(BufferView * bv) const { bv->showDialog("graphics", params2string(params(), bv->buffer()), diff --git a/src/insets/InsetGraphics.h b/src/insets/InsetGraphics.h index 8b459a677f..7aaff0cf83 100644 --- a/src/insets/InsetGraphics.h +++ b/src/insets/InsetGraphics.h @@ -85,8 +85,6 @@ private: /// void draw(PainterInfo & pi, int x, int y) const; /// - void edit(Cursor & cur, bool front, EntryDirection entry_from); - /// bool showInsetDialog(BufferView * bv) const; /// void editGraphics(InsetGraphicsParams const &, Buffer const &) const; diff --git a/src/insets/InsetSpace.cpp b/src/insets/InsetSpace.cpp index db7072f95f..a12d28e1d0 100644 --- a/src/insets/InsetSpace.cpp +++ b/src/insets/InsetSpace.cpp @@ -153,11 +153,6 @@ void InsetSpace::doDispatch(Cursor & cur, FuncRequest & cmd) cur.bv().updateDialog("space", params2string(params())); break; - case LFUN_MOUSE_RELEASE: - if (!cur.selection() && cmd.button() == mouse_button::button1) - cur.bv().showDialog("space", params2string(params()), this); - break; - default: Inset::doDispatch(cur, cmd); break; @@ -187,12 +182,6 @@ bool InsetSpace::getStatus(Cursor & cur, FuncRequest const & cmd, } -void InsetSpace::edit(Cursor & cur, bool, EntryDirection) -{ - showInsetDialog(&cur.bv()); -} - - bool InsetSpace::showInsetDialog(BufferView * bv) const { bv->showDialog("space", params2string(params()), diff --git a/src/insets/InsetSpace.h b/src/insets/InsetSpace.h index d3842ddd05..5e1638e212 100644 --- a/src/insets/InsetSpace.h +++ b/src/insets/InsetSpace.h @@ -133,9 +133,6 @@ public: /// the string that is passed to the TOC void tocString(odocstream &) const; /// - void edit(Cursor & cur, bool front, - EntryDirection entry_from = ENTRY_DIRECTION_IGNORE); - /// EDITABLE editable() const { return IS_EDITABLE; } /// InsetCode lyxCode() const { return SPACE_CODE; } diff --git a/src/insets/InsetVSpace.cpp b/src/insets/InsetVSpace.cpp index 0042f981d1..a0249720fa 100644 --- a/src/insets/InsetVSpace.cpp +++ b/src/insets/InsetVSpace.cpp @@ -66,12 +66,6 @@ void InsetVSpace::doDispatch(Cursor & cur, FuncRequest & cmd) break; } - case LFUN_MOUSE_RELEASE: - if (!cur.selection() && cmd.button() == mouse_button::button1) - cur.bv().showDialog("vspace", params2string(space()), - const_cast(this)); - break; - default: Inset::doDispatch(cur, cmd); break; @@ -103,12 +97,6 @@ bool InsetVSpace::getStatus(Cursor & cur, FuncRequest const & cmd, } -void InsetVSpace::edit(Cursor & cur, bool, EntryDirection) -{ - showInsetDialog(&cur.bv()); -} - - bool InsetVSpace::showInsetDialog(BufferView * bv) const { bv->showDialog("vspace", params2string(space()), diff --git a/src/insets/InsetVSpace.h b/src/insets/InsetVSpace.h index a559f13be9..873e3c3623 100644 --- a/src/insets/InsetVSpace.h +++ b/src/insets/InsetVSpace.h @@ -32,9 +32,6 @@ public: /// InsetCode lyxCode() const { return VSPACE_CODE; } /// - void edit(Cursor & cur, bool front, - EntryDirection entry_from = ENTRY_DIRECTION_IGNORE); - /// EDITABLE editable() const { return IS_EDITABLE; } /// docstring contextMenu(BufferView const & bv, int x, int y) const; -- 2.39.2