Move handling of LFUN_MOUSE_RELEASE up to Inset and remove the edit() functions for insets that do not derive from InsetCollapsable.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29184 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2009-04-10 12:38:32 +00:00
parent 823e44822e
commit 80228965b1
11 changed files with 10 additions and 72 deletions

View File

@ -220,10 +220,20 @@ void Inset::dispatch(Cursor & cur, FuncRequest & cmd)
void Inset::doDispatch(Cursor & cur, FuncRequest &cmd) void Inset::doDispatch(Cursor & cur, FuncRequest &cmd)
{ {
switch (cmd.action) { switch (cmd.action) {
case LFUN_MOUSE_RELEASE:
// if the derived inset did not explicitly handle mouse_release,
// we assume we request the settings dialog
if (!cur.selection() && cmd.button() == mouse_button::button1) {
FuncRequest tmpcmd(LFUN_INSET_SETTINGS);
dispatch(cur, tmpcmd);
}
break;
case LFUN_INSET_SETTINGS: case LFUN_INSET_SETTINGS:
showInsetDialog(&cur.bv()); showInsetDialog(&cur.bv());
cur.dispatched(); cur.dispatched();
break; break;
default: default:
cur.noUpdate(); cur.noUpdate();
cur.undispatched(); cur.undispatched();

View File

@ -136,12 +136,6 @@ void InsetCommand::doDispatch(Cursor & cur, FuncRequest & cmd)
break; break;
} }
case LFUN_MOUSE_RELEASE: {
if (!cur.selection() && cmd.button() != mouse_button::button3)
edit(cur, true);
break;
}
default: default:
Inset::doDispatch(cur, cmd); Inset::doDispatch(cur, cmd);
break; break;
@ -186,12 +180,6 @@ docstring InsetCommand::contextMenu(BufferView const &, int, int) const
} }
void InsetCommand::edit(Cursor & cur, bool, EntryDirection)
{
showInsetDialog(&cur.bv());
}
bool InsetCommand::showInsetDialog(BufferView * bv) const bool InsetCommand::showInsetDialog(BufferView * bv) const
{ {
if (!mailer_name_.empty()) if (!mailer_name_.empty())

View File

@ -90,9 +90,6 @@ private:
/// ///
InsetCode lyxCode() const { return NO_CODE; } InsetCode lyxCode() const { return NO_CODE; }
/// ///
void edit(Cursor & cur, bool front,
EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);
///
RenderButton & button() const { return button_; } RenderButton & button() const { return button_; }
/// ///
bool setMouseHover(bool mouse_hover); bool setMouseHover(bool mouse_hover);

View File

@ -414,13 +414,6 @@ void InsetExternal::doDispatch(Cursor & cur, FuncRequest & cmd)
params2string(params(), cur.bv().buffer())); params2string(params(), cur.bv().buffer()));
break; break;
case LFUN_MOUSE_RELEASE:
if (!cur.selection() && cmd.button() == mouse_button::button1)
cur.bv().showDialog("external",
params2string(params(), cur.bv().buffer()),
this);
break;
default: default:
Inset::doDispatch(cur, cmd); Inset::doDispatch(cur, cmd);
} }
@ -445,12 +438,6 @@ bool InsetExternal::getStatus(Cursor & cur, FuncRequest const & cmd,
} }
void InsetExternal::edit(Cursor & cur, bool, EntryDirection)
{
showInsetDialog(&cur.bv());
}
bool InsetExternal::showInsetDialog(BufferView * bv) const bool InsetExternal::showInsetDialog(BufferView * bv) const
{ {
bv->showDialog("external", params2string(params(), bv->buffer()), bv->showDialog("external", params2string(params(), bv->buffer()),

View File

@ -138,8 +138,6 @@ private:
/// ///
void addPreview(graphics::PreviewLoader &) const; void addPreview(graphics::PreviewLoader &) const;
/// ///
void edit(Cursor & cur, bool front, EntryDirection entry_from);
///
bool showInsetDialog(BufferView * bv) const; bool showInsetDialog(BufferView * bv) const;
/// ///
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;

View File

@ -215,11 +215,6 @@ void InsetGraphics::doDispatch(Cursor & cur, FuncRequest & cmd)
cur.bv().updateDialog("graphics", params2string(params(), buffer())); cur.bv().updateDialog("graphics", params2string(params(), buffer()));
break; break;
case LFUN_MOUSE_RELEASE:
if (!cur.selection() && cmd.button() == mouse_button::button1)
cur.bv().showDialog("graphics", params2string(params(), buffer()), this);
break;
default: default:
Inset::doDispatch(cur, cmd); Inset::doDispatch(cur, cmd);
break; break;
@ -244,12 +239,6 @@ bool InsetGraphics::getStatus(Cursor & cur, FuncRequest const & cmd,
} }
void InsetGraphics::edit(Cursor & cur, bool, EntryDirection)
{
showInsetDialog(&cur.bv());
}
bool InsetGraphics::showInsetDialog(BufferView * bv) const bool InsetGraphics::showInsetDialog(BufferView * bv) const
{ {
bv->showDialog("graphics", params2string(params(), bv->buffer()), bv->showDialog("graphics", params2string(params(), bv->buffer()),

View File

@ -85,8 +85,6 @@ private:
/// ///
void draw(PainterInfo & pi, int x, int y) const; void draw(PainterInfo & pi, int x, int y) const;
/// ///
void edit(Cursor & cur, bool front, EntryDirection entry_from);
///
bool showInsetDialog(BufferView * bv) const; bool showInsetDialog(BufferView * bv) const;
/// ///
void editGraphics(InsetGraphicsParams const &, Buffer const &) const; void editGraphics(InsetGraphicsParams const &, Buffer const &) const;

View File

@ -153,11 +153,6 @@ void InsetSpace::doDispatch(Cursor & cur, FuncRequest & cmd)
cur.bv().updateDialog("space", params2string(params())); cur.bv().updateDialog("space", params2string(params()));
break; break;
case LFUN_MOUSE_RELEASE:
if (!cur.selection() && cmd.button() == mouse_button::button1)
cur.bv().showDialog("space", params2string(params()), this);
break;
default: default:
Inset::doDispatch(cur, cmd); Inset::doDispatch(cur, cmd);
break; break;
@ -187,12 +182,6 @@ bool InsetSpace::getStatus(Cursor & cur, FuncRequest const & cmd,
} }
void InsetSpace::edit(Cursor & cur, bool, EntryDirection)
{
showInsetDialog(&cur.bv());
}
bool InsetSpace::showInsetDialog(BufferView * bv) const bool InsetSpace::showInsetDialog(BufferView * bv) const
{ {
bv->showDialog("space", params2string(params()), bv->showDialog("space", params2string(params()),

View File

@ -133,9 +133,6 @@ public:
/// the string that is passed to the TOC /// the string that is passed to the TOC
void tocString(odocstream &) const; void tocString(odocstream &) const;
/// ///
void edit(Cursor & cur, bool front,
EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);
///
EDITABLE editable() const { return IS_EDITABLE; } EDITABLE editable() const { return IS_EDITABLE; }
/// ///
InsetCode lyxCode() const { return SPACE_CODE; } InsetCode lyxCode() const { return SPACE_CODE; }

View File

@ -66,12 +66,6 @@ void InsetVSpace::doDispatch(Cursor & cur, FuncRequest & cmd)
break; break;
} }
case LFUN_MOUSE_RELEASE:
if (!cur.selection() && cmd.button() == mouse_button::button1)
cur.bv().showDialog("vspace", params2string(space()),
const_cast<InsetVSpace *>(this));
break;
default: default:
Inset::doDispatch(cur, cmd); Inset::doDispatch(cur, cmd);
break; break;
@ -103,12 +97,6 @@ bool InsetVSpace::getStatus(Cursor & cur, FuncRequest const & cmd,
} }
void InsetVSpace::edit(Cursor & cur, bool, EntryDirection)
{
showInsetDialog(&cur.bv());
}
bool InsetVSpace::showInsetDialog(BufferView * bv) const bool InsetVSpace::showInsetDialog(BufferView * bv) const
{ {
bv->showDialog("vspace", params2string(space()), bv->showDialog("vspace", params2string(space()),

View File

@ -32,9 +32,6 @@ public:
/// ///
InsetCode lyxCode() const { return VSPACE_CODE; } InsetCode lyxCode() const { return VSPACE_CODE; }
/// ///
void edit(Cursor & cur, bool front,
EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);
///
EDITABLE editable() const { return IS_EDITABLE; } EDITABLE editable() const { return IS_EDITABLE; }
/// ///
docstring contextMenu(BufferView const & bv, int x, int y) const; docstring contextMenu(BufferView const & bv, int x, int y) const;