From 77ed747114e72f378b2137c64fa843fda721a528 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Thu, 29 May 2008 15:14:00 +0000 Subject: [PATCH] FuncStatus::enabled(bool) --> FuncStatus::setEnabled(bool) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24999 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView.cpp | 34 ++++++++++++++-------------- src/FuncStatus.cpp | 2 +- src/FuncStatus.h | 2 +- src/LyXFunc.cpp | 12 +++++----- src/Text3.cpp | 2 +- src/frontends/qt4/GuiApplication.cpp | 2 +- src/frontends/qt4/GuiView.cpp | 2 +- src/frontends/qt4/Menus.cpp | 2 +- src/insets/Inset.cpp | 6 ++--- src/insets/InsetBibtex.cpp | 2 +- src/insets/InsetBox.cpp | 6 ++--- src/insets/InsetBranch.cpp | 10 ++++---- src/insets/InsetCaption.cpp | 4 ++-- src/insets/InsetCollapsable.cpp | 14 ++++++------ src/insets/InsetCommand.cpp | 8 +++---- src/insets/InsetERT.cpp | 2 +- src/insets/InsetExternal.cpp | 2 +- src/insets/InsetFloat.cpp | 2 +- src/insets/InsetGraphics.cpp | 2 +- src/insets/InsetInclude.cpp | 2 +- src/insets/InsetListings.cpp | 4 ++-- src/insets/InsetNewline.cpp | 2 +- src/insets/InsetNewpage.cpp | 2 +- src/insets/InsetNote.cpp | 4 ++-- src/insets/InsetSpace.cpp | 2 +- src/insets/InsetTabular.cpp | 30 ++++++++++++------------ src/insets/InsetVSpace.cpp | 2 +- src/insets/InsetWrap.cpp | 2 +- src/mathed/InsetMathAMSArray.cpp | 2 +- src/mathed/InsetMathCases.cpp | 2 +- src/mathed/InsetMathGrid.cpp | 18 +++++++-------- src/mathed/InsetMathHull.cpp | 20 ++++++++-------- src/mathed/InsetMathNest.cpp | 22 +++++++++--------- src/mathed/InsetMathRef.cpp | 2 +- src/mathed/InsetMathSplit.cpp | 2 +- src/mathed/InsetMathSubstack.cpp | 2 +- src/mathed/MathMacroTemplate.cpp | 18 +++++++-------- 37 files changed, 127 insertions(+), 127 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index a3f3672e5c..13e90d23f7 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -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(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; diff --git a/src/FuncStatus.cpp b/src/FuncStatus.cpp index f7b529b856..d56df61aa0 100644 --- a/src/FuncStatus.cpp +++ b/src/FuncStatus.cpp @@ -52,7 +52,7 @@ bool FuncStatus::unknown() const } -void FuncStatus::enabled(bool b) +void FuncStatus::setEnabled(bool b) { if (b) v_ &= ~DISABLED; diff --git a/src/FuncStatus.h b/src/FuncStatus.h index 02949ed0bf..af2801389e 100644 --- a/src/FuncStatus.h +++ b/src/FuncStatus.h @@ -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; diff --git a/src/LyXFunc.cpp b/src/LyXFunc.cpp index c0c3eb0b15..ad802c7c2c 100644 --- a/src/LyXFunc.cpp +++ b/src/LyXFunc.cpp @@ -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 diff --git a/src/Text3.cpp b/src/Text3.cpp index e787e08d07..5e91672f0a 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -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; } diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index eaeb6e138a..d3c8439492 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -515,7 +515,7 @@ bool GuiApplication::getStatus(FuncRequest const & cmd, FuncStatus & flag) const } if (!enable) - flag.enabled(false); + flag.setEnabled(false); return true; } diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 565a4fcf75..90e33c36ab 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -1175,7 +1175,7 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag) } if (!enable) - flag.enabled(false); + flag.setEnabled(false); return true; } diff --git a/src/frontends/qt4/Menus.cpp b/src/frontends/qt4/Menus.cpp index 928559999f..6f8aba311a 100644 --- a/src/frontends/qt4/Menus.cpp +++ b/src/frontends/qt4/Menus.cpp @@ -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 diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp index b16dfb57ac..d83fc6629d 100644 --- a/src/insets/Inset.cpp +++ b/src/insets/Inset.cpp @@ -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: diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp index 7965242266..38845a4a16 100644 --- a/src/insets/InsetBibtex.cpp +++ b/src/insets/InsetBibtex.cpp @@ -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: diff --git a/src/insets/InsetBox.cpp b/src/insets/InsetBox.cpp index b716e7dab4..25911bc985 100644 --- a/src/insets/InsetBox.cpp +++ b/src/insets/InsetBox.cpp @@ -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: diff --git a/src/insets/InsetBranch.cpp b/src/insets/InsetBranch.cpp index d2dbc527dc..c0be8352b1 100644 --- a/src/insets/InsetBranch.cpp +++ b/src/insets/InsetBranch.cpp @@ -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: diff --git a/src/insets/InsetCaption.cpp b/src/insets/InsetCaption.cpp index c3fb149bf9..7dca728ee8 100644 --- a/src/insets/InsetCaption.cpp +++ b/src/insets/InsetCaption.cpp @@ -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: diff --git a/src/insets/InsetCollapsable.cpp b/src/insets/InsetCollapsable.cpp index c255d24709..54530751e0 100644 --- a/src/insets/InsetCollapsable.cpp +++ b/src/insets/InsetCollapsable.cpp @@ -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: diff --git a/src/insets/InsetCommand.cpp b/src/insets/InsetCommand.cpp index cf860e3079..745cfeca8a 100644 --- a/src/insets/InsetCommand.cpp +++ b/src/insets/InsetCommand.cpp @@ -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); diff --git a/src/insets/InsetERT.cpp b/src/insets/InsetERT.cpp index c11df694cd..30a290510d 100644 --- a/src/insets/InsetERT.cpp +++ b/src/insets/InsetERT.cpp @@ -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 diff --git a/src/insets/InsetExternal.cpp b/src/insets/InsetExternal.cpp index 63f7b7d96a..42efa6d289 100644 --- a/src/insets/InsetExternal.cpp +++ b/src/insets/InsetExternal.cpp @@ -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: diff --git a/src/insets/InsetFloat.cpp b/src/insets/InsetFloat.cpp index 2d92366803..a98d52170f 100644 --- a/src/insets/InsetFloat.cpp +++ b/src/insets/InsetFloat.cpp @@ -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: diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp index 640124a860..4a577c02cd 100644 --- a/src/insets/InsetGraphics.cpp +++ b/src/insets/InsetGraphics.cpp @@ -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: diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index 87741831e6..fee3bc2291 100644 --- a/src/insets/InsetInclude.cpp +++ b/src/insets/InsetInclude.cpp @@ -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: diff --git a/src/insets/InsetListings.cpp b/src/insets/InsetListings.cpp index 94909a054a..a2cb9851a4 100644 --- a/src/insets/InsetListings.cpp +++ b/src/insets/InsetListings.cpp @@ -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); diff --git a/src/insets/InsetNewline.cpp b/src/insets/InsetNewline.cpp index cd48f96a51..62be1d3ca8 100644 --- a/src/insets/InsetNewline.cpp +++ b/src/insets/InsetNewline.cpp @@ -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); diff --git a/src/insets/InsetNewpage.cpp b/src/insets/InsetNewpage.cpp index 7a6667a8e5..9cb680c684 100644 --- a/src/insets/InsetNewpage.cpp +++ b/src/insets/InsetNewpage.cpp @@ -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); diff --git a/src/insets/InsetNote.cpp b/src/insets/InsetNote.cpp index c8dededc59..c44d637a56 100644 --- a/src/insets/InsetNote.cpp +++ b/src/insets/InsetNote.cpp @@ -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: diff --git a/src/insets/InsetSpace.cpp b/src/insets/InsetSpace.cpp index 89325bae7c..8667fae837 100644 --- a/src/insets/InsetSpace.cpp +++ b/src/insets/InsetSpace.cpp @@ -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); diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index e49c2a7a6d..462029dabe 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -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 diff --git a/src/insets/InsetVSpace.cpp b/src/insets/InsetVSpace.cpp index f93a7e2ee6..e109896ed2 100644 --- a/src/insets/InsetVSpace.cpp +++ b/src/insets/InsetVSpace.cpp @@ -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); diff --git a/src/insets/InsetWrap.cpp b/src/insets/InsetWrap.cpp index 92dddaf489..ad5036a26a 100644 --- a/src/insets/InsetWrap.cpp +++ b/src/insets/InsetWrap.cpp @@ -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: diff --git a/src/mathed/InsetMathAMSArray.cpp b/src/mathed/InsetMathAMSArray.cpp index 3a8c378380..3a615d987a 100644 --- a/src/mathed/InsetMathAMSArray.cpp +++ b/src/mathed/InsetMathAMSArray.cpp @@ -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); diff --git a/src/mathed/InsetMathCases.cpp b/src/mathed/InsetMathCases.cpp index 6ade4d2ebe..63a78848c2 100644 --- a/src/mathed/InsetMathCases.cpp +++ b/src/mathed/InsetMathCases.cpp @@ -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)); diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp index 683235e748..0d2460f617 100644 --- a/src/mathed/InsetMathGrid.cpp +++ b/src/mathed/InsetMathGrid.cpp @@ -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: diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index c9e540bed6..f5c2cabce3 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -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); diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index c63bcfeec3..3ebeafb798 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -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: diff --git a/src/mathed/InsetMathRef.cpp b/src/mathed/InsetMathRef.cpp index 998653b38b..36a678ae06 100644 --- a/src/mathed/InsetMathRef.cpp +++ b/src/mathed/InsetMathRef.cpp @@ -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); diff --git a/src/mathed/InsetMathSplit.cpp b/src/mathed/InsetMathSplit.cpp index 01b5bcfe68..d05b5f25e3 100644 --- a/src/mathed/InsetMathSplit.cpp +++ b/src/mathed/InsetMathSplit.cpp @@ -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); diff --git a/src/mathed/InsetMathSubstack.cpp b/src/mathed/InsetMathSubstack.cpp index 1ecf2b04e7..fd0d57acec 100644 --- a/src/mathed/InsetMathSubstack.cpp +++ b/src/mathed/InsetMathSubstack.cpp @@ -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); diff --git a/src/mathed/MathMacroTemplate.cpp b/src/mathed/MathMacroTemplate.cpp index b6e1fbc032..989a5f5e3e 100644 --- a/src/mathed/MathMacroTemplate.cpp +++ b/src/mathed/MathMacroTemplate.cpp @@ -1047,48 +1047,48 @@ bool MathMacroTemplate::getStatus(Cursor & /*cur*/, FuncRequest const & cmd, num = convert(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(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: -- 2.39.2