mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-11 03:03:06 +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:
|
case RC_BIBTEX_ALTERNATIVES:
|
||||||
if (lexrc.next(true)) {
|
if (lexrc.next(true)) {
|
||||||
bibtex_alternatives.push_back(lexrc.getString());
|
bibtex_alternatives.insert(lexrc.getString());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -616,7 +616,7 @@ int LyXRC::read(Lexer & lexrc)
|
|||||||
|
|
||||||
case RC_INDEX_ALTERNATIVES:
|
case RC_INDEX_ALTERNATIVES:
|
||||||
if (lexrc.next(true)) {
|
if (lexrc.next(true)) {
|
||||||
index_alternatives.push_back(lexrc.getString());
|
index_alternatives.insert(lexrc.getString());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1371,28 +1371,13 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
|
|||||||
if (tag != RC_LAST)
|
if (tag != RC_LAST)
|
||||||
break;
|
break;
|
||||||
case RC_BIBTEX_ALTERNATIVES: {
|
case RC_BIBTEX_ALTERNATIVES: {
|
||||||
vector<string>::const_iterator it = bibtex_alternatives.begin();
|
set<string>::const_iterator it = bibtex_alternatives.begin();
|
||||||
vector<string>::const_iterator end = bibtex_alternatives.end();
|
set<string>::const_iterator end = bibtex_alternatives.end();
|
||||||
if (ignore_system_lyxrc) {
|
for ( ; it != end; ++it) {
|
||||||
for ( ; it != end; ++it)
|
if (ignore_system_lyxrc
|
||||||
|
|| !system_lyxrc.bibtex_alternatives.count(*it))
|
||||||
os << "\\bibtex_alternatives \""
|
os << "\\bibtex_alternatives \""
|
||||||
<< *it << "\"\n";
|
<< *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)
|
if (tag != RC_LAST)
|
||||||
break;
|
break;
|
||||||
@ -1412,28 +1397,13 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
|
|||||||
if (tag != RC_LAST)
|
if (tag != RC_LAST)
|
||||||
break;
|
break;
|
||||||
case RC_INDEX_ALTERNATIVES: {
|
case RC_INDEX_ALTERNATIVES: {
|
||||||
vector<string>::const_iterator it = index_alternatives.begin();
|
set<string>::const_iterator it = index_alternatives.begin();
|
||||||
vector<string>::const_iterator end = index_alternatives.end();
|
set<string>::const_iterator end = index_alternatives.end();
|
||||||
if (ignore_system_lyxrc) {
|
for ( ; it != end; ++it) {
|
||||||
for ( ; it != end; ++it)
|
if (ignore_system_lyxrc
|
||||||
|
|| !system_lyxrc.index_alternatives.count(*it))
|
||||||
os << "\\index_alternatives \""
|
os << "\\index_alternatives \""
|
||||||
<< *it << "\"\n";
|
<< *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)
|
if (tag != RC_LAST)
|
||||||
break;
|
break;
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
|
|
||||||
#include "support/strfwd.h"
|
#include "support/strfwd.h"
|
||||||
|
|
||||||
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
@ -250,13 +250,13 @@ public:
|
|||||||
/// command to run chktex incl. options
|
/// command to run chktex incl. options
|
||||||
std::string chktex_command;
|
std::string chktex_command;
|
||||||
/// all available commands to run bibtex incl. options
|
/// 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
|
/// command to run bibtex incl. options
|
||||||
std::string bibtex_command;
|
std::string bibtex_command;
|
||||||
/// command to run japanese bibtex incl. options
|
/// command to run japanese bibtex incl. options
|
||||||
std::string jbibtex_command;
|
std::string jbibtex_command;
|
||||||
/// all available index commands incl. options
|
/// 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
|
/// command to run makeindex incl. options or other index programs
|
||||||
std::string index_command;
|
std::string index_command;
|
||||||
/// command to run japanese index program incl. options
|
/// command to run japanese index program incl. options
|
||||||
|
@ -871,7 +871,7 @@ GuiDocument::GuiDocument(GuiView & lv)
|
|||||||
biblioModule->bibtexCO->clear();
|
biblioModule->bibtexCO->clear();
|
||||||
|
|
||||||
biblioModule->bibtexCO->addItem(qt_("Default"), QString("default"));
|
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) {
|
it != lyxrc.bibtex_alternatives.end(); ++it) {
|
||||||
QString const command = toqstr(*it).left(toqstr(*it).indexOf(" "));
|
QString const command = toqstr(*it).left(toqstr(*it).indexOf(" "));
|
||||||
biblioModule->bibtexCO->addItem(command, command);
|
biblioModule->bibtexCO->addItem(command, command);
|
||||||
|
@ -54,7 +54,7 @@ GuiIndices::GuiIndices(QWidget * parent)
|
|||||||
|
|
||||||
indexCO->clear();
|
indexCO->clear();
|
||||||
indexCO->addItem(qt_("Default"), QString("default"));
|
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) {
|
it != lyxrc.index_alternatives.end(); ++it) {
|
||||||
QString const command = toqstr(*it).left(toqstr(*it).indexOf(" "));
|
QString const command = toqstr(*it).left(toqstr(*it).indexOf(" "));
|
||||||
indexCO->addItem(command, command);
|
indexCO->addItem(command, command);
|
||||||
|
@ -626,7 +626,7 @@ void PrefLatex::on_latexBibtexCO_activated(int n)
|
|||||||
latexBibtexOptionsLA->setText(qt_("C&ommand:"));
|
latexBibtexOptionsLA->setText(qt_("C&ommand:"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (vector<string>::const_iterator it = bibtex_alternatives.begin();
|
for (set<string>::const_iterator it = bibtex_alternatives.begin();
|
||||||
it != bibtex_alternatives.end(); ++it) {
|
it != bibtex_alternatives.end(); ++it) {
|
||||||
QString const bib = toqstr(*it);
|
QString const bib = toqstr(*it);
|
||||||
int ind = bib.indexOf(" ");
|
int ind = bib.indexOf(" ");
|
||||||
@ -651,7 +651,7 @@ void PrefLatex::on_latexIndexCO_activated(int n)
|
|||||||
latexIndexOptionsLA->setText(qt_("Co&mmand:"));
|
latexIndexOptionsLA->setText(qt_("Co&mmand:"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (vector<string>::const_iterator it = index_alternatives.begin();
|
for (set<string>::const_iterator it = index_alternatives.begin();
|
||||||
it != index_alternatives.end(); ++it) {
|
it != index_alternatives.end(); ++it) {
|
||||||
QString const idx = toqstr(*it);
|
QString const idx = toqstr(*it);
|
||||||
int ind = idx.indexOf(" ");
|
int ind = idx.indexOf(" ");
|
||||||
@ -714,7 +714,7 @@ void PrefLatex::update(LyXRC const & rc)
|
|||||||
latexBibtexCO->clear();
|
latexBibtexCO->clear();
|
||||||
|
|
||||||
latexBibtexCO->addItem(qt_("Custom"), QString());
|
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) {
|
it != rc.bibtex_alternatives.end(); ++it) {
|
||||||
QString const command = toqstr(*it).left(toqstr(*it).indexOf(" "));
|
QString const command = toqstr(*it).left(toqstr(*it).indexOf(" "));
|
||||||
latexBibtexCO->addItem(command, command);
|
latexBibtexCO->addItem(command, command);
|
||||||
@ -741,7 +741,7 @@ void PrefLatex::update(LyXRC const & rc)
|
|||||||
latexIndexCO->clear();
|
latexIndexCO->clear();
|
||||||
|
|
||||||
latexIndexCO->addItem(qt_("Custom"), QString());
|
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) {
|
it != rc.index_alternatives.end(); ++it) {
|
||||||
QString const command = toqstr(*it).left(toqstr(*it).indexOf(" "));
|
QString const command = toqstr(*it).left(toqstr(*it).indexOf(" "));
|
||||||
latexIndexCO->addItem(command, command);
|
latexIndexCO->addItem(command, command);
|
||||||
|
@ -232,9 +232,9 @@ private Q_SLOTS:
|
|||||||
|
|
||||||
private:
|
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