Cleanup 3: move dispatch stuff from CharStyle to Collapsable

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19654 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Martin Vermeer 2007-08-20 04:56:04 +00:00
parent a6c9a208ca
commit 5c1ffabd05
2 changed files with 18 additions and 38 deletions

View File

@ -183,37 +183,7 @@ void InsetCharStyle::getDrawFont(Font & font) const
void InsetCharStyle::doDispatch(Cursor & cur, FuncRequest & cmd)
{
switch (cmd.action) {
case LFUN_MOUSE_RELEASE:
if (cmd.button() == mouse_button::button3)
if (internalStatus() == Open)
setStatus(cur, Collapsed);
else
setStatus(cur, Open);
else
InsetCollapsable::doDispatch(cur, cmd);
break;
case LFUN_INSET_TOGGLE:
if (cmd.argument() == "open")
setStatus(cur, Open);
else if (cmd.argument() == "close")
setStatus(cur, Collapsed);
else if (cmd.argument() == "toggle" || cmd.argument().empty())
if (internalStatus() == Open)
setStatus(cur, Collapsed);
else
setStatus(cur, Open);
else // if assign or anything else
cur.undispatched();
cur.dispatched();
break;
default:
InsetCollapsable::doDispatch(cur, cmd);
break;
}
InsetCollapsable::doDispatch(cur, cmd);
}

View File

@ -495,9 +495,19 @@ void InsetCollapsable::doDispatch(Cursor & cur, FuncRequest & cmd)
case LFUN_MOUSE_RELEASE:
if (cmd.button() == mouse_button::button3) {
// Open the Inset configuration dialog
showInsetDialog(&cur.bv());
break;
if (decoration() == Conglomerate) {
if (internalStatus() == Open)
setStatus(cur, Collapsed);
else
setStatus(cur, Open);
break;
} else {
// Open the Inset
// configuration dialog
showInsetDialog(&cur.bv());
break;
}
}
if (decoration() == Minimalistic) {
@ -538,11 +548,11 @@ void InsetCollapsable::doDispatch(Cursor & cur, FuncRequest & cmd)
else if (cmd.argument() == "close")
setStatus(cur, Collapsed);
else if (cmd.argument() == "toggle" || cmd.argument().empty())
if (isOpen()) {
if (internalStatus() == Open) {
setStatus(cur, Collapsed);
cur.top().forwardPos();
}
else
if (geometry() == ButtonOnly)
cur.top().forwardPos();
} else
setStatus(cur, Open);
else // if assign or anything else
cur.undispatched();