]> git.lyx.org Git - features.git/commitdiff
Do not use localized strings internally (bug 1870)
authorJürgen Spitzmüller <spitz@lyx.org>
Wed, 27 Jul 2005 15:22:08 +0000 (15:22 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Wed, 27 Jul 2005 15:22:08 +0000 (15:22 +0000)
Someone please check the gtk TOC dialog.

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

15 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/insets/ChangeLog
src/insets/insetfloat.C
src/insets/insetwrap.C
src/toc.C
src/toc.h

index 720581cf4fd188d62edc9217b3b7579a2aac946c..2566c7779cd626d1896191c745e01f02dc95f321 100644 (file)
@@ -1,3 +1,7 @@
+2005-07-27  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * toc.[Ch]: Do not use translatable strings (bug 1870).
+
 2005-07-20  John Levon  <levon@movementarian.org>
 
        * tabular.C: fix 1748 - setting multicolumn adds
index 1e73f493e01aa64f44b66d629a64bdf2a04dea9c..a35e0e9b4b7ef614c90d1961488f8844ec6099fa 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-27  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * ControlToc.[Ch]: getGuiName takes a type argument now.
+       * ControlToc.C (getGuiName): Do all guiname translations here (bug 1870)
+
 2005-07-16  José Matos  <jamatos@fc.up.pt>
 
        * ControlTabular.C (set): use a single papersize variable.
index 36d8d77795a18229df3ed9698217882fa5f75d94..f64cb4ad62c98e864f5a62651207f0f1d66f3dec 100644 (file)
@@ -11,6 +11,7 @@
 #include <config.h>
 
 #include "ControlToc.h"
+#include "gettext.h"
 
 using std::vector;
 using std::string;
@@ -21,6 +22,7 @@ class Buffer;
 namespace lyx {
 namespace frontend {
 
+
 ControlToc::ControlToc(Dialog & d)
        : ControlCommand(d, "toc")
 {}
@@ -38,9 +40,12 @@ vector<string> const ControlToc::getTypes() const
 }
 
 
-string const ControlToc::getGuiName() const
+string const ControlToc::getGuiName(string const & type) const
 {
-       return toc::getGuiName(params().getCmdName(), kernel().buffer());
+       if (type == "TOC")
+               return _("Table of Contents");
+       else
+               return _(toc::getGuiName(type, kernel().buffer()));
 }
 
 
index bec48d93d1cf1e8e544d4975ab8822bb4dce2f48..f71751c2fe4e12e41fa2c0cd37a68e1aa91d2589 100644 (file)
@@ -34,7 +34,7 @@ public:
        std::vector<std::string> const getTypes() const;
 
        /// Return the guiname from a given cmdName of the TOC param
-       std::string const getGuiName() const;
+       std::string const getGuiName(std::string const & type) const;
 
        /// Given a type, returns the contents
        toc::Toc const getContents(std::string const & type) const;
index 1b095fde43fe383c0682a6134f81f941ff99ac53..19453e8c75eef75bd3475b9bf2de44b4a37f814a 100644 (file)
@@ -1,3 +1,9 @@
+2005-07-27  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * GToc.C (update, updateContents): Do not compare against 
+       translatable strings (bug 1870).
+       Someone who can actually compile against gtk should verify this.
+
 2005-07-24  Georg Baum  <Georg.Baum@post.rwth-aachen.de>
 
        * GDocument.[Ch], glade/document.glade: remove remaining
index 949303af83a31be0fe450fd70f451d7a973b5fc8..8d473fccf85537038eb2e79205bd54d34b5c815a 100644 (file)
@@ -88,7 +88,8 @@ void GToc::update()
 void GToc::updateType()
 {
        changing_views_ = true;
-       string const targettype = controller().getGuiName();
+       string const targettype = 
+               toc::getType(controller().params().getCmdName());
 
        typestore_->clear();
        vector<string> types = controller().getTypes();
@@ -100,8 +101,9 @@ void GToc::updateType()
        vector<string>::iterator it = types.begin();
        vector<string>::iterator end = types.end();
        for(;it != end; ++it) {
+               string const & guiname = controller().getGuiName(*it);
                Gtk::TreeModel::iterator row = typestore_->append();
-               (*row)[listCol_] = *it;
+               (*row)[listCol_] = guiname;
                if (*it == targettype)
                        typecombo_->set_active(row);
        }
@@ -119,7 +121,8 @@ void GToc::updateContents()
        }
 
        Gtk::TreeModel::iterator it = typecombo_->get_active();
-       Glib::ustring const type = (*it)[listCol_];
+       vector<string> const & choice = controller().getTypes();
+       string const type = choice[(*it)[listColIndex_]];
        toc::Toc const contents = controller().getContents(type);
 
        // Check if all elements are the same.
index 2aab567170cfeaabeb35fa3076c3503bc0972efd..f291daf809ee5830e28c02778e1b202c5cc968de 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-27  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * QToc.C (updateType, update_contents): Do not compare against 
+       translatable strings (bug 1870).
+
 2005-07-23  Angus Leeming  <leeming@lyx.org>
 
        * QRefDialogBase.ui: disconnect two refsLB signals to the
index be70e5f757a78bff6ec0362ad8925f4e32dcd203..ff4c41e3b9db1e2615ab4446ef949c4d9dafcd06 100644 (file)
@@ -56,12 +56,13 @@ void QToc::updateType()
        dialog_->typeCO->clear();
 
        vector<string> const & choice = controller().getTypes();
-       string const & guiname = controller().getGuiName();
+       string const & type = toc::getType(controller().params().getCmdName());
 
        for (vector<string>::const_iterator it = choice.begin();
                it != choice.end(); ++it) {
-               dialog_->typeCO->insertItem(toqstr(*it));
-               if (*it == guiname) {
+               string const & guiname = controller().getGuiName(*it);
+               dialog_->typeCO->insertItem(toqstr(guiname));
+               if (*it == type) {
                        dialog_->typeCO->setCurrentItem(it - choice.begin());
                        setTitle(guiname);
                }
@@ -78,7 +79,8 @@ void QToc::update_contents()
 
 void QToc::updateToc(int newdepth)
 {
-       string type = fromqstr(dialog_->typeCO->currentText());
+       vector<string> const & choice = controller().getTypes();
+       string const & type = choice[dialog_->typeCO->currentItem()];
 
        toc::Toc const & contents = controller().getContents(type);
 
@@ -157,6 +159,7 @@ void QToc::updateToc(int newdepth)
 
        dialog_->tocLV->setUpdatesEnabled(true);
        dialog_->tocLV->update();
+       setTitle(dialog_->typeCO->currentText());
 }
 
 
index 0e6097bf282e4d2a4c6c89bcc09260357457537c..666a6a1ba1f5a60a26cbf8d3687901f4222dd221 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-27  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * FormToc.C (updateType, update_contents): Do not compare against 
+       translatable strings (bug 1870).
+
 2005-07-22  Angus Leeming  <leeming@lyx.org>
 
        * FormSearch.C (input): do not trim the find and replace strings.
index ccc1e37dca40e2bea66865767457d56ba7ab7493..7feec7f18e4b696198756b698bdca349cd1c3f0e 100644 (file)
@@ -43,9 +43,8 @@ void FormToc::build()
 
        vector<string> types = controller().getTypes();
 
-
        string const choice =
-               ' ' + getStringFromVector(controller().getTypes(), " | ") + ' ';
+               ' ' + getStringFromVector(types, " | ") + ' ';
        fl_addto_choice(dialog_->choice_toc_type, choice.c_str());
 
        // Manage the cancel/close button
@@ -85,18 +84,23 @@ void FormToc::updateType()
 {
        // Update the choice list from scratch
        fl_clear_choice(dialog_->choice_toc_type);
-       string const choice = getStringFromVector(controller().getTypes(), "|");
-       fl_addto_choice(dialog_->choice_toc_type, choice.c_str());
-
-       // And select the correct one
-       string const guiname = controller().getGuiName();
-       fl_set_choice_text(dialog_->choice_toc_type, guiname.c_str());
+       vector<string> const & choice = controller().getTypes();
+       string const & type = toc::getType(controller().params().getCmdName());
+       for (vector<string>::const_iterator it = choice.begin();
+               it != choice.end(); ++it) {
+               string const & guiname = controller().getGuiName(*it);
+               fl_addto_choice(dialog_->choice_toc_type, guiname.c_str());
+               // And select the correct one
+               if (*it == type)
+                       fl_set_choice(dialog_->choice_toc_type, it - choice.begin() + 1);
+       }
 }
 
 
 void FormToc::updateContents()
 {
-       string const type = getString(dialog_->choice_toc_type);
+       vector<string> types = controller().getTypes();
+       string const type = types[fl_get_choice(dialog_->choice_toc_type) - 1];
        if (type.empty()) {
                fl_clear_browser(dialog_->browser_toc);
                fl_add_browser_line(dialog_->browser_toc,
index 655d47b5b6a6bd6e0bec8fd212ddd6846118c12e..f6d46467411f526ee38d9a8d7fafd0ef66e3a27c 100644 (file)
@@ -1,3 +1,9 @@
+2005-07-27  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * insetfloat.C: 
+       * insetwrap.C: Do not use translatable strings as internal identifier 
+       (bug 1870).
+
 2005-07-18  Lars Gullik Bjønnes  <larsbj@lyx.org>
 
        * insetbase.C: include boost/current_function.hpp
index a68d8a677421c660282acd49e0d9c7691d27ef41..e2121a34024bffaf674cd8f6aa47d6dbddfbb012 100644 (file)
@@ -434,12 +434,12 @@ void InsetFloat::addToToc(lyx::toc::TocList & toclist, Buffer const & buf) const
        // Find a caption layout in one of the (child inset's) pars
        for (; pit != end; ++pit) {
                if (pit->layout()->labeltype == LABEL_SENSITIVE) {
-                       string const name = floatname(params_.type, buf.params());
+                       string const type = params_.type;
                        string const str =
-                               convert<string>(toclist[name].size() + 1)
+                               convert<string>(toclist[type].size() + 1)
                                + ". " + pit->asString(buf, false);
                        lyx::toc::TocItem const item(pit->id(), 0 , str);
-                       toclist[name].push_back(item);
+                       toclist[type].push_back(item);
                }
        }
 }
index 1ac102ba36c3dd12ded6f33057766aa4fe9b1397..7d41b6df86586c56f04a01fe4834c29f5024a004 100644 (file)
@@ -242,12 +242,12 @@ void InsetWrap::addToToc(lyx::toc::TocList & toclist, Buffer const & buf) const
        // Find a caption layout in one of the (child inset's) pars
        for (; pit != end; ++pit) {
                if (pit->layout()->labeltype == LABEL_SENSITIVE) {
-                       string const name = floatname(params_.type, buf.params());
+                       string const type = params_.type;
                        string const str =
-                               convert<string>(toclist[name].size() + 1)
+                               convert<string>(toclist[type].size() + 1)
                                + ". " + pit->asString(buf, false);
                        lyx::toc::TocItem const item(pit->id(), 0 , str);
-                       toclist[name].push_back(item);
+                       toclist[type].push_back(item);
                }
        }
 }
index d207636526dfc41171830281c734ef064358689a..0a17d5a2c175585dc6818505331066651e1812bb 100644 (file)
--- a/src/toc.C
+++ b/src/toc.C
@@ -17,7 +17,6 @@
 #include "bufferparams.h"
 #include "FloatList.h"
 #include "funcrequest.h"
-#include "gettext.h"
 #include "LyXAction.h"
 #include "paragraph.h"
 #include "pariterator.h"
@@ -61,20 +60,20 @@ 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)
+string const getGuiName(string const & type, Buffer const & buffer)
 {
        FloatList const & floats =
                buffer.params().getLyXTextClass().floats();
-       if (floats.typeExist(cmdName))
-               return _(floats.getType(cmdName).name());
+       if (floats.typeExist(type))
+               return floats.getType(type).name();
        else
-               return getType(cmdName);
+               return type;
 }
 
 
@@ -130,7 +129,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 75cdcbaadd8290feb52bf68589e90f9ff0db0bf4..f0f2f80262b22f7a81a227f8687ee8fc3991408d 100644 (file)
--- a/src/toc.h
+++ b/src/toc.h
@@ -65,8 +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 &);
+/** Returns the guiname from a given @c type
+    The localization of the names will be done in the frontends */
+std::string const getGuiName(std::string const & type, Buffer const &);
 
 inline
 bool operator==(TocItem const & a, TocItem const & b)