]> git.lyx.org Git - features.git/commitdiff
* add "List of Graphics"
authorAbdelrazak Younes <younes@lyx.org>
Tue, 11 Mar 2008 10:27:33 +0000 (10:27 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Tue, 11 Mar 2008 10:27:33 +0000 (10:27 +0000)
* don't append "(embedded)" to embedded list items.
* limit the number of entry to 30 items and offer to open the Navigator if above.

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

src/frontends/qt4/GuiToc.cpp
src/frontends/qt4/Menus.cpp
src/insets/InsetGraphics.cpp
src/insets/InsetGraphics.h
src/insets/InsetInclude.cpp

index 076c62a0f473f5529db15583c18b8eb809d18095..d6ab24257c0ba686dd0faf11c9fa97534ee798f7 100644 (file)
@@ -145,7 +145,8 @@ bool GuiToc::initialiseParams(string const & data)
                        new_type = "table";
                else if (str.contains("\"algorithm"))
                        new_type = "algorithm";
-       }
+       } else
+               new_type = toqstr(data);
 
        types_.clear();
        type_names_.clear();
@@ -225,6 +226,8 @@ docstring GuiToc::guiName(string const & type) const
                return _("Child Documents");
        if (type == "embedded")
                return _("Embedded Files");
+       if (type == "graphics")
+               return _("List of Graphics");
        if (type == "equation")
                return _("List of Equations");
        if (type == "footnote")
index 671d426ddb6af867e85ec57254f901edae0ec7e8..8f81ddb051e730e66f40fed90cb33db7ed50f86e 100644 (file)
@@ -904,15 +904,6 @@ void MenuDefinition::expandToc(Buffer const * buf)
                if (cit->first == "tableofcontents")
                        continue;
 
-               // All the rest is for floats
-               MenuDefinition submenu;
-               TocIterator ccit = cit->second.begin();
-               TocIterator eend = cit->second.end();
-               for (; ccit != eend; ++ccit) {
-                       QString const label = limitStringLength(ccit->str());
-                       submenu.add(MenuItem(MenuItem::Command, label,
-                                          FuncRequest(ccit->action())));
-               }
                string const & floatName = floatlist.getType(cit->first).listName();
                QString label;
                bool in_other_list = true;
@@ -925,6 +916,8 @@ void MenuDefinition::expandToc(Buffer const * buf)
                        in_other_list = false;
                } else if (cit->first == "embedded")
                        label = qt_("Embedded Files");
+               else if (cit->first == "graphics")
+                       label = qt_("List of Graphics");
                else if (cit->first == "equation")
                        label = qt_("List of Equations");
                else if (cit->first == "index")
@@ -945,6 +938,21 @@ void MenuDefinition::expandToc(Buffer const * buf)
                        // This should not happen unless the entry is missing above.
                        label = qt_("Other floats: ") + toqstr(cit->first);
 
+               MenuDefinition submenu;
+
+               if (cit->second.size() >= 30) {
+                       FuncRequest f(LFUN_DIALOG_SHOW, "toc " + cit->first);
+                       submenu.add(MenuItem(MenuItem::Command, qt_("Open Navigator..."), f));
+               } else {
+                       TocIterator ccit = cit->second.begin();
+                       TocIterator eend = cit->second.end();
+                       for (; ccit != eend; ++ccit) {
+                               QString const label = limitStringLength(ccit->str());
+                               submenu.add(MenuItem(MenuItem::Command, label,
+                                       FuncRequest(ccit->action())));
+                       }
+               }
+
                MenuItem item(MenuItem::Submenu, label);
                item.setSubmenu(submenu);
                if (in_other_list)
index 4fc28beb86c265e26bc81299d77acf1b2a8456b4..13de24daabbd79b4705d8bed6f7d9946b76af448 100644 (file)
@@ -54,6 +54,7 @@ TODO
 #include "Converter.h"
 #include "Cursor.h"
 #include "DispatchResult.h"
+#include "EmbeddedFiles.h"
 #include "ErrorList.h"
 #include "Exporter.h"
 #include "Format.h"
@@ -66,7 +67,7 @@ TODO
 #include "Mover.h"
 #include "OutputParams.h"
 #include "sgml.h"
-#include "EmbeddedFiles.h"
+#include "TocBackend.h"
 
 #include "frontends/alert.h"
 
@@ -915,6 +916,19 @@ void InsetGraphics::editGraphics(InsetGraphicsParams const & p,
 }
 
 
+void InsetGraphics::addToToc(ParConstIterator const & cpit) const
+{
+       TocBackend & backend = buffer().tocBackend();
+
+       docstring str = params_.filename.displayName();
+       if (params_.filename.embedded()) {
+               backend.toc("embedded").push_back(TocItem(cpit, 0, str));
+               str += _(" (embedded)");
+       }
+       backend.toc("graphics").push_back(TocItem(cpit, 0, str));
+}
+
+
 string const InsetGraphicsMailer::name_("graphics");
 
 InsetGraphicsMailer::InsetGraphicsMailer(InsetGraphics & inset)
index 6d2da3bc6ac990bfb57a178337abff61e74d6a3c..b1270bb30c321d9b2fe4f4e94703a30968ac9b78 100644 (file)
@@ -34,6 +34,7 @@ public:
        ///
        ~InsetGraphics();
        ///
+       bool isLabeled() const { return true; }
        void metrics(MetricsInfo &, Dimension &) const;
        ///
        EDITABLE editable() const;
@@ -79,6 +80,9 @@ public:
        void registerEmbeddedFiles(EmbeddedFileList &) const;
        ///
        void updateEmbeddedFile(EmbeddedFile const &);
+       ///
+       void addToToc(ParConstIterator const &) const;
+
        /// Force inset into LTR environment if surroundings are RTL?
        virtual bool forceLTR() const { return true; }
 protected:
index c2b3aeb6ed46ea9656b2be3553e16a0cc86b8dd6..9b003c7f27171b5b7e0845bebc08f703e8f39091 100644 (file)
@@ -875,13 +875,15 @@ void InsetInclude::addToToc(ParConstIterator const & cpit) const
                if (caption.empty())
                        return;
                Toc & toc = backend.toc("listing");
-               docstring const str = convert<docstring>(toc.size() + 1)
+               docstring str = convert<docstring>(toc.size() + 1)
                        + ". " +  from_utf8(caption);
+               if (embedded_status) {
+                       backend.toc("embedded").push_back(TocItem(cpit, 0, str));
+                       str += _(" (embedded)");
+               }
                ParConstIterator pit = cpit;
                pit.push_back(*this);
                toc.push_back(TocItem(pit, 0, str));
-               if (embedded_status)
-                       backend.toc("embedded").push_back(TocItem(cpit, 0, str));
                return;
        }
        Buffer const * const childbuffer = getChildBuffer(buffer(), params());
@@ -895,11 +897,11 @@ void InsetInclude::addToToc(ParConstIterator const & cpit) const
 
        Toc & toc = backend.toc("child");
        docstring str = childbuffer->fileName().displayName();
-       if (embedded_status)
+       if (embedded_status) {
+               backend.toc("embedded").push_back(TocItem(cpit, 0, str));
                str += _(" (embedded)");
+       }
        toc.push_back(TocItem(cpit, 0, str));
-       if (embedded_status)
-               backend.toc("embedded").push_back(TocItem(cpit, 0, str));
 
        TocList & toclist = backend.tocs();
        TocList const & childtoclist = childbuffer->tocBackend().tocs();