From: Angus Leeming Date: Sun, 9 Mar 2003 09:38:47 +0000 (+0000) Subject: Remove the 'gross hack' of calling inset->edit when LFUN_MOUSE_RELEASE X-Git-Tag: 1.6.10~17317 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=d94600a357a3f7ef824bf4de6d2845ffbdbee628;p=features.git Remove the 'gross hack' of calling inset->edit when LFUN_MOUSE_RELEASE is better handled by inset->localDispatch. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6395 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/ChangeLog b/src/ChangeLog index 0f9fca01f3..f7171fefdd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -30,6 +30,12 @@ * LaTeX.C (run): Fix a bug where the DVI file was not updated due to an old format .dep file. +2003-03-07 Angus Leeming + + * text3.C (dispatch): remove the 'gross hack' of calling inset->edit + when the LFUN_MOUSE_RELEASE should have been handled by + inset->localDispatch. + 2003-03-07 Angus Leeming * BufferView_pimpl.C (dispatch): diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 9307dbe4dd..68607647d1 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,8 @@ +2003-03-07 Angus Leeming + + * inseterror.C (localDispatch): new method; calls edit() on + LFUN_MOUSE_RELEASE. + 2003-03-07 Angus Leeming * insetbibitem.C (localDispatch): diff --git a/src/insets/insetcommand.C b/src/insets/insetcommand.C index dadb444486..2759492a44 100644 --- a/src/insets/insetcommand.C +++ b/src/insets/insetcommand.C @@ -88,6 +88,10 @@ dispatch_result InsetCommand::localDispatch(FuncRequest const & cmd) } break; + case LFUN_MOUSE_RELEASE: + edit(cmd.view(), cmd.x, cmd.y, cmd.button()); + break; + default: break; } diff --git a/src/insets/insetcommand.h b/src/insets/insetcommand.h index 8d2e70b9f3..6d8df729c3 100644 --- a/src/insets/insetcommand.h +++ b/src/insets/insetcommand.h @@ -70,7 +70,7 @@ public: InsetCommandParams const & params() const { return p_; } /// void setParams(InsetCommandParams const &); - /// small wrapper for the time being + /// virtual dispatch_result localDispatch(FuncRequest const & cmd); private: diff --git a/src/insets/inseterror.C b/src/insets/inseterror.C index 08b9b4179e..084a777bb5 100644 --- a/src/insets/inseterror.C +++ b/src/insets/inseterror.C @@ -10,15 +10,18 @@ #include +#include "inseterror.h" #include "BufferView.h" -#include "frontends/font_metrics.h" -#include "lyxfont.h" +#include "funcrequest.h" #include "gettext.h" -#include "inseterror.h" +#include "lyxfont.h" + +#include "frontends/Dialogs.h" +#include "frontends/font_metrics.h" #include "frontends/LyXView.h" #include "frontends/Painter.h" -#include "frontends/Dialogs.h" + #include "support/LAssert.h" using std::ostream; @@ -37,6 +40,23 @@ InsetError::~InsetError() } +dispatch_result InsetError::localDispatch(FuncRequest const & cmd) +{ + dispatch_result result = UNDISPATCHED; + + switch (cmd.action) { + case LFUN_MOUSE_RELEASE: + edit(cmd.view(), cmd.x, cmd.y, cmd.button()); + break; + + default: + break; + } + + return result; +} + + int InsetError::ascent(BufferView *, LyXFont const & font) const { LyXFont efont; diff --git a/src/insets/inseterror.h b/src/insets/inseterror.h index e24aa22bd2..e0d1ad36e3 100644 --- a/src/insets/inseterror.h +++ b/src/insets/inseterror.h @@ -29,6 +29,8 @@ public: /// ~InsetError(); /// + virtual dispatch_result localDispatch(FuncRequest const & cmd); + /// int ascent(BufferView *, LyXFont const &) const; /// int descent(BufferView *, LyXFont const &) const; diff --git a/src/insets/insetexternal.C b/src/insets/insetexternal.C index 7f2ff23107..c377a7780c 100644 --- a/src/insets/insetexternal.C +++ b/src/insets/insetexternal.C @@ -85,6 +85,10 @@ dispatch_result InsetExternal::localDispatch(FuncRequest const & cmd) } break; + case LFUN_MOUSE_RELEASE: + edit(cmd.view(), cmd.x, cmd.y, cmd.button()); + break; + default: break; } diff --git a/src/insets/insetgraphics.C b/src/insets/insetgraphics.C index 932ac0af4e..ab60e9ba70 100644 --- a/src/insets/insetgraphics.C +++ b/src/insets/insetgraphics.C @@ -241,6 +241,10 @@ dispatch_result InsetGraphics::localDispatch(FuncRequest const & cmd) } break; + case LFUN_MOUSE_RELEASE: + edit(cmd.view(), cmd.x, cmd.y, cmd.button()); + break; + default: result = DISPATCHED; break; diff --git a/src/insets/insetinclude.C b/src/insets/insetinclude.C index 84c07b3421..2057a751f9 100644 --- a/src/insets/insetinclude.C +++ b/src/insets/insetinclude.C @@ -138,6 +138,10 @@ dispatch_result InsetInclude::localDispatch(FuncRequest const & cmd) } break; + case LFUN_MOUSE_RELEASE: + edit(cmd.view(), cmd.x, cmd.y, cmd.button()); + break; + default: break; } diff --git a/src/insets/insetlabel.C b/src/insets/insetlabel.C index 0642361d3c..efb874673d 100644 --- a/src/insets/insetlabel.C +++ b/src/insets/insetlabel.C @@ -74,6 +74,7 @@ dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd) result = DISPATCHED; } break; + default: result = InsetCommand::localDispatch(cmd); } diff --git a/src/text3.C b/src/text3.C index 0782e0fcf9..0ac114e8ba 100644 --- a/src/text3.C +++ b/src/text3.C @@ -1528,24 +1528,8 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd) bv->owner()->message(inset_hit->editMessage()); - if (isHighlyEditableInset(inset_hit)) { - // Highly editable inset, like math - UpdatableInset * inset = (UpdatableInset *) inset_hit; - FuncRequest cmd1(bv, LFUN_MOUSE_RELEASE, x, y, cmd.button()); - inset->localDispatch(cmd1); - } else { - FuncRequest cmd1(bv, LFUN_MOUSE_RELEASE, x, y, cmd.button()); - inset_hit->localDispatch(cmd1); - // IMO this is a gross hack! Insets should be changed so that - // they call the actions they have to do with the insetButtonRel. - // function and not in the edit(). This should be changed - // (Jug 20020329) -#ifdef WITH_WARNINGS -#warning Please remove donot call inset->edit() here (Jug 20020812) -#endif - inset_hit->edit(bv, x, y, cmd.button()); - } - break; + FuncRequest cmd1(bv, LFUN_MOUSE_RELEASE, x, y, cmd.button()); + inset_hit->localDispatch(cmd1); } break;