]> git.lyx.org Git - lyx.git/commitdiff
This is intended to be a pure renaming of the Inset::name() routine,
authorRichard Heck <rgheck@comcast.net>
Mon, 28 Mar 2011 22:33:04 +0000 (22:33 +0000)
committerRichard Heck <rgheck@comcast.net>
Mon, 28 Mar 2011 22:33:04 +0000 (22:33 +0000)
preparatory to fixing #7080. Note that mathed uses the same routine, but
for a completely different purpose, so I did not rename it there. I have
seen no difference in behavior after testing, e.g., opening and
exporting Math.lyx, and also re-saving it and looking at the diff.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38109 a592a061-630c-0410-9148-cb99ea01b6c8

36 files changed:
src/BufferView.cpp
src/CutAndPaste.cpp
src/insets/Inset.cpp
src/insets/Inset.h
src/insets/InsetArgument.h
src/insets/InsetBox.cpp
src/insets/InsetBox.h
src/insets/InsetBranch.h
src/insets/InsetCaption.cpp
src/insets/InsetCaption.h
src/insets/InsetCollapsable.h
src/insets/InsetERT.h
src/insets/InsetFlex.h
src/insets/InsetFloat.cpp
src/insets/InsetFloat.h
src/insets/InsetFoot.h
src/insets/InsetFootlike.cpp
src/insets/InsetIndex.cpp
src/insets/InsetIndex.h
src/insets/InsetInfo.cpp
src/insets/InsetInfo.h
src/insets/InsetListings.h
src/insets/InsetMarginal.h
src/insets/InsetNote.cpp
src/insets/InsetNote.h
src/insets/InsetPhantom.cpp
src/insets/InsetPhantom.h
src/insets/InsetPreview.h
src/insets/InsetQuotes.cpp
src/insets/InsetQuotes.h
src/insets/InsetScript.cpp
src/insets/InsetScript.h
src/insets/InsetWrap.cpp
src/insets/InsetWrap.h
src/mathed/InsetMath.cpp
src/mathed/InsetMath.h

index ac22a4e618996a53145199735e6c0df51b551425..7c93fea7eb3537e2c4020e9aef44aab61ebcad9e 100644 (file)
@@ -1752,7 +1752,7 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                        Inset * ins = cur.nextInset();
                        if (!ins)
                                break;
-                       docstring insname = ins->name();
+                       docstring insname = ins->layoutName();
                        while (!insname.empty()) {
                                if (insname == name || name == from_utf8("*")) {
                                        cur.recordUndo();
index fb7ad88b5a5fe58eb54e9ceba391211f376cb414..39b732fea6b2affdec2d3ab6d800c9b1bb010fe3 100644 (file)
@@ -667,7 +667,9 @@ void switchBetweenClasses(DocumentClass const * const oldone,
                if (it->lyxCode() != FLEX_CODE)
                        // FIXME: Should we verify all InsetCollapsable?
                        continue;
-               docstring const & n = newone->insetLayout(it->name()).name();
+
+               docstring const layoutName = it->layoutName();
+               docstring const & n = newone->insetLayout(layoutName).name();
                bool const is_undefined = n.empty() ||
                        n == DocumentClass::plainInsetLayout().name();
                if (!is_undefined)
@@ -679,12 +681,11 @@ void switchBetweenClasses(DocumentClass const * const oldone,
                docstring s;
                if (oldname == newname)
                        s = bformat(_("Flex inset %1$s is undefined after "
-                               "reloading `%2$s' layout."),
-                               it->name(), oldname);
+                               "reloading `%2$s' layout."), layoutName, oldname);
                else
                        s = bformat(_("Flex inset %1$s is undefined because of "
                                "conversion from `%2$s' layout to `%3$s'."),
-                               it->name(), oldname, newname);
+                               layoutName, oldname, newname);
                // To warn the user that something had to be done.
                errorlist.push_back(ErrorItem(
                                _("Undefined flex inset"),
index c93018e0755acb2d0013c56782c00ecb6ee98c10..9a8a084cac3b0e1f4848b984b5071dee2e51559f 100644 (file)
@@ -186,11 +186,10 @@ Buffer & Inset::buffer()
 {
        if (!buffer_) {
                odocstringstream s;
-               lyxerr << "Inset: " << this
-                                       << " LyX Code: " << lyxCode()
-                                       << " name: " << insetName(lyxCode())
-                                       << std::endl;
-               s << "LyX Code: " << lyxCode() << " name: " << name();
+               string const iname = insetName(lyxCode());
+               LYXERR0("Inset: " << this << " LyX Code: " << lyxCode()
+                                       << " name: " << iname);
+               s << "LyX Code: " << lyxCode() << " name: " << iname;
                LASSERT(false, /**/);
                throw ExceptionMessage(BufferException, 
                        from_ascii("Inset::buffer_ member not initialized!"), s.str());
@@ -218,7 +217,7 @@ bool Inset::isBufferValid() const
 }
 
 
-docstring Inset::name() const
+docstring Inset::layoutName() const
 {
        return from_ascii("unknown");
 }
@@ -579,7 +578,7 @@ InsetLayout const & Inset::getLayout() const
 {
        if (!buffer_)
                return DocumentClass::plainInsetLayout();
-       return buffer().params().documentClass().insetLayout(name());
+       return buffer().params().documentClass().insetLayout(layoutName());
 }
 
 
index 3b3e4306d32c5fe5eb8b982c7cf82f3999aace46..2d272e34365a7ea44a920119210e79425d4414bd 100644 (file)
@@ -415,13 +415,7 @@ public:
        virtual docstring contextMenuName() const;
 
 
-       // FIXME This should really disappear in favor of 
-       //      docstring name() const { return from_ascii(insetName(lyxCode()))); }
-       // There's no reason to be using different names in different places.
-       // But to do this we would need to change the file format, since the names
-       // used there don't correspond to what is used here. 
-       ///
-       virtual docstring name() const;
+       virtual docstring layoutName() const;
        ///
        virtual InsetLayout const & getLayout() const;
        /// Is this inset's layout defined in the document's textclass?
index f45c0ea0ad06200b8450a9be0a955ec744fa6e83..c57553474af8815571a794712edc6407058a1478 100644 (file)
@@ -39,7 +39,7 @@ private:
        /// code of the inset
        InsetCode lyxCode() const { return ARG_CODE; }
        ///
-       docstring name() const { return from_ascii("Argument"); }
+       docstring layoutName() const { return from_ascii("Argument"); }
        /// Standard LaTeX output -- short-circuited
        void latex(otexstream &, OutputParams const &) const;
        /// Standard plain text output -- short-circuited
index 1273ac9e082ccdce10556ce8ddccec4e43e845b6..b6d574e4c229c4f1043be37419c5360ff40c771e 100644 (file)
@@ -102,7 +102,7 @@ InsetBox::InsetBox(Buffer * buffer, string const & label)
 {}
 
 
-docstring InsetBox::name() const 
+docstring InsetBox::layoutName() const
 {
        // FIXME: UNICODE
        string name = "Box";
index 922a92f51126b17051bf45200b372e5420915177..2fb33bf2098dd9c80f6f507fa5c7612474aac5e0 100644 (file)
@@ -91,7 +91,7 @@ private:
        ///
        InsetCode lyxCode() const { return BOX_CODE; }
        ///
-       docstring name() const;
+       docstring layoutName() const;
        ///
        void write(std::ostream &) const;
        ///
index 18600aeedf2e1c54c92a7b6d313f3c468282606c..c51c728e4f1610a4ce2a070a2cd11087f6240e78 100644 (file)
@@ -109,7 +109,7 @@ private:
        ///
        void doDispatch(Cursor & cur, FuncRequest & cmd);
        ///
-       docstring name() const { return from_ascii("Branch"); }
+       docstring layoutName() const { return from_ascii("Branch"); }
        ///
        Inset * clone() const { return new InsetBranch(*this); }
 
index 84efecc2d42e54d2ad1d897ea0b908f7f100cdd5..ed2120c171273a5ea00ab126b30583eb12f6fc44 100644 (file)
@@ -65,7 +65,7 @@ void InsetCaption::write(ostream & os) const
 }
 
 
-docstring InsetCaption::name() const
+docstring InsetCaption::layoutName() const
 {
        if (type_.empty())
                return from_ascii("Caption");
index 03c100f3a4d770ad8d07243cfe270e706e10c67e..d0050913e1838701cda063c84f9a49c78713b7e3 100644 (file)
@@ -25,7 +25,7 @@ public:
        ///
        std::string const & type() const { return type_; }
        ///
-       docstring name() const;
+       docstring layoutName() const;
        /// return the mandatory argument (LaTeX format) only
        void getArgument(otexstream & os, OutputParams const &) const;
        /// return the optional argument(s) only
index 4008cee7425662bd7daab785f914de998c5d13ef..fba355a5c6bc352f180b56eb0e3ac8ae4f4d02e2 100644 (file)
@@ -45,7 +45,7 @@ public:
        ///
        docstring toolTip(BufferView const & bv, int x, int y) const;
        ///
-       docstring name() const { return from_ascii("Collapsable"); }
+       docstring layoutName() const { return from_ascii("Collapsable"); }
        ///
        void read(Lexer &);
        ///
index 416dffbf31c17688fffc038958df41e399acc021..83ac11cf58c97b051a33d58442263f36c99ee5df 100644 (file)
@@ -44,7 +44,7 @@ private:
        ///
        InsetCode lyxCode() const { return ERT_CODE; }
        ///
-       docstring name() const { return from_ascii("ERT"); }
+       docstring layoutName() const { return from_ascii("ERT"); }
        ///
        void write(std::ostream & os) const;
        ///
index bae49b26c0fc9ec7ca38dc11032e9fc1556f1c10..8a73a24c51069d730ad2704c12e350483492120e 100644 (file)
@@ -25,7 +25,7 @@ public:
        ///
        InsetFlex(Buffer *, std::string const & layoutName);
        ///
-       docstring name() const { return from_utf8(name_); }
+       docstring layoutName() const { return from_utf8(name_); }
        ///
        InsetLayout const & getLayout() const;
        ///
index a1bddb0a22f0ac0d228a60466f7f48a5f0b580fb..99d6c43402dd73f7d23380eeb678f604dfa5b8da 100644 (file)
@@ -119,7 +119,7 @@ InsetFloat::InsetFloat(Buffer * buf, string params_str)
 }
 
 
-docstring InsetFloat::name() const 
+docstring InsetFloat::layoutName() const
 { 
        return "Float:" + from_utf8(params_.type);
 }
index 3c9a717473cf87bb4d646aaa29ecda04478f37e2..4a4c7d5bfbded980859a3d7174ebf884695af1dd 100644 (file)
@@ -69,7 +69,7 @@ public:
        InsetFloatParams const & params() const { return params_; }
 private:
        ///
-       docstring name() const;
+       docstring layoutName() const;
        ///
        docstring toolTip(BufferView const & bv, int x, int y) const;
        ///
index e2ba08edb26263b37ce3afe6159bd8479fe4d639..f77ae3fedf2ed7c33472651079caed9fbc737811 100644 (file)
@@ -30,7 +30,7 @@ private:
        ///
        InsetCode lyxCode() const { return FOOT_CODE; }
        ///
-       docstring name() const { return from_ascii("Foot"); }
+       docstring layoutName() const { return from_ascii("Foot"); }
        ///
        void latex(otexstream &, OutputParams const &) const;
        ///
index 85f4fb00724e163ea909cad7948962909089fdd2..afd23295307bb8d33da8bc6b29f4219728108ca9 100644 (file)
@@ -50,7 +50,7 @@ void InsetFootlike::draw(PainterInfo & pi, int x, int y) const
 
 void InsetFootlike::write(ostream & os) const
 {
-       os << to_utf8(name()) << "\n";
+       os << to_utf8(layoutName()) << "\n";
        InsetCollapsable::write(os);
 }
 
index fe50bf4fea7ccd5b050cbfe7fb2991a8e045c2e7..60f039c381fee2a2e682f23619aa351eb0e2bcaa 100644 (file)
@@ -315,7 +315,7 @@ docstring const InsetIndex::buttonLabel(BufferView const & bv) const
 
 void InsetIndex::write(ostream & os) const
 {
-       os << to_utf8(name());
+       os << to_utf8(layoutName());
        params_.write(os);
        InsetCollapsable::write(os);
 }
index 40b450be0b49e4be77d41c05d47037c221cbca25..0c6a961a49c689174cca5cf6db42df4cecf13201 100644 (file)
@@ -49,7 +49,7 @@ private:
        ///
        InsetCode lyxCode() const { return INDEX_CODE; }
        ///
-       docstring name() const { return from_ascii("Index"); }
+       docstring layoutName() const { return from_ascii("Index"); }
        ///
        ColorCode labelColor() const;
        ///
index acea3acb25acdbcd1d3a9496e846a5b723ec8eea..e28832ef4e3c92ba75ceef7d9202a151baa3e584 100644 (file)
@@ -107,7 +107,7 @@ string InsetInfo::infoType() const
 }
 
 
-docstring InsetInfo::name() const 
+docstring InsetInfo::layoutName() const
 {
        return from_ascii("Info:" + infoType());
 }
index 3a2cbe1edf8f80c0f4cd1d22e888fe8eb6481006..44bc7b2bf3554b652a6b6f3313b866a203ae7cfc 100644 (file)
@@ -96,7 +96,7 @@ public:
        ///
        InsetCode lyxCode() const { return INFO_CODE; }
        ///
-       docstring name() const;
+       docstring layoutName() const;
        ///
        Inset * editXY(Cursor & cur, int x, int y);
        ///
index 18125dc3bb6f0a765eb4cc2a27b4667f809a73e0..c9d833a4adf061626b5c9ff00cfd129576245e0f 100644 (file)
@@ -47,7 +47,7 @@ private:
        /// lstinline is inlined, normal listing is displayed
        DisplayType display() const;
        ///
-       docstring name() const { return from_ascii("Listings"); }
+       docstring layoutName() const { return from_ascii("Listings"); }
        // Update the counters of this inset and of its contents
        void updateBuffer(ParIterator const &, UpdateType);
        ///
index 8d11c96c13b94eaf491c25df05a26d4b63a9e59d..67bd1e5a549982380e7fdd462b2368276fe28611 100644 (file)
@@ -29,7 +29,7 @@ public:
        ///
        InsetCode lyxCode() const { return MARGIN_CODE; }
        ///
-       docstring name() const { return from_ascii("Marginal"); }
+       docstring layoutName() const { return from_ascii("Marginal"); }
        ///
        int plaintext(odocstream &, OutputParams const & runparams) const;
        ///
index 9c9f862839351e8d50268ba661863d12de7c2f09..05ee4f0fbb752c03f19a056fd94e9402c92197da 100644 (file)
@@ -111,7 +111,7 @@ InsetNote::~InsetNote()
 }
 
 
-docstring InsetNote::name() const 
+docstring InsetNote::layoutName() const
 {
        return from_ascii("Note:" + notetranslator().find(params_.type));
 }
index 04435a0b40358b1209e5de6ee5f068abe858b1ce..efb0f278661bc46d1e0f791c84a2763ed889bcad 100644 (file)
@@ -60,7 +60,7 @@ private:
        ///
        InsetCode lyxCode() const { return NOTE_CODE; }
        ///
-       docstring name() const;
+       docstring layoutName() const;
        ///
        DisplayType display() const;
        /** returns false if, when outputing LaTeX, font changes should
index 54aa4abd5c5378dfa9e5598aee5b2abc484bc606..9e3808f0e7ca38d1d9bc4f333fc5411ac3360145 100644 (file)
@@ -126,7 +126,7 @@ InsetPhantom::~InsetPhantom()
 }
 
 
-docstring InsetPhantom::name() const 
+docstring InsetPhantom::layoutName() const
 {
        return from_ascii("Phantom:" + phantomtranslator().find(params_.type));
 }
index a6711acdccf576e96397d336291fea8afaa2d0f6..548bdb0b9cde7c7cbecf76d940aa128d82c8b38e 100644 (file)
@@ -60,7 +60,7 @@ private:
        ///
        InsetCode lyxCode() const { return PHANTOM_CODE; }
        ///
-       docstring name() const;
+       docstring layoutName() const;
        ///
        void metrics(MetricsInfo &, Dimension &) const;
        ///
index 439740a4f734bf3fe5ccc08ba45cddf78e9322d4..039b8e2f45ac06a7b43367853da23136718a7eb5 100644 (file)
@@ -45,7 +45,7 @@ public:
        
        InsetCode lyxCode() const { return PREVIEW_CODE; }
        
-       docstring name() const { return from_ascii("Preview"); }
+       docstring layoutName() const { return from_ascii("Preview"); }
        
        bool descendable(BufferView const & /*bv*/) const { return true; }
 
index 74a0e4ae6012b5fb8b9ecd0c6ed82422ac42904f..0792e15e91dbbb66a3f43c6f239e39d170f1b82f 100644 (file)
@@ -114,7 +114,7 @@ InsetQuotes::InsetQuotes(Buffer * buf, char_type c, QuoteTimes t)
 }
 
 
-docstring InsetQuotes::name() const
+docstring InsetQuotes::layoutName() const
 {
        return from_ascii("Quotes");
 }
index 9b42c273e68275d759f436e2fc3254bc443ee973..af0136e939f50001d0d150339cf81c776784c38f 100644 (file)
@@ -68,7 +68,7 @@ public:
        /// Direct access to inner/outer quotation marks
        InsetQuotes(Buffer * buf, char_type c, QuoteTimes t);
        ///
-       docstring name() const;
+       docstring layoutName() const;
        ///
        void metrics(MetricsInfo &, Dimension &) const;
        ///
index b85b36ee13d8e32f476ccdedd431b66ddc494788..32c83ff161eb2a106ae89eb5760a63ab1eb7531f 100644 (file)
@@ -143,7 +143,7 @@ InsetScript::~InsetScript()
 }
 
 
-docstring InsetScript::name() const 
+docstring InsetScript::layoutName() const
 {
        return from_ascii("script:" + scripttranslator().find(params_.type));
 }
index b2062dabfde1fc6f88097f80fa4414771d95edf4..e558a76294a2d69eb8f887a42a1f3e1042b106af 100644 (file)
@@ -65,7 +65,7 @@ public:
        ///
        InsetCode lyxCode() const { return SCRIPT_CODE; }
        ///
-       docstring name() const;
+       docstring layoutName() const;
        ///
        DisplayType display() const;
        ///
index c40f7005b7727275781a5b77ce6a3fe37c5a887e..02a2ccdff85b3f60e1a4a9d1202a91aa8fc9f75f 100644 (file)
@@ -58,7 +58,7 @@ InsetWrap::~InsetWrap()
 }
 
 
-docstring InsetWrap::name() const
+docstring InsetWrap::layoutName() const
 {
        return "Wrap:" + from_utf8(params_.type);
 }
index f533e6d0a3b8553da4c2d54dfbc54e9b78fea318..bdd084b0ef98cfaaaf89d72ad8a5e15cab6132b4 100644 (file)
@@ -83,7 +83,7 @@ private:
        ///
        void doDispatch(Cursor & cur, FuncRequest & cmd);
        ///
-       docstring name() const;
+       docstring layoutName() const;
        ///
        Inset * clone() const { return new InsetWrap(*this); }
 
index 943ca902635bad29b77f9e5d6d04dd6c97a643c6..5507a868c9985e3e2a9432fbe2a3701437eec6e6 100644 (file)
@@ -27,6 +27,12 @@ using namespace std;
 
 namespace lyx {
 
+docstring InsetMath::name() const
+{
+       return from_utf8("Unknown");
+}
+
+
 MathData & InsetMath::cell(idx_type)
 {
        static MathData dummyCell(&buffer());
index 3d68f22d902fd601ac15c1937c5efd1a22ab2a0c..24884ba541ebf0c827ce0524d848aff10a59ee56 100644 (file)
@@ -102,6 +102,8 @@ public:
        InsetMath const * asInsetMath() const { return this; }
        /// this is overridden in math text insets (i.e. mbox)
        bool inMathed() const { return true; }
+       ///
+       virtual docstring name() const;
 
        /// this is overridden by specific insets
        virtual mode_type currentMode() const { return MATH_MODE; }