]> git.lyx.org Git - features.git/commitdiff
Remove the 'gross hack' of calling inset->edit when LFUN_MOUSE_RELEASE
authorAngus Leeming <leeming@lyx.org>
Sun, 9 Mar 2003 09:38:47 +0000 (09:38 +0000)
committerAngus Leeming <leeming@lyx.org>
Sun, 9 Mar 2003 09:38:47 +0000 (09:38 +0000)
is better handled by inset->localDispatch.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6395 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/insets/ChangeLog
src/insets/insetcommand.C
src/insets/insetcommand.h
src/insets/inseterror.C
src/insets/inseterror.h
src/insets/insetexternal.C
src/insets/insetgraphics.C
src/insets/insetinclude.C
src/insets/insetlabel.C
src/text3.C

index 0f9fca01f38487cd887360d037e0ae14f7da11ed..f7171fefdd5207cc66ab40ecd6de687b756ab107 100644 (file)
        * 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  <leeming@lyx.org>
+
+       * 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  <leeming@lyx.org>
 
        * BufferView_pimpl.C (dispatch):
index 9307dbe4ddee074b293d2ef495bcb6c1e3be9a2b..68607647d1e8df4ef52b03ba560a370000a8552b 100644 (file)
@@ -1,3 +1,8 @@
+2003-03-07  Angus Leeming  <leeming@lyx.org>
+
+       * inseterror.C (localDispatch): new method; calls edit() on
+       LFUN_MOUSE_RELEASE.
+
 2003-03-07  Angus Leeming  <leeming@lyx.org>
 
        * insetbibitem.C (localDispatch):
index dadb444486cddd52ad01ae944988605936ee3742..2759492a4471eba77af587994796b8c6302dff0e 100644 (file)
@@ -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;
        }
index 8d2e70b9f34f8c7f976314538034e1b575eeb315..6d8df729c363e5a2d92103af8a721730797e2cbc 100644 (file)
@@ -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:
index 08b9b4179e768e8940360fe781d9c37d8aeb4802..084a777bb524771fbab55709a4f05fbcac9bdb1b 100644 (file)
 
 #include <config.h>
 
+#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;
index e24aa22bd2b8eb5d383b979b960d56a69e256659..e0d1ad36e37319e79c550cdeab8aa41d6e859db6 100644 (file)
@@ -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;
index 7f2ff23107f59098a0f6ffaa07dd4f7c5a695df8..c377a7780c4fe0fecef9a85a5d586c4ac013d8ad 100644 (file)
@@ -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;
        }
index 932ac0af4e99c33e9334b6783f264c5452b27328..ab60e9ba70be7a7262b2bcb451e6beafc516ab51 100644 (file)
@@ -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;
index 84c07b342137decfa4970900d040e19fa8365566..2057a751f99824767ee323411094e61a79e511a3 100644 (file)
@@ -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;
        }
index 0642361d3cf870fce87c53398a1e4912ca0a093a..efb874673df1536a16f517d44b458da77a3befe6 100644 (file)
@@ -74,6 +74,7 @@ dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd)
                result = DISPATCHED;
        }
        break;
+
        default:
                result = InsetCommand::localDispatch(cmd);
        }
index 0782e0fcf9577bfac6be0302053444f4fd36dcf1..0ac114e8ba32b109fb809ab9c29da64454480cfe 100644 (file)
@@ -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;