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
This commit is contained in:
Angus Leeming 2003-03-09 09:38:47 +00:00
parent 060e6bc6af
commit d94600a357
11 changed files with 57 additions and 23 deletions

View File

@ -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 <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):

View 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):

View 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;
}

View 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:

View File

@ -10,15 +10,18 @@
#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;

View 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;

View 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;
}

View 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;

View 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;
}

View File

@ -74,6 +74,7 @@ dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd)
result = DISPATCHED;
}
break;
default:
result = InsetCommand::localDispatch(cmd);
}

View 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;