mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 10:18:50 +00:00
Rework default bibliography style UI
* Use a combo with all available styles * Correctly reset default on engine change * Consider that EngineTypes might have different defaults
This commit is contained in:
parent
bda9d95fad
commit
adc93015f9
@ -14,7 +14,7 @@ Format 62
|
|||||||
Requires natbib
|
Requires natbib
|
||||||
|
|
||||||
CiteEngineType authoryear|numerical
|
CiteEngineType authoryear|numerical
|
||||||
DefaultBiblio plainnat
|
DefaultBiblio authoryear:plainnat|numerical:plainnat
|
||||||
|
|
||||||
CiteEngine authoryear
|
CiteEngine authoryear
|
||||||
Citet*[][]
|
Citet*[][]
|
||||||
|
@ -1511,7 +1511,7 @@ def checkCiteEnginesConfig():
|
|||||||
## It has been automatically generated by configure
|
## It has been automatically generated by configure
|
||||||
## Use "Options/Reconfigure" if you need to update it after a
|
## Use "Options/Reconfigure" if you need to update it after a
|
||||||
## configuration change.
|
## configuration change.
|
||||||
## "CiteEngineName" "filename" "CiteEngineType" "Description" "Packages" "Requires" "Excludes"
|
## "CiteEngineName" "filename" "CiteEngineType" "DefaultBiblio" "Description" "Packages" "Requires" "Excludes"
|
||||||
''')
|
''')
|
||||||
|
|
||||||
# build the list of available modules
|
# build the list of available modules
|
||||||
@ -1550,16 +1550,17 @@ def processCiteEngineFile(file, filename, bool_docbook):
|
|||||||
#Excludes: [list of excluded engines]
|
#Excludes: [list of excluded engines]
|
||||||
The last two lines are optional.
|
The last two lines are optional.
|
||||||
We expect output:
|
We expect output:
|
||||||
"CiteEngineName" "filename" "CiteEngineType" "Description" "Packages" "Requires" "Excludes"
|
"CiteEngineName" "filename" "CiteEngineType" "DefaultBiblio" "Description" "Packages" "Requires" "Excludes"
|
||||||
'''
|
'''
|
||||||
remods = re.compile(r'\DeclareLyXCiteEngine\s*(?:\[([^]]*?)\])?{(.*)}')
|
remods = re.compile(r'\DeclareLyXCiteEngine\s*(?:\[([^]]*?)\])?{(.*)}')
|
||||||
rereqs = re.compile(r'#+\s*Requires: (.*)')
|
rereqs = re.compile(r'#+\s*Requires:\s*(.*)')
|
||||||
reexcs = re.compile(r'#+\s*Excludes: (.*)')
|
reexcs = re.compile(r'#+\s*Excludes:\s*(.*)')
|
||||||
redbeg = re.compile(r'#+\s*DescriptionBegin\s*$')
|
redbeg = re.compile(r'#+\s*DescriptionBegin\s*$')
|
||||||
redend = re.compile(r'#+\s*DescriptionEnd\s*$')
|
redend = re.compile(r'#+\s*DescriptionEnd\s*$')
|
||||||
recet = re.compile(r'\s*CiteEngineType (.*)')
|
recet = re.compile(r'\s*CiteEngineType\s*(.*)')
|
||||||
|
redb = re.compile(r'\s*DefaultBiblio\s*(.*)')
|
||||||
|
|
||||||
modname = desc = pkgs = req = excl = cet = ""
|
modname = desc = pkgs = req = excl = cet = db = ""
|
||||||
readingDescription = False
|
readingDescription = False
|
||||||
descLines = []
|
descLines = []
|
||||||
|
|
||||||
@ -1603,6 +1604,10 @@ def processCiteEngineFile(file, filename, bool_docbook):
|
|||||||
if res != None:
|
if res != None:
|
||||||
cet = res.group(1)
|
cet = res.group(1)
|
||||||
continue
|
continue
|
||||||
|
res = redb.search(line)
|
||||||
|
if res != None:
|
||||||
|
db = res.group(1)
|
||||||
|
continue
|
||||||
|
|
||||||
if modname == "":
|
if modname == "":
|
||||||
logger.warning("Cite Engine File file without \DeclareLyXCiteEngine line. ")
|
logger.warning("Cite Engine File file without \DeclareLyXCiteEngine line. ")
|
||||||
@ -1625,7 +1630,7 @@ def processCiteEngineFile(file, filename, bool_docbook):
|
|||||||
cm.write(line + '\n')
|
cm.write(line + '\n')
|
||||||
cm.close()
|
cm.close()
|
||||||
|
|
||||||
return '"%s" "%s" "%s" "%s" "%s" "%s" "%s"\n' % (modname, filename, cet, desc, pkgs, req, excl)
|
return '"%s" "%s" "%s" "%s" "%s" "%s" "%s" "%s"\n' % (modname, filename, cet, db, desc, pkgs, req, excl)
|
||||||
|
|
||||||
|
|
||||||
def checkTeXAllowSpaces():
|
def checkTeXAllowSpaces():
|
||||||
|
@ -3240,7 +3240,8 @@ bool BufferParams::addCiteEngine(vector<string> const & engine)
|
|||||||
|
|
||||||
string const & BufferParams::defaultBiblioStyle() const
|
string const & BufferParams::defaultBiblioStyle() const
|
||||||
{
|
{
|
||||||
return documentClass().defaultBiblioStyle();
|
map<string, string> bs = documentClass().defaultBiblioStyle();
|
||||||
|
return bs[documentClass().opt_enginetype()];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,11 +38,11 @@ CiteEnginesList theCiteEnginesList;
|
|||||||
|
|
||||||
|
|
||||||
LyXCiteEngine::LyXCiteEngine(string const & n, string const & i,
|
LyXCiteEngine::LyXCiteEngine(string const & n, string const & i,
|
||||||
vector<string> const & cet, string const & d,
|
vector<string> const & cet, vector<string> const & dbs,
|
||||||
vector<string> const & p,
|
string const & d, vector<string> const & p,
|
||||||
vector<string> const & r, vector<string> const & e):
|
vector<string> const & r, vector<string> const & e):
|
||||||
name_(n), id_(i), engine_types_(cet), description_(d), package_list_(p),
|
name_(n), id_(i), engine_types_(cet), default_biblios_(dbs), description_(d),
|
||||||
required_engines_(r), excluded_engines_(e),
|
package_list_(p), required_engines_(r), excluded_engines_(e),
|
||||||
checked_(false), available_(false)
|
checked_(false), available_(false)
|
||||||
{
|
{
|
||||||
filename_ = id_ + ".citeengine";
|
filename_ = id_ + ".citeengine";
|
||||||
@ -118,6 +118,33 @@ bool LyXCiteEngine::areCompatible(string const & eng1, string const & eng2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
string LyXCiteEngine::getDefaultBiblio(CiteEngineType const & cet) const
|
||||||
|
{
|
||||||
|
string res;
|
||||||
|
string const etp = theCiteEnginesList.getTypeAsString(cet) + ":";
|
||||||
|
//check whether all of the required packages are available
|
||||||
|
vector<string>::const_iterator it = default_biblios_.begin();
|
||||||
|
vector<string>::const_iterator end = default_biblios_.end();
|
||||||
|
for (; it != end; ++it) {
|
||||||
|
string const s = *it;
|
||||||
|
if (prefixIs(s, etp))
|
||||||
|
res = split(s, ':');
|
||||||
|
else if (!contains(s, ':') && res.empty())
|
||||||
|
res = s;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LyXCiteEngine::isDefaultBiblio(string const & bf) const
|
||||||
|
{
|
||||||
|
if (find(default_biblios_.begin(), default_biblios_.end(), bf) != default_biblios_.end())
|
||||||
|
return true;
|
||||||
|
string const bfp = ":" + bf;
|
||||||
|
return find(default_biblios_.begin(), default_biblios_.end(), bfp) != default_biblios_.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// used when sorting the cite engine list.
|
// used when sorting the cite engine list.
|
||||||
class EngineSorter {
|
class EngineSorter {
|
||||||
public:
|
public:
|
||||||
@ -217,6 +244,16 @@ bool CiteEnginesList::read()
|
|||||||
cet = split(cet, p, '|');
|
cet = split(cet, p, '|');
|
||||||
cets.push_back(p);
|
cets.push_back(p);
|
||||||
}
|
}
|
||||||
|
if (!lex.next(true))
|
||||||
|
break;
|
||||||
|
string db = lex.getString();
|
||||||
|
LYXERR(Debug::TCLASS, "Default Biblio: " << db);
|
||||||
|
vector<string> dbs;
|
||||||
|
while (!db.empty()) {
|
||||||
|
string p;
|
||||||
|
db = split(db, p, '|');
|
||||||
|
dbs.push_back(p);
|
||||||
|
}
|
||||||
if (!lex.next(true))
|
if (!lex.next(true))
|
||||||
break;
|
break;
|
||||||
string const desc = lex.getString();
|
string const desc = lex.getString();
|
||||||
@ -254,7 +291,7 @@ bool CiteEnginesList::read()
|
|||||||
}
|
}
|
||||||
// This code is run when we have
|
// This code is run when we have
|
||||||
// cename, fname, desc, pkgs, req and exc
|
// cename, fname, desc, pkgs, req and exc
|
||||||
addCiteEngine(cename, fname, cets, desc, pkgs, req, exc);
|
addCiteEngine(cename, fname, cets, dbs, desc, pkgs, req, exc);
|
||||||
} // end switch
|
} // end switch
|
||||||
} //end while
|
} //end while
|
||||||
|
|
||||||
@ -267,11 +304,12 @@ bool CiteEnginesList::read()
|
|||||||
|
|
||||||
|
|
||||||
void CiteEnginesList::addCiteEngine(string const & cename,
|
void CiteEnginesList::addCiteEngine(string const & cename,
|
||||||
string const & filename, vector<string> const & cets, string const & description,
|
string const & filename, vector<string> const & cets,
|
||||||
|
vector<string> const & dbs, string const & description,
|
||||||
vector<string> const & pkgs, vector<string> const & req,
|
vector<string> const & pkgs, vector<string> const & req,
|
||||||
vector<string> const & exc)
|
vector<string> const & exc)
|
||||||
{
|
{
|
||||||
LyXCiteEngine ce(cename, filename, cets, description, pkgs, req, exc);
|
LyXCiteEngine ce(cename, filename, cets, dbs, description, pkgs, req, exc);
|
||||||
englist_.push_back(ce);
|
englist_.push_back(ce);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ public:
|
|||||||
///
|
///
|
||||||
LyXCiteEngine(std::string const & name, std::string const & id,
|
LyXCiteEngine(std::string const & name, std::string const & id,
|
||||||
std::vector<std::string> const & enginetypes,
|
std::vector<std::string> const & enginetypes,
|
||||||
|
std::vector<std::string> const & defaultbiblios,
|
||||||
std::string const & description,
|
std::string const & description,
|
||||||
std::vector<std::string> const & packagelist,
|
std::vector<std::string> const & packagelist,
|
||||||
std::vector<std::string> const & requires,
|
std::vector<std::string> const & requires,
|
||||||
@ -70,6 +71,10 @@ public:
|
|||||||
///
|
///
|
||||||
bool hasEngineType(CiteEngineType const &) const;
|
bool hasEngineType(CiteEngineType const &) const;
|
||||||
///
|
///
|
||||||
|
std::string getDefaultBiblio(CiteEngineType const &) const;
|
||||||
|
///
|
||||||
|
bool isDefaultBiblio(std::string const &) const;
|
||||||
|
///
|
||||||
std::string const & getDescription() const { return description_; }
|
std::string const & getDescription() const { return description_; }
|
||||||
///
|
///
|
||||||
std::vector<std::string> const & getPackageList() const
|
std::vector<std::string> const & getPackageList() const
|
||||||
@ -97,6 +102,8 @@ private:
|
|||||||
std::string filename_;
|
std::string filename_;
|
||||||
/// the engine type(s)
|
/// the engine type(s)
|
||||||
std::vector<std::string> engine_types_;
|
std::vector<std::string> engine_types_;
|
||||||
|
/// default bibliography styles
|
||||||
|
std::vector<std::string> default_biblios_;
|
||||||
/// a short description for use in the ui
|
/// a short description for use in the ui
|
||||||
std::string description_;
|
std::string description_;
|
||||||
/// the LaTeX packages on which this depends, if any
|
/// the LaTeX packages on which this depends, if any
|
||||||
@ -153,7 +160,8 @@ public:
|
|||||||
void operator=(CiteEnginesList const &);
|
void operator=(CiteEnginesList const &);
|
||||||
/// add an engine to the list
|
/// add an engine to the list
|
||||||
void addCiteEngine(std::string const &, std::string const &,
|
void addCiteEngine(std::string const &, std::string const &,
|
||||||
std::vector<std::string> const &, std::string const &, std::vector<std::string> const &,
|
std::vector<std::string> const &, std::vector<std::string> const &,
|
||||||
|
std::string const &, std::vector<std::string> const &,
|
||||||
std::vector<std::string> const &, std::vector<std::string> const &);
|
std::vector<std::string> const &, std::vector<std::string> const &);
|
||||||
///
|
///
|
||||||
std::vector<LyXCiteEngine> englist_;
|
std::vector<LyXCiteEngine> englist_;
|
||||||
|
@ -759,8 +759,21 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case TC_DEFAULTBIBLIO:
|
case TC_DEFAULTBIBLIO:
|
||||||
if (lexrc.next())
|
if (lexrc.next()) {
|
||||||
cite_default_biblio_style_ = rtrim(lexrc.getString());
|
vector<string> const dbs =
|
||||||
|
getVectorFromString(rtrim(lexrc.getString()), "|");
|
||||||
|
vector<string>::const_iterator it = dbs.begin();
|
||||||
|
vector<string>::const_iterator end = dbs.end();
|
||||||
|
for (; it != end; ++it) {
|
||||||
|
if (!contains(*it, ':'))
|
||||||
|
cite_default_biblio_style_[opt_enginetype_] = *it;
|
||||||
|
else {
|
||||||
|
string eng;
|
||||||
|
string const db = split(*it, eng, ':');
|
||||||
|
cite_default_biblio_style_[eng] = db;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TC_FULLAUTHORLIST:
|
case TC_FULLAUTHORLIST:
|
||||||
|
@ -330,7 +330,7 @@ protected:
|
|||||||
/// Citation macros
|
/// Citation macros
|
||||||
std::map<CiteEngineType, std::map<std::string, std::string> > cite_macros_;
|
std::map<CiteEngineType, std::map<std::string, std::string> > cite_macros_;
|
||||||
/// The default BibTeX bibliography style file
|
/// The default BibTeX bibliography style file
|
||||||
std::string cite_default_biblio_style_;
|
std::map<std::string, std::string> cite_default_biblio_style_;
|
||||||
/// Whether full author lists are supported
|
/// Whether full author lists are supported
|
||||||
bool cite_full_author_list_;
|
bool cite_full_author_list_;
|
||||||
/// The possible citation styles
|
/// The possible citation styles
|
||||||
@ -487,7 +487,8 @@ public:
|
|||||||
///
|
///
|
||||||
std::vector<CitationStyle> const & citeStyles(CiteEngineType const &) const;
|
std::vector<CitationStyle> const & citeStyles(CiteEngineType const &) const;
|
||||||
///
|
///
|
||||||
std::string const & defaultBiblioStyle() const { return cite_default_biblio_style_; }
|
std::map<std::string, std::string> const & defaultBiblioStyle() const
|
||||||
|
{ return cite_default_biblio_style_; }
|
||||||
///
|
///
|
||||||
bool const & fullAuthorList() const { return cite_full_author_list_; }
|
bool const & fullAuthorList() const { return cite_full_author_list_; }
|
||||||
protected:
|
protected:
|
||||||
|
@ -1130,15 +1130,23 @@ GuiDocument::GuiDocument(GuiView & lv)
|
|||||||
connect(biblioModule->citeEngineCO, SIGNAL(activated(int)),
|
connect(biblioModule->citeEngineCO, SIGNAL(activated(int)),
|
||||||
this, SLOT(citeEngineChanged(int)));
|
this, SLOT(citeEngineChanged(int)));
|
||||||
connect(biblioModule->citeStyleCO, SIGNAL(activated(int)),
|
connect(biblioModule->citeStyleCO, SIGNAL(activated(int)),
|
||||||
this, SLOT(biblioChanged()));
|
this, SLOT(citeStyleChanged()));
|
||||||
connect(biblioModule->bibtopicCB, SIGNAL(clicked()),
|
connect(biblioModule->bibtopicCB, SIGNAL(clicked()),
|
||||||
this, SLOT(biblioChanged()));
|
this, SLOT(biblioChanged()));
|
||||||
connect(biblioModule->bibtexCO, SIGNAL(activated(int)),
|
connect(biblioModule->bibtexCO, SIGNAL(activated(int)),
|
||||||
this, SLOT(bibtexChanged(int)));
|
this, SLOT(bibtexChanged(int)));
|
||||||
connect(biblioModule->bibtexOptionsLE, SIGNAL(textChanged(QString)),
|
connect(biblioModule->bibtexOptionsLE, SIGNAL(textChanged(QString)),
|
||||||
this, SLOT(biblioChanged()));
|
this, SLOT(biblioChanged()));
|
||||||
connect(biblioModule->bibtexStyleLE, SIGNAL(textChanged(QString)),
|
connect(biblioModule->defaultBiblioCO, SIGNAL(activated(int)),
|
||||||
this, SLOT(biblioChanged()));
|
this, SLOT(biblioChanged()));
|
||||||
|
connect(biblioModule->defaultBiblioCO, SIGNAL(editTextChanged(QString)),
|
||||||
|
this, SLOT(biblioChanged()));
|
||||||
|
connect(biblioModule->defaultBiblioCO, SIGNAL(editTextChanged(QString)),
|
||||||
|
this, SLOT(updateResetDefaultBiblio()));
|
||||||
|
connect(biblioModule->rescanBibliosPB, SIGNAL(clicked()),
|
||||||
|
this, SLOT(rescanBibFiles()));
|
||||||
|
connect(biblioModule->resetDefaultBiblioPB, SIGNAL(clicked()),
|
||||||
|
this, SLOT(resetDefaultBibfile()));
|
||||||
|
|
||||||
biblioModule->citeEngineCO->clear();
|
biblioModule->citeEngineCO->clear();
|
||||||
for (LyXCiteEngine const & cet : theCiteEnginesList) {
|
for (LyXCiteEngine const & cet : theCiteEnginesList) {
|
||||||
@ -1150,8 +1158,8 @@ GuiDocument::GuiDocument(GuiView & lv)
|
|||||||
|
|
||||||
biblioModule->bibtexOptionsLE->setValidator(new NoNewLineValidator(
|
biblioModule->bibtexOptionsLE->setValidator(new NoNewLineValidator(
|
||||||
biblioModule->bibtexOptionsLE));
|
biblioModule->bibtexOptionsLE));
|
||||||
biblioModule->bibtexStyleLE->setValidator(new NoNewLineValidator(
|
biblioModule->defaultBiblioCO->lineEdit()->setValidator(new NoNewLineValidator(
|
||||||
biblioModule->bibtexStyleLE));
|
biblioModule->defaultBiblioCO->lineEdit()));
|
||||||
|
|
||||||
// NOTE: we do not provide "custom" here for security reasons!
|
// NOTE: we do not provide "custom" here for security reasons!
|
||||||
biblioModule->bibtexCO->clear();
|
biblioModule->bibtexCO->clear();
|
||||||
@ -2271,14 +2279,49 @@ void GuiDocument::biblioChanged()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiDocument::rescanBibFiles()
|
||||||
|
{
|
||||||
|
rescanTexStyles("bst");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiDocument::resetDefaultBibfile()
|
||||||
|
{
|
||||||
|
QString const engine =
|
||||||
|
biblioModule->citeEngineCO->itemData(
|
||||||
|
biblioModule->citeEngineCO->currentIndex()).toString();
|
||||||
|
|
||||||
|
CiteEngineType const cet =
|
||||||
|
CiteEngineType(biblioModule->citeStyleCO->itemData(
|
||||||
|
biblioModule->citeStyleCO->currentIndex()).toInt());
|
||||||
|
|
||||||
|
updateDefaultBiblio(theCiteEnginesList[fromqstr(engine)]->getDefaultBiblio(cet));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiDocument::citeEngineChanged(int n)
|
void GuiDocument::citeEngineChanged(int n)
|
||||||
{
|
{
|
||||||
QString const engine = biblioModule->citeEngineCO->itemData(n).toString();
|
QString const engine =
|
||||||
|
biblioModule->citeEngineCO->itemData(n).toString();
|
||||||
|
|
||||||
vector<string> const engs =
|
vector<string> const engs =
|
||||||
theCiteEnginesList[fromqstr(engine)]->getEngineType();
|
theCiteEnginesList[fromqstr(engine)]->getEngineType();
|
||||||
|
|
||||||
updateCiteStyles(engs);
|
updateCiteStyles(engs);
|
||||||
|
resetDefaultBibfile();
|
||||||
|
|
||||||
|
biblioChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiDocument::citeStyleChanged()
|
||||||
|
{
|
||||||
|
QString const engine =
|
||||||
|
biblioModule->citeEngineCO->itemData(
|
||||||
|
biblioModule->citeEngineCO->currentIndex()).toString();
|
||||||
|
if (theCiteEnginesList[fromqstr(engine)]->isDefaultBiblio(
|
||||||
|
fromqstr(biblioModule->defaultBiblioCO->currentText())))
|
||||||
|
resetDefaultBibfile();
|
||||||
|
|
||||||
biblioChanged();
|
biblioChanged();
|
||||||
}
|
}
|
||||||
@ -2292,24 +2335,6 @@ void GuiDocument::bibtexChanged(int n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiDocument::setAuthorYear(bool authoryear)
|
|
||||||
{
|
|
||||||
if (authoryear)
|
|
||||||
biblioModule->citeStyleCO->setCurrentIndex(
|
|
||||||
biblioModule->citeStyleCO->findData(ENGINE_TYPE_AUTHORYEAR));
|
|
||||||
biblioChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GuiDocument::setNumerical(bool numerical)
|
|
||||||
{
|
|
||||||
if (numerical)
|
|
||||||
biblioModule->citeStyleCO->setCurrentIndex(
|
|
||||||
biblioModule->citeStyleCO->findData(ENGINE_TYPE_NUMERICAL));
|
|
||||||
biblioChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GuiDocument::updateCiteStyles(vector<string> const & engs, CiteEngineType const & sel)
|
void GuiDocument::updateCiteStyles(vector<string> const & engs, CiteEngineType const & sel)
|
||||||
{
|
{
|
||||||
biblioModule->citeStyleCO->clear();
|
biblioModule->citeStyleCO->clear();
|
||||||
@ -2617,7 +2642,7 @@ void GuiDocument::applyView()
|
|||||||
bp_.use_bibtopic =
|
bp_.use_bibtopic =
|
||||||
biblioModule->bibtopicCB->isChecked();
|
biblioModule->bibtopicCB->isChecked();
|
||||||
|
|
||||||
bp_.biblio_style = fromqstr(biblioModule->bibtexStyleLE->text());
|
bp_.biblio_style = fromqstr(biblioModule->defaultBiblioCO->currentText());
|
||||||
|
|
||||||
string const bibtex_command =
|
string const bibtex_command =
|
||||||
fromqstr(biblioModule->bibtexCO->itemData(
|
fromqstr(biblioModule->bibtexCO->itemData(
|
||||||
@ -3040,7 +3065,7 @@ void GuiDocument::paramsToDialog()
|
|||||||
biblioModule->bibtopicCB->setChecked(
|
biblioModule->bibtopicCB->setChecked(
|
||||||
bp_.use_bibtopic);
|
bp_.use_bibtopic);
|
||||||
|
|
||||||
biblioModule->bibtexStyleLE->setText(toqstr(bp_.biblio_style));
|
updateDefaultBiblio(bp_.defaultBiblioStyle());
|
||||||
|
|
||||||
string command;
|
string command;
|
||||||
string options =
|
string options =
|
||||||
@ -3626,6 +3651,59 @@ void GuiDocument::updateIncludeonlys()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiDocument::updateDefaultBiblio(string const & style)
|
||||||
|
{
|
||||||
|
QString const bibstyle = toqstr(style);
|
||||||
|
biblioModule->defaultBiblioCO->clear();
|
||||||
|
|
||||||
|
int item_nr = -1;
|
||||||
|
|
||||||
|
QStringList str = texFileList("bstFiles.lst");
|
||||||
|
// test whether we have a valid list, otherwise run rescan
|
||||||
|
if (str.isEmpty()) {
|
||||||
|
rescanTexStyles("bst");
|
||||||
|
str = texFileList("bstFiles.lst");
|
||||||
|
}
|
||||||
|
for (int i = 0; i != str.size(); ++i)
|
||||||
|
str[i] = onlyFileName(str[i]);
|
||||||
|
// sort on filename only (no path)
|
||||||
|
str.sort();
|
||||||
|
|
||||||
|
for (int i = 0; i != str.count(); ++i) {
|
||||||
|
QString item = changeExtension(str[i], "");
|
||||||
|
if (item == bibstyle)
|
||||||
|
item_nr = i;
|
||||||
|
biblioModule->defaultBiblioCO->addItem(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item_nr == -1 && !bibstyle.isEmpty()) {
|
||||||
|
biblioModule->defaultBiblioCO->addItem(bibstyle);
|
||||||
|
item_nr = biblioModule->defaultBiblioCO->count() - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item_nr != -1)
|
||||||
|
biblioModule->defaultBiblioCO->setCurrentIndex(item_nr);
|
||||||
|
else
|
||||||
|
biblioModule->defaultBiblioCO->clearEditText();
|
||||||
|
|
||||||
|
updateResetDefaultBiblio();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiDocument::updateResetDefaultBiblio()
|
||||||
|
{
|
||||||
|
QString const engine =
|
||||||
|
biblioModule->citeEngineCO->itemData(
|
||||||
|
biblioModule->citeEngineCO->currentIndex()).toString();
|
||||||
|
CiteEngineType const cet =
|
||||||
|
CiteEngineType(biblioModule->citeStyleCO->itemData(
|
||||||
|
biblioModule->citeStyleCO->currentIndex()).toInt());
|
||||||
|
biblioModule->resetDefaultBiblioPB->setEnabled(
|
||||||
|
theCiteEnginesList[fromqstr(engine)]->getDefaultBiblio(cet)
|
||||||
|
!= fromqstr(biblioModule->defaultBiblioCO->currentText()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiDocument::updateContents()
|
void GuiDocument::updateContents()
|
||||||
{
|
{
|
||||||
// Nothing to do here as the document settings is not cursor dependant.
|
// Nothing to do here as the document settings is not cursor dependant.
|
||||||
|
@ -115,10 +115,12 @@ private Q_SLOTS:
|
|||||||
void classChanged_adaptor();
|
void classChanged_adaptor();
|
||||||
void languagePackageChanged(int);
|
void languagePackageChanged(int);
|
||||||
void biblioChanged();
|
void biblioChanged();
|
||||||
|
void rescanBibFiles();
|
||||||
|
void resetDefaultBibfile();
|
||||||
void citeEngineChanged(int);
|
void citeEngineChanged(int);
|
||||||
|
void citeStyleChanged();
|
||||||
void bibtexChanged(int);
|
void bibtexChanged(int);
|
||||||
void setAuthorYear(bool);
|
void updateResetDefaultBiblio();
|
||||||
void setNumerical(bool);
|
|
||||||
void updateModuleInfo();
|
void updateModuleInfo();
|
||||||
void modulesChanged();
|
void modulesChanged();
|
||||||
void changeBackgroundColor();
|
void changeBackgroundColor();
|
||||||
@ -181,6 +183,8 @@ private:
|
|||||||
void updateSelectedModules();
|
void updateSelectedModules();
|
||||||
///
|
///
|
||||||
void updateIncludeonlys();
|
void updateIncludeonlys();
|
||||||
|
///
|
||||||
|
void updateDefaultBiblio(std::string const & style);
|
||||||
/// save as default template
|
/// save as default template
|
||||||
void saveDocDefault();
|
void saveDocDefault();
|
||||||
/// reset to default params
|
/// reset to default params
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>418</width>
|
<width>475</width>
|
||||||
<height>394</height>
|
<height>394</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -46,7 +46,7 @@
|
|||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Sty&le Engine:</string>
|
<string>Sty&le engine:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy">
|
<property name="buddy">
|
||||||
<cstring>citeEngineCO</cstring>
|
<cstring>citeEngineCO</cstring>
|
||||||
@ -116,27 +116,6 @@
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_1">
|
<layout class="QGridLayout" name="gridLayout_1">
|
||||||
<item row="0" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_1">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="bibtexStyleLA">
|
|
||||||
<property name="text">
|
|
||||||
<string>Default st&yle:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>bibtexStyleLE</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="bibtexStyleLE">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Define the default BibTeX style</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QCheckBox" name="bibtopicCB">
|
<widget class="QCheckBox" name="bibtopicCB">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@ -147,6 +126,63 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_1">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="bibtexStyleLA">
|
||||||
|
<property name="text">
|
||||||
|
<string>Default BibTeX st&yle:</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>defaultBiblioCO</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="defaultBiblioCO">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Here, you can define a BibTeX style that is suggested in the BibTeX dialog by default</string>
|
||||||
|
</property>
|
||||||
|
<property name="editable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="rescanBibliosPB">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Rescan style files</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Re&scan</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="resetDefaultBiblioPB">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Reset to the preset default</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Reset</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -328,7 +328,7 @@ void InsetBibtex::latex(otexstream & os, OutputParams const & runparams) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (style == "default")
|
if (style == "default")
|
||||||
style = buffer().params().biblio_style;
|
style = buffer().params().defaultBiblioStyle();
|
||||||
|
|
||||||
if (!style.empty() && !buffer().params().use_bibtopic) {
|
if (!style.empty() && !buffer().params().use_bibtopic) {
|
||||||
string base = normalizeName(buffer(), runparams, style, ".bst");
|
string base = normalizeName(buffer(), runparams, style, ".bst");
|
||||||
|
Loading…
Reference in New Issue
Block a user