From 925df4e00b9c74ce8623475dd56124435ba8ac36 Mon Sep 17 00:00:00 2001 From: John Levon Date: Tue, 1 Apr 2003 19:22:14 +0000 Subject: [PATCH] Alfredo's patches git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6675 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/ChangeLog | 11 +++++++++++ src/insets/insetbutton.C | 9 +++++++++ src/insets/insetbutton.h | 2 ++ src/insets/insetcommand.C | 1 + src/insets/insettext.C | 13 ++++++++++--- 5 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 7421f70424..42453bd643 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,14 @@ +2003-04-01 John Levon + + From Alfredo Braunstein + + * insetbutton.h: + * insetbutton.C: add localDispatch() + + * insetcommand.C: return DISPATCHED when edit() called + + * insettext.C: fix bug 967 + 2003-04-01 Lars Gullik Bjønnes * insettext.C: adjust diff --git a/src/insets/insetbutton.C b/src/insets/insetbutton.C index 53ea673814..9fa257d2e1 100644 --- a/src/insets/insetbutton.C +++ b/src/insets/insetbutton.C @@ -16,6 +16,7 @@ #include "insetbutton.h" #include "debug.h" #include "BufferView.h" +#include "funcrequest.h" #include "frontends/LyXView.h" #include "frontends/Painter.h" #include "support/LAssert.h" @@ -127,3 +128,11 @@ BufferView * InsetButton::view() const { return view_.lock().get(); } + + +dispatch_result InsetButton::localDispatch(FuncRequest const & cmd) +{ + FuncRequest cmd1(cmd); + edit(cmd1.view(), cmd1.x, cmd1.y, cmd1.button()); + return DISPATCHED; +} diff --git a/src/insets/insetbutton.h b/src/insets/insetbutton.h index b0a6edbe0d..a27485a17a 100644 --- a/src/insets/insetbutton.h +++ b/src/insets/insetbutton.h @@ -31,6 +31,8 @@ public: int width(BufferView *, LyXFont const &) const; /// void draw(BufferView *, LyXFont const &, int, float &) const; + /// + dispatch_result localDispatch(FuncRequest const & cmd); protected: /// diff --git a/src/insets/insetcommand.C b/src/insets/insetcommand.C index dd2ae21cc4..974f256983 100644 --- a/src/insets/insetcommand.C +++ b/src/insets/insetcommand.C @@ -90,6 +90,7 @@ dispatch_result InsetCommand::localDispatch(FuncRequest const & cmd) case LFUN_MOUSE_RELEASE: edit(cmd.view(), cmd.x, cmd.y, cmd.button()); + result = DISPATCHED; break; default: diff --git a/src/insets/insettext.C b/src/insets/insettext.C index e76d3cb9b0..c94ac1666b 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -1014,6 +1014,12 @@ bool InsetText::lfunMouseRelease(FuncRequest const & cmd) Inset * inset = getLyXText(bv)->checkInsetHit(tmp_x, tmp_y); bool ret = false; if (inset) { +// This code should probably be removed now. Simple insets +// (!highlyEditable) can actually take the localDispatch, +// and turn it into edit() if necessary. But we still +// need to deal properly with the whole relative vs. +// absolute mouse co-ords thing in a realiable, sensible way +#if 0 if (isHighlyEditableInset(inset)) ret = inset->localDispatch(cmd1); else { @@ -1021,12 +1027,13 @@ bool InsetText::lfunMouseRelease(FuncRequest const & cmd) inset_y = ciy(bv) + drawTextYOffset; cmd1.x = cmd.x - inset_x; cmd1.y = cmd.x - inset_y; -// note that we should do ret = inset->localDispatch(cmd1) -// and fix this instead (Alfredo); - ret = true; inset->edit(bv, cmd1.x, cmd1.y, cmd.button()); + ret = true; } +#endif + ret = inset->localDispatch(cmd1); updateLocal(bv, CURSOR_PAR, false); + } return ret; }