]> git.lyx.org Git - features.git/commitdiff
fix bug 1870 (List of tables windows shows list of figures)
authorJürgen Spitzmüller <spitz@lyx.org>
Mon, 4 Jul 2005 13:05:03 +0000 (13:05 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Mon, 4 Jul 2005 13:05:03 +0000 (13:05 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10125 a592a061-630c-0410-9148-cb99ea01b6c8

12 files changed:
src/ChangeLog
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlToc.C
src/frontends/controllers/ControlToc.h
src/frontends/gtk/ChangeLog
src/frontends/gtk/GToc.C
src/frontends/qt2/ChangeLog
src/frontends/qt2/QToc.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormToc.C
src/toc.C
src/toc.h

index 747c2561d4bec66c506cae9142f5bce741efe7e7..eb6a546816b9cfbb3c0f66d4e064a5417179fffa 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-04  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * toc.[Ch]: new method getGuiName, which is used by the frontends 
+       to set the toc combo (fixes bug 1870). Make TOC string translatable.
+
 2005-07-01  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
 
        * dociterator.[Ch]: implement operator==(StableDocIterator const &, 
index ee072c0f12cc50820bcb55248d8b7334480c9507..aa550a47492a0222c4dfaf6664d7139bcd1ee276 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-04  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * ControlToc.[Ch]: new method getGuiName, which is used by the frontends 
+       to set the toc combo (fixes bug 1870).
+
 2005-06-30  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
 
        * ControlPrint.C (browse): 
index 8802de0df36f38d0eb0c81a98e515c1533cabe12..36d8d77795a18229df3ed9698217882fa5f75d94 100644 (file)
@@ -38,6 +38,12 @@ vector<string> const ControlToc::getTypes() const
 }
 
 
+string const ControlToc::getGuiName() const
+{
+       return toc::getGuiName(params().getCmdName(), kernel().buffer());
+}
+
+
 toc::Toc const ControlToc::getContents(string const & type) const
 {
        toc::Toc empty_list;
index 3285e38e26055bc487cf54ed29d850378ff964d9..bec48d93d1cf1e8e544d4975ab8822bb4dce2f48 100644 (file)
@@ -33,6 +33,9 @@ public:
        /// Return the list of types available
        std::vector<std::string> const getTypes() const;
 
+       /// Return the guiname from a given cmdName of the TOC param
+       std::string const getGuiName() const;
+
        /// Given a type, returns the contents
        toc::Toc const getContents(std::string const & type) const;
 };
index c071866d90d0f74759de5594d8ed6cdbfb378e22..afa45953d5fd0fa8fecf8c1542e7f13143977def 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-04  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * GToc.C: consider gui name, not type, when trying to set the
+       toc combo (fixes bug 1870).
+
 2005-05-14  Michael Schmitt  <michael.schmitt@teststep.org>
 
        * Dialogs.C: dialog title "Index" => "Index Entry"
index 0c7c77791e82a876af24b9b4d08352c58a38e2a3..949303af83a31be0fe450fd70f451d7a973b5fc8 100644 (file)
@@ -88,8 +88,7 @@ void GToc::update()
 void GToc::updateType()
 {
        changing_views_ = true;
-       string const targettype =
-               toc::getType(controller().params().getCmdName());
+       string const targettype = controller().getGuiName();
 
        typestore_->clear();
        vector<string> types = controller().getTypes();
index 6b3a9d7b8ebc5649a2e3944b5c26ca97eae541a3..94737791f759732c12452780951f7cea1f96e155 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-04  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * QToc.C: consider gui name, not type, when trying to set the
+       toc combo (fixes bug 1870).
+
 2005-07-04  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
 
        * QChanges.C: use bformat() for translatable strings.
index d879e8eb2b8782787ce60226cb570f41a5d488b3..be70e5f757a78bff6ec0362ad8925f4e32dcd203 100644 (file)
@@ -56,14 +56,14 @@ void QToc::updateType()
        dialog_->typeCO->clear();
 
        vector<string> const & choice = controller().getTypes();
-       string const & type = toc::getType(controller().params().getCmdName());
+       string const & guiname = controller().getGuiName();
 
        for (vector<string>::const_iterator it = choice.begin();
                it != choice.end(); ++it) {
                dialog_->typeCO->insertItem(toqstr(*it));
-               if (*it == type) {
+               if (*it == guiname) {
                        dialog_->typeCO->setCurrentItem(it - choice.begin());
-                       setTitle(type);
+                       setTitle(guiname);
                }
        }
 }
index 901081d36675c45f1920882ad63be4d2bfbb6b11..c2a2f6e93b77e9773f3969c6d636b0a79cbaf65e 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-04  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * FormToc.C: consider gui name, not type, when trying to set the
+       toc combo (fixes bug 1870).
+
 2005-05-31  Angus Leeming  <leeming@lyx.org>
 
        * checkedwidgets.C (check): allow ':' characters in file names. data.
index 62842e0342c0029ae6e25e43228e176a432b9431..ccc1e37dca40e2bea66865767457d56ba7ab7493 100644 (file)
@@ -89,8 +89,8 @@ void FormToc::updateType()
        fl_addto_choice(dialog_->choice_toc_type, choice.c_str());
 
        // And select the correct one
-       string const type = toc::getType(controller().params().getCmdName());
-       fl_set_choice_text(dialog_->choice_toc_type, type.c_str());
+       string const guiname = controller().getGuiName();
+       fl_set_choice_text(dialog_->choice_toc_type, guiname.c_str());
 }
 
 
index 55616f21388988eb9ce97d0910930b5e2d48b525..d207636526dfc41171830281c734ef064358689a 100644 (file)
--- a/src/toc.C
+++ b/src/toc.C
@@ -15,7 +15,9 @@
 
 #include "buffer.h"
 #include "bufferparams.h"
+#include "FloatList.h"
 #include "funcrequest.h"
+#include "gettext.h"
 #include "LyXAction.h"
 #include "paragraph.h"
 #include "pariterator.h"
@@ -59,12 +61,23 @@ string const getType(string const & cmdName)
 {
        // special case
        if (cmdName == "tableofcontents")
-               return "TOC";
+               return _("TOC");
        else
                return cmdName;
 }
 
 
+string const getGuiName(string const & cmdName, Buffer const & buffer)
+{
+       FloatList const & floats =
+               buffer.params().getLyXTextClass().floats();
+       if (floats.typeExist(cmdName))
+               return _(floats.getType(cmdName).name());
+       else
+               return getType(cmdName);
+}
+
+
 TocList const getTocList(Buffer const & buf)
 {
        TocList toclist;
@@ -117,7 +130,7 @@ TocList const getTocList(Buffer const & buf)
                                tocstring = pit->asString(buf, true);
                        TocItem const item(pit->id(), toclevel - min_toclevel,
                                           tocstring);
-                       toclist["TOC"].push_back(item);
+                       toclist[_("TOC")].push_back(item);
                }
        }
        return toclist;
index 9c83b32b7742499b4e04bea214d642dbf05ec9ae..75cdcbaadd8290feb52bf68589e90f9ff0db0bf4 100644 (file)
--- a/src/toc.h
+++ b/src/toc.h
@@ -65,6 +65,9 @@ void asciiTocList(std::string const &, Buffer const &, std::ostream &);
     by ControlToc::getContents() */
 std::string const getType(std::string const & cmdName);
 
+/// Returns the guiname from a given CmdName
+std::string const getGuiName(std::string const & cmdName, Buffer const &);
+
 inline
 bool operator==(TocItem const & a, TocItem const & b)
 {