mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
Do not use localized strings internally (bug 1870)
Someone please check the gtk TOC dialog. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10363 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
945be79c7c
commit
7d978a119f
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
13
src/toc.C
13
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;
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user