mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
FuncStatus::enabled(bool) --> FuncStatus::setEnabled(bool)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24999 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
fb69a2e3e4
commit
77ed747114
@ -837,17 +837,17 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
|
||||
switch (cmd.action) {
|
||||
|
||||
case LFUN_UNDO:
|
||||
flag.enabled(buffer_.undo().hasUndoStack());
|
||||
flag.setEnabled(buffer_.undo().hasUndoStack());
|
||||
break;
|
||||
case LFUN_REDO:
|
||||
flag.enabled(buffer_.undo().hasRedoStack());
|
||||
flag.setEnabled(buffer_.undo().hasRedoStack());
|
||||
break;
|
||||
case LFUN_FILE_INSERT:
|
||||
case LFUN_FILE_INSERT_PLAINTEXT_PARA:
|
||||
case LFUN_FILE_INSERT_PLAINTEXT:
|
||||
case LFUN_BOOKMARK_SAVE:
|
||||
// FIXME: Actually, these LFUNS should be moved to Text
|
||||
flag.enabled(cur.inTexted());
|
||||
flag.setEnabled(cur.inTexted());
|
||||
break;
|
||||
case LFUN_FONT_STATE:
|
||||
case LFUN_LABEL_INSERT:
|
||||
@ -865,7 +865,7 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
|
||||
case LFUN_BIBTEX_DATABASE_ADD:
|
||||
case LFUN_BIBTEX_DATABASE_DEL:
|
||||
case LFUN_STATISTICS:
|
||||
flag.enabled(true);
|
||||
flag.setEnabled(true);
|
||||
break;
|
||||
|
||||
case LFUN_NEXT_INSET_TOGGLE:
|
||||
@ -883,18 +883,18 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_LABEL_GOTO: {
|
||||
flag.enabled(!cmd.argument().empty()
|
||||
flag.setEnabled(!cmd.argument().empty()
|
||||
|| getInsetByCode<InsetRef>(cur, REF_CODE));
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_CHANGES_TRACK:
|
||||
flag.enabled(true);
|
||||
flag.setEnabled(true);
|
||||
flag.setOnOff(buffer_.params().trackChanges);
|
||||
break;
|
||||
|
||||
case LFUN_CHANGES_OUTPUT:
|
||||
flag.enabled(true);
|
||||
flag.setEnabled(true);
|
||||
flag.setOnOff(buffer_.params().outputChanges);
|
||||
break;
|
||||
|
||||
@ -906,7 +906,7 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
|
||||
// In principle, these command should only be enabled if there
|
||||
// is a change in the document. However, without proper
|
||||
// optimizations, this will inevitably result in poor performance.
|
||||
flag.enabled(true);
|
||||
flag.setEnabled(true);
|
||||
break;
|
||||
|
||||
case LFUN_BUFFER_TOGGLE_COMPRESSION: {
|
||||
@ -919,25 +919,25 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
|
||||
case LFUN_SCROLL:
|
||||
case LFUN_SCREEN_UP_SELECT:
|
||||
case LFUN_SCREEN_DOWN_SELECT:
|
||||
flag.enabled(true);
|
||||
flag.setEnabled(true);
|
||||
break;
|
||||
|
||||
case LFUN_LAYOUT_TABULAR:
|
||||
flag.enabled(cur.innerInsetOfType(TABULAR_CODE));
|
||||
flag.setEnabled(cur.innerInsetOfType(TABULAR_CODE));
|
||||
break;
|
||||
|
||||
case LFUN_LAYOUT:
|
||||
flag.enabled(!cur.inset().forceEmptyLayout(cur.idx()));
|
||||
flag.setEnabled(!cur.inset().forceEmptyLayout(cur.idx()));
|
||||
break;
|
||||
|
||||
case LFUN_LAYOUT_PARAGRAPH:
|
||||
flag.enabled(cur.inset().allowParagraphCustomization(cur.idx()));
|
||||
flag.setEnabled(cur.inset().allowParagraphCustomization(cur.idx()));
|
||||
break;
|
||||
|
||||
case LFUN_INSET_SETTINGS: {
|
||||
InsetCode code = cur.inset().lyxCode();
|
||||
if (cmd.getArg(0) == insetName(code)) {
|
||||
flag.enabled(true);
|
||||
flag.setEnabled(true);
|
||||
break;
|
||||
}
|
||||
bool enable = false;
|
||||
@ -958,12 +958,12 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
flag.enabled(enable);
|
||||
flag.setEnabled(enable);
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_DIALOG_SHOW_NEW_INSET:
|
||||
flag.enabled(cur.inset().lyxCode() != ERT_CODE &&
|
||||
flag.setEnabled(cur.inset().lyxCode() != ERT_CODE &&
|
||||
cur.inset().lyxCode() != LISTINGS_CODE);
|
||||
if (cur.inset().lyxCode() == CAPTION_CODE) {
|
||||
FuncStatus flag;
|
||||
@ -978,12 +978,12 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
|
||||
docstring const branchName = cmd.argument();
|
||||
if (!branchName.empty())
|
||||
enable = buffer_.params().branchlist().find(branchName);
|
||||
flag.enabled(enable);
|
||||
flag.setEnabled(enable);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
flag.enabled(false);
|
||||
flag.setEnabled(false);
|
||||
}
|
||||
|
||||
return flag;
|
||||
|
@ -52,7 +52,7 @@ bool FuncStatus::unknown() const
|
||||
}
|
||||
|
||||
|
||||
void FuncStatus::enabled(bool b)
|
||||
void FuncStatus::setEnabled(bool b)
|
||||
{
|
||||
if (b)
|
||||
v_ &= ~DISABLED;
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
bool unknown() const;
|
||||
|
||||
///
|
||||
void enabled(bool b);
|
||||
void setEnabled(bool b);
|
||||
/// tells whether it can be invoked (otherwise it will be grayed-out).
|
||||
bool enabled() const;
|
||||
|
||||
|
@ -389,7 +389,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
|
||||
if (cmd.action == LFUN_NOACTION) {
|
||||
flag.message(from_utf8(N_("Nothing to do")));
|
||||
flag.enabled(false);
|
||||
flag.setEnabled(false);
|
||||
return flag;
|
||||
}
|
||||
|
||||
@ -399,7 +399,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
case LFUN_THESAURUS_ENTRY:
|
||||
#endif
|
||||
flag.unknown(true);
|
||||
flag.enabled(false);
|
||||
flag.setEnabled(false);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -422,7 +422,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
// no, exit directly
|
||||
flag.message(from_utf8(N_("Command not allowed with"
|
||||
"out any document open")));
|
||||
flag.enabled(false);
|
||||
flag.setEnabled(false);
|
||||
return flag;
|
||||
}
|
||||
|
||||
@ -624,14 +624,14 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
}
|
||||
|
||||
if (!enable)
|
||||
flag.enabled(false);
|
||||
flag.setEnabled(false);
|
||||
|
||||
// Can we use a readonly buffer?
|
||||
if (buf && buf->isReadonly()
|
||||
&& !lyxaction.funcHasFlag(cmd.action, LyXAction::ReadOnly)
|
||||
&& !lyxaction.funcHasFlag(cmd.action, LyXAction::NoBuffer)) {
|
||||
flag.message(from_utf8(N_("Document is read-only")));
|
||||
flag.enabled(false);
|
||||
flag.setEnabled(false);
|
||||
}
|
||||
|
||||
// Are we in a DELETED change-tracking region?
|
||||
@ -640,7 +640,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
&& !lyxaction.funcHasFlag(cmd.action, LyXAction::ReadOnly)
|
||||
&& !lyxaction.funcHasFlag(cmd.action, LyXAction::NoBuffer)) {
|
||||
flag.message(from_utf8(N_("This portion of the document is deleted.")));
|
||||
flag.enabled(false);
|
||||
flag.setEnabled(false);
|
||||
}
|
||||
|
||||
// the default error message if we disable the command
|
||||
|
@ -2298,7 +2298,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
&& (cur.empty() || !cur.inset().insetAllowed(code)))
|
||||
enable = false;
|
||||
|
||||
flag.enabled(enable);
|
||||
flag.setEnabled(enable);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -515,7 +515,7 @@ bool GuiApplication::getStatus(FuncRequest const & cmd, FuncStatus & flag) const
|
||||
}
|
||||
|
||||
if (!enable)
|
||||
flag.enabled(false);
|
||||
flag.setEnabled(false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1175,7 +1175,7 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
||||
}
|
||||
|
||||
if (!enable)
|
||||
flag.enabled(false);
|
||||
flag.setEnabled(false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -352,7 +352,7 @@ void MenuDefinition::addWithStatusCheck(MenuItem const & i)
|
||||
}
|
||||
if (enabled || !i.optional()) {
|
||||
items_.push_back(i);
|
||||
items_.back().status().enabled(enabled);
|
||||
items_.back().status().setEnabled(enabled);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -241,19 +241,19 @@ bool Inset::getStatus(Cursor &, FuncRequest const & cmd,
|
||||
// Allow modification of our data.
|
||||
// This needs to be handled in the doDispatch method of our
|
||||
// instantiatable children.
|
||||
flag.enabled(true);
|
||||
flag.setEnabled(true);
|
||||
return true;
|
||||
|
||||
case LFUN_INSET_INSERT:
|
||||
// Don't allow insertion of new insets.
|
||||
// Every inset that wants to allow new insets from open
|
||||
// dialogs needs to override this.
|
||||
flag.enabled(false);
|
||||
flag.setEnabled(false);
|
||||
return true;
|
||||
|
||||
case LFUN_INSET_TOGGLE:
|
||||
// remove this if we dissociate toggle from edit.
|
||||
flag.enabled(editable() == IS_EDITABLE);
|
||||
flag.setEnabled(editable() == IS_EDITABLE);
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
@ -108,7 +108,7 @@ bool InsetBibtex::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_EDIT:
|
||||
flag.enabled(true);
|
||||
flag.setEnabled(true);
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
@ -223,17 +223,17 @@ bool InsetBox::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_INSET_MODIFY:
|
||||
if (cmd.getArg(0) == "changetype")
|
||||
flag.setOnOff(cmd.getArg(1) == params_.type);
|
||||
flag.enabled(true);
|
||||
flag.setEnabled(true);
|
||||
return true;
|
||||
|
||||
case LFUN_INSET_DIALOG_UPDATE:
|
||||
flag.enabled(true);
|
||||
flag.setEnabled(true);
|
||||
return true;
|
||||
|
||||
case LFUN_BREAK_PARAGRAPH:
|
||||
if (params_.inner_box || params_.type == "Framed")
|
||||
return InsetCollapsable::getStatus(cur, cmd, flag);
|
||||
flag.enabled(false);
|
||||
flag.setEnabled(false);
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
@ -168,20 +168,20 @@ bool InsetBranch::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_MODIFY:
|
||||
case LFUN_INSET_DIALOG_UPDATE:
|
||||
flag.enabled(true);
|
||||
flag.setEnabled(true);
|
||||
break;
|
||||
|
||||
case LFUN_INSET_TOGGLE:
|
||||
if (cmd.argument() == "open" || cmd.argument() == "close" ||
|
||||
cmd.argument() == "toggle")
|
||||
flag.enabled(true);
|
||||
flag.setEnabled(true);
|
||||
else if (cmd.argument() == "assign" || cmd.argument().empty()) {
|
||||
if (isBranchSelected())
|
||||
flag.enabled(status() != Open);
|
||||
flag.setEnabled(status() != Open);
|
||||
else
|
||||
flag.enabled(status() != Collapsed);
|
||||
flag.setEnabled(status() != Collapsed);
|
||||
} else
|
||||
flag.enabled(true);
|
||||
flag.setEnabled(true);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -191,11 +191,11 @@ bool InsetCaption::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
|
||||
case LFUN_BREAK_PARAGRAPH:
|
||||
case LFUN_BREAK_PARAGRAPH_SKIP:
|
||||
status.enabled(false);
|
||||
status.setEnabled(false);
|
||||
return true;
|
||||
|
||||
case LFUN_OPTIONAL_INSERT:
|
||||
status.enabled(cur.paragraph().insetList().find(OPTARG_CODE) == -1);
|
||||
status.setEnabled(cur.paragraph().insetList().find(OPTARG_CODE) == -1);
|
||||
return true;
|
||||
|
||||
case LFUN_INSET_TOGGLE:
|
||||
|
@ -713,30 +713,30 @@ bool InsetCollapsable::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_TOC_INSERT:
|
||||
case LFUN_WRAP_INSERT:
|
||||
if (layout_->isPassThru()) {
|
||||
flag.enabled(false);
|
||||
flag.setEnabled(false);
|
||||
return true;
|
||||
}
|
||||
return InsetText::getStatus(cur, cmd, flag);
|
||||
|
||||
case LFUN_INSET_TOGGLE:
|
||||
if (cmd.argument() == "open")
|
||||
flag.enabled(status_ != Open);
|
||||
flag.setEnabled(status_ != Open);
|
||||
else if (cmd.argument() == "close")
|
||||
flag.enabled(status_ == Open);
|
||||
flag.setEnabled(status_ == Open);
|
||||
else if (cmd.argument() == "toggle" || cmd.argument().empty()) {
|
||||
flag.enabled(true);
|
||||
flag.setEnabled(true);
|
||||
flag.setOnOff(status_ == Open);
|
||||
} else
|
||||
flag.enabled(false);
|
||||
flag.setEnabled(false);
|
||||
return true;
|
||||
|
||||
case LFUN_LANGUAGE:
|
||||
flag.enabled(!layout_->isForceLtr());
|
||||
flag.setEnabled(!layout_->isForceLtr());
|
||||
return InsetText::getStatus(cur, cmd, flag);
|
||||
|
||||
case LFUN_BREAK_PARAGRAPH:
|
||||
case LFUN_BREAK_PARAGRAPH_SKIP:
|
||||
flag.enabled(layout_->isMultiPar());
|
||||
flag.setEnabled(layout_->isMultiPar());
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
@ -156,19 +156,19 @@ bool InsetCommand::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
switch (cmd.action) {
|
||||
// suppress these
|
||||
case LFUN_ERT_INSERT:
|
||||
status.enabled(false);
|
||||
status.setEnabled(false);
|
||||
return true;
|
||||
// we handle these
|
||||
case LFUN_INSET_MODIFY:
|
||||
if (cmd.getArg(0) == "changetype") {
|
||||
string const newtype = cmd.getArg(1);
|
||||
status.enabled(p_.isCompatibleCommand(p_.code(), newtype));
|
||||
status.setEnabled(p_.isCompatibleCommand(p_.code(), newtype));
|
||||
status.setOnOff(newtype == p_.getCmdName());
|
||||
}
|
||||
status.enabled(true);
|
||||
status.setEnabled(true);
|
||||
return true;
|
||||
case LFUN_INSET_DIALOG_UPDATE:
|
||||
status.enabled(true);
|
||||
status.setEnabled(true);
|
||||
return true;
|
||||
default:
|
||||
return Inset::getStatus(cur, cmd, status);
|
||||
|
@ -141,7 +141,7 @@ bool InsetERT::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_PASTE:
|
||||
case LFUN_PRIMARY_SELECTION_PASTE:
|
||||
case LFUN_QUOTE_INSERT:
|
||||
status.enabled(true);
|
||||
status.setEnabled(true);
|
||||
return true;
|
||||
|
||||
// this one is difficult to get right. As a half-baked
|
||||
|
@ -468,7 +468,7 @@ bool InsetExternal::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_INSET_EDIT:
|
||||
case LFUN_INSET_MODIFY:
|
||||
case LFUN_INSET_DIALOG_UPDATE:
|
||||
flag.enabled(true);
|
||||
flag.setEnabled(true);
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
@ -180,7 +180,7 @@ bool InsetFloat::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
|
||||
case LFUN_INSET_MODIFY:
|
||||
case LFUN_INSET_DIALOG_UPDATE:
|
||||
flag.enabled(true);
|
||||
flag.setEnabled(true);
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
@ -230,7 +230,7 @@ bool InsetGraphics::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_INSET_EDIT:
|
||||
case LFUN_INSET_MODIFY:
|
||||
case LFUN_INSET_DIALOG_UPDATE:
|
||||
flag.enabled(true);
|
||||
flag.setEnabled(true);
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
@ -304,7 +304,7 @@ bool InsetInclude::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
|
||||
case LFUN_INSET_EDIT:
|
||||
case LFUN_INSET_MODIFY:
|
||||
flag.enabled(true);
|
||||
flag.setEnabled(true);
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
@ -231,10 +231,10 @@ bool InsetListings::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_MODIFY:
|
||||
case LFUN_INSET_DIALOG_UPDATE:
|
||||
status.enabled(true);
|
||||
status.setEnabled(true);
|
||||
return true;
|
||||
case LFUN_CAPTION_INSERT:
|
||||
status.enabled(!params().isInline());
|
||||
status.setEnabled(!params().isInline());
|
||||
return true;
|
||||
default:
|
||||
return InsetCollapsable::getStatus(cur, cmd, status);
|
||||
|
@ -116,7 +116,7 @@ bool InsetNewline::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
string2params(to_utf8(cmd.argument()), params);
|
||||
status.setOnOff(params_.kind == params.kind);
|
||||
}
|
||||
status.enabled(true);
|
||||
status.setEnabled(true);
|
||||
return true;
|
||||
default:
|
||||
return Inset::getStatus(cur, cmd, status);
|
||||
|
@ -164,7 +164,7 @@ bool InsetNewpage::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
string2params(to_utf8(cmd.argument()), params);
|
||||
status.setOnOff(params_.kind == params.kind);
|
||||
}
|
||||
status.enabled(true);
|
||||
status.setEnabled(true);
|
||||
return true;
|
||||
default:
|
||||
return Inset::getStatus(cur, cmd, status);
|
||||
|
@ -202,7 +202,7 @@ bool InsetNote::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
|
||||
case LFUN_INSET_MODIFY:
|
||||
// disallow comment and greyed out in commands
|
||||
flag.enabled(!cur.paragraph().layout().isCommand() ||
|
||||
flag.setEnabled(!cur.paragraph().layout().isCommand() ||
|
||||
cmd.getArg(2) == "Note");
|
||||
if (cmd.getArg(0) == "note") {
|
||||
InsetNoteParams params;
|
||||
@ -212,7 +212,7 @@ bool InsetNote::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
return true;
|
||||
|
||||
case LFUN_INSET_DIALOG_UPDATE:
|
||||
flag.enabled(true);
|
||||
flag.setEnabled(true);
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
@ -159,7 +159,7 @@ bool InsetSpace::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
string2params(to_utf8(cmd.argument()), params);
|
||||
status.setOnOff(params_.kind == params.kind);
|
||||
}
|
||||
status.enabled(true);
|
||||
status.setEnabled(true);
|
||||
return true;
|
||||
default:
|
||||
return Inset::getStatus(cur, cmd, status);
|
||||
|
@ -2745,7 +2745,7 @@ bool InsetTableCell::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
default:
|
||||
return InsetText::getStatus(cur, cmd, status);
|
||||
}
|
||||
status.enabled(enabled);
|
||||
status.setEnabled(enabled);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -3550,33 +3550,33 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
return true;
|
||||
|
||||
case Tabular::MULTICOLUMN:
|
||||
status.enabled(sel_row_start == sel_row_end);
|
||||
status.setEnabled(sel_row_start == sel_row_end);
|
||||
status.setOnOff(tabular.isMultiColumn(cur.idx()));
|
||||
break;
|
||||
|
||||
case Tabular::SET_ALL_LINES:
|
||||
case Tabular::UNSET_ALL_LINES:
|
||||
case Tabular::SET_BORDER_LINES:
|
||||
status.enabled(!tabular.ltCaption(tabular.cellRow(cur.idx())));
|
||||
status.setEnabled(!tabular.ltCaption(tabular.cellRow(cur.idx())));
|
||||
break;
|
||||
|
||||
case Tabular::TOGGLE_LINE_TOP:
|
||||
status.enabled(!tabular.ltCaption(tabular.cellRow(cur.idx())));
|
||||
status.setEnabled(!tabular.ltCaption(tabular.cellRow(cur.idx())));
|
||||
status.setOnOff(tabular.topLine(cur.idx()));
|
||||
break;
|
||||
|
||||
case Tabular::TOGGLE_LINE_BOTTOM:
|
||||
status.enabled(!tabular.ltCaption(tabular.cellRow(cur.idx())));
|
||||
status.setEnabled(!tabular.ltCaption(tabular.cellRow(cur.idx())));
|
||||
status.setOnOff(tabular.bottomLine(cur.idx()));
|
||||
break;
|
||||
|
||||
case Tabular::TOGGLE_LINE_LEFT:
|
||||
status.enabled(!tabular.ltCaption(tabular.cellRow(cur.idx())));
|
||||
status.setEnabled(!tabular.ltCaption(tabular.cellRow(cur.idx())));
|
||||
status.setOnOff(tabular.leftLine(cur.idx()));
|
||||
break;
|
||||
|
||||
case Tabular::TOGGLE_LINE_RIGHT:
|
||||
status.enabled(!tabular.ltCaption(tabular.cellRow(cur.idx())));
|
||||
status.setEnabled(!tabular.ltCaption(tabular.cellRow(cur.idx())));
|
||||
status.setOnOff(tabular.rightLine(cur.idx()));
|
||||
break;
|
||||
|
||||
@ -3599,7 +3599,7 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
break;
|
||||
|
||||
case Tabular::ALIGN_BLOCK:
|
||||
status.enabled(!tabular.getPWidth(cur.idx()).zero());
|
||||
status.setEnabled(!tabular.getPWidth(cur.idx()).zero());
|
||||
status.setOnOff(tabular.getAlignment(cur.idx(), flag) == LYX_ALIGN_BLOCK);
|
||||
break;
|
||||
|
||||
@ -3693,7 +3693,7 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
break;
|
||||
|
||||
case Tabular::TOGGLE_LTCAPTION:
|
||||
status.enabled(sel_row_start == sel_row_end);
|
||||
status.setEnabled(sel_row_start == sel_row_end);
|
||||
status.setOnOff(tabular.ltCaption(sel_row_start));
|
||||
break;
|
||||
|
||||
@ -3707,7 +3707,7 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
|
||||
default:
|
||||
status.clear();
|
||||
status.enabled(false);
|
||||
status.setEnabled(false);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
@ -3716,7 +3716,7 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
// These are only enabled inside tabular
|
||||
case LFUN_CELL_BACKWARD:
|
||||
case LFUN_CELL_FORWARD:
|
||||
status.enabled(true);
|
||||
status.setEnabled(true);
|
||||
return true;
|
||||
|
||||
// disable these with multiple cells selected
|
||||
@ -3738,7 +3738,7 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_WRAP_INSERT:
|
||||
case LFUN_ERT_INSERT: {
|
||||
if (tablemode(cur)) {
|
||||
status.enabled(false);
|
||||
status.setEnabled(false);
|
||||
return true;
|
||||
} else
|
||||
return cell(cur.idx())->getStatus(cur, cmd, status);
|
||||
@ -3749,7 +3749,7 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_BREAK_PARAGRAPH:
|
||||
case LFUN_BREAK_PARAGRAPH_SKIP: {
|
||||
if (tabular.getPWidth(cur.idx()).zero()) {
|
||||
status.enabled(false);
|
||||
status.setEnabled(false);
|
||||
return true;
|
||||
} else
|
||||
return cell(cur.idx())->getStatus(cur, cmd, status);
|
||||
@ -3757,14 +3757,14 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
|
||||
case LFUN_PASTE:
|
||||
if (tabularStackDirty() && theClipboard().isInternal()) {
|
||||
status.enabled(true);
|
||||
status.setEnabled(true);
|
||||
return true;
|
||||
} else
|
||||
return cell(cur.idx())->getStatus(cur, cmd, status);
|
||||
|
||||
case LFUN_INSET_MODIFY:
|
||||
if (insetCode(cmd.getArg(0)) == TABULAR_CODE) {
|
||||
status.enabled(true);
|
||||
status.setEnabled(true);
|
||||
return true;
|
||||
}
|
||||
// Fall through
|
||||
|
@ -90,7 +90,7 @@ bool InsetVSpace::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
InsetVSpace::string2params(to_utf8(cmd.argument()), vspace);
|
||||
status.setOnOff(vspace == space_);
|
||||
}
|
||||
status.enabled(true);
|
||||
status.setEnabled(true);
|
||||
return true;
|
||||
default:
|
||||
return Inset::getStatus(cur, cmd, status);
|
||||
|
@ -107,7 +107,7 @@ bool InsetWrap::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_MODIFY:
|
||||
case LFUN_INSET_DIALOG_UPDATE:
|
||||
flag.enabled(true);
|
||||
flag.setEnabled(true);
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
@ -109,7 +109,7 @@ bool InsetMathAMSArray::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
if (s == "add-vline-left" || s == "add-vline-right") {
|
||||
flag.message(bformat(
|
||||
from_utf8(N_("Can't add vertical grid lines in '%1$s'")), name_));
|
||||
flag.enabled(false);
|
||||
flag.setEnabled(false);
|
||||
return true;
|
||||
}
|
||||
return InsetMathGrid::getStatus(cur, cmd, flag);
|
||||
|
@ -92,7 +92,7 @@ bool InsetMathCases::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
docstring const & s = cmd.argument();
|
||||
if (s == "add-vline-left" || s == "add-vline-right") {
|
||||
flag.enabled(false);
|
||||
flag.setEnabled(false);
|
||||
flag.message(bformat(
|
||||
from_utf8(N_("No vertical grid lines in 'cases': feature %1$s")),
|
||||
s));
|
||||
|
@ -1341,13 +1341,13 @@ bool InsetMathGrid::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
string const s = to_utf8(cmd.argument());
|
||||
if (nrows() <= 1 && (s == "delete-row" || s == "swap-row")) {
|
||||
status.enabled(false);
|
||||
status.setEnabled(false);
|
||||
status.message(from_utf8(N_("Only one row")));
|
||||
return true;
|
||||
}
|
||||
if (ncols() <= 1 &&
|
||||
(s == "delete-column" || s == "swap-column")) {
|
||||
status.enabled(false);
|
||||
status.setEnabled(false);
|
||||
status.message(from_utf8(N_("Only one column")));
|
||||
return true;
|
||||
}
|
||||
@ -1355,7 +1355,7 @@ bool InsetMathGrid::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
s == "delete-hline-above") ||
|
||||
(rowinfo_[cur.row() + 1].lines_ == 0 &&
|
||||
s == "delete-hline-below")) {
|
||||
status.enabled(false);
|
||||
status.setEnabled(false);
|
||||
status.message(from_utf8(N_("No hline to delete")));
|
||||
return true;
|
||||
}
|
||||
@ -1364,7 +1364,7 @@ bool InsetMathGrid::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
s == "delete-vline-left") ||
|
||||
(colinfo_[cur.col() + 1].lines_ == 0 &&
|
||||
s == "delete-vline-right")) {
|
||||
status.enabled(false);
|
||||
status.setEnabled(false);
|
||||
status.message(from_utf8(N_("No vline to delete")));
|
||||
return true;
|
||||
}
|
||||
@ -1379,9 +1379,9 @@ bool InsetMathGrid::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
s == "copy-column" || s == "swap-column" ||
|
||||
s == "add-vline-left" || s == "add-vline-right" ||
|
||||
s == "delete-vline-left" || s == "delete-vline-right")
|
||||
status.enabled(true);
|
||||
status.setEnabled(true);
|
||||
else {
|
||||
status.enabled(false);
|
||||
status.setEnabled(false);
|
||||
status.message(bformat(
|
||||
from_utf8(N_("Unknown tabular feature '%1$s'")), lyx::from_ascii(s)));
|
||||
}
|
||||
@ -1412,18 +1412,18 @@ bool InsetMathGrid::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
break;
|
||||
}
|
||||
status.setOnOff(cmd.argument()[0] == v_align_);
|
||||
status.enabled(true);
|
||||
status.setEnabled(true);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
case LFUN_CELL_SPLIT:
|
||||
status.enabled(true);
|
||||
status.setEnabled(true);
|
||||
return true;
|
||||
|
||||
case LFUN_CELL_BACKWARD:
|
||||
case LFUN_CELL_FORWARD:
|
||||
status.enabled(true);
|
||||
status.setEnabled(true);
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
@ -1299,12 +1299,12 @@ bool InsetMathHull::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_MATH_MUTATE:
|
||||
case LFUN_MATH_DISPLAY:
|
||||
// we handle these
|
||||
status.enabled(true);
|
||||
status.setEnabled(true);
|
||||
return true;
|
||||
case LFUN_MATH_NUMBER_TOGGLE:
|
||||
// FIXME: what is the right test, this or the one of
|
||||
// LABEL_INSERT?
|
||||
status.enabled(display());
|
||||
status.setEnabled(display());
|
||||
status.setOnOff(numberedType());
|
||||
return true;
|
||||
case LFUN_MATH_NUMBER_LINE_TOGGLE: {
|
||||
@ -1313,16 +1313,16 @@ bool InsetMathHull::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
bool const enable = (type_ == hullMultline) ?
|
||||
(nrows() - 1 == cur.row()) : display();
|
||||
row_type const r = (type_ == hullMultline) ? nrows() - 1 : cur.row();
|
||||
status.enabled(enable);
|
||||
status.setEnabled(enable);
|
||||
status.setOnOff(numbered(r));
|
||||
return true;
|
||||
}
|
||||
case LFUN_LABEL_INSERT:
|
||||
status.enabled(type_ != hullSimple);
|
||||
status.setEnabled(type_ != hullSimple);
|
||||
return true;
|
||||
case LFUN_INSET_INSERT:
|
||||
if (cmd.getArg(0) == "label") {
|
||||
status.enabled(type_ != hullSimple);
|
||||
status.setEnabled(type_ != hullSimple);
|
||||
return true;
|
||||
}
|
||||
return InsetMathGrid::getStatus(cur, cmd, status);
|
||||
@ -1337,7 +1337,7 @@ bool InsetMathHull::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
status.message(bformat(
|
||||
from_utf8(N_("Can't change number of rows in '%1$s'")),
|
||||
hullName(type_)));
|
||||
status.enabled(false);
|
||||
status.setEnabled(false);
|
||||
return true;
|
||||
}
|
||||
if (!colChangeOK()
|
||||
@ -1347,7 +1347,7 @@ bool InsetMathHull::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
status.message(bformat(
|
||||
from_utf8(N_("Can't change number of columns in '%1$s'")),
|
||||
hullName(type_)));
|
||||
status.enabled(false);
|
||||
status.setEnabled(false);
|
||||
return true;
|
||||
}
|
||||
if ((type_ == hullSimple
|
||||
@ -1357,20 +1357,20 @@ bool InsetMathHull::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
status.message(bformat(
|
||||
from_utf8(N_("Can't add horizontal grid lines in '%1$s'")),
|
||||
hullName(type_)));
|
||||
status.enabled(false);
|
||||
status.setEnabled(false);
|
||||
return true;
|
||||
}
|
||||
if (s == "add-vline-left" || s == "add-vline-right") {
|
||||
status.message(bformat(
|
||||
from_utf8(N_("Can't add vertical grid lines in '%1$s'")),
|
||||
hullName(type_)));
|
||||
status.enabled(false);
|
||||
status.setEnabled(false);
|
||||
return true;
|
||||
}
|
||||
if (s == "valign-top" || s == "valign-middle"
|
||||
|| s == "valign-bottom" || s == "align-left"
|
||||
|| s == "align-center" || s == "align-right") {
|
||||
status.enabled(false);
|
||||
status.setEnabled(false);
|
||||
return true;
|
||||
}
|
||||
return InsetMathGrid::getStatus(cur, cmd, status);
|
||||
|
@ -1161,7 +1161,7 @@ bool InsetMathNest::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
string const arg = to_utf8(cmd.argument());
|
||||
switch (cmd.action) {
|
||||
case LFUN_TABULAR_FEATURE:
|
||||
flag.enabled(false);
|
||||
flag.setEnabled(false);
|
||||
break;
|
||||
#if 0
|
||||
case LFUN_TABULAR_FEATURE:
|
||||
@ -1192,7 +1192,7 @@ bool InsetMathNest::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_FONT_NOUN:
|
||||
case LFUN_FONT_ROMAN:
|
||||
case LFUN_FONT_DEFAULT:
|
||||
flag.enabled(true);
|
||||
flag.setEnabled(true);
|
||||
break;
|
||||
case LFUN_MATH_MUTATE:
|
||||
//flag.setOnOff(mathcursor::formula()->hullType() == to_utf8(cmd.argument()));
|
||||
@ -1204,11 +1204,11 @@ bool InsetMathNest::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_MATH_SPACE:
|
||||
case LFUN_MATH_LIMITS:
|
||||
case LFUN_MATH_EXTERN:
|
||||
flag.enabled(true);
|
||||
flag.setEnabled(true);
|
||||
break;
|
||||
|
||||
case LFUN_FONT_FRAK:
|
||||
flag.enabled(currentMode() != TEXT_MODE);
|
||||
flag.setEnabled(currentMode() != TEXT_MODE);
|
||||
break;
|
||||
|
||||
case LFUN_MATH_INSERT: {
|
||||
@ -1219,12 +1219,12 @@ bool InsetMathNest::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
arg == "\\textsl" || arg == "\\textup" ||
|
||||
arg == "\\texttt" || arg == "\\textbb" ||
|
||||
arg == "\\textnormal";
|
||||
flag.enabled(currentMode() != TEXT_MODE || textarg);
|
||||
flag.setEnabled(currentMode() != TEXT_MODE || textarg);
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_MATH_MATRIX:
|
||||
flag.enabled(currentMode() == MATH_MODE);
|
||||
flag.setEnabled(currentMode() == MATH_MODE);
|
||||
break;
|
||||
|
||||
case LFUN_INSET_INSERT: {
|
||||
@ -1232,31 +1232,31 @@ bool InsetMathNest::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
// getStatus is not called with a valid reference and the
|
||||
// dialog would not be applyable.
|
||||
string const name = cmd.getArg(0);
|
||||
flag.enabled(name == "ref");
|
||||
flag.setEnabled(name == "ref");
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_MATH_DELIM:
|
||||
case LFUN_MATH_BIGDELIM:
|
||||
// Don't do this with multi-cell selections
|
||||
flag.enabled(cur.selBegin().idx() == cur.selEnd().idx());
|
||||
flag.setEnabled(cur.selBegin().idx() == cur.selEnd().idx());
|
||||
break;
|
||||
|
||||
case LFUN_MATH_MACRO_FOLD:
|
||||
case LFUN_MATH_MACRO_UNFOLD: {
|
||||
Cursor it = cur;
|
||||
bool found = findMacroToFoldUnfold(it, cmd.action == LFUN_MATH_MACRO_FOLD);
|
||||
flag.enabled(found);
|
||||
flag.setEnabled(found);
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_SPECIALCHAR_INSERT:
|
||||
// FIXME: These would probably make sense in math-text mode
|
||||
flag.enabled(false);
|
||||
flag.setEnabled(false);
|
||||
break;
|
||||
|
||||
case LFUN_INSET_DISSOLVE:
|
||||
flag.enabled(!asHullInset());
|
||||
flag.setEnabled(!asHullInset());
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -114,7 +114,7 @@ bool InsetMathRef::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
case LFUN_MOUSE_PRESS:
|
||||
case LFUN_MOUSE_MOTION:
|
||||
status.enabled(true);
|
||||
status.setEnabled(true);
|
||||
return true;
|
||||
default:
|
||||
return CommandInset::getStatus(cur, cmd, status);
|
||||
|
@ -74,7 +74,7 @@ bool InsetMathSplit::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
if (s == "add-vline-left" || s == "add-vline-right") {
|
||||
flag.message(bformat(
|
||||
from_utf8(N_("Can't add vertical grid lines in '%1$s'")), name_));
|
||||
flag.enabled(false);
|
||||
flag.setEnabled(false);
|
||||
return true;
|
||||
}
|
||||
return InsetMathGrid::getStatus(cur, cmd, flag);
|
||||
|
@ -70,7 +70,7 @@ bool InsetMathSubstack::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
flag.message(bformat(
|
||||
from_utf8(N_("Can't add vertical grid lines in '%1$s'")),
|
||||
from_utf8(name)));
|
||||
flag.enabled(false);
|
||||
flag.setEnabled(false);
|
||||
return true;
|
||||
}
|
||||
return InsetMathGrid::getStatus(cur, cmd, flag);
|
||||
|
@ -1047,48 +1047,48 @@ bool MathMacroTemplate::getStatus(Cursor & /*cur*/, FuncRequest const & cmd,
|
||||
num = convert<int>(arg);
|
||||
bool on = (num >= optionals_
|
||||
&& numargs_ < 9 && num <= numargs_ + 1);
|
||||
flag.enabled(on);
|
||||
flag.setEnabled(on);
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_MATH_MACRO_APPEND_GREEDY_PARAM:
|
||||
flag.enabled(numargs_ < 9);
|
||||
flag.setEnabled(numargs_ < 9);
|
||||
break;
|
||||
|
||||
case LFUN_MATH_MACRO_REMOVE_PARAM: {
|
||||
int num = numargs_;
|
||||
if (arg.size() != 0)
|
||||
num = convert<int>(arg);
|
||||
flag.enabled(num >= 1 && num <= numargs_);
|
||||
flag.setEnabled(num >= 1 && num <= numargs_);
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_MATH_MACRO_MAKE_OPTIONAL:
|
||||
flag.enabled(numargs_ > 0
|
||||
flag.setEnabled(numargs_ > 0
|
||||
&& optionals_ < numargs_
|
||||
&& type_ != MacroTypeDef);
|
||||
break;
|
||||
|
||||
case LFUN_MATH_MACRO_MAKE_NONOPTIONAL:
|
||||
flag.enabled(optionals_ > 0
|
||||
flag.setEnabled(optionals_ > 0
|
||||
&& type_ != MacroTypeDef);
|
||||
break;
|
||||
|
||||
case LFUN_MATH_MACRO_ADD_OPTIONAL_PARAM:
|
||||
flag.enabled(numargs_ < 9);
|
||||
flag.setEnabled(numargs_ < 9);
|
||||
break;
|
||||
|
||||
case LFUN_MATH_MACRO_REMOVE_OPTIONAL_PARAM:
|
||||
flag.enabled(optionals_ > 0);
|
||||
flag.setEnabled(optionals_ > 0);
|
||||
break;
|
||||
|
||||
case LFUN_MATH_MACRO_ADD_GREEDY_OPTIONAL_PARAM:
|
||||
flag.enabled(numargs_ == 0
|
||||
flag.setEnabled(numargs_ == 0
|
||||
&& type_ != MacroTypeDef);
|
||||
break;
|
||||
|
||||
case LFUN_IN_MATHMACROTEMPLATE:
|
||||
flag.enabled(true);
|
||||
flag.setEnabled(true);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user