Alfredo's patches

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6675 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2003-04-01 19:22:14 +00:00
parent 0d876bc179
commit 925df4e00b
5 changed files with 33 additions and 3 deletions

View File

@ -1,3 +1,14 @@
2003-04-01 John Levon <levon@movementarian.org>
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 <larsbj@gullik.net> 2003-04-01 Lars Gullik Bjønnes <larsbj@gullik.net>
* insettext.C: adjust * insettext.C: adjust

View File

@ -16,6 +16,7 @@
#include "insetbutton.h" #include "insetbutton.h"
#include "debug.h" #include "debug.h"
#include "BufferView.h" #include "BufferView.h"
#include "funcrequest.h"
#include "frontends/LyXView.h" #include "frontends/LyXView.h"
#include "frontends/Painter.h" #include "frontends/Painter.h"
#include "support/LAssert.h" #include "support/LAssert.h"
@ -127,3 +128,11 @@ BufferView * InsetButton::view() const
{ {
return view_.lock().get(); 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;
}

View File

@ -31,6 +31,8 @@ public:
int width(BufferView *, LyXFont const &) const; int width(BufferView *, LyXFont const &) const;
/// ///
void draw(BufferView *, LyXFont const &, int, float &) const; void draw(BufferView *, LyXFont const &, int, float &) const;
///
dispatch_result localDispatch(FuncRequest const & cmd);
protected: protected:
/// ///

View File

@ -90,6 +90,7 @@ dispatch_result InsetCommand::localDispatch(FuncRequest const & cmd)
case LFUN_MOUSE_RELEASE: case LFUN_MOUSE_RELEASE:
edit(cmd.view(), cmd.x, cmd.y, cmd.button()); edit(cmd.view(), cmd.x, cmd.y, cmd.button());
result = DISPATCHED;
break; break;
default: default:

View File

@ -1014,6 +1014,12 @@ bool InsetText::lfunMouseRelease(FuncRequest const & cmd)
Inset * inset = getLyXText(bv)->checkInsetHit(tmp_x, tmp_y); Inset * inset = getLyXText(bv)->checkInsetHit(tmp_x, tmp_y);
bool ret = false; bool ret = false;
if (inset) { 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)) if (isHighlyEditableInset(inset))
ret = inset->localDispatch(cmd1); ret = inset->localDispatch(cmd1);
else { else {
@ -1021,12 +1027,13 @@ bool InsetText::lfunMouseRelease(FuncRequest const & cmd)
inset_y = ciy(bv) + drawTextYOffset; inset_y = ciy(bv) + drawTextYOffset;
cmd1.x = cmd.x - inset_x; cmd1.x = cmd.x - inset_x;
cmd1.y = cmd.x - inset_y; 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()); inset->edit(bv, cmd1.x, cmd1.y, cmd.button());
ret = true;
} }
#endif
ret = inset->localDispatch(cmd1);
updateLocal(bv, CURSOR_PAR, false); updateLocal(bv, CURSOR_PAR, false);
} }
return ret; return ret;
} }