void InsetBranch::doDispatch(Cursor & cur, FuncRequest & cmd) { switch (cmd.action()) { case LFUN_INSET_MODIFY: { InsetBranchParams params; InsetBranch::string2params(to_utf8(cmd.argument()), params); cur.recordUndoInset(ATOMIC_UNDO, this); params_.branch = params.branch; // what we really want here is a TOC update, but that means // a full buffer update cur.forceBufferUpdate(); break; } case LFUN_BRANCH_ACTIVATE: case LFUN_BRANCH_DEACTIVATE: { // FIXME: I do not like this cast, but have no other idea... Buffer const * buf = buffer().masterBuffer(); BranchList const & branchlist = buf->params().branchlist(); Branch * our_branch = const_cast<Branch *>(branchlist.find(params_.branch)); if (!our_branch) { // child only? our_branch = buffer().params().branchlist().find(params_.branch); if (!our_branch) break; } bool const activate = (cmd.action() == LFUN_BRANCH_ACTIVATE); if (our_branch->isSelected() != activate) { our_branch->setSelected(activate); cur.forceBufferUpdate(); } break; } case LFUN_INSET_TOGGLE: if (cmd.argument() == "assign") setStatus(cur, isBranchSelected() ? Open : Collapsed); else InsetCollapsable::doDispatch(cur, cmd); break; default: InsetCollapsable::doDispatch(cur, cmd); break; } }
void InsetCommand::doDispatch(Cursor & cur, FuncRequest & cmd) { switch (cmd.action()) { case LFUN_INSET_MODIFY: { if (cmd.getArg(0) == "changetype") { cur.recordUndo(); p_.setCmdName(cmd.getArg(1)); cur.forceBufferUpdate(); initView(); break; } InsetCommandParams p(p_.code()); InsetCommand::string2params(to_utf8(cmd.argument()), p); if (p.getCmdName().empty()) cur.noScreenUpdate(); else { cur.recordUndo(); setParams(p); } // FIXME We might also want to check here if this one is in the TOC. // But I think most of those are labeled. if (isLabeled()) cur.forceBufferUpdate(); break; } case LFUN_INSET_DIALOG_UPDATE: { string const name = to_utf8(cmd.argument()); cur.bv().updateDialog(name, params2string(params())); break; } default: Inset::doDispatch(cur, cmd); break; } }
void InsetCaption::doDispatch(Cursor & cur, FuncRequest & cmd) { switch (cmd.action()) { case LFUN_INSET_MODIFY: { if (cmd.getArg(0) == "changetype") { cur.recordUndoInset(ATOMIC_UNDO, this); type_ = cmd.getArg(1); cur.forceBufferUpdate(); break; } } default: InsetText::doDispatch(cur, cmd); break; } }
void InsetNote::doDispatch(Cursor & cur, FuncRequest & cmd) { switch (cmd.action()) { case LFUN_INSET_MODIFY: cur.recordUndoInset(ATOMIC_UNDO, this); string2params(to_utf8(cmd.argument()), params_); setButtonLabel(); // what we really want here is a TOC update, but that means // a full buffer update cur.forceBufferUpdate(); break; case LFUN_INSET_DIALOG_UPDATE: cur.bv().updateDialog("note", params2string(params())); break; default: InsetCollapsable::doDispatch(cur, cmd); break; } }