}
-void FuncStatus::disabled(bool b)
+void FuncStatus::enabled(bool b)
{
if (b)
- v_ |= DISABLED;
- else
v_ &= !DISABLED;
+ else
+ v_ |= DISABLED;
}
-bool FuncStatus::disabled() const
+bool FuncStatus::enabled() const
{
- return (v_ & DISABLED);
+ return !(v_ & DISABLED);
}
bool unknown() const;
///
- void disabled(bool b);
+ void enabled(bool b);
///
- bool disabled() const;
+ bool enabled() const;
///
void setOnOff(bool b);
}
switch (i.kind()) {
- case MenuItem::Command:
- {
+
+ case MenuItem::Command: {
FuncStatus status =
view->getLyXFunc().getStatus(i.func());
if (status.unknown()
- || (status.disabled() && i.optional()))
+ || (!status.enabled() && i.optional()))
break;
items_.push_back(i);
items_.back().status(status);
break;
}
- case MenuItem::Submenu:
- {
+
+ case MenuItem::Submenu: {
if (i.submenu()) {
- bool disabled = true;
+ bool enabled = false;
for (const_iterator cit = i.submenu()->begin();
cit != i.submenu()->end(); ++cit) {
if ((cit->kind() == MenuItem::Command
|| cit->kind() == MenuItem::Submenu)
- && !cit->status().disabled()) {
- disabled = false;
+ && cit->status().enabled()) {
+ enabled = true;
break;
}
}
- if (!disabled || !i.optional()) {
+ if (enabled || !i.optional()) {
items_.push_back(i);
- items_.back().status().disabled(disabled);
+ items_.back().status().enabled(enabled);
}
}
else
items_.push_back(i);
break;
}
+
case MenuItem::Separator:
if (!items_.empty()
&& items_.back().kind() != MenuItem::Separator)
items_.push_back(i);
break;
+
default:
items_.push_back(i);
}
return (nset > 0);
}
-
-bool changeDepthAllowed(LCursor & cur, LyXText * text, DEPTH_CHANGE type)
-{
- return cur.bv().available() && text && text->changeDepthAllowed(cur, type);
-}
-
-
} // namespace bv_funcs
#include <string>
-class LCursor;
class LyXFont;
-class LyXText;
namespace bv_funcs {
*/
std::string const freefont2string();
-
-/// what type of depth change to make
-enum DEPTH_CHANGE {
- INC_DEPTH,
- DEC_DEPTH
-};
-
-/// Returns whether something would be changed by changeDepth
-bool changeDepthAllowed(LCursor & cur, LyXText * text, DEPTH_CHANGE);
-
} // namespace bv_funcs
#endif
//lyxerr << "\nLCursor::dispatch: cmd: " << cmd0 << endl << *this << endl;
FuncRequest cmd = cmd0;
nopop_ = false;
- DocumentIterator safe = *this;
+ LCursor safe = *this;
- for ( ; size(); pop_back()) {
+ for ( ; size(); pop()) {
lyxerr << "\nLCursor::dispatch: cmd: " << cmd0 << endl << *this << endl;
BOOST_ASSERT(pos() <= lastpos());
BOOST_ASSERT(idx() <= lastidx());
// it completely to get a 'bomb early' behaviour in case this
// object will be used again.
if (nopop_ || !disp_.dispatched())
- DocumentIterator::operator=(safe);
+ operator=(safe);
return disp_;
}
bool LCursor::getStatus(FuncRequest const & cmd, FuncStatus & status)
{
- lyxerr << "\nLCursor::getStatus: cmd: " << cmd << endl << *this << endl;
- DocumentIterator safe = *this;
- for ( ; size(); pop_back()) {
+ LCursor safe = *this;
+ for ( ; size(); pop()) {
+ //lyxerr << "\nLCursor::getStatus: cmd: " << cmd << endl << *this << endl;
BOOST_ASSERT(pos() <= lastpos());
BOOST_ASSERT(idx() <= lastidx());
BOOST_ASSERT(par() <= lastpar());
if (inset().getStatus(*this, cmd, status))
break;
}
- DocumentIterator::operator=(safe);
+ operator=(safe);
return true;
}
{
bool const math = bufferview_->cursor().inMathed();
bool const table =
- !getLyXFunc().getStatus(FuncRequest(LFUN_LAYOUT_TABULAR)).disabled();
+ getLyXFunc().getStatus(FuncRequest(LFUN_LAYOUT_TABULAR)).enabled();
toolbar_->update(math, table);
}
insertSeparator();
} else if (m->kind() == MenuItem::Submenu) {
pair<int, QLPopupMenu *> res = createMenu(this, &(*m), owner_);
- setItemEnabled(res.first,
- !m->status().disabled());
+ setItemEnabled(res.first, m->status().enabled());
res.second->populate(m->submenu());
} else {
FuncStatus const status = m->status();
int const index = distance(funcs_.begin(), fit);
insertItem(toqstr(getLabel(*m)), index);
- setItemEnabled(index, !status.disabled());
+ setItemEnabled(index, status.enabled());
setItemChecked(index, status.onoff(true));
}
}
button->setToggleButton(true);
button->setOn(status.onoff(true));
- button->setEnabled(!status.disabled());
+ button->setEnabled(status.enabled());
}
- bool const enable = !owner_->getLyXFunc().getStatus(FuncRequest(LFUN_LAYOUT)).disabled();
+ bool const enable = owner_->getLyXFunc().
+ getStatus(FuncRequest(LFUN_LAYOUT)).enabled();
// Workaround for Qt bug where setEnabled(true) closes
// the popup
label += "%B";
if (flag.onoff(false))
label += "%b";
- if (flag.disabled())
+ if (!flag.enabled())
label += "%i";
// Add the shortcut
for (; p != end; ++p) {
if (p->func.action == int(ToolbarBackend::LAYOUTS) && combox_) {
LyXFunc const & lf = owner_->getLyXFunc();
- bool const disable =
- lf.getStatus(FuncRequest(LFUN_LAYOUT)).disabled();
- setEnabled(combox_, !disable);
+ bool const enable =
+ lf.getStatus(FuncRequest(LFUN_LAYOUT)).enabled();
+ setEnabled(combox_, enable);
continue;
}
fl_set_object_color(p->icon, FL_MCOL, FL_BLUE);
fl_set_object_boxtype(p->icon, FL_UP_BOX);
}
- if (status.disabled()) {
+ if (status.enabled()) {
+ fl_activate_object(p->icon);
+ } else {
// Is there a way here to specify a
// mask in order to show that the
// button is disabled? (JMarc)
fl_deactivate_object(p->icon);
}
- else
- fl_activate_object(p->icon);
}
}
}
-bool InsetBase::getStatus(LCursor &, FuncRequest const &, FuncStatus &)
+bool InsetBase::getStatus(LCursor &, FuncRequest const &, FuncStatus &) const
{
return false;
}
void dispatch(LCursor & cur, FuncRequest & cmd);
/// do we want to handle this event?
virtual bool getStatus(LCursor & cur, FuncRequest const & cmd,
- FuncStatus & status);
+ FuncStatus & status) const;
/// cursor enters
virtual void edit(LCursor & cur, bool left);
}
+bool InsetCollapsable::getStatus(LCursor & cur, FuncRequest const & cmd,
+ FuncStatus & flag) const
+{
+ return inset.getStatus(cur, cmd, flag);
+}
+
+
void InsetCollapsable::validate(LaTeXFeatures & features) const
{
inset.validate(features);
///
void priv_dispatch(LCursor & cur, FuncRequest & cmd);
///
+ bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
+ ///
void dimension_collapsed(Dimension &) const;
///
void draw_collapsed(PainterInfo & pi, int x, int y) const;
}
+bool InsetTabular::getStatus(LCursor & cur, FuncRequest const & cmd,
+ FuncStatus & flag) const
+{
+ switch (cmd.action) {
+ case LFUN_TABULAR_FEATURE:
+#if 0
+ if (cur.inMathed()) {
+ // FIXME: check temporarily disabled
+ // valign code
+ char align = mathcursor::valign();
+ if (align == '\0') {
+ enable = false;
+ break;
+ }
+ if (cmd.argument.empty()) {
+ flag.clear();
+ break;
+ }
+ if (!contains("tcb", cmd.argument[0])) {
+ enable = false;
+ break;
+ }
+ flag.setOnOff(cmd.argument[0] == align);
+ } else {
+ enable = false;
+
+ char const align = mathcursor::halign();
+ if (align == '\0') {
+ enable = false;
+ break;
+ }
+ if (cmd.argument.empty()) {
+ flag.clear();
+ break;
+ }
+ if (!contains("lcr", cmd.argument[0])) {
+ enable = false;
+ break;
+ }
+ flag.setOnOff(cmd.argument[0] == align);
+
+ disable = !mathcursor::halign();
+ break;
+ }
+
+ FuncStatus ret;
+ //ret.disabled(true);
+ InsetTabular * tab = static_cast<InsetTabular *>
+ (cur.innerInsetOfType(InsetBase::TABULAR_CODE));
+ if (tab) {
+ ret = tab->getStatus(cmd.argument);
+ flag |= ret;
+ enable = true;
+ } else {
+ enable = false;
+ }
+ } else {
+ static InsetTabular inset(*buf, 1, 1);
+ enable = false;
+ FuncStatus ret = inset.getStatus(cmd.argument);
+ if (ret.onoff(true) || ret.onoff(false))
+ flag.setOnOff(false);
+ }
+#endif
+ return true;
+
+ default:
+ // we try to handle this event in the insets dispatch function.
+ return cell(cur.idx()).getStatus(cur, cmd, flag);
+ }
+}
+
+
int InsetTabular::latex(Buffer const & buf, ostream & os,
OutputParams const & runparams) const
{
break;
case LyXTabular::ALIGN_BLOCK:
- status.disabled(tabular.getPWidth(actcell).zero());
+ status.enabled(!tabular.getPWidth(actcell).zero());
status.setOnOff(tabular.getAlignment(actcell, flag) == LYX_ALIGN_BLOCK);
break;
default:
status.clear();
- status.disabled(true);
+ status.enabled(false);
break;
}
return status;
data << "\\end_inset\n";
return data.str();
}
+
protected:
///
void priv_dispatch(LCursor & cur, FuncRequest & cmd);
+ ///
+ bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
private:
///
void drawCellLines(Painter &, int x, int baseline,
}
+bool InsetText::getStatus(LCursor & cur, FuncRequest const & cmd,
+ FuncStatus & status) const
+{
+ return text_.getStatus(cur, cmd, status);
+}
+
+
int InsetText::latex(Buffer const & buf, ostream & os,
OutputParams const & runparams) const
{
}
///
LyXText * getText(int) const;
+ ///
+ bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
/// mark as erased for change tracking
void markErased() { clear(true); };
#include "support/std_sstream.h"
#include "support/os.h"
-using bv_funcs::DEC_DEPTH;
using bv_funcs::freefont2string;
-using bv_funcs::INC_DEPTH;
using lyx::support::AddName;
using lyx::support::AddPath;
FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
{
+ //lyxerr << "LyXFunc::getStatus: cmd: " << cmd << endl;
FuncStatus flag;
Buffer * buf = owner->buffer();
LCursor & cur = view()->cursor();
if (cmd.action == LFUN_NOACTION) {
setStatusMessage(N_("Nothing to do"));
- flag.disabled(true);
+ flag.enabled(false);
return flag;
}
case LFUN_THESAURUS_ENTRY:
#endif
flag.unknown(true);
- flag.disabled(true);
+ flag.enabled(false);
break;
default:
flag |= lyx_gui::getStatus(cmd);
LyXAction::ReadOnly)) {
// no
setStatusMessage(N_("Document is read-only"));
- flag.disabled(true);
+ flag.enabled(false);
}
} else {
// no
setStatusMessage(N_("Command not allowed with"
"out any document open"));
- flag.disabled(true);
+ flag.enabled(false);
return flag;
}
}
// I would really like to avoid having this switch and rather try to
// encode this in the function itself.
- bool disable = false;
+ // -- And I'd rather let an inset decide which LFUNs it is willing
+ // to handle (Andre')
+ bool enable = true;
switch (cmd.action) {
+ case LFUN_TOOLTIPS_TOGGLE:
+ flag.setOnOff(owner->getDialogs().tooltipsEnabled());
+ break;
+
+ case LFUN_READ_ONLY_TOGGLE:
+ flag.setOnOff(buf->isReadonly());
+ break;
+
+ case LFUN_SWITCHBUFFER:
+ // toggle on the current buffer, but do not toggle off
+ // the other ones (is that a good idea?)
+ if (cmd.argument == buf->fileName())
+ flag.setOnOff(true);
+ break;
+
+ case LFUN_TRACK_CHANGES:
+ flag.setOnOff(buf->params().tracking_changes);
+ break;
+
case LFUN_EXPORT:
- disable = cmd.argument != "custom"
- && !Exporter::IsExportable(*buf, cmd.argument);
+ enable = cmd.argument == "custom"
+ || Exporter::IsExportable(*buf, cmd.argument);
break;
case LFUN_UNDO:
- disable = buf->undostack().empty();
+ enable = !buf->undostack().empty();
break;
case LFUN_REDO:
- disable = buf->redostack().empty();
+ enable = !buf->redostack().empty();
break;
case LFUN_CUT:
case LFUN_COPY:
- disable = !cur.selection();
+ enable = cur.selection();
break;
case LFUN_RUNCHKTEX:
- disable = !buf->isLatex() || lyxrc.chktex_command == "none";
+ enable = buf->isLatex() && lyxrc.chktex_command != "none";
break;
case LFUN_BUILDPROG:
- disable = !Exporter::IsExportable(*buf, "program");
+ enable = Exporter::IsExportable(*buf, "program");
break;
case LFUN_LAYOUT_TABULAR:
- disable = !cur.innerInsetOfType(InsetBase::TABULAR_CODE);
- break;
-
- case LFUN_DEPTH_MIN:
- disable = !changeDepthAllowed(cur, view()->getLyXText(), DEC_DEPTH);
- break;
-
- case LFUN_DEPTH_PLUS:
- disable = !changeDepthAllowed(cur, view()->getLyXText(), INC_DEPTH);
+ enable = cur.innerInsetOfType(InsetBase::TABULAR_CODE);
break;
case LFUN_LAYOUT:
case LFUN_LAYOUT_PARAGRAPH:
- disable = cur.inset().forceDefaultParagraphs(&cur.inset());
- break;
-
- case LFUN_INSET_OPTARG:
- disable = cur.inMathed()
- || cur.paragraph().layout()->optionalargs == 0;
- break;
-
- case LFUN_TABULAR_FEATURE:
-#if 0
- if (cur.inMathed()) {
- // FIXME: check temporarily disabled
- // valign code
- char align = mathcursor::valign();
- if (align == '\0') {
- disable = true;
- break;
- }
- if (cmd.argument.empty()) {
- flag.clear();
- break;
- }
- if (!contains("tcb", cmd.argument[0])) {
- disable = true;
- break;
- }
- flag.setOnOff(cmd.argument[0] == align);
- } else {
- disable = true;
-
- char const align = mathcursor::halign();
- if (align == '\0') {
- disable = true;
- break;
- }
- if (cmd.argument.empty()) {
- flag.clear();
- break;
- }
- if (!contains("lcr", cmd.argument[0])) {
- disable = true;
- break;
- }
- flag.setOnOff(cmd.argument[0] == align);
-
- disable = !mathcursor::halign();
- break;
- }
-
- if (!cur.empty() && cur.inset().asUpdatableInset()) {
- FuncStatus ret;
- //ret.disabled(true);
- InsetTabular * tab = static_cast<InsetTabular *>
- (cur.innerInsetOfType(InsetBase::TABULAR_CODE));
- if (tab) {
- ret = tab->getStatus(cmd.argument);
- flag |= ret;
- disable = false;
- } else {
- disable = true;
- }
- } else {
- static InsetTabular inset(*buf, 1, 1);
- disable = true;
- FuncStatus ret = inset.getStatus(cmd.argument);
- if (ret.onoff(true) || ret.onoff(false))
- flag.setOnOff(false);
- }
-#endif
+ enable = !cur.inset().forceDefaultParagraphs(&cur.inset());
break;
case LFUN_VC_REGISTER:
- disable = buf->lyxvc().inUse();
+ enable = !buf->lyxvc().inUse();
break;
case LFUN_VC_CHECKIN:
- disable = !buf->lyxvc().inUse() || buf->isReadonly();
+ enable = buf->lyxvc().inUse() && !buf->isReadonly();
break;
case LFUN_VC_CHECKOUT:
- disable = !buf->lyxvc().inUse() || !buf->isReadonly();
+ enable = buf->lyxvc().inUse() && buf->isReadonly();
break;
case LFUN_VC_REVERT:
case LFUN_VC_UNDO:
- disable = !buf->lyxvc().inUse();
+ enable = buf->lyxvc().inUse();
break;
case LFUN_MENURELOAD:
- disable = buf->isUnnamed() || buf->isClean();
+ enable = !buf->isUnnamed() && !buf->isClean();
break;
case LFUN_BOOKMARK_GOTO:
- disable = !view()->
- isSavedPosition(strToUnsignedInt(cmd.argument));
+ enable = view()->isSavedPosition(strToUnsignedInt(cmd.argument));
break;
case LFUN_MERGE_CHANGES:
case LFUN_REJECT_CHANGE:
case LFUN_ACCEPT_ALL_CHANGES:
case LFUN_REJECT_ALL_CHANGES:
- disable = !buf->params().tracking_changes;
+ enable = buf && buf->params().tracking_changes;
break;
case LFUN_INSET_SETTINGS: {
- disable = true;
+ enable = false;
+ if (!cur.size())
+ break;
UpdatableInset * inset = cur.inset().asUpdatableInset();
+ lyxerr << "inset: " << inset << endl;
if (!inset)
break;
// we get back to the InsetTabular or whatever
if (inset->lyxCode() == InsetOld::TEXT_CODE)
inset = inset->owner();
+ lyxerr << "inset 2: " << inset << endl;
+ if (!inset)
+ break;
InsetOld::Code code = inset->lyxCode();
switch (code) {
case InsetOld::TABULAR_CODE:
- disable = cmd.argument != "tabular";
+ enable = cmd.argument == "tabular";
break;
case InsetOld::ERT_CODE:
- disable = cmd.argument != "ert";
+ enable = cmd.argument == "ert";
break;
case InsetOld::FLOAT_CODE:
- disable = cmd.argument != "float";
+ enable = cmd.argument == "float";
break;
case InsetOld::WRAP_CODE:
- disable = cmd.argument != "wrap";
+ enable = cmd.argument == "wrap";
break;
case InsetOld::NOTE_CODE:
- disable = cmd.argument != "note";
+ enable = cmd.argument == "note";
break;
case InsetOld::BRANCH_CODE:
- disable = cmd.argument != "branch";
+ enable = cmd.argument == "branch";
break;
case InsetOld::BOX_CODE:
- disable = cmd.argument != "box";
+ enable = cmd.argument == "box";
break;
default:
break;
break;
}
- case LFUN_MATH_MUTATE:
- if (cur.inMathed())
- //flag.setOnOff(mathcursor::formula()->hullType() == cmd.argument);
- flag.setOnOff(false);
- else
- disable = true;
- break;
-
- // we just need to be in math mode to enable that
- case LFUN_MATH_SIZE:
- case LFUN_MATH_SPACE:
- case LFUN_MATH_LIMITS:
- case LFUN_MATH_NONUMBER:
- case LFUN_MATH_NUMBER:
- case LFUN_MATH_EXTERN:
- disable = cur.inTexted();
- break;
-
case LFUN_DIALOG_SHOW: {
string const name = cmd.getArg(0);
if (!buf)
- disable = !(name == "aboutlyx" ||
- name == "file" ||
- name == "preferences" ||
- name == "texinfo");
+ enable = name == "aboutlyx"
+ || name == "file"
+ || name == "forks"
+ || name == "preferences"
+ || name == "texinfo";
else if (name == "print")
- disable = !Exporter::IsExportable(*buf, "dvi") ||
- lyxrc.print_command == "none";
+ enable = Exporter::IsExportable(*buf, "dvi")
+ && lyxrc.print_command != "none";
else if (name == "character")
- disable = cur.inset().lyxCode() == InsetOld::ERT_CODE;
+ enable = cur.inset().lyxCode() != InsetOld::ERT_CODE;
else if (name == "vclog")
- disable = !buf->lyxvc().inUse();
+ enable = buf->lyxvc().inUse();
else if (name == "latexlog")
- disable = !IsFileReadable(buf->getLogName().second);
+ enable = IsFileReadable(buf->getLogName().second);
break;
}
- default:
- break;
- }
-
- // the functions which insert insets
- InsetOld::Code code = InsetOld::NO_CODE;
- switch (cmd.action) {
+ case LFUN_MENUNEW:
+ case LFUN_MENUNEWTMPLT:
+ case LFUN_WORDFINDFORWARD:
+ case LFUN_WORDFINDBACKWARD:
+ case LFUN_PREFIX:
+ case LFUN_EXEC_COMMAND:
+ case LFUN_CANCEL:
+ case LFUN_META_FAKE:
+ case LFUN_CLOSEBUFFER:
+ case LFUN_MENUWRITE:
+ case LFUN_WRITEAS:
+ case LFUN_UPDATE:
+ case LFUN_PREVIEW:
+ case LFUN_IMPORT:
+ case LFUN_QUIT:
+ case LFUN_TOCVIEW:
+ case LFUN_AUTOSAVE:
+ case LFUN_RECONFIGURE:
+ case LFUN_HELP_OPEN:
+ case LFUN_FILE_NEW:
+ case LFUN_FILE_OPEN:
+ case LFUN_DROP_LAYOUTS_CHOICE:
+ case LFUN_MENU_OPEN_BY_NAME:
+ case LFUN_GETNAME:
+ case LFUN_NOTIFY:
+ case LFUN_GOTOFILEROW:
+ case LFUN_GOTO_PARAGRAPH:
case LFUN_DIALOG_SHOW_NEW_INSET:
- if (cmd.argument == "bibitem")
- code = InsetOld::BIBITEM_CODE;
- else if (cmd.argument == "bibtex")
- code = InsetOld::BIBTEX_CODE;
- else if (cmd.argument == "box")
- code = InsetOld::BOX_CODE;
- else if (cmd.argument == "branch")
- code = InsetOld::BRANCH_CODE;
- else if (cmd.argument == "citation")
- code = InsetOld::CITE_CODE;
- else if (cmd.argument == "ert")
- code = InsetOld::ERT_CODE;
- else if (cmd.argument == "external")
- code = InsetOld::EXTERNAL_CODE;
- else if (cmd.argument == "float")
- code = InsetOld::FLOAT_CODE;
- else if (cmd.argument == "graphics")
- code = InsetOld::GRAPHICS_CODE;
- else if (cmd.argument == "include")
- code = InsetOld::INCLUDE_CODE;
- else if (cmd.argument == "index")
- code = InsetOld::INDEX_CODE;
- else if (cmd.argument == "label")
- code = InsetOld::LABEL_CODE;
- else if (cmd.argument == "note")
- code = InsetOld::NOTE_CODE;
- else if (cmd.argument == "ref")
- code = InsetOld::REF_CODE;
- else if (cmd.argument == "toc")
- code = InsetOld::TOC_CODE;
- else if (cmd.argument == "url")
- code = InsetOld::URL_CODE;
- else if (cmd.argument == "vspace")
- code = InsetOld::VSPACE_CODE;
- else if (cmd.argument == "wrap")
- code = InsetOld::WRAP_CODE;
+ case LFUN_DIALOG_SHOW_NEXT_INSET:
+ case LFUN_DIALOG_UPDATE:
+ case LFUN_DIALOG_HIDE:
+ case LFUN_DIALOG_DISCONNECT_INSET:
+ case LFUN_CHILDOPEN:
+ case LFUN_TOGGLECURSORFOLLOW:
+ case LFUN_KMAP_OFF:
+ case LFUN_KMAP_PRIM:
+ case LFUN_KMAP_SEC:
+ case LFUN_KMAP_TOGGLE:
+ case LFUN_REPEAT:
+ case LFUN_SEQUENCE:
+ case LFUN_SAVEPREFERENCES:
+ case LFUN_SCREEN_FONT_UPDATE:
+ case LFUN_SET_COLOR:
+ case LFUN_MESSAGE:
+ case LFUN_FORKS_KILL:
+ case LFUN_EXTERNAL_EDIT:
+ // these are handled in our dispatch()
break;
- case LFUN_INSET_ERT:
- code = InsetOld::ERT_CODE;
- break;
- case LFUN_INSET_FOOTNOTE:
- code = InsetOld::FOOT_CODE;
- break;
- case LFUN_TABULAR_INSERT:
- code = InsetOld::TABULAR_CODE;
- break;
- case LFUN_INSET_MARGINAL:
- code = InsetOld::MARGIN_CODE;
- break;
- case LFUN_INSET_FLOAT:
- case LFUN_INSET_WIDE_FLOAT:
- code = InsetOld::FLOAT_CODE;
- break;
- case LFUN_INSET_WRAP:
- code = InsetOld::WRAP_CODE;
- break;
- case LFUN_FLOAT_LIST:
- code = InsetOld::FLOAT_LIST_CODE;
- break;
-#if 0
- case LFUN_INSET_LIST:
- code = InsetOld::LIST_CODE;
- break;
- case LFUN_INSET_THEOREM:
- code = InsetOld::THEOREM_CODE;
- break;
-#endif
- case LFUN_INSET_CAPTION:
- code = InsetOld::CAPTION_CODE;
- break;
- case LFUN_INSERT_NOTE:
- code = InsetOld::NOTE_CODE;
- break;
- case LFUN_INSERT_CHARSTYLE:
- code = InsetOld::CHARSTYLE_CODE;
- if (buf->params().getLyXTextClass().charstyles().empty())
- disable = true;
- break;
- case LFUN_INSERT_BOX:
- code = InsetOld::BOX_CODE;
- break;
- case LFUN_INSERT_BRANCH:
- code = InsetOld::BRANCH_CODE;
- if (buf->params().branchlist().empty())
- disable = true;
- break;
- case LFUN_INSERT_LABEL:
- code = InsetOld::LABEL_CODE;
- break;
- case LFUN_INSET_OPTARG:
- code = InsetOld::OPTARG_CODE;
- break;
- case LFUN_ENVIRONMENT_INSERT:
- code = InsetOld::BOX_CODE;
- break;
- case LFUN_INDEX_INSERT:
- code = InsetOld::INDEX_CODE;
- break;
- case LFUN_INDEX_PRINT:
- code = InsetOld::INDEX_PRINT_CODE;
- break;
- case LFUN_TOC_INSERT:
- code = InsetOld::TOC_CODE;
- break;
- case LFUN_HTMLURL:
- case LFUN_URL:
- code = InsetOld::URL_CODE;
- break;
- case LFUN_QUOTE:
- // always allow this, since we will inset a raw quote
- // if an inset is not allowed.
- break;
- case LFUN_HYPHENATION:
- case LFUN_LIGATURE_BREAK:
- case LFUN_HFILL:
- case LFUN_MENU_SEPARATOR:
- case LFUN_LDOTS:
- case LFUN_END_OF_SENTENCE:
- code = InsetOld::SPECIALCHAR_CODE;
- break;
- case LFUN_SPACE_INSERT:
- // slight hack: we know this is allowed in math mode
- if (cur.inTexted())
- code = InsetOld::SPACE_CODE;
- break;
- case LFUN_INSET_DIALOG_SHOW: {
- InsetBase * inset = cur.nextInset();
- disable = !inset;
- if (inset) {
- code = inset->lyxCode();
- if (!(code == InsetOld::INCLUDE_CODE
- || code == InsetOld::BIBTEX_CODE
- || code == InsetOld::FLOAT_LIST_CODE
- || code == InsetOld::TOC_CODE))
- disable = true;
- }
- break;
- }
- default:
- break;
- }
-
- if (code != InsetOld::NO_CODE
- && (cur.empty() || !cur.inset().insetAllowed(code)))
- disable = true;
-
- if (disable)
- flag.disabled(true);
-
- // A few general toggles
- switch (cmd.action) {
- case LFUN_TOOLTIPS_TOGGLE:
- flag.setOnOff(owner->getDialogs().tooltipsEnabled());
- break;
-
- case LFUN_READ_ONLY_TOGGLE:
- flag.setOnOff(buf->isReadonly());
- break;
- case LFUN_APPENDIX:
- flag.setOnOff(cur.inTexted()
- && cur.paragraph().params().startOfAppendix());
- break;
- case LFUN_SWITCHBUFFER:
- // toggle on the current buffer, but do not toggle off
- // the other ones (is that a good idea?)
- if (cmd.argument == buf->fileName())
- flag.setOnOff(true);
- break;
- case LFUN_TRACK_CHANGES:
- flag.setOnOff(buf->params().tracking_changes);
- break;
default:
- break;
- }
-
-#ifdef LOCK
- // the font related toggles
- if (cur.inTexted()) {
- LyXFont const & font = cur.text()->real_current_font;
- switch (cmd.action) {
- case LFUN_EMPH:
- flag.setOnOff(font.emph() == LyXFont::ON);
- break;
- case LFUN_NOUN:
- flag.setOnOff(font.noun() == LyXFont::ON);
- break;
- case LFUN_BOLD:
- flag.setOnOff(font.series() == LyXFont::BOLD_SERIES);
- break;
- case LFUN_SANS:
- flag.setOnOff(font.family() == LyXFont::SANS_FAMILY);
- break;
- case LFUN_ROMAN:
- flag.setOnOff(font.family() == LyXFont::ROMAN_FAMILY);
- break;
- case LFUN_CODE:
- flag.setOnOff(font.family() == LyXFont::TYPEWRITER_FAMILY);
- break;
- default:
- break;
- }
- } else {
- string tc = mathcursor::getLastCode();
- switch (cmd.action) {
- case LFUN_BOLD:
- flag.setOnOff(tc == "mathbf");
- break;
- case LFUN_SANS:
- flag.setOnOff(tc == "mathsf");
- break;
- case LFUN_EMPH:
- flag.setOnOff(tc == "mathcal");
- break;
- case LFUN_ROMAN:
- flag.setOnOff(tc == "mathrm");
- break;
- case LFUN_CODE:
- flag.setOnOff(tc == "mathtt");
- break;
- case LFUN_NOUN:
- flag.setOnOff(tc == "mathbb");
- break;
- case LFUN_DEFAULT:
- flag.setOnOff(tc == "mathnormal");
- break;
- default:
- break;
- }
- }
-#endif
-
- // this one is difficult to get right. As a half-baked
- // solution, we consider only the first action of the sequence
- if (cmd.action == LFUN_SEQUENCE) {
- // argument contains ';'-terminated commands
-#warning LyXAction arguments not handled here.
- flag = getStatus(FuncRequest(
- lyxaction.lookupFunc(token(cmd.argument, ';', 0))));
+ cur.getStatus(cmd, flag);
+ return flag;
}
+ flag.enabled(enable);
return flag;
}
selection_possible = false;
// We cannot use this function here
- if (getStatus(cmd).disabled()) {
+ if (!getStatus(cmd).enabled()) {
lyxerr[Debug::ACTION] << "LyXFunc::dispatch: "
<< lyxaction.getActionName(action)
<< " [" << action << "] is disabled at this location"
view()->update();
view()->cursor().updatePos();
// if we executed a mutating lfun, mark the buffer as dirty
- if (!getStatus(cmd).disabled()
+ if (getStatus(cmd).enabled()
&& !lyxaction.funcHasFlag(cmd.action, LyXAction::NoBuffer)
&& !lyxaction.funcHasFlag(cmd.action, LyXAction::ReadOnly))
view()->buffer()->markDirty();
void setLayout(LCursor & cur, std::string const & layout);
/// Increase or decrease the nesting depth of the selected paragraph(s)
- void changeDepth(LCursor & cur, bv_funcs::DEPTH_CHANGE type);
+ /// what type of depth change to make
+ enum DEPTH_CHANGE {
+ INC_DEPTH,
+ DEC_DEPTH
+ };
+ void changeDepth(LCursor & cur, DEPTH_CHANGE type);
/// Returns whether something would be changed by changeDepth
- bool changeDepthAllowed(LCursor & cur, bv_funcs::DEPTH_CHANGE type);
+ bool changeDepthAllowed(LCursor & cur, DEPTH_CHANGE type) const;
/// Set font over selection paragraphs and rebreak.
void setFont(LCursor & cur, LyXFont const &, bool toggleall = false);
/// try to handle that request
void dispatch(LCursor & cur, FuncRequest & cmd);
/// do we want to handle this event?
- bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus & status);
+ bool getStatus(LCursor & cur, FuncRequest const & cmd,
+ FuncStatus & status) const;
/// access to out BufferView. This should go...
BufferView * bv();
#include "math_unknowninset.h"
#include "BufferView.h"
+#include "FuncStatus.h"
#include "bufferview_funcs.h"
#include "cursor.h"
#include "debug.h"
}
+bool MathNestInset::getStatus(LCursor & cur, FuncRequest const & cmd,
+ FuncStatus & flag) const
+{
+ // the font related toggles
+ //string tc = mathcursor::getLastCode();
+ bool ret = true;
+ switch (cmd.action) {
+#if 0
+ case LFUN_TABULAR_FEATURE:
+ // FIXME: check temporarily disabled
+ // valign code
+ char align = mathcursor::valign();
+ if (align == '\0') {
+ enable = false;
+ break;
+ }
+ if (cmd.argument.empty()) {
+ flag.clear();
+ break;
+ }
+ if (!contains("tcb", cmd.argument[0])) {
+ enable = false;
+ break;
+ }
+ flag.setOnOff(cmd.argument[0] == align);
+ break;
+ case LFUN_BOLD:
+ flag.setOnOff(tc == "mathbf");
+ break;
+ case LFUN_SANS:
+ flag.setOnOff(tc == "mathsf");
+ break;
+ case LFUN_EMPH:
+ flag.setOnOff(tc == "mathcal");
+ break;
+ case LFUN_ROMAN:
+ flag.setOnOff(tc == "mathrm");
+ break;
+ case LFUN_CODE:
+ flag.setOnOff(tc == "mathtt");
+ break;
+ case LFUN_NOUN:
+ flag.setOnOff(tc == "mathbb");
+ break;
+ case LFUN_DEFAULT:
+ flag.setOnOff(tc == "mathnormal");
+ break;
+#endif
+ case LFUN_MATH_MUTATE:
+ //flag.setOnOff(mathcursor::formula()->hullType() == cmd.argument);
+ flag.setOnOff(false);
+ break;
+
+ // we just need to be in math mode to enable that
+ case LFUN_MATH_SIZE:
+ case LFUN_MATH_SPACE:
+ case LFUN_MATH_LIMITS:
+ case LFUN_MATH_NONUMBER:
+ case LFUN_MATH_NUMBER:
+ case LFUN_MATH_EXTERN:
+ flag.enabled(true);
+ break;
+
+ default:
+ ret = false;
+ break;
+ }
+ return ret;
+}
+
void MathNestInset::edit(LCursor & cur, bool left)
{
cur.push(*this);
protected:
///
void priv_dispatch(LCursor & cur, FuncRequest & cmd);
+ /// do we want to handle this event?
+ bool getStatus(LCursor & cur, FuncRequest const & cmd,
+ FuncStatus & status) const;
///
void handleFont(LCursor & cur,
std::string const & arg, std::string const & font);
}
-bool changeDepthAllowed(bv_funcs::DEPTH_CHANGE type,
- Paragraph const & par,
- int max_depth)
+bool changeDepthAllowed(LyXText::DEPTH_CHANGE type,
+ Paragraph const & par, int max_depth)
{
if (par.layout()->labeltype == LABEL_BIBLIO)
return false;
int const depth = par.params().depth();
- if (type == bv_funcs::INC_DEPTH && depth < max_depth)
+ if (type == LyXText::INC_DEPTH && depth < max_depth)
return true;
- if (type == bv_funcs::DEC_DEPTH && depth > 0)
+ if (type == LyXText::DEC_DEPTH && depth > 0)
return true;
return false;
}
}
-bool LyXText::changeDepthAllowed(LCursor & cur, bv_funcs::DEPTH_CHANGE type)
+bool LyXText::changeDepthAllowed(LCursor & cur, DEPTH_CHANGE type) const
{
BOOST_ASSERT(this == cur.text());
ParagraphList::iterator beg, end;
- getSelectionSpan(cur, *this, beg, end);
+ getSelectionSpan(cur, const_cast<LyXText&>(*this), beg, end);
int max_depth = 0;
if (beg != paragraphs().begin())
max_depth = boost::prior(beg)->getMaxDepthAfter();
}
-void LyXText::changeDepth(LCursor & cur, bv_funcs::DEPTH_CHANGE type)
+void LyXText::changeDepth(LCursor & cur, DEPTH_CHANGE type)
{
BOOST_ASSERT(this == cur.text());
ParagraphList::iterator beg, end;
for (ParagraphList::iterator pit = beg; pit != end; ++pit) {
if (::changeDepthAllowed(type, *pit, max_depth)) {
int const depth = pit->params().depth();
- if (type == bv_funcs::INC_DEPTH)
+ if (type == INC_DEPTH)
pit->params().depth(depth + 1);
else
pit->params().depth(depth - 1);
#include "lyxtext.h"
+#include "FloatList.h"
+#include "FuncStatus.h"
#include "buffer.h"
#include "bufferparams.h"
#include "BufferView.h"
#include "debug.h"
#include "dispatchresult.h"
#include "factory.h"
-#include "FloatList.h"
#include "funcrequest.h"
#include "gettext.h"
#include "intl.h"
lyxerr[Debug::ACTION] << "LyXText::dispatch: cmd: " << cmd << endl;
//lyxerr << "*** LyXText::dispatch: cmd: " << cmd << endl;
+ BOOST_ASSERT(cur.text() == this);
BufferView * bv = &cur.bv();
CursorSlice sl = cur.top();
break;
case LFUN_DEPTH_MIN:
- changeDepth(cur, bv_funcs::DEC_DEPTH);
+ changeDepth(cur, DEC_DEPTH);
cur.update();
break;
case LFUN_DEPTH_PLUS:
- changeDepth(cur, bv_funcs::INC_DEPTH);
+ changeDepth(cur, INC_DEPTH);
cur.update();
break;
}
-bool LyXText::getStatus(LCursor &, FuncRequest const &, FuncStatus &)
+bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd,
+ FuncStatus & flag) const
{
- return false;
+ BOOST_ASSERT(cur.text() == this);
+ LyXFont const & font = real_current_font;
+ bool enable = true;
+
+ switch (cmd.action) {
+
+ case LFUN_DEPTH_MIN:
+ enable = changeDepthAllowed(cur, DEC_DEPTH);
+ break;
+
+ case LFUN_DEPTH_PLUS:
+ enable = changeDepthAllowed(cur, INC_DEPTH);
+ break;
+
+ case LFUN_INSET_OPTARG:
+ enable = cur.paragraph().layout()->optionalargs;
+ break;
+
+ case LFUN_APPENDIX:
+ flag.setOnOff(cur.paragraph().params().startOfAppendix());
+ break;
+
+#if 0
+ // the functions which insert insets
+ InsetOld::Code code = InsetOld::NO_CODE;
+ switch (cmd.action) {
+ case LFUN_DIALOG_SHOW_NEW_INSET:
+ if (cmd.argument == "bibitem")
+ code = InsetOld::BIBITEM_CODE;
+ else if (cmd.argument == "bibtex")
+ code = InsetOld::BIBTEX_CODE;
+ else if (cmd.argument == "box")
+ code = InsetOld::BOX_CODE;
+ else if (cmd.argument == "branch")
+ code = InsetOld::BRANCH_CODE;
+ else if (cmd.argument == "citation")
+ code = InsetOld::CITE_CODE;
+ else if (cmd.argument == "ert")
+ code = InsetOld::ERT_CODE;
+ else if (cmd.argument == "external")
+ code = InsetOld::EXTERNAL_CODE;
+ else if (cmd.argument == "float")
+ code = InsetOld::FLOAT_CODE;
+ else if (cmd.argument == "graphics")
+ code = InsetOld::GRAPHICS_CODE;
+ else if (cmd.argument == "include")
+ code = InsetOld::INCLUDE_CODE;
+ else if (cmd.argument == "index")
+ code = InsetOld::INDEX_CODE;
+ else if (cmd.argument == "label")
+ code = InsetOld::LABEL_CODE;
+ else if (cmd.argument == "note")
+ code = InsetOld::NOTE_CODE;
+ else if (cmd.argument == "ref")
+ code = InsetOld::REF_CODE;
+ else if (cmd.argument == "toc")
+ code = InsetOld::TOC_CODE;
+ else if (cmd.argument == "url")
+ code = InsetOld::URL_CODE;
+ else if (cmd.argument == "vspace")
+ code = InsetOld::VSPACE_CODE;
+ else if (cmd.argument == "wrap")
+ code = InsetOld::WRAP_CODE;
+ break;
+
+ case LFUN_INSET_ERT:
+ code = InsetOld::ERT_CODE;
+ break;
+ case LFUN_INSET_FOOTNOTE:
+ code = InsetOld::FOOT_CODE;
+ break;
+ case LFUN_TABULAR_INSERT:
+ code = InsetOld::TABULAR_CODE;
+ break;
+ case LFUN_INSET_MARGINAL:
+ code = InsetOld::MARGIN_CODE;
+ break;
+ case LFUN_INSET_FLOAT:
+ case LFUN_INSET_WIDE_FLOAT:
+ code = InsetOld::FLOAT_CODE;
+ break;
+ case LFUN_INSET_WRAP:
+ code = InsetOld::WRAP_CODE;
+ break;
+ case LFUN_FLOAT_LIST:
+ code = InsetOld::FLOAT_LIST_CODE;
+ break;
+#if 0
+ case LFUN_INSET_LIST:
+ code = InsetOld::LIST_CODE;
+ break;
+ case LFUN_INSET_THEOREM:
+ code = InsetOld::THEOREM_CODE;
+ break;
+#endif
+ case LFUN_INSET_CAPTION:
+ code = InsetOld::CAPTION_CODE;
+ break;
+ case LFUN_INSERT_NOTE:
+ code = InsetOld::NOTE_CODE;
+ break;
+ case LFUN_INSERT_CHARSTYLE:
+ code = InsetOld::CHARSTYLE_CODE;
+ if (buf->params().getLyXTextClass().charstyles().empty())
+ enable = false;
+ break;
+ case LFUN_INSERT_BOX:
+ code = InsetOld::BOX_CODE;
+ break;
+ case LFUN_INSERT_BRANCH:
+ code = InsetOld::BRANCH_CODE;
+ if (buf->params().branchlist().empty())
+ enable = false;
+ break;
+ case LFUN_INSERT_LABEL:
+ code = InsetOld::LABEL_CODE;
+ break;
+ case LFUN_INSET_OPTARG:
+ code = InsetOld::OPTARG_CODE;
+ break;
+ case LFUN_ENVIRONMENT_INSERT:
+ code = InsetOld::BOX_CODE;
+ break;
+ case LFUN_INDEX_INSERT:
+ code = InsetOld::INDEX_CODE;
+ break;
+ case LFUN_INDEX_PRINT:
+ code = InsetOld::INDEX_PRINT_CODE;
+ break;
+ case LFUN_TOC_INSERT:
+ code = InsetOld::TOC_CODE;
+ break;
+ case LFUN_HTMLURL:
+ case LFUN_URL:
+ code = InsetOld::URL_CODE;
+ break;
+ case LFUN_QUOTE:
+ // always allow this, since we will inset a raw quote
+ // if an inset is not allowed.
+ break;
+ case LFUN_HYPHENATION:
+ case LFUN_LIGATURE_BREAK:
+ case LFUN_HFILL:
+ case LFUN_MENU_SEPARATOR:
+ case LFUN_LDOTS:
+ case LFUN_END_OF_SENTENCE:
+ code = InsetOld::SPECIALCHAR_CODE;
+ break;
+ case LFUN_SPACE_INSERT:
+ // slight hack: we know this is allowed in math mode
+ if (cur.inTexted())
+ code = InsetOld::SPACE_CODE;
+ break;
+ case LFUN_INSET_DIALOG_SHOW: {
+ InsetBase * inset = cur.nextInset();
+ enable = inset;
+ if (inset) {
+ code = inset->lyxCode();
+ if (!(code == InsetOld::INCLUDE_CODE
+ || code == InsetOld::BIBTEX_CODE
+ || code == InsetOld::FLOAT_LIST_CODE
+ || code == InsetOld::TOC_CODE))
+ enable = false;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ if (code != InsetOld::NO_CODE
+ && (cur.empty() || !cur.inset().insetAllowed(code)))
+ enable = false;
+
+#endif
+
+ case LFUN_DIALOG_SHOW_NEW_INSET:
+ case LFUN_INSET_ERT:
+ case LFUN_INSERT_BOX:
+ case LFUN_INSERT_BRANCH:
+ case LFUN_ENVIRONMENT_INSERT:
+ case LFUN_INDEX_INSERT:
+ case LFUN_INDEX_PRINT:
+ case LFUN_TOC_INSERT:
+ case LFUN_HTMLURL:
+ case LFUN_URL:
+ case LFUN_QUOTE:
+ case LFUN_HYPHENATION:
+ case LFUN_LIGATURE_BREAK:
+ case LFUN_HFILL:
+ case LFUN_MENU_SEPARATOR:
+ case LFUN_LDOTS:
+ case LFUN_END_OF_SENTENCE:
+ case LFUN_SPACE_INSERT:
+ case LFUN_INSET_DIALOG_SHOW:
+ break;
+
+ case LFUN_EMPH:
+ flag.setOnOff(font.emph() == LyXFont::ON);
+ break;
+
+ case LFUN_NOUN:
+ flag.setOnOff(font.noun() == LyXFont::ON);
+ break;
+
+ case LFUN_BOLD:
+ flag.setOnOff(font.series() == LyXFont::BOLD_SERIES);
+ break;
+
+ case LFUN_SANS:
+ flag.setOnOff(font.family() == LyXFont::SANS_FAMILY);
+ break;
+
+ case LFUN_ROMAN:
+ flag.setOnOff(font.family() == LyXFont::ROMAN_FAMILY);
+ break;
+
+ case LFUN_CODE:
+ flag.setOnOff(font.family() == LyXFont::TYPEWRITER_FAMILY);
+ break;
+
+ case LFUN_DELETE_WORD_FORWARD:
+ case LFUN_DELETE_WORD_BACKWARD:
+ case LFUN_DELETE_LINE_FORWARD:
+ case LFUN_WORDRIGHT:
+ case LFUN_WORDLEFT:
+ case LFUN_ENDBUF:
+ case LFUN_RIGHT:
+ case LFUN_RIGHTSEL:
+ case LFUN_LEFT:
+ case LFUN_LEFTSEL:
+ case LFUN_UP:
+ case LFUN_UPSEL:
+ case LFUN_DOWN:
+ case LFUN_DOWNSEL:
+ case LFUN_UP_PARAGRAPHSEL:
+ case LFUN_DOWN_PARAGRAPHSEL:
+ case LFUN_PRIORSEL:
+ case LFUN_NEXTSEL:
+ case LFUN_HOMESEL:
+ case LFUN_ENDSEL:
+ case LFUN_WORDRIGHTSEL:
+ case LFUN_WORDLEFTSEL:
+ case LFUN_WORDSEL:
+ case LFUN_UP_PARAGRAPH:
+ case LFUN_DOWN_PARAGRAPH:
+ case LFUN_PRIOR:
+ case LFUN_NEXT:
+ case LFUN_HOME:
+ case LFUN_END:
+ case LFUN_BREAKLINE:
+ case LFUN_DELETE:
+ case LFUN_DELETE_SKIP:
+ case LFUN_BACKSPACE:
+ case LFUN_BACKSPACE_SKIP:
+ case LFUN_BREAKPARAGRAPH:
+ case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
+ case LFUN_BREAKPARAGRAPH_SKIP:
+ case LFUN_PARAGRAPH_SPACING:
+ case LFUN_INSET_APPLY:
+ case LFUN_INSET_INSERT:
+ case LFUN_INSET_TOGGLE:
+ case LFUN_UPCASE_WORD:
+ case LFUN_LOWCASE_WORD:
+ case LFUN_CAPITALIZE_WORD:
+ case LFUN_TRANSPOSE_CHARS:
+ case LFUN_PASTE:
+ case LFUN_CUT:
+ case LFUN_COPY:
+ case LFUN_GETXY:
+ case LFUN_SETXY:
+ case LFUN_GETFONT:
+ case LFUN_GETLAYOUT:
+ case LFUN_LAYOUT:
+ case LFUN_PASTESELECTION:
+ case LFUN_GOTOERROR:
+ case LFUN_GOTONOTE:
+ case LFUN_REFERENCE_GOTO:
+ case LFUN_DATE_INSERT:
+ case LFUN_SELFINSERT:
+ case LFUN_INSERT_LABEL:
+ case LFUN_INSERT_NOTE:
+ case LFUN_INSERT_CHARSTYLE:
+ case LFUN_INSERT_BIBITEM:
+ case LFUN_INSET_FLOAT:
+ case LFUN_INSET_FOOTNOTE:
+ case LFUN_INSET_MARGINAL:
+ case LFUN_INSET_WIDE_FLOAT:
+ case LFUN_INSET_WRAP:
+ case LFUN_TABULAR_INSERT:
+ case LFUN_INSERT_LINE:
+ case LFUN_INSERT_PAGEBREAK:
+ case LFUN_MATH_DISPLAY:
+ case LFUN_MATH_IMPORT_SELECTION:
+ case LFUN_MATH_MODE:
+ case LFUN_MATH_MACRO:
+ case LFUN_INSERT_MATH:
+ case LFUN_INSERT_MATRIX:
+ case LFUN_MATH_DELIM:
+ case LFUN_DEFAULT:
+ case LFUN_UNDERLINE:
+ case LFUN_FONT_SIZE:
+ case LFUN_LANGUAGE:
+ case LFUN_FREEFONT_APPLY:
+ case LFUN_FREEFONT_UPDATE:
+ case LFUN_LAYOUT_PARAGRAPH:
+ case LFUN_PARAGRAPH_UPDATE:
+ case LFUN_UMLAUT:
+ case LFUN_CIRCUMFLEX:
+ case LFUN_GRAVE:
+ case LFUN_ACUTE:
+ case LFUN_TILDE:
+ case LFUN_CEDILLA:
+ case LFUN_MACRON:
+ case LFUN_DOT:
+ case LFUN_UNDERDOT:
+ case LFUN_UNDERBAR:
+ case LFUN_CARON:
+ case LFUN_SPECIAL_CARON:
+ case LFUN_BREVE:
+ case LFUN_TIE:
+ case LFUN_HUNG_UMLAUT:
+ case LFUN_CIRCLE:
+ case LFUN_OGONEK:
+ case LFUN_FLOAT_LIST:
+ case LFUN_ACCEPT_CHANGE:
+ case LFUN_REJECT_CHANGE:
+ case LFUN_THESAURUS_ENTRY:
+ case LFUN_PARAGRAPH_APPLY:
+ case LFUN_ESCAPE:
+ // these are handled in our dispatch()
+ enable = true;
+ break;
+
+ default:
+ enable = false;
+ break;
+ }
+ flag.enabled(enable);
+ return true;
}