mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
Fix doubling of bibtex and index alternatives everytime preferences are saved.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29876 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
864773d7d9
commit
3e18652f8e
@ -598,7 +598,7 @@ int LyXRC::read(Lexer & lexrc)
|
||||
|
||||
case RC_BIBTEX_ALTERNATIVES:
|
||||
if (lexrc.next(true)) {
|
||||
bibtex_alternatives.push_back(lexrc.getString());
|
||||
bibtex_alternatives.insert(lexrc.getString());
|
||||
}
|
||||
break;
|
||||
|
||||
@ -616,7 +616,7 @@ int LyXRC::read(Lexer & lexrc)
|
||||
|
||||
case RC_INDEX_ALTERNATIVES:
|
||||
if (lexrc.next(true)) {
|
||||
index_alternatives.push_back(lexrc.getString());
|
||||
index_alternatives.insert(lexrc.getString());
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1371,28 +1371,13 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
|
||||
if (tag != RC_LAST)
|
||||
break;
|
||||
case RC_BIBTEX_ALTERNATIVES: {
|
||||
vector<string>::const_iterator it = bibtex_alternatives.begin();
|
||||
vector<string>::const_iterator end = bibtex_alternatives.end();
|
||||
if (ignore_system_lyxrc) {
|
||||
for ( ; it != end; ++it)
|
||||
set<string>::const_iterator it = bibtex_alternatives.begin();
|
||||
set<string>::const_iterator end = bibtex_alternatives.end();
|
||||
for ( ; it != end; ++it) {
|
||||
if (ignore_system_lyxrc
|
||||
|| !system_lyxrc.bibtex_alternatives.count(*it))
|
||||
os << "\\bibtex_alternatives \""
|
||||
<< *it << "\"\n";
|
||||
} else {
|
||||
vector<string>::const_iterator sbeg =
|
||||
system_lyxrc.bibtex_alternatives.begin();
|
||||
vector<string>::const_iterator send =
|
||||
system_lyxrc.bibtex_alternatives.end();
|
||||
for ( ; it != end; ++it) {
|
||||
bool found = false;
|
||||
for (vector<string>::const_iterator sit = sbeg;
|
||||
sit != send; ++sit) {
|
||||
if (*it == *sit)
|
||||
found = true;
|
||||
}
|
||||
if (!found)
|
||||
os << "\\bibtex_alternatives \""
|
||||
<< *it << "\"\n";
|
||||
}
|
||||
}
|
||||
if (tag != RC_LAST)
|
||||
break;
|
||||
@ -1412,28 +1397,13 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
|
||||
if (tag != RC_LAST)
|
||||
break;
|
||||
case RC_INDEX_ALTERNATIVES: {
|
||||
vector<string>::const_iterator it = index_alternatives.begin();
|
||||
vector<string>::const_iterator end = index_alternatives.end();
|
||||
if (ignore_system_lyxrc) {
|
||||
for ( ; it != end; ++it)
|
||||
set<string>::const_iterator it = index_alternatives.begin();
|
||||
set<string>::const_iterator end = index_alternatives.end();
|
||||
for ( ; it != end; ++it) {
|
||||
if (ignore_system_lyxrc
|
||||
|| !system_lyxrc.index_alternatives.count(*it))
|
||||
os << "\\index_alternatives \""
|
||||
<< *it << "\"\n";
|
||||
} else {
|
||||
vector<string>::const_iterator sbeg =
|
||||
system_lyxrc.index_alternatives.begin();
|
||||
vector<string>::const_iterator send =
|
||||
system_lyxrc.index_alternatives.end();
|
||||
for ( ; it != end; ++it) {
|
||||
bool found = false;
|
||||
for (vector<string>::const_iterator sit = sbeg;
|
||||
sit != send; ++sit) {
|
||||
if (*it == *sit)
|
||||
found = true;
|
||||
}
|
||||
if (!found)
|
||||
os << "\\index_alternatives \""
|
||||
<< *it << "\"\n";
|
||||
}
|
||||
}
|
||||
if (tag != RC_LAST)
|
||||
break;
|
||||
|
@ -22,8 +22,8 @@
|
||||
|
||||
#include "support/strfwd.h"
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
@ -250,13 +250,13 @@ public:
|
||||
/// command to run chktex incl. options
|
||||
std::string chktex_command;
|
||||
/// all available commands to run bibtex incl. options
|
||||
std::vector<std::string> bibtex_alternatives;
|
||||
std::set<std::string> bibtex_alternatives;
|
||||
/// command to run bibtex incl. options
|
||||
std::string bibtex_command;
|
||||
/// command to run japanese bibtex incl. options
|
||||
std::string jbibtex_command;
|
||||
/// all available index commands incl. options
|
||||
std::vector<std::string> index_alternatives;
|
||||
std::set<std::string> index_alternatives;
|
||||
/// command to run makeindex incl. options or other index programs
|
||||
std::string index_command;
|
||||
/// command to run japanese index program incl. options
|
||||
|
@ -871,7 +871,7 @@ GuiDocument::GuiDocument(GuiView & lv)
|
||||
biblioModule->bibtexCO->clear();
|
||||
|
||||
biblioModule->bibtexCO->addItem(qt_("Default"), QString("default"));
|
||||
for (vector<string>::const_iterator it = lyxrc.bibtex_alternatives.begin();
|
||||
for (set<string>::const_iterator it = lyxrc.bibtex_alternatives.begin();
|
||||
it != lyxrc.bibtex_alternatives.end(); ++it) {
|
||||
QString const command = toqstr(*it).left(toqstr(*it).indexOf(" "));
|
||||
biblioModule->bibtexCO->addItem(command, command);
|
||||
|
@ -54,7 +54,7 @@ GuiIndices::GuiIndices(QWidget * parent)
|
||||
|
||||
indexCO->clear();
|
||||
indexCO->addItem(qt_("Default"), QString("default"));
|
||||
for (vector<string>::const_iterator it = lyxrc.index_alternatives.begin();
|
||||
for (set<string>::const_iterator it = lyxrc.index_alternatives.begin();
|
||||
it != lyxrc.index_alternatives.end(); ++it) {
|
||||
QString const command = toqstr(*it).left(toqstr(*it).indexOf(" "));
|
||||
indexCO->addItem(command, command);
|
||||
|
@ -626,7 +626,7 @@ void PrefLatex::on_latexBibtexCO_activated(int n)
|
||||
latexBibtexOptionsLA->setText(qt_("C&ommand:"));
|
||||
return;
|
||||
}
|
||||
for (vector<string>::const_iterator it = bibtex_alternatives.begin();
|
||||
for (set<string>::const_iterator it = bibtex_alternatives.begin();
|
||||
it != bibtex_alternatives.end(); ++it) {
|
||||
QString const bib = toqstr(*it);
|
||||
int ind = bib.indexOf(" ");
|
||||
@ -651,7 +651,7 @@ void PrefLatex::on_latexIndexCO_activated(int n)
|
||||
latexIndexOptionsLA->setText(qt_("Co&mmand:"));
|
||||
return;
|
||||
}
|
||||
for (vector<string>::const_iterator it = index_alternatives.begin();
|
||||
for (set<string>::const_iterator it = index_alternatives.begin();
|
||||
it != index_alternatives.end(); ++it) {
|
||||
QString const idx = toqstr(*it);
|
||||
int ind = idx.indexOf(" ");
|
||||
@ -714,7 +714,7 @@ void PrefLatex::update(LyXRC const & rc)
|
||||
latexBibtexCO->clear();
|
||||
|
||||
latexBibtexCO->addItem(qt_("Custom"), QString());
|
||||
for (vector<string>::const_iterator it = rc.bibtex_alternatives.begin();
|
||||
for (set<string>::const_iterator it = rc.bibtex_alternatives.begin();
|
||||
it != rc.bibtex_alternatives.end(); ++it) {
|
||||
QString const command = toqstr(*it).left(toqstr(*it).indexOf(" "));
|
||||
latexBibtexCO->addItem(command, command);
|
||||
@ -741,7 +741,7 @@ void PrefLatex::update(LyXRC const & rc)
|
||||
latexIndexCO->clear();
|
||||
|
||||
latexIndexCO->addItem(qt_("Custom"), QString());
|
||||
for (vector<string>::const_iterator it = rc.index_alternatives.begin();
|
||||
for (set<string>::const_iterator it = rc.index_alternatives.begin();
|
||||
it != rc.index_alternatives.end(); ++it) {
|
||||
QString const command = toqstr(*it).left(toqstr(*it).indexOf(" "));
|
||||
latexIndexCO->addItem(command, command);
|
||||
|
@ -232,9 +232,9 @@ private Q_SLOTS:
|
||||
|
||||
private:
|
||||
///
|
||||
std::vector<std::string> bibtex_alternatives;
|
||||
std::set<std::string> bibtex_alternatives;
|
||||
///
|
||||
std::vector<std::string> index_alternatives;
|
||||
std::set<std::string> index_alternatives;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user