]> git.lyx.org Git - features.git/commitdiff
Add list of labels. If I have the time and energy the next step is to cleanup the...
authorAbdelrazak Younes <younes@lyx.org>
Wed, 27 Feb 2008 15:23:22 +0000 (15:23 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Wed, 27 Feb 2008 15:23:22 +0000 (15:23 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23282 a592a061-630c-0410-9148-cb99ea01b6c8

src/MenuBackend.cpp
src/frontends/qt4/GuiToc.cpp
src/insets/InsetLabel.cpp
src/insets/InsetLabel.h

index 7abcf5c5e11d63a8d74d084eff6b39bbc14c63e5..e8d8156f4f84cd65c0481ad223ce50fc91f06fe6 100644 (file)
@@ -778,6 +778,8 @@ void expandToc(Menu & tomenu, Buffer const * buf)
                        label = _("List of Notes");
                else if (cit->first == "footnote")
                        label = _("List of Foot notes");
+               else if (cit->first == "label")
+                       label = _("Labels and References");
                // this should not happen now, but if something else like
                // listings is added later, this can avoid an empty menu name.
                else
index b10b864d1fb009c6f8838483d37757ee06925366..3dd5ea1b2e55b1f98557f0894a523d2808e1b8b3 100644 (file)
@@ -233,6 +233,8 @@ docstring GuiToc::guiName(string const & type) const
                return _("List of Marginal notes");
        if (type == "note")
                return _("List of Notes");
+       if (type == "label")
+               return _("Labels and References");
 
        FloatList const & floats = buffer().params().textClass().floats();
        if (floats.typeExist(type))
index c0b6b4d19d316c3fec4a57c2f5227d86a3ea062c..047807577ec1de21a0c2699008cb597ccfb9cc5b 100644 (file)
 #include "BufferView.h"
 #include "DispatchResult.h"
 #include "FuncRequest.h"
-#include "Text.h"
+#include "ParIterator.h"
 #include "sgml.h"
+#include "Text.h"
+#include "TocBackend.h"
 
 #include "support/lstrings.h"
 #include "support/lyxalgo.h"
@@ -61,6 +63,21 @@ docstring const InsetLabel::getScreenLabel(Buffer const &) const
 }
 
 
+void InsetLabel::addToToc(Buffer const & buf,
+       ParConstIterator const & cpit) const
+{
+       ParConstIterator pit = cpit;
+       pit.push_back(*this);
+
+       //FIXME: It would be really, really, really nice if we could
+       // construct a tree here with all the cross-reference to this
+       // label.
+
+       Toc & toc = buf.tocBackend().toc("label");
+       toc.push_back(TocItem(pit, 0, getScreenLabel(buf)));
+}
+
+
 void InsetLabel::doDispatch(Cursor & cur, FuncRequest & cmd)
 {
        switch (cmd.action) {
index 640c1ca0fef59b243f8ff36341b84f46cb9caccc..cfd9374f539621be26a66e09de5ee9799162122b 100644 (file)
@@ -42,6 +42,8 @@ public:
        ///
        static bool isCompatibleCommand(std::string const & s) 
                { return s == "label"; }
+       ///
+       void addToToc(Buffer const &, ParConstIterator const &) const;
 protected:
        ///
        virtual void doDispatch(Cursor & cur, FuncRequest & cmd);