From 4c9fe33c833fb7239a790acc847f45393983da2b Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Wed, 22 Apr 2009 20:55:13 +0000 Subject: [PATCH] * Move handling of LFUN_INSET_SETTINGS to Inset, * Remove the EDITABLE enum, * add functions hasSettings() for all insets. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29375 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView.cpp | 2 +- src/DocIterator.cpp | 2 +- src/Text2.cpp | 4 ++-- src/insets/Inset.cpp | 31 ++++++++++++++++++++++++------- src/insets/Inset.h | 31 +++++++++++-------------------- src/insets/InsetBibitem.h | 2 +- src/insets/InsetBibtex.h | 2 +- src/insets/InsetBox.cpp | 1 - src/insets/InsetBranch.cpp | 1 - src/insets/InsetCitation.h | 2 +- src/insets/InsetCollapsable.cpp | 4 ++-- src/insets/InsetCollapsable.h | 4 +++- src/insets/InsetCommand.cpp | 3 +-- src/insets/InsetERT.cpp | 1 - src/insets/InsetExternal.cpp | 1 - src/insets/InsetExternal.h | 2 +- src/insets/InsetFlex.h | 2 ++ src/insets/InsetFloat.cpp | 1 - src/insets/InsetFloatList.h | 2 -- src/insets/InsetFootlike.h | 2 ++ src/insets/InsetGraphics.cpp | 7 ------- src/insets/InsetGraphics.h | 2 +- src/insets/InsetHyperlink.h | 2 +- src/insets/InsetInclude.cpp | 1 + src/insets/InsetInclude.h | 2 +- src/insets/InsetIndex.cpp | 30 +++++++++++++++++++++++------- src/insets/InsetIndex.h | 5 +++-- src/insets/InsetInfo.h | 4 +++- src/insets/InsetLabel.h | 2 +- src/insets/InsetListings.cpp | 2 -- src/insets/InsetNomencl.h | 4 +--- src/insets/InsetNote.cpp | 1 - src/insets/InsetOptArg.h | 2 ++ src/insets/InsetPhantom.cpp | 1 - src/insets/InsetRef.h | 2 +- src/insets/InsetSpace.cpp | 1 - src/insets/InsetSpace.h | 2 +- src/insets/InsetTOC.h | 2 -- src/insets/InsetTabular.cpp | 3 +++ src/insets/InsetTabular.h | 4 +++- src/insets/InsetText.h | 2 +- src/insets/InsetVSpace.cpp | 4 ---- src/insets/InsetVSpace.h | 2 +- src/insets/InsetWrap.cpp | 1 - src/mathed/InsetFormulaMacro.h | 2 +- src/mathed/InsetMathHull.h | 2 +- src/mathed/InsetMathSpace.h | 2 +- src/mathed/MathMacroTemplate.h | 2 +- src/rowpainter.cpp | 2 +- 49 files changed, 105 insertions(+), 93 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 3c2fd470f4..6089756f9b 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -729,7 +729,7 @@ bool BufferView::moveToPosition(pit_type bottom_pit, pos_type bottom_pos, // insets. size_t const n = dit.depth(); for (size_t i = 0; i < n; ++i) - if (dit[i].inset().editable() != Inset::HIGHLY_EDITABLE) { + if (!dit[i].inset().editable()) { dit.resize(i); break; } diff --git a/src/DocIterator.cpp b/src/DocIterator.cpp index 51433d4781..49705bc96b 100644 --- a/src/DocIterator.cpp +++ b/src/DocIterator.cpp @@ -315,7 +315,7 @@ void DocIterator::forwardPosIgnoreCollapsed() // FIXME: the check for asInsetMath() shouldn't be necessary // but math insets do not return a sensible editable() state yet. if (nextinset && !nextinset->asInsetMath() - && nextinset->editable() != Inset::HIGHLY_EDITABLE) { + && !nextinset->editable()) { ++top().pos(); return; } diff --git a/src/Text2.cpp b/src/Text2.cpp index d592e6637b..b32f3a0526 100644 --- a/src/Text2.cpp +++ b/src/Text2.cpp @@ -573,7 +573,7 @@ bool Text::checkAndActivateInset(Cursor & cur, bool front) if (!front && cur.pos() == 0) return false; Inset * inset = front ? cur.nextInset() : cur.prevInset(); - if (!inset || inset->editable() != Inset::HIGHLY_EDITABLE) + if (!inset || !inset->editable()) return false; /* * Apparently, when entering an inset we are expected to be positioned @@ -599,7 +599,7 @@ bool Text::checkAndActivateInsetVisual(Cursor & cur, bool movingForward, bool mo return false; Paragraph & par = cur.paragraph(); Inset * inset = par.isInset(cur.pos()) ? par.getInset(cur.pos()) : 0; - if (!inset || inset->editable() != Inset::HIGHLY_EDITABLE) + if (!inset || !inset->editable()) return false; inset->edit(cur, movingForward, movingLeft ? Inset::ENTRY_DIRECTION_RIGHT : Inset::ENTRY_DIRECTION_LEFT); diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp index 29984f0679..aa71a47a6d 100644 --- a/src/insets/Inset.cpp +++ b/src/insets/Inset.cpp @@ -223,15 +223,19 @@ void Inset::doDispatch(Cursor & cur, FuncRequest &cmd) case LFUN_MOUSE_RELEASE: // if the derived inset did not explicitly handle mouse_release, // we assume we request the settings dialog - if (!cur.selection() && cmd.button() == mouse_button::button1) { + if (!cur.selection() && cmd.button() == mouse_button::button1 + && hasSettings()) { FuncRequest tmpcmd(LFUN_INSET_SETTINGS); dispatch(cur, tmpcmd); } break; case LFUN_INSET_SETTINGS: - showInsetDialog(&cur.bv()); - cur.dispatched(); + if (cmd.argument().empty() || cmd.getArg(0) == insetName(lyxCode())) { + showInsetDialog(&cur.bv()); + cur.dispatched(); + } else + cur.undispatched(); break; default: @@ -269,8 +273,14 @@ bool Inset::getStatus(Cursor &, FuncRequest const & cmd, return true; case LFUN_INSET_SETTINGS: - flag.setEnabled(false); - return true; + if (cmd.argument().empty() || cmd.getArg(0) == insetName(lyxCode())) { + bool const enable = hasSettings(); + flag.setEnabled(enable); + return true; + } else { + flag.setEnabled(false); + return false; + } default: break; @@ -326,12 +336,19 @@ bool Inset::directWrite() const } -Inset::EDITABLE Inset::editable() const +bool Inset::editable() const +{ + return false; +} + + +bool Inset::hasSettings() const { - return NOT_EDITABLE; + return false; } + bool Inset::autoDelete() const { return false; diff --git a/src/insets/Inset.h b/src/insets/Inset.h index ac7bb21387..25af09fc28 100644 --- a/src/insets/Inset.h +++ b/src/insets/Inset.h @@ -213,9 +213,6 @@ public: /// Force inset into LTR environment if surroundings are RTL? virtual bool forceLTR() const { return false; } - /// is this an inset that can be moved into? - /// FIXME: merge with editable() - virtual bool isActive() const { return nargs() > 0; } /// Where should we go when we press the up or down cursor key? virtual bool idxUpDown(Cursor & cur, bool up) const; /// Move one cell backwards @@ -301,27 +298,21 @@ public: /// the string that is passed to the TOC virtual void tocString(odocstream &) const {} - /** This enum indicates by which means the inset can be modified: - - NOT_EDITABLE: the inset's content cannot be modified at all - (e.g. printindex, insetspecialchar) - - IS_EDITABLE: content can be edited via dialog (e.g. bibtex, index, href) - - HIGHLY_EDITABLE: content can be edited on screen (normally means that - insettext is contained, e.g. collapsables, tabular) */ - // FIXME: This has not yet been fully implemented to math insets - enum EDITABLE { - /// - NOT_EDITABLE = 0, - /// - IS_EDITABLE, - /// - HIGHLY_EDITABLE - }; /// what appears in the minibuffer when opening virtual docstring editMessage() const; - /// - virtual EDITABLE editable() const; + /// can the contents of the inset be edited on screen ? + // true for InsetCollapsables (not ButtonOnly) (not InsetInfo), InsetText + virtual bool editable() const; + /// has the Inset settings that can be modified in a dialog ? + virtual bool hasSettings() const; /// can we go further down on mouse click? + // true for InsetCaption, InsetCollapsables (not ButtonOnly), InsetTabular virtual bool descendable() const { return false; } + /// is this an inset that can be moved into? + /// FIXME: merge with editable() + // true for InsetTabular & InsetText + virtual bool isActive() const { return nargs() > 0; } + /// does this contain text that can be change track marked in DVI? virtual bool canTrackChanges() const { return false; } /// return true if the inset should be removed automatically diff --git a/src/insets/InsetBibitem.h b/src/insets/InsetBibitem.h index 435dd71972..ca5559ce42 100644 --- a/src/insets/InsetBibitem.h +++ b/src/insets/InsetBibitem.h @@ -53,7 +53,7 @@ private: /// docstring screenLabel() const; /// - EDITABLE editable() const { return IS_EDITABLE; } + bool hasSettings() const { return true; } /// InsetCode lyxCode() const { return BIBITEM_CODE; } /// diff --git a/src/insets/InsetBibtex.h b/src/insets/InsetBibtex.h index ad6e064e71..e48e39ee9c 100644 --- a/src/insets/InsetBibtex.h +++ b/src/insets/InsetBibtex.h @@ -34,7 +34,7 @@ public: /// docstring toolTip(BufferView const & bv, int x, int y) const; /// - EDITABLE editable() const { return IS_EDITABLE; } + bool hasSettings() const { return true; } /// InsetCode lyxCode() const { return BIBTEX_CODE; } /// diff --git a/src/insets/InsetBox.cpp b/src/insets/InsetBox.cpp index 4882f78e4b..43d29d8dcd 100644 --- a/src/insets/InsetBox.cpp +++ b/src/insets/InsetBox.cpp @@ -239,7 +239,6 @@ bool InsetBox::getStatus(Cursor & cur, FuncRequest const & cmd, return true; case LFUN_INSET_DIALOG_UPDATE: - case LFUN_INSET_SETTINGS: flag.setEnabled(true); return true; diff --git a/src/insets/InsetBranch.cpp b/src/insets/InsetBranch.cpp index 1f7f38a970..b8a272da58 100644 --- a/src/insets/InsetBranch.cpp +++ b/src/insets/InsetBranch.cpp @@ -176,7 +176,6 @@ bool InsetBranch::getStatus(Cursor & cur, FuncRequest const & cmd, switch (cmd.action) { case LFUN_INSET_MODIFY: case LFUN_INSET_DIALOG_UPDATE: - case LFUN_INSET_SETTINGS: flag.setEnabled(true); break; diff --git a/src/insets/InsetCitation.h b/src/insets/InsetCitation.h index d2e88b4d60..4567077a42 100644 --- a/src/insets/InsetCitation.h +++ b/src/insets/InsetCitation.h @@ -38,7 +38,7 @@ public: /// docstring screenLabel() const; /// - EDITABLE editable() const { return IS_EDITABLE; } + bool hasSettings() const { return true; } /// docstring toolTip(BufferView const & bv, int x, int y) const; /// diff --git a/src/insets/InsetCollapsable.cpp b/src/insets/InsetCollapsable.cpp index e2fbb3600c..8606de4e31 100644 --- a/src/insets/InsetCollapsable.cpp +++ b/src/insets/InsetCollapsable.cpp @@ -437,9 +437,9 @@ void InsetCollapsable::cursorPos(BufferView const & bv, } -Inset::EDITABLE InsetCollapsable::editable() const +bool InsetCollapsable::editable() const { - return geometry() != ButtonOnly ? HIGHLY_EDITABLE : IS_EDITABLE; + return geometry() != ButtonOnly; } diff --git a/src/insets/InsetCollapsable.h b/src/insets/InsetCollapsable.h index 9b4e9b02bf..73fde24e8c 100644 --- a/src/insets/InsetCollapsable.h +++ b/src/insets/InsetCollapsable.h @@ -74,7 +74,9 @@ public: /// docstring const getNewLabel(docstring const & l) const; /// - EDITABLE editable() const; + bool editable() const; + /// + bool hasSettings() const { return true; } /// can we go further down on mouse click? bool descendable() const; /// diff --git a/src/insets/InsetCommand.cpp b/src/insets/InsetCommand.cpp index 0e6b0df080..378866c2a0 100644 --- a/src/insets/InsetCommand.cpp +++ b/src/insets/InsetCommand.cpp @@ -52,7 +52,7 @@ InsetCommand::~InsetCommand() void InsetCommand::metrics(MetricsInfo & mi, Dimension & dim) const { - button_.update(screenLabel(), editable() != NOT_EDITABLE); + button_.update(screenLabel(), editable() || hasSettings()); button_.metrics(mi, dim); } @@ -163,7 +163,6 @@ bool InsetCommand::getStatus(Cursor & cur, FuncRequest const & cmd, status.setEnabled(true); return true; - case LFUN_INSET_SETTINGS: case LFUN_INSET_DIALOG_UPDATE: status.setEnabled(true); return true; diff --git a/src/insets/InsetERT.cpp b/src/insets/InsetERT.cpp index f6e99d8498..bd59d14072 100644 --- a/src/insets/InsetERT.cpp +++ b/src/insets/InsetERT.cpp @@ -137,7 +137,6 @@ bool InsetERT::getStatus(Cursor & cur, FuncRequest const & cmd, case LFUN_PASTE: case LFUN_PRIMARY_SELECTION_PASTE: case LFUN_QUOTE_INSERT: - case LFUN_INSET_SETTINGS: status.setEnabled(true); return true; diff --git a/src/insets/InsetExternal.cpp b/src/insets/InsetExternal.cpp index e53ee55987..b773a20204 100644 --- a/src/insets/InsetExternal.cpp +++ b/src/insets/InsetExternal.cpp @@ -428,7 +428,6 @@ bool InsetExternal::getStatus(Cursor & cur, FuncRequest const & cmd, case LFUN_INSET_EDIT: case LFUN_INSET_MODIFY: case LFUN_INSET_DIALOG_UPDATE: - case LFUN_INSET_SETTINGS: flag.setEnabled(true); return true; diff --git a/src/insets/InsetExternal.h b/src/insets/InsetExternal.h index 490c6ed3c4..c41adea0af 100644 --- a/src/insets/InsetExternal.h +++ b/src/insets/InsetExternal.h @@ -120,7 +120,7 @@ private: /// InsetCode lyxCode() const { return EXTERNAL_CODE; } /// - EDITABLE editable() const { return IS_EDITABLE; } + bool hasSettings() const { return true; } /// void metrics(MetricsInfo &, Dimension &) const; /// diff --git a/src/insets/InsetFlex.h b/src/insets/InsetFlex.h index 58ce052194..239ced831f 100644 --- a/src/insets/InsetFlex.h +++ b/src/insets/InsetFlex.h @@ -34,6 +34,8 @@ public: void write(std::ostream &) const; /// should paragraph indendation be ommitted in any case? bool neverIndent() const { return true; } + /// + bool hasSettings() const { return false; } protected: InsetFlex(InsetFlex const &); diff --git a/src/insets/InsetFloat.cpp b/src/insets/InsetFloat.cpp index 07b5ece5b1..37a247af44 100644 --- a/src/insets/InsetFloat.cpp +++ b/src/insets/InsetFloat.cpp @@ -183,7 +183,6 @@ bool InsetFloat::getStatus(Cursor & cur, FuncRequest const & cmd, case LFUN_INSET_MODIFY: case LFUN_INSET_DIALOG_UPDATE: - case LFUN_INSET_SETTINGS: flag.setEnabled(true); return true; diff --git a/src/insets/InsetFloatList.h b/src/insets/InsetFloatList.h index 9afa316891..c15f0eb61f 100644 --- a/src/insets/InsetFloatList.h +++ b/src/insets/InsetFloatList.h @@ -29,8 +29,6 @@ public: /// docstring screenLabel() const; /// - EDITABLE editable() const { return NOT_EDITABLE; } - /// InsetCode lyxCode() const { return FLOAT_LIST_CODE; } /// DisplayType display() const { return AlignCenter; } diff --git a/src/insets/InsetFootlike.h b/src/insets/InsetFootlike.h index 7a48f7d3f5..75d9acf213 100644 --- a/src/insets/InsetFootlike.h +++ b/src/insets/InsetFootlike.h @@ -24,6 +24,8 @@ class InsetFootlike : public InsetCollapsable { public: /// InsetFootlike(Buffer const &); + /// + bool hasSettings() const { return false; } private: /// void metrics(MetricsInfo &, Dimension &) const; diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp index 33fc1e5c86..9decdaaa80 100644 --- a/src/insets/InsetGraphics.cpp +++ b/src/insets/InsetGraphics.cpp @@ -230,7 +230,6 @@ bool InsetGraphics::getStatus(Cursor & cur, FuncRequest const & cmd, case LFUN_INSET_EDIT: case LFUN_INSET_MODIFY: case LFUN_INSET_DIALOG_UPDATE: - case LFUN_INSET_SETTINGS: flag.setEnabled(true); return true; @@ -261,12 +260,6 @@ void InsetGraphics::draw(PainterInfo & pi, int x, int y) const } -Inset::EDITABLE InsetGraphics::editable() const -{ - return IS_EDITABLE; -} - - void InsetGraphics::write(ostream & os) const { os << "Graphics\n"; diff --git a/src/insets/InsetGraphics.h b/src/insets/InsetGraphics.h index 7aaff0cf83..ec68897b88 100644 --- a/src/insets/InsetGraphics.h +++ b/src/insets/InsetGraphics.h @@ -60,7 +60,7 @@ private: bool isLabeled() const { return true; } void metrics(MetricsInfo &, Dimension &) const; /// - EDITABLE editable() const; + bool hasSettings() const { return true; } /// void write(std::ostream &) const; /// diff --git a/src/insets/InsetHyperlink.h b/src/insets/InsetHyperlink.h index 58943bfa9b..d764d2c8c8 100644 --- a/src/insets/InsetHyperlink.h +++ b/src/insets/InsetHyperlink.h @@ -31,7 +31,7 @@ public: /// docstring screenLabel() const; /// - EDITABLE editable() const { return IS_EDITABLE; } + bool hasSettings() const { return true; } /// DisplayType display() const { return Inline; } /// diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index ce4a12c2ba..b2e715d240 100644 --- a/src/insets/InsetInclude.cpp +++ b/src/insets/InsetInclude.cpp @@ -299,6 +299,7 @@ void InsetInclude::editIncluded(string const & file) bool InsetInclude::getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus & flag) const { + LYXERR0(cmd.action); switch (cmd.action) { case LFUN_INSET_EDIT: diff --git a/src/insets/InsetInclude.h b/src/insets/InsetInclude.h index 91ecc57955..0e14405a8a 100644 --- a/src/insets/InsetInclude.h +++ b/src/insets/InsetInclude.h @@ -72,7 +72,7 @@ public: support::FileNameList const & getBibfilesCache() const; /// - EDITABLE editable() const { return IS_EDITABLE; } + bool hasSettings() const { return true; } /// int latex(odocstream &, OutputParams const &) const; /// diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index b583fac50b..45eb2a38c5 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -181,6 +181,8 @@ bool InsetIndex::showInsetDialog(BufferView * bv) const void InsetIndex::doDispatch(Cursor & cur, FuncRequest & cmd) { + LYXERR0( cmd.action); + LYXERR0( cmd.getArg(0)); switch (cmd.action) { case LFUN_INSET_MODIFY: { @@ -210,6 +212,8 @@ void InsetIndex::doDispatch(Cursor & cur, FuncRequest & cmd) bool InsetIndex::getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus & flag) const { + LYXERR0( cmd.action); + LYXERR0( cmd.getArg(0)); switch (cmd.action) { case LFUN_INSET_MODIFY: @@ -226,8 +230,7 @@ bool InsetIndex::getStatus(Cursor & cur, FuncRequest const & cmd, flag.setEnabled(true); return true; - case LFUN_INSET_DIALOG_UPDATE: - case LFUN_INSET_SETTINGS: { + case LFUN_INSET_DIALOG_UPDATE: { Buffer const & realbuffer = *buffer().masterBuffer(); flag.setEnabled(realbuffer.params().use_indices); return true; @@ -340,6 +343,21 @@ docstring InsetIndex::contextMenu(BufferView const &, int, int) const } +bool InsetIndex::hasSettings() const +{ + return buffer().masterBuffer()->params().use_indices; +} + + + + +///////////////////////////////////////////////////////////////////// +// +// InsetIndexParams +// +/////////////////////////////////////////////////////////////////////// + + void InsetIndexParams::write(ostream & os) const { os << ' '; @@ -446,8 +464,7 @@ bool InsetPrintIndex::getStatus(Cursor & cur, FuncRequest const & cmd, return InsetCommand::getStatus(cur, cmd, status); } - case LFUN_INSET_DIALOG_UPDATE: - case LFUN_INSET_SETTINGS: { + case LFUN_INSET_DIALOG_UPDATE: { Buffer const & realbuffer = *buffer().masterBuffer(); status.setEnabled(realbuffer.params().use_indices); return true; @@ -486,10 +503,9 @@ docstring InsetPrintIndex::contextMenu(BufferView const &, int, int) const } -Inset::EDITABLE InsetPrintIndex::editable() const +bool InsetPrintIndex::hasSettings() const { - return buffer().masterBuffer()->params().use_indices ? - IS_EDITABLE : NOT_EDITABLE; + return buffer().masterBuffer()->params().use_indices; } diff --git a/src/insets/InsetIndex.h b/src/insets/InsetIndex.h index 99d8b8923d..69d1a3d23e 100644 --- a/src/insets/InsetIndex.h +++ b/src/insets/InsetIndex.h @@ -45,7 +45,7 @@ public: static void string2params(std::string const &, InsetIndexParams &); private: /// - EDITABLE editable() const { return HIGHLY_EDITABLE; } + bool hasSettings() const; /// InsetCode lyxCode() const { return INDEX_CODE; } /// @@ -112,7 +112,8 @@ private: /// Updates needed features for this inset. void validate(LaTeXFeatures & features) const; /// - EDITABLE editable() const; + bool hasSettings() const; + /// DisplayType display() const { return AlignCenter; } /// diff --git a/src/insets/InsetInfo.h b/src/insets/InsetInfo.h index 6dfb496f4d..bac475866f 100644 --- a/src/insets/InsetInfo.h +++ b/src/insets/InsetInfo.h @@ -100,7 +100,9 @@ public: /// Inset * editXY(Cursor & cur, int x, int y); /// - EDITABLE editable() const { return IS_EDITABLE; } + bool editable() const { return false; } + /// + bool hasSettings() const { return true; } /// void read(Lexer & lex); /// diff --git a/src/insets/InsetLabel.h b/src/insets/InsetLabel.h index 92f0560579..e649643f15 100644 --- a/src/insets/InsetLabel.h +++ b/src/insets/InsetLabel.h @@ -34,7 +34,7 @@ public: /// docstring screenLabel() const; /// - EDITABLE editable() const { return IS_EDITABLE; } + bool hasSettings() const { return true; } /// InsetCode lyxCode() const { return LABEL_CODE; } /// diff --git a/src/insets/InsetListings.cpp b/src/insets/InsetListings.cpp index f0820a60e2..43f5eeed53 100644 --- a/src/insets/InsetListings.cpp +++ b/src/insets/InsetListings.cpp @@ -18,7 +18,6 @@ #include "BufferParams.h" #include "Counters.h" #include "Cursor.h" -#include "CutAndPaste.h" #include "DispatchResult.h" #include "Encoding.h" #include "FuncRequest.h" @@ -387,7 +386,6 @@ bool InsetListings::getStatus(Cursor & cur, FuncRequest const & cmd, switch (cmd.action) { case LFUN_INSET_MODIFY: case LFUN_INSET_DIALOG_UPDATE: - case LFUN_INSET_SETTINGS: status.setEnabled(true); return true; case LFUN_CAPTION_INSERT: diff --git a/src/insets/InsetNomencl.h b/src/insets/InsetNomencl.h index 39e1d9ce3b..d63e99c249 100644 --- a/src/insets/InsetNomencl.h +++ b/src/insets/InsetNomencl.h @@ -32,7 +32,7 @@ public: /// docstring toolTip(BufferView const & bv, int x, int y) const; /// - EDITABLE editable() const { return IS_EDITABLE; } + bool hasSettings() const { return true; } /// Updates needed features for this inset. void validate(LaTeXFeatures & features) const; /// @@ -66,8 +66,6 @@ public: // Currently the width can be read from file and written, but not // changed. /// - EDITABLE editable() const { return NOT_EDITABLE; } - /// int docbook(odocstream &, OutputParams const &) const; /// InsetCode lyxCode() const; diff --git a/src/insets/InsetNote.cpp b/src/insets/InsetNote.cpp index e0804ed8d5..c773bf80e1 100644 --- a/src/insets/InsetNote.cpp +++ b/src/insets/InsetNote.cpp @@ -211,7 +211,6 @@ bool InsetNote::getStatus(Cursor & cur, FuncRequest const & cmd, } return true; - case LFUN_INSET_SETTINGS: case LFUN_INSET_DIALOG_UPDATE: flag.setEnabled(true); return true; diff --git a/src/insets/InsetOptArg.h b/src/insets/InsetOptArg.h index 6e8d2d3d65..740564c31c 100644 --- a/src/insets/InsetOptArg.h +++ b/src/insets/InsetOptArg.h @@ -31,6 +31,8 @@ public: /// Outputting the optional parameter of a LaTeX command int latexOptional(odocstream &, OutputParams const &) const; + /// + bool hasSettings() const { return false; } private: /// code of the inset diff --git a/src/insets/InsetPhantom.cpp b/src/insets/InsetPhantom.cpp index 2be07faf9c..234f502832 100644 --- a/src/insets/InsetPhantom.cpp +++ b/src/insets/InsetPhantom.cpp @@ -293,7 +293,6 @@ bool InsetPhantom::getStatus(Cursor & cur, FuncRequest const & cmd, flag.setEnabled(true); return true; - case LFUN_INSET_SETTINGS: case LFUN_INSET_DIALOG_UPDATE: flag.setEnabled(true); return true; diff --git a/src/insets/InsetRef.h b/src/insets/InsetRef.h index 1adcc4fef9..e6f37462cd 100644 --- a/src/insets/InsetRef.h +++ b/src/insets/InsetRef.h @@ -43,7 +43,7 @@ public: /// docstring screenLabel() const; /// - EDITABLE editable() const { return IS_EDITABLE; } + bool hasSettings() const { return true; } /// InsetCode lyxCode() const { return REF_CODE; } /// diff --git a/src/insets/InsetSpace.cpp b/src/insets/InsetSpace.cpp index a12d28e1d0..a9ffe812ac 100644 --- a/src/insets/InsetSpace.cpp +++ b/src/insets/InsetSpace.cpp @@ -172,7 +172,6 @@ bool InsetSpace::getStatus(Cursor & cur, FuncRequest const & cmd, status.setOnOff(params_.kind == params.kind); } // fall through - case LFUN_INSET_SETTINGS: case LFUN_INSET_DIALOG_UPDATE: status.setEnabled(true); return true; diff --git a/src/insets/InsetSpace.h b/src/insets/InsetSpace.h index 5e1638e212..716925334e 100644 --- a/src/insets/InsetSpace.h +++ b/src/insets/InsetSpace.h @@ -133,7 +133,7 @@ public: /// the string that is passed to the TOC void tocString(odocstream &) const; /// - EDITABLE editable() const { return IS_EDITABLE; } + bool hasSettings() const { return true; } /// InsetCode lyxCode() const { return SPACE_CODE; } /// is this an expandible space (rubber length)? diff --git a/src/insets/InsetTOC.h b/src/insets/InsetTOC.h index 037d461f45..b95c9c4ebb 100644 --- a/src/insets/InsetTOC.h +++ b/src/insets/InsetTOC.h @@ -26,8 +26,6 @@ public: /// docstring screenLabel() const; /// - EDITABLE editable() const { return NOT_EDITABLE; } - /// InsetCode lyxCode() const { return TOC_CODE; } /// DisplayType display() const { return AlignCenter; } diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index ed03034146..1ad481ec41 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -4075,6 +4075,9 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd, return cell(cur.idx())->getStatus(cur, cmd, status); case LFUN_INSET_SETTINGS: + // relay this lfun to Inset, not to the cell. + return Inset::getStatus(cur, cmd, status); + case LFUN_INSET_MODIFY: if (insetCode(cmd.getArg(0)) == TABULAR_CODE) { status.setEnabled(true); diff --git a/src/insets/InsetTabular.h b/src/insets/InsetTabular.h index 1f71350aeb..e81cbc0e57 100644 --- a/src/insets/InsetTabular.h +++ b/src/insets/InsetTabular.h @@ -736,7 +736,9 @@ public: /// docstring editMessage() const; /// - EDITABLE editable() const { return HIGHLY_EDITABLE; } + bool editable() const { return true; } + /// + bool hasSettings() const { return true; } /// bool insetAllowed(InsetCode code) const; /// diff --git a/src/insets/InsetText.h b/src/insets/InsetText.h index 90d246719c..1fcbead651 100644 --- a/src/insets/InsetText.h +++ b/src/insets/InsetText.h @@ -64,7 +64,7 @@ public: /// docstring editMessage() const; /// - EDITABLE editable() const { return HIGHLY_EDITABLE; } + bool editable() const { return true; } /// bool canTrackChanges() const { return true; } /// diff --git a/src/insets/InsetVSpace.cpp b/src/insets/InsetVSpace.cpp index a0249720fa..3b912ad41d 100644 --- a/src/insets/InsetVSpace.cpp +++ b/src/insets/InsetVSpace.cpp @@ -87,10 +87,6 @@ bool InsetVSpace::getStatus(Cursor & cur, FuncRequest const & cmd, status.setEnabled(true); return true; - case LFUN_INSET_SETTINGS: - status.setEnabled(true); - return true; - default: return Inset::getStatus(cur, cmd, status); } diff --git a/src/insets/InsetVSpace.h b/src/insets/InsetVSpace.h index 873e3c3623..42c1fc7748 100644 --- a/src/insets/InsetVSpace.h +++ b/src/insets/InsetVSpace.h @@ -32,7 +32,7 @@ public: /// InsetCode lyxCode() const { return VSPACE_CODE; } /// - EDITABLE editable() const { return IS_EDITABLE; } + bool hasSettings() const { return true; } /// docstring contextMenu(BufferView const & bv, int x, int y) const; /// diff --git a/src/insets/InsetWrap.cpp b/src/insets/InsetWrap.cpp index 718ce4eefe..c21d222507 100644 --- a/src/insets/InsetWrap.cpp +++ b/src/insets/InsetWrap.cpp @@ -107,7 +107,6 @@ bool InsetWrap::getStatus(Cursor & cur, FuncRequest const & cmd, switch (cmd.action) { case LFUN_INSET_MODIFY: case LFUN_INSET_DIALOG_UPDATE: - case LFUN_INSET_SETTINGS: flag.setEnabled(true); return true; diff --git a/src/mathed/InsetFormulaMacro.h b/src/mathed/InsetFormulaMacro.h index 5929c1b330..47dc2664d8 100644 --- a/src/mathed/InsetFormulaMacro.h +++ b/src/mathed/InsetFormulaMacro.h @@ -55,7 +55,7 @@ public: /// docstring const & getInsetName() const { return name_; } /// - EDITABLE editable() const { return HIGHLY_EDITABLE; } + bool editable() const { return true; } private: /// MathAtom & tmpl() const; diff --git a/src/mathed/InsetMathHull.h b/src/mathed/InsetMathHull.h index 9f850b240e..bfb6e34f4d 100644 --- a/src/mathed/InsetMathHull.h +++ b/src/mathed/InsetMathHull.h @@ -212,7 +212,7 @@ public: /// virtual void revealCodes(Cursor & cur) const; /// - EDITABLE editable() const { return HIGHLY_EDITABLE; } + bool editable() const { return true; } /// void edit(Cursor & cur, bool front, EntryDirection entry_from = ENTRY_DIRECTION_IGNORE); diff --git a/src/mathed/InsetMathSpace.h b/src/mathed/InsetMathSpace.h index 15b79d2b58..f45dee5d96 100644 --- a/src/mathed/InsetMathSpace.h +++ b/src/mathed/InsetMathSpace.h @@ -56,7 +56,7 @@ public: /// generate something that will be understood by the Dialogs. std::string const createDialogStr() const; /// - EDITABLE editable() const { return IS_EDITABLE; } + bool hasSettings() const { return true; } /// docstring contextMenu(BufferView const &, int, int) const; /// diff --git a/src/mathed/MathMacroTemplate.h b/src/mathed/MathMacroTemplate.h index 6f469c673e..dea1acf28e 100644 --- a/src/mathed/MathMacroTemplate.h +++ b/src/mathed/MathMacroTemplate.h @@ -36,7 +36,7 @@ public: /// explicit MathMacroTemplate(const docstring & str); /// - EDITABLE editable() const { return HIGHLY_EDITABLE; } + bool editable() const { return true; } /// void edit(Cursor & cur, bool front, EntryDirection entry_from); /// diff --git a/src/rowpainter.cpp b/src/rowpainter.cpp index 16c3ad7250..5c8f694b50 100644 --- a/src/rowpainter.cpp +++ b/src/rowpainter.cpp @@ -772,7 +772,7 @@ void RowPainter::paintText() Inset const * inset = par_.getInset(pos); bool const highly_editable_inset = inset - && inset->editable() == Inset::HIGHLY_EDITABLE; + && inset->editable(); // If we reach the end of a change or if the author changes, paint it. // We also don't paint across things like tables -- 2.39.5