mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
Remove extra whitespace.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40346 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3e0568817f
commit
dfdcc56cba
@ -82,7 +82,7 @@ docstring familyName(docstring const & name)
|
||||
for (; it != en; ++it) {
|
||||
if (!first)
|
||||
retval += " ";
|
||||
else
|
||||
else
|
||||
first = false;
|
||||
retval += *it;
|
||||
}
|
||||
@ -109,7 +109,7 @@ docstring convertLaTeXCommands(docstring const & str)
|
||||
escaped = false;
|
||||
else if (ch == '\\')
|
||||
escaped = true;
|
||||
else if (ch == '$')
|
||||
else if (ch == '$')
|
||||
scanning_math = false;
|
||||
ret += ch;
|
||||
val = val.substr(1);
|
||||
@ -216,7 +216,7 @@ docstring const BibTeXInfo::getAbbreviatedAuthor() const
|
||||
docstring authors;
|
||||
docstring const remainder = trim(split(opt, authors, '('));
|
||||
if (remainder.empty())
|
||||
// in this case, we didn't find a "(",
|
||||
// in this case, we didn't find a "(",
|
||||
// so we don't have author (year)
|
||||
return docstring();
|
||||
return authors;
|
||||
@ -231,7 +231,7 @@ docstring const BibTeXInfo::getAbbreviatedAuthor() const
|
||||
|
||||
// FIXME Move this to a separate routine that can
|
||||
// be called from elsewhere.
|
||||
//
|
||||
//
|
||||
// OK, we've got some names. Let's format them.
|
||||
// Try to split the author list on " and "
|
||||
vector<docstring> const authors =
|
||||
@ -250,7 +250,7 @@ docstring const BibTeXInfo::getAbbreviatedAuthor() const
|
||||
|
||||
docstring const BibTeXInfo::getYear() const
|
||||
{
|
||||
if (is_bibtex_)
|
||||
if (is_bibtex_)
|
||||
return operator[]("year");
|
||||
|
||||
docstring const opt = label();
|
||||
@ -259,7 +259,7 @@ docstring const BibTeXInfo::getYear() const
|
||||
|
||||
docstring authors;
|
||||
docstring tmp = split(opt, authors, '(');
|
||||
if (tmp.empty())
|
||||
if (tmp.empty())
|
||||
// we don't have author (year)
|
||||
return docstring();
|
||||
docstring year;
|
||||
@ -277,7 +277,7 @@ docstring const BibTeXInfo::getXRef() const
|
||||
|
||||
|
||||
namespace {
|
||||
string parseOptions(string const & format, string & optkey,
|
||||
string parseOptions(string const & format, string & optkey,
|
||||
string & ifpart, string & elsepart);
|
||||
|
||||
// Calls parseOptions to deal with an embedded option, such as:
|
||||
@ -300,9 +300,9 @@ namespace {
|
||||
ifelsepart = format.substr(0, format.size() - rest.size());
|
||||
return rest;
|
||||
}
|
||||
|
||||
|
||||
// Gets a "clause" from a format string, where the clause is
|
||||
|
||||
|
||||
// Gets a "clause" from a format string, where the clause is
|
||||
// delimited by '[[' and ']]'. Returns what is left after the
|
||||
// clause is removed, and returns format if there is an error.
|
||||
string getClause(string const & format, string & clause)
|
||||
@ -310,9 +310,9 @@ namespace {
|
||||
string fmt = format;
|
||||
// remove '[['
|
||||
fmt = fmt.substr(2);
|
||||
// we'll remove characters from the front of fmt as we
|
||||
// we'll remove characters from the front of fmt as we
|
||||
// deal with them
|
||||
while (fmt.size()) {
|
||||
while (fmt.size()) {
|
||||
if (fmt[0] == ']' && fmt.size() > 1 && fmt[1] == ']') {
|
||||
// that's the end
|
||||
fmt = fmt.substr(2);
|
||||
@ -341,8 +341,8 @@ namespace {
|
||||
// format parameter. puts the parsed bits in optkey, ifpart, and
|
||||
// elsepart and returns what's left after the option is removed.
|
||||
// if there's an error, it returns format itself.
|
||||
string parseOptions(string const & format, string & optkey,
|
||||
string & ifpart, string & elsepart)
|
||||
string parseOptions(string const & format, string & optkey,
|
||||
string & ifpart, string & elsepart)
|
||||
{
|
||||
LASSERT(format[0] == '{' && format[1] == '%', return format);
|
||||
// strip '{%'
|
||||
@ -369,13 +369,13 @@ namespace {
|
||||
|
||||
if (fmt[0] == '}') // we're done, no else clause
|
||||
return fmt.substr(1);
|
||||
|
||||
|
||||
// else part should follow
|
||||
if (fmt[0] != '[' || fmt[1] != '[') {
|
||||
LYXERR0("Error parsing `" << format <<"'. Can't find else clause.");
|
||||
return format;
|
||||
}
|
||||
|
||||
|
||||
curfmt = fmt;
|
||||
fmt = getClause(curfmt, elsepart);
|
||||
// we should be done
|
||||
@ -389,8 +389,8 @@ namespace {
|
||||
} // anon namespace
|
||||
|
||||
|
||||
docstring BibTeXInfo::expandFormat(string const & format,
|
||||
BibTeXInfo const * const xref, int & counter, Buffer const & buf,
|
||||
docstring BibTeXInfo::expandFormat(string const & format,
|
||||
BibTeXInfo const * const xref, int & counter, Buffer const & buf,
|
||||
bool richtext) const
|
||||
{
|
||||
// incorrect use of macros could put us in an infinite loop
|
||||
@ -401,33 +401,33 @@ docstring BibTeXInfo::expandFormat(string const & format,
|
||||
bool scanning_rich = false;
|
||||
|
||||
string fmt = format;
|
||||
// we'll remove characters from the front of fmt as we
|
||||
// we'll remove characters from the front of fmt as we
|
||||
// deal with them
|
||||
while (fmt.size()) {
|
||||
if (counter++ > max_passes) {
|
||||
LYXERR0("Recursion limit reached while parsing `"
|
||||
LYXERR0("Recursion limit reached while parsing `"
|
||||
<< format << "'.");
|
||||
return _("ERROR!");
|
||||
}
|
||||
|
||||
|
||||
char_type thischar = fmt[0];
|
||||
if (thischar == '%') {
|
||||
if (thischar == '%') {
|
||||
// beginning or end of key
|
||||
if (scanning_key) {
|
||||
if (scanning_key) {
|
||||
// end of key
|
||||
scanning_key = false;
|
||||
// so we replace the key with its value, which may be empty
|
||||
if (key[0] == '!') {
|
||||
// macro
|
||||
string const val =
|
||||
string const val =
|
||||
buf.params().documentClass().getCiteMacro(key);
|
||||
fmt = val + fmt.substr(1);
|
||||
continue;
|
||||
} else if (key[0] == '_') {
|
||||
// a translatable bit
|
||||
string const val =
|
||||
string const val =
|
||||
buf.params().documentClass().getCiteMacro(key);
|
||||
docstring const trans =
|
||||
docstring const trans =
|
||||
translateIfPossible(from_utf8(val), buf.params().language->code());
|
||||
ret += trans;
|
||||
} else {
|
||||
@ -440,7 +440,7 @@ docstring BibTeXInfo::expandFormat(string const & format,
|
||||
scanning_key = true;
|
||||
}
|
||||
}
|
||||
else if (thischar == '{') {
|
||||
else if (thischar == '{') {
|
||||
// beginning of option?
|
||||
if (scanning_key) {
|
||||
LYXERR0("ERROR: Found `{' when scanning key in `" << format << "'.");
|
||||
@ -452,7 +452,7 @@ docstring BibTeXInfo::expandFormat(string const & format,
|
||||
string optkey;
|
||||
string ifpart;
|
||||
string elsepart;
|
||||
string const newfmt =
|
||||
string const newfmt =
|
||||
parseOptions(fmt, optkey, ifpart, elsepart);
|
||||
if (newfmt == fmt) // parse error
|
||||
return _("ERROR!");
|
||||
@ -463,7 +463,7 @@ docstring BibTeXInfo::expandFormat(string const & format,
|
||||
else if (!elsepart.empty())
|
||||
ret += expandFormat(elsepart, xref, counter, buf, richtext);
|
||||
// fmt will have been shortened for us already
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
if (fmt[1] == '!') {
|
||||
// beginning of rich text
|
||||
@ -472,11 +472,11 @@ docstring BibTeXInfo::expandFormat(string const & format,
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// we are here if '{' was not followed by % or !.
|
||||
// we are here if '{' was not followed by % or !.
|
||||
// So it's just a character.
|
||||
ret += thischar;
|
||||
}
|
||||
else if (scanning_rich && thischar == '!'
|
||||
else if (scanning_rich && thischar == '!'
|
||||
&& fmt.size() > 1 && fmt[1] == '}') {
|
||||
// end of rich text
|
||||
scanning_rich = false;
|
||||
@ -494,9 +494,9 @@ docstring BibTeXInfo::expandFormat(string const & format,
|
||||
ret += "<";
|
||||
else if (thischar == '>')
|
||||
ret += ">";
|
||||
else
|
||||
else
|
||||
ret += thischar;
|
||||
}
|
||||
}
|
||||
} else if (!scanning_rich /* && !richtext */)
|
||||
ret += thischar;
|
||||
// else the character is discarded, which will happen only if
|
||||
@ -546,15 +546,15 @@ docstring const & BibTeXInfo::operator[](docstring const & field) const
|
||||
static docstring const empty_value = docstring();
|
||||
return empty_value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
docstring const & BibTeXInfo::operator[](string const & field) const
|
||||
{
|
||||
return operator[](from_ascii(field));
|
||||
}
|
||||
|
||||
|
||||
docstring BibTeXInfo::getValueForKey(string const & key,
|
||||
docstring BibTeXInfo::getValueForKey(string const & key,
|
||||
BibTeXInfo const * const xref) const
|
||||
{
|
||||
docstring const ret = operator[](key);
|
||||
@ -661,7 +661,7 @@ docstring const BiblioInfo::getYear(docstring const & key, bool use_modifier) co
|
||||
}
|
||||
|
||||
|
||||
docstring const BiblioInfo::getInfo(docstring const & key,
|
||||
docstring const BiblioInfo::getInfo(docstring const & key,
|
||||
Buffer const & buf, bool richtext) const
|
||||
{
|
||||
BiblioInfo::const_iterator it = find(key);
|
||||
@ -712,7 +712,7 @@ vector<docstring> const BiblioInfo::getNumericalStrings(
|
||||
return vector<docstring>();
|
||||
|
||||
vector<CiteStyle> const & styles = citeStyles(buf.params().citeEngine());
|
||||
|
||||
|
||||
vector<docstring> vec(styles.size());
|
||||
for (size_t i = 0; i != vec.size(); ++i) {
|
||||
docstring str;
|
||||
@ -771,7 +771,7 @@ vector<docstring> const BiblioInfo::getAuthorYearStrings(
|
||||
return vector<docstring>();
|
||||
|
||||
vector<CiteStyle> const & styles = citeStyles(buf.params().citeEngine());
|
||||
|
||||
|
||||
vector<docstring> vec(styles.size());
|
||||
for (size_t i = 0; i != vec.size(); ++i) {
|
||||
docstring str;
|
||||
@ -865,9 +865,9 @@ void BiblioInfo::collectCitedEntries(Buffer const & buf)
|
||||
}
|
||||
if (citekeys.empty())
|
||||
return;
|
||||
|
||||
|
||||
// We have a set of the keys used in this document.
|
||||
// We will now convert it to a list of the BibTeXInfo objects used in
|
||||
// We will now convert it to a list of the BibTeXInfo objects used in
|
||||
// this document...
|
||||
vector<BibTeXInfo const *> bi;
|
||||
set<docstring>::const_iterator cit = citekeys.begin();
|
||||
@ -880,7 +880,7 @@ void BiblioInfo::collectCitedEntries(Buffer const & buf)
|
||||
}
|
||||
// ...and sort it.
|
||||
sort(bi.begin(), bi.end(), lSorter);
|
||||
|
||||
|
||||
// Now we can write the sorted keys
|
||||
vector<BibTeXInfo const *>::const_iterator bit = bi.begin();
|
||||
vector<BibTeXInfo const *>::const_iterator ben = bi.end();
|
||||
@ -893,7 +893,7 @@ void BiblioInfo::makeCitationLabels(Buffer const & buf)
|
||||
{
|
||||
collectCitedEntries(buf);
|
||||
CiteEngine const engine = buf.params().citeEngine();
|
||||
bool const numbers =
|
||||
bool const numbers =
|
||||
(engine == ENGINE_BASIC || engine == ENGINE_NATBIB_NUMERICAL);
|
||||
|
||||
int keynumber = 0;
|
||||
@ -932,7 +932,7 @@ void BiblioInfo::makeCitationLabels(Buffer const & buf)
|
||||
} else {
|
||||
modifier = 0;
|
||||
}
|
||||
entry.setModifier(modifier);
|
||||
entry.setModifier(modifier);
|
||||
// remember the last one
|
||||
last = biit;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
|
||||
class Buffer;
|
||||
|
||||
/// FIXME: To Citation.cpp?
|
||||
@ -43,7 +43,7 @@ std::string citationStyleToString(CitationStyle const &);
|
||||
/// std::map.
|
||||
class BibTeXInfo {
|
||||
public:
|
||||
/// The keys are BibTeX fields (e.g., author, title, etc),
|
||||
/// The keys are BibTeX fields (e.g., author, title, etc),
|
||||
/// and the values are the associated field values.
|
||||
typedef std::map<docstring, docstring>::const_iterator const_iterator;
|
||||
///
|
||||
@ -55,7 +55,7 @@ public:
|
||||
BibTeXInfo(docstring const & key, docstring const & type);
|
||||
/// \return the short form of an authorlist
|
||||
docstring const getAbbreviatedAuthor() const;
|
||||
///
|
||||
///
|
||||
docstring const getYear() const;
|
||||
///
|
||||
docstring const getXRef() const;
|
||||
@ -69,7 +69,7 @@ public:
|
||||
const_iterator end() const { return bimap_.end(); }
|
||||
/// \return value for field f
|
||||
/// note that this will create an empty field if it does not exist
|
||||
docstring & operator[](docstring const & f)
|
||||
docstring & operator[](docstring const & f)
|
||||
{ return bimap_[f]; }
|
||||
/// \return value for field f
|
||||
/// this one, since it is const, will simply return docstring() if
|
||||
@ -92,20 +92,20 @@ public:
|
||||
docstring citeNumber() const { return cite_number_; }
|
||||
///
|
||||
void setCiteNumber(docstring const & num) { cite_number_ = num; }
|
||||
/// a,b,c, etc, for author-year. currently used only by XHTML
|
||||
/// a,b,c, etc, for author-year. currently used only by XHTML
|
||||
/// output routines.
|
||||
char modifier() const { return modifier_; }
|
||||
///
|
||||
void setModifier(char c) { modifier_ = c; }
|
||||
///
|
||||
docstring entryType() const { return entry_type_; }
|
||||
///
|
||||
///
|
||||
bool isBibTeX() const { return is_bibtex_; }
|
||||
private:
|
||||
/// like operator[], except, if the field is empty, it will attempt
|
||||
/// to get the data from xref BibTeXInfo object, which would normally
|
||||
/// be the one referenced in the crossref field.
|
||||
docstring getValueForKey(std::string const & key,
|
||||
docstring getValueForKey(std::string const & key,
|
||||
BibTeXInfo const * const xref = 0) const;
|
||||
/// replace %keys% in a format string with their values
|
||||
/// called from getInfo()
|
||||
@ -114,7 +114,7 @@ private:
|
||||
/// {%key%[[format]]}, which prints format if key is non-empty
|
||||
/// the latter may optionally contain an `else' clause as well:
|
||||
/// {%key%[[if format]][[else format]]}
|
||||
/// material intended only for rich text (HTML) output should be
|
||||
/// material intended only for rich text (HTML) output should be
|
||||
/// wrapped in "{!" and "!}". it will be removed if richtext is
|
||||
/// false.
|
||||
/// a simple macro facility is also available. keys that look like
|
||||
@ -122,7 +122,7 @@ private:
|
||||
/// moreover, keys that look like "%_key%" are treated as translatable
|
||||
/// so that things like "pp." and "vol." can be translated.
|
||||
docstring expandFormat(std::string const & fmt,
|
||||
BibTeXInfo const * const xref, int & counter,
|
||||
BibTeXInfo const * const xref, int & counter,
|
||||
Buffer const & buf, bool richtext) const;
|
||||
/// true if from BibTeX; false if from bibliography environment
|
||||
bool is_bibtex_;
|
||||
@ -138,7 +138,7 @@ private:
|
||||
docstring entry_type_;
|
||||
/// a cache for getInfo()
|
||||
mutable docstring info_;
|
||||
///
|
||||
///
|
||||
docstring cite_number_;
|
||||
///
|
||||
char modifier_;
|
||||
@ -165,13 +165,13 @@ public:
|
||||
/// if \param use_modifier is true, then we will also append any
|
||||
/// modifier for this entry (e.g., 1998b).
|
||||
/// Note that this will get the year from the crossref if it's
|
||||
/// not present in the record itself.
|
||||
/// not present in the record itself.
|
||||
docstring const getYear(docstring const & key,
|
||||
bool use_modifier = false) const;
|
||||
///
|
||||
docstring const getCiteNumber(docstring const & key) const;
|
||||
/// \return formatted BibTeX data associated with a given key.
|
||||
/// Empty if no info exists.
|
||||
/// Empty if no info exists.
|
||||
/// Note that this will retrieve data from the crossref as needed.
|
||||
/// If \param richtext is true, then it will output any richtext tags
|
||||
/// marked in the citation format and escape < and > elsewhere.
|
||||
@ -213,9 +213,9 @@ public:
|
||||
void collectCitedEntries(Buffer const & buf);
|
||||
/// A list of BibTeX keys cited in the current document, sorted by
|
||||
/// the last name of the author.
|
||||
/// Make sure you have called collectCitedEntries() before you try to
|
||||
/// Make sure you have called collectCitedEntries() before you try to
|
||||
/// use this. You should probably call it just before you use this.
|
||||
std::vector<docstring> const & citedEntries() const
|
||||
std::vector<docstring> const & citedEntries() const
|
||||
{ return cited_entries_; }
|
||||
///
|
||||
void makeCitationLabels(Buffer const & buf);
|
||||
@ -246,7 +246,7 @@ private:
|
||||
std::map<docstring, BibTeXInfo> bimap_;
|
||||
/// a possibly sorted list of entries cited in our Buffer.
|
||||
/// do not try to make this a vector<BibTeXInfo *> or anything of
|
||||
/// the sort, because reloads will invalidate those pointers.
|
||||
/// the sort, because reloads will invalidate those pointers.
|
||||
std::vector<docstring> cited_entries_;
|
||||
};
|
||||
|
||||
|
146
src/Buffer.cpp
146
src/Buffer.cpp
@ -160,7 +160,7 @@ public:
|
||||
}
|
||||
delete inset;
|
||||
}
|
||||
|
||||
|
||||
/// search for macro in local (buffer) table or in children
|
||||
MacroData const * getBufferMacro(docstring const & name,
|
||||
DocIterator const & pos) const;
|
||||
@ -276,7 +276,7 @@ public:
|
||||
|
||||
/// This is here to force the test to be done whenever parent_buffer
|
||||
/// is accessed.
|
||||
Buffer const * parent() const {
|
||||
Buffer const * parent() const {
|
||||
// if parent_buffer is not loaded, then it has been unloaded,
|
||||
// which means that parent_buffer is an invalid pointer. So we
|
||||
// set it to null in that case.
|
||||
@ -285,9 +285,9 @@ public:
|
||||
// for the best.
|
||||
if (!cloned_buffer_ && !theBufferList().isLoaded(parent_buffer))
|
||||
parent_buffer = 0;
|
||||
return parent_buffer;
|
||||
return parent_buffer;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
void setParent(Buffer const * pb) {
|
||||
if (parent_buffer == pb)
|
||||
@ -309,7 +309,7 @@ public:
|
||||
CloneList * clone_list_;
|
||||
/// are we in the process of exporting this buffer?
|
||||
mutable bool doing_export;
|
||||
|
||||
|
||||
private:
|
||||
/// So we can force access via the accessors.
|
||||
mutable Buffer const * parent_buffer;
|
||||
@ -341,8 +341,8 @@ Buffer::Impl::Impl(Buffer * owner, FileName const & file, bool readonly_,
|
||||
: owner_(owner), lyx_clean(true), bak_clean(true), unnamed(false),
|
||||
read_only(readonly_), filename(file), file_fully_loaded(false),
|
||||
toc_backend(owner), macro_lock(false), timestamp_(0), checksum_(0),
|
||||
wa_(0), gui_(0), undo_(*owner), bibinfo_cache_valid_(false),
|
||||
bibfile_cache_valid_(false), cite_labels_valid_(false),
|
||||
wa_(0), gui_(0), undo_(*owner), bibinfo_cache_valid_(false),
|
||||
bibfile_cache_valid_(false), cite_labels_valid_(false),
|
||||
preview_loader_(0), cloned_buffer_(cloned_buffer), clone_list_(0),
|
||||
doing_export(false), parent_buffer(0)
|
||||
{
|
||||
@ -419,7 +419,7 @@ Buffer::~Buffer()
|
||||
// if this is not empty, we have leaked something. worse, one of the
|
||||
// children still has a reference to this list.
|
||||
LASSERT(d->clone_list_->empty(), /* */);
|
||||
list<CloneList *>::iterator it =
|
||||
list<CloneList *>::iterator it =
|
||||
find(cloned_buffers.begin(), cloned_buffers.end(), d->clone_list_);
|
||||
LASSERT(it != cloned_buffers.end(), /* */);
|
||||
cloned_buffers.erase(it);
|
||||
@ -860,7 +860,7 @@ bool Buffer::readDocument(Lexer & lex)
|
||||
FileName const master_file = makeAbsPath(params().master,
|
||||
onlyPath(absFileName()));
|
||||
if (isLyXFileName(master_file.absFileName())) {
|
||||
Buffer * master =
|
||||
Buffer * master =
|
||||
checkAndLoadLyXFile(master_file, true);
|
||||
if (master) {
|
||||
// necessary e.g. after a reload
|
||||
@ -885,7 +885,7 @@ bool Buffer::readDocument(Lexer & lex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// assure we have a default index
|
||||
params().indiceslist().addDefault(B_("Index"));
|
||||
|
||||
@ -942,7 +942,7 @@ Buffer::ReadStatus Buffer::readFile(FileName const & fn)
|
||||
Lexer lex;
|
||||
if (!lex.setFile(fname)) {
|
||||
Alert::error(_("File Not Found"),
|
||||
bformat(_("Unable to open file `%1$s'."),
|
||||
bformat(_("Unable to open file `%1$s'."),
|
||||
from_utf8(fn.absFileName())));
|
||||
return ReadFileNotFound;
|
||||
}
|
||||
@ -960,7 +960,7 @@ Buffer::ReadStatus Buffer::readFile(FileName const & fn)
|
||||
return readFile(tmpFile);
|
||||
}
|
||||
|
||||
// FIXME: InsetInfo needs to know whether the file is under VCS
|
||||
// FIXME: InsetInfo needs to know whether the file is under VCS
|
||||
// during the parse process, so this has to be done before.
|
||||
lyxvc().file_found_hook(d->filename);
|
||||
|
||||
@ -1032,7 +1032,7 @@ Buffer::ReadStatus Buffer::parseLyXFormat(Lexer & lex,
|
||||
bformat(_("%1$s is not a readable LyX document."),
|
||||
from_utf8(fn.absFileName())));
|
||||
return ReadNoLyXFormat;
|
||||
}
|
||||
}
|
||||
|
||||
string tmp_format;
|
||||
lex >> tmp_format;
|
||||
@ -1049,7 +1049,7 @@ Buffer::ReadStatus Buffer::parseLyXFormat(Lexer & lex,
|
||||
}
|
||||
|
||||
|
||||
Buffer::ReadStatus Buffer::convertLyXFormat(FileName const & fn,
|
||||
Buffer::ReadStatus Buffer::convertLyXFormat(FileName const & fn,
|
||||
FileName & tmpfile, int from_format)
|
||||
{
|
||||
tmpfile = FileName::tempName("Buffer_convertLyXFormat");
|
||||
@ -1127,7 +1127,7 @@ bool Buffer::save() const
|
||||
|
||||
// ask if the disk file has been externally modified (use checksum method)
|
||||
if (fileName().exists() && isExternallyModified(checksum_method)) {
|
||||
docstring text =
|
||||
docstring text =
|
||||
bformat(_("Document %1$s has been externally modified. "
|
||||
"Are you sure you want to overwrite this file?"), file);
|
||||
int const ret = Alert::prompt(_("Overwrite modified file?"),
|
||||
@ -1557,7 +1557,7 @@ void Buffer::writeLaTeXSource(otexstream & os,
|
||||
int num_lines = (*it)->write(os.os(), true);
|
||||
os.texrow().newlines(num_lines);
|
||||
}
|
||||
|
||||
|
||||
} // output_preamble
|
||||
|
||||
os.texrow().start(paragraphs().begin()->id(), 0);
|
||||
@ -1688,18 +1688,18 @@ void Buffer::writeDocBookSource(odocstream & os, string const & fname,
|
||||
else
|
||||
top += params().language->code().substr(0, 2);
|
||||
top += '"';
|
||||
|
||||
|
||||
if (!params().options.empty()) {
|
||||
top += ' ';
|
||||
top += params().options;
|
||||
}
|
||||
|
||||
|
||||
os << "<!-- " << ((runparams.flavor == OutputParams::XML)? "XML" : "SGML")
|
||||
<< " file was created by LyX " << lyx_version
|
||||
<< "\n See http://www.lyx.org/ for more information -->\n";
|
||||
|
||||
|
||||
params().documentClass().counters().reset();
|
||||
|
||||
|
||||
sgml::openTag(os, top);
|
||||
os << '\n';
|
||||
docbookParagraphs(text(), *this, os, runparams);
|
||||
@ -1755,8 +1755,8 @@ void Buffer::writeLyXHTMLSource(odocstream & os,
|
||||
|
||||
docstring const & doctitle = features.htmlTitle();
|
||||
os << "<title>"
|
||||
<< (doctitle.empty() ?
|
||||
from_ascii("LyX Document") :
|
||||
<< (doctitle.empty() ?
|
||||
from_ascii("LyX Document") :
|
||||
html::htmlize(doctitle, XHTMLStream::ESCAPE_ALL))
|
||||
<< "</title>\n";
|
||||
|
||||
@ -2127,7 +2127,7 @@ void Buffer::dispatch(string const & command, DispatchResult & result)
|
||||
|
||||
|
||||
// NOTE We can end up here even if we have no GUI, because we are called
|
||||
// by LyX::exec to handled command-line requests. So we may need to check
|
||||
// by LyX::exec to handled command-line requests. So we may need to check
|
||||
// whether we have a GUI or not. The boolean use_gui holds this information.
|
||||
void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
|
||||
{
|
||||
@ -2154,7 +2154,7 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
|
||||
ExportStatus const status = doExport(argument, false);
|
||||
dr.setError(status != ExportSuccess);
|
||||
if (status != ExportSuccess)
|
||||
dr.setMessage(bformat(_("Error exporting to format: %1$s."),
|
||||
dr.setMessage(bformat(_("Error exporting to format: %1$s."),
|
||||
func.argument()));
|
||||
break;
|
||||
}
|
||||
@ -2253,7 +2253,7 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_BRANCHES_RENAME: {
|
||||
case LFUN_BRANCHES_RENAME: {
|
||||
if (func.argument().empty())
|
||||
break;
|
||||
|
||||
@ -2292,7 +2292,7 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
|
||||
|
||||
case LFUN_BUFFER_PRINT: {
|
||||
// we'll assume there's a problem until we succeed
|
||||
dr.setError(true);
|
||||
dr.setError(true);
|
||||
string target = func.getArg(0);
|
||||
string target_name = func.getArg(1);
|
||||
string command = func.getArg(2);
|
||||
@ -2301,14 +2301,14 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
|
||||
|| target_name.empty()
|
||||
|| command.empty()) {
|
||||
LYXERR0("Unable to parse " << func.argument());
|
||||
docstring const msg =
|
||||
docstring const msg =
|
||||
bformat(_("Unable to parse \"%1$s\""), func.argument());
|
||||
dr.setMessage(msg);
|
||||
break;
|
||||
}
|
||||
if (target != "printer" && target != "file") {
|
||||
LYXERR0("Unrecognized target \"" << target << '"');
|
||||
docstring const msg =
|
||||
docstring const msg =
|
||||
bformat(_("Unrecognized target \"%1$s\""), from_utf8(target));
|
||||
dr.setMessage(msg);
|
||||
break;
|
||||
@ -2398,7 +2398,7 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
|
||||
res = one.startscript(stype, command, filePath());
|
||||
}
|
||||
|
||||
if (res == 0)
|
||||
if (res == 0)
|
||||
dr.setError(false);
|
||||
else {
|
||||
dr.setMessage(_("Error running external commands."));
|
||||
@ -2682,7 +2682,7 @@ DocIterator Buffer::firstChildPosition(Buffer const * child)
|
||||
|
||||
bool Buffer::hasChildren() const
|
||||
{
|
||||
return !d->children_positions.empty();
|
||||
return !d->children_positions.empty();
|
||||
}
|
||||
|
||||
|
||||
@ -2698,7 +2698,7 @@ void Buffer::collectChildren(ListOfBuffers & clist, bool grand_children) const
|
||||
if (bit != clist.end())
|
||||
continue;
|
||||
clist.push_back(child);
|
||||
if (grand_children)
|
||||
if (grand_children)
|
||||
// there might be grandchildren
|
||||
child->collectChildren(clist, true);
|
||||
}
|
||||
@ -2912,7 +2912,7 @@ void Buffer::Impl::updateMacros(DocIterator & it, DocIterator & scope)
|
||||
it.pop_back();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (iit->inset->asInsetTabular()) {
|
||||
CursorSlice slice(*iit->inset);
|
||||
size_t const numcells = slice.nargs();
|
||||
@ -3236,7 +3236,7 @@ void Buffer::getSourceCode(odocstream & os, string const format,
|
||||
}
|
||||
} else {
|
||||
os << "% ";
|
||||
if (output == FullSource)
|
||||
if (output == FullSource)
|
||||
os << _("Preview source code");
|
||||
else if (output == OnlyPreamble)
|
||||
os << _("Preview preamble");
|
||||
@ -3359,7 +3359,7 @@ private:
|
||||
int AutoSaveBuffer::generateChild()
|
||||
{
|
||||
#if defined(__APPLE__)
|
||||
/* FIXME fork() is not usable for autosave on Mac OS X 10.6 (snow leopard)
|
||||
/* FIXME fork() is not usable for autosave on Mac OS X 10.6 (snow leopard)
|
||||
* We should use something else like threads.
|
||||
*
|
||||
* Since I do not know how to determine at run time what is the OS X
|
||||
@ -3419,7 +3419,7 @@ FileName Buffer::getEmergencyFileName() const
|
||||
FileName Buffer::getAutosaveFileName() const
|
||||
{
|
||||
// if the document is unnamed try to save in the backup dir, else
|
||||
// in the default document path, and as a last try in the filePath,
|
||||
// in the default document path, and as a last try in the filePath,
|
||||
// which will most often be the temporary directory
|
||||
string fpath;
|
||||
if (isUnnamed())
|
||||
@ -3452,7 +3452,7 @@ void Buffer::moveAutosaveFile(support::FileName const & oldauto) const
|
||||
}
|
||||
|
||||
|
||||
bool Buffer::autoSave() const
|
||||
bool Buffer::autoSave() const
|
||||
{
|
||||
Buffer const * buf = d->cloned_buffer_ ? d->cloned_buffer_ : this;
|
||||
if (buf->d->bak_clean || isReadonly())
|
||||
@ -3460,7 +3460,7 @@ bool Buffer::autoSave() const
|
||||
|
||||
message(_("Autosaving current document..."));
|
||||
buf->d->bak_clean = true;
|
||||
|
||||
|
||||
FileName const fname = getAutosaveFileName();
|
||||
if (d->cloned_buffer_) {
|
||||
// If this buffer is cloned, we assume that
|
||||
@ -3474,7 +3474,7 @@ bool Buffer::autoSave() const
|
||||
}
|
||||
// failed to write/rename tmp_ret so try writing direct
|
||||
return writeFile(fname);
|
||||
} else {
|
||||
} else {
|
||||
/// This function is deprecated as the frontend needs to take care
|
||||
/// of cloning the buffer and autosaving it in another thread. It
|
||||
/// is still here to allow (QT_VERSION < 0x040400).
|
||||
@ -3505,7 +3505,7 @@ private:
|
||||
|
||||
void Buffer::setExportStatus(bool e) const
|
||||
{
|
||||
d->doing_export = e;
|
||||
d->doing_export = e;
|
||||
ListOfBuffers clist = getDescendents();
|
||||
ListOfBuffers::const_iterator cit = clist.begin();
|
||||
ListOfBuffers::const_iterator const cen = clist.end();
|
||||
@ -3535,8 +3535,8 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir
|
||||
&& !params().getIncludedChildren().empty();
|
||||
|
||||
// (1) export with all included children (omit \includeonly)
|
||||
if (update_unincluded) {
|
||||
ExportStatus const status =
|
||||
if (update_unincluded) {
|
||||
ExportStatus const status =
|
||||
doExport(target, put_in_tempdir, true, result_file);
|
||||
if (status != ExportSuccess)
|
||||
return status;
|
||||
@ -3621,17 +3621,17 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir
|
||||
else if (backend_format == "xhtml") {
|
||||
runparams.flavor = OutputParams::HTML;
|
||||
switch (params().html_math_output) {
|
||||
case BufferParams::MathML:
|
||||
runparams.math_flavor = OutputParams::MathAsMathML;
|
||||
case BufferParams::MathML:
|
||||
runparams.math_flavor = OutputParams::MathAsMathML;
|
||||
break;
|
||||
case BufferParams::HTML:
|
||||
runparams.math_flavor = OutputParams::MathAsHTML;
|
||||
case BufferParams::HTML:
|
||||
runparams.math_flavor = OutputParams::MathAsHTML;
|
||||
break;
|
||||
case BufferParams::Images:
|
||||
runparams.math_flavor = OutputParams::MathAsImages;
|
||||
runparams.math_flavor = OutputParams::MathAsImages;
|
||||
break;
|
||||
case BufferParams::LaTeX:
|
||||
runparams.math_flavor = OutputParams::MathAsLaTeX;
|
||||
runparams.math_flavor = OutputParams::MathAsLaTeX;
|
||||
break;
|
||||
}
|
||||
makeLyXHTMLFile(FileName(filename), runparams);
|
||||
@ -3681,9 +3681,9 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir
|
||||
// cloned Buffer so that it can be emitted afterwards.
|
||||
if (format != backend_format) {
|
||||
if (d->cloned_buffer_) {
|
||||
d->cloned_buffer_->d->errorLists[error_type] =
|
||||
d->cloned_buffer_->d->errorLists[error_type] =
|
||||
d->errorLists[error_type];
|
||||
} else
|
||||
} else
|
||||
errors(error_type);
|
||||
// also to the children, in case of master-buffer-view
|
||||
ListOfBuffers clist = getDescendents();
|
||||
@ -3695,7 +3695,7 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir
|
||||
// texrow object to the cloned buffer.
|
||||
// FIXME: this is not thread safe.
|
||||
(*cit)->d->cloned_buffer_->d->texrow = (*cit)->d->texrow;
|
||||
(*cit)->d->cloned_buffer_->d->errorLists[error_type] =
|
||||
(*cit)->d->cloned_buffer_->d->errorLists[error_type] =
|
||||
(*cit)->d->errorLists[error_type];
|
||||
} else
|
||||
(*cit)->errors(error_type, true);
|
||||
@ -3733,7 +3733,7 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir
|
||||
bool use_force = use_gui ? lyxrc.export_overwrite == ALL_FILES
|
||||
: force_overwrite == ALL_FILES;
|
||||
CopyStatus status = use_force ? FORCE : SUCCESS;
|
||||
|
||||
|
||||
vector<ExportedFile>::const_iterator it = files.begin();
|
||||
vector<ExportedFile>::const_iterator const en = files.end();
|
||||
for (; it != en && status != CANCEL; ++it) {
|
||||
@ -3756,8 +3756,8 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir
|
||||
if (status == CANCEL) {
|
||||
message(_("Document export cancelled."));
|
||||
return ExportCancel;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (tmp_result_file.exists()) {
|
||||
// Finally copy the main file
|
||||
use_force = use_gui ? lyxrc.export_overwrite != NO_FILES
|
||||
@ -3799,7 +3799,7 @@ Buffer::ExportStatus Buffer::preview(string const & format, bool includeall) con
|
||||
MarkAsExporting exporting(this);
|
||||
string result_file;
|
||||
// (1) export with all included children (omit \includeonly)
|
||||
if (includeall) {
|
||||
if (includeall) {
|
||||
ExportStatus const status = doExport(format, true, true, result_file);
|
||||
if (status != ExportSuccess)
|
||||
return status;
|
||||
@ -3828,14 +3828,14 @@ Buffer::ReadStatus Buffer::extractFromVC()
|
||||
Buffer::ReadStatus Buffer::loadEmergency()
|
||||
{
|
||||
FileName const emergencyFile = getEmergencyFileName();
|
||||
if (!emergencyFile.exists()
|
||||
if (!emergencyFile.exists()
|
||||
|| emergencyFile.lastModified() <= d->filename.lastModified())
|
||||
return ReadFileNotFound;
|
||||
|
||||
docstring const file = makeDisplayPath(d->filename.absFileName(), 20);
|
||||
docstring const text = bformat(_("An emergency save of the document "
|
||||
"%1$s exists.\n\nRecover emergency save?"), file);
|
||||
|
||||
|
||||
int const load_emerg = Alert::prompt(_("Load emergency save?"), text,
|
||||
0, 2, _("&Recover"), _("&Load Original"), _("&Cancel"));
|
||||
|
||||
@ -3860,7 +3860,7 @@ Buffer::ReadStatus Buffer::loadEmergency()
|
||||
str += "\n\n" + bformat(_("Remove emergency file now?\n(%1$s)"),
|
||||
makeDisplayPath(emergencyFile.absFileName()));
|
||||
|
||||
int const del_emerg =
|
||||
int const del_emerg =
|
||||
Alert::prompt(_("Delete emergency file?"), str, 1, 1,
|
||||
_("&Remove"), _("&Keep"));
|
||||
if (del_emerg == 0) {
|
||||
@ -3892,16 +3892,16 @@ Buffer::ReadStatus Buffer::loadAutosave()
|
||||
{
|
||||
// Now check if autosave file is newer.
|
||||
FileName const autosaveFile = getAutosaveFileName();
|
||||
if (!autosaveFile.exists()
|
||||
|| autosaveFile.lastModified() <= d->filename.lastModified())
|
||||
if (!autosaveFile.exists()
|
||||
|| autosaveFile.lastModified() <= d->filename.lastModified())
|
||||
return ReadFileNotFound;
|
||||
|
||||
docstring const file = makeDisplayPath(d->filename.absFileName(), 20);
|
||||
docstring const text = bformat(_("The backup of the document %1$s "
|
||||
docstring const text = bformat(_("The backup of the document %1$s "
|
||||
"is newer.\n\nLoad the backup instead?"), file);
|
||||
int const ret = Alert::prompt(_("Load backup?"), text, 0, 2,
|
||||
_("&Load backup"), _("Load &original"), _("&Cancel"));
|
||||
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
case 0: {
|
||||
@ -3913,7 +3913,7 @@ Buffer::ReadStatus Buffer::loadAutosave()
|
||||
bformat(_("A backup file is successfully loaded, "
|
||||
"but the original file %1$s is marked read-only. "
|
||||
"Please make sure to save the document as a "
|
||||
"different file."),
|
||||
"different file."),
|
||||
from_utf8(d->filename.absFileName())));
|
||||
}
|
||||
markDirty();
|
||||
@ -3943,7 +3943,7 @@ Buffer::ReadStatus Buffer::loadLyXFile()
|
||||
ReadStatus const ret_re = loadEmergency();
|
||||
if (ret_re == ReadSuccess || ret_re == ReadCancel)
|
||||
return ret_re;
|
||||
|
||||
|
||||
ReadStatus const ret_ra = loadAutosave();
|
||||
if (ret_ra == ReadSuccess || ret_ra == ReadCancel)
|
||||
return ret_ra;
|
||||
@ -4016,7 +4016,7 @@ void Buffer::bufferErrors(TeXErrors const & terr, ErrorList & errorList) const
|
||||
|
||||
void Buffer::setBuffersForInsets() const
|
||||
{
|
||||
inset().setBuffer(const_cast<Buffer &>(*this));
|
||||
inset().setBuffer(const_cast<Buffer &>(*this));
|
||||
}
|
||||
|
||||
|
||||
@ -4025,7 +4025,7 @@ void Buffer::updateBuffer(UpdateScope scope, UpdateType utype) const
|
||||
// Use the master text class also for child documents
|
||||
Buffer const * const master = masterBuffer();
|
||||
DocumentClass const & textclass = master->params().documentClass();
|
||||
|
||||
|
||||
// do this only if we are the top-level Buffer
|
||||
if (master == this)
|
||||
reloadBibInfoCache();
|
||||
@ -4039,7 +4039,7 @@ void Buffer::updateBuffer(UpdateScope scope, UpdateType utype) const
|
||||
if (master != this) {
|
||||
bufToUpdate.insert(this);
|
||||
master->updateBuffer(UpdateMaster, utype);
|
||||
// Do this here in case the master has no gui associated with it. Then,
|
||||
// Do this here in case the master has no gui associated with it. Then,
|
||||
// the TocModel is not updated and TocModel::toc_ is invalid (bug 5699).
|
||||
if (!master->d->gui_)
|
||||
structureChanged();
|
||||
@ -4256,13 +4256,13 @@ void Buffer::Impl::setLabel(ParIterator & it, UpdateType utype) const
|
||||
if (counters.hasCounter(from_utf8(type))) {
|
||||
string const & lang = par.getParLanguage(bp)->code();
|
||||
counters.step(from_utf8(type), utype);
|
||||
full_label = bformat(from_ascii("%1$s %2$s:"),
|
||||
name,
|
||||
full_label = bformat(from_ascii("%1$s %2$s:"),
|
||||
name,
|
||||
counters.theCounter(from_utf8(type), lang));
|
||||
} else
|
||||
full_label = bformat(from_ascii("%1$s #:"), name);
|
||||
full_label = bformat(from_ascii("%1$s #:"), name);
|
||||
}
|
||||
par.params().labelString(full_label);
|
||||
par.params().labelString(full_label);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -4273,7 +4273,7 @@ void Buffer::Impl::setLabel(ParIterator & it, UpdateType utype) const
|
||||
case LABEL_MANUAL:
|
||||
case LABEL_TOP_ENVIRONMENT:
|
||||
case LABEL_CENTERED_TOP_ENVIRONMENT:
|
||||
case LABEL_STATIC:
|
||||
case LABEL_STATIC:
|
||||
case LABEL_BIBLIO:
|
||||
par.params().labelString(par.expandLabel(layout, bp));
|
||||
break;
|
||||
@ -4303,7 +4303,7 @@ void Buffer::updateBuffer(ParIterator & parit, UpdateType utype) const
|
||||
masterBuffer()->params().documentClass().counters().
|
||||
setActiveLayout(parit->layout());
|
||||
}
|
||||
|
||||
|
||||
// set the counter for this paragraph
|
||||
d->setLabel(parit, utype);
|
||||
|
||||
@ -4376,7 +4376,7 @@ Buffer::ReadStatus Buffer::reload()
|
||||
d->undo_.clear();
|
||||
} else {
|
||||
message(bformat(_("Could not reload document %1$s."), disp_fn));
|
||||
}
|
||||
}
|
||||
setBusy(false);
|
||||
removePreviews();
|
||||
updatePreviews();
|
||||
|
30
src/Buffer.h
30
src/Buffer.h
@ -111,7 +111,7 @@ public:
|
||||
ReadWrongVersion,
|
||||
ReadFileNotFound,
|
||||
ReadVCError,
|
||||
ReadAutosaveFailure,
|
||||
ReadAutosaveFailure,
|
||||
ReadEmergencyFailure,
|
||||
ReadNoLyXFormat,
|
||||
ReadDocumentFailure,
|
||||
@ -234,7 +234,7 @@ private:
|
||||
///
|
||||
void clone(BufferMap &, CloneList *) const;
|
||||
/// save timestamp and checksum of the given file.
|
||||
void saveCheckSum() const;
|
||||
void saveCheckSum() const;
|
||||
/// read a new file
|
||||
ReadStatus readFile(support::FileName const & fn);
|
||||
/// Reads a file without header.
|
||||
@ -246,14 +246,14 @@ private:
|
||||
/// implemented for RCS.
|
||||
/// \sa LyXVC::file_not_found_hook
|
||||
ReadStatus extractFromVC();
|
||||
/// Reads the first tag of a LyX File and
|
||||
/// Reads the first tag of a LyX File and
|
||||
/// returns the file format number.
|
||||
ReadStatus parseLyXFormat(Lexer & lex, support::FileName const & fn,
|
||||
int & file_format) const;
|
||||
/// Convert the LyX file to the LYX_FORMAT using
|
||||
/// the lyx2lyx script and returns the filename
|
||||
/// of the temporary file to be read
|
||||
ReadStatus convertLyXFormat(support::FileName const & fn,
|
||||
ReadStatus convertLyXFormat(support::FileName const & fn,
|
||||
support::FileName & tmpfile, int from_format);
|
||||
//@}
|
||||
|
||||
@ -261,7 +261,7 @@ public:
|
||||
/// \name Functions involved in autosave and emergency files.
|
||||
//@{
|
||||
/// Save an autosave file to #filename.lyx#
|
||||
bool autoSave() const;
|
||||
bool autoSave() const;
|
||||
/// save emergency file
|
||||
/// \return a status message towards the user.
|
||||
docstring emergencyWrite();
|
||||
@ -270,11 +270,11 @@ public:
|
||||
//private:
|
||||
///
|
||||
void removeAutosaveFile() const;
|
||||
|
||||
|
||||
private:
|
||||
/// Try to load an autosave file associated to \c fn.
|
||||
ReadStatus loadAutosave();
|
||||
/// Try to load an emergency file associated to \c fn.
|
||||
/// Try to load an emergency file associated to \c fn.
|
||||
ReadStatus loadEmergency();
|
||||
/// Get the filename of the emergency file associated with the Buffer
|
||||
support::FileName getEmergencyFileName() const;
|
||||
@ -407,15 +407,15 @@ public:
|
||||
|
||||
/// \return true if \p child is a child of this \c Buffer.
|
||||
bool isChild(Buffer * child) const;
|
||||
|
||||
|
||||
/// \return true if this \c Buffer has children
|
||||
bool hasChildren() const;
|
||||
|
||||
|
||||
/// \return a list of the direct children of this Buffer.
|
||||
/// this list has no duplicates and is in the order in which
|
||||
/// the children appear.
|
||||
ListOfBuffers getChildren() const;
|
||||
|
||||
|
||||
/// \return a list of all descendents of this Buffer (children,
|
||||
/// grandchildren, etc). this list has no duplicates and is in
|
||||
/// the order in which the children appear.
|
||||
@ -447,7 +447,7 @@ public:
|
||||
void validate(LaTeXFeatures &) const;
|
||||
|
||||
/// Reference information is cached in the Buffer, so we do not
|
||||
/// have to check or read things over and over.
|
||||
/// have to check or read things over and over.
|
||||
///
|
||||
/// There are two caches.
|
||||
///
|
||||
@ -455,11 +455,11 @@ public:
|
||||
/// being gathered. This cache is PER BUFFER, and the cache for the
|
||||
/// master essentially includes the cache for its children. This gets
|
||||
/// invalidated when an InsetBibtex is created, deleted, or modified.
|
||||
///
|
||||
///
|
||||
/// The other is a cache of the reference information itself. This
|
||||
/// exists only in the master buffer, and when it needs to be updated,
|
||||
/// the children add their information to the master's cache.
|
||||
|
||||
|
||||
/// Calling this method invalidates the cache and so requires a
|
||||
/// re-read.
|
||||
void invalidateBibinfoCache() const;
|
||||
@ -667,7 +667,7 @@ public:
|
||||
/// do this one.
|
||||
/// \param output: whether we are preparing for output.
|
||||
void updateBuffer(UpdateScope scope, UpdateType utype) const;
|
||||
///
|
||||
///
|
||||
void updateBuffer(ParIterator & parit, UpdateType utype) const;
|
||||
|
||||
/// Spellcheck starting from \p from.
|
||||
@ -700,7 +700,7 @@ private:
|
||||
void updateBibfilesCache(UpdateScope scope = UpdateMaster) const;
|
||||
/// Return the list with all bibfiles in use (including bibfiles
|
||||
/// of loaded child documents).
|
||||
support::FileNameList const &
|
||||
support::FileNameList const &
|
||||
getBibfilesCache(UpdateScope scope = UpdateMaster) const;
|
||||
///
|
||||
void collectChildren(ListOfBuffers & children, bool grand_children) const;
|
||||
|
@ -551,7 +551,7 @@ string BufferParams::readToken(Lexer & lex, string const & token,
|
||||
lex.next();
|
||||
string const classname = lex.getString();
|
||||
// if there exists a local layout file, ignore the system one
|
||||
// NOTE: in this case, the textclass (.cls file) is assumed to
|
||||
// NOTE: in this case, the textclass (.cls file) is assumed to
|
||||
// be available.
|
||||
string tcp;
|
||||
LayoutFileList & bcl = LayoutFileList::get();
|
||||
@ -561,12 +561,12 @@ string BufferParams::readToken(Lexer & lex, string const & token,
|
||||
setBaseClass(tcp);
|
||||
else
|
||||
setBaseClass(classname);
|
||||
// We assume that a tex class exists for local or unknown
|
||||
// We assume that a tex class exists for local or unknown
|
||||
// layouts so this warning, will only be given for system layouts.
|
||||
if (!baseClass()->isTeXClassAvailable()) {
|
||||
docstring const desc =
|
||||
docstring const desc =
|
||||
translateIfPossible(from_utf8(baseClass()->description()));
|
||||
docstring const prereqs =
|
||||
docstring const prereqs =
|
||||
from_utf8(baseClass()->prerequisites());
|
||||
docstring const msg =
|
||||
bformat(_("The selected document class\n"
|
||||
@ -874,7 +874,7 @@ string BufferParams::readToken(Lexer & lex, string const & token,
|
||||
} else if (token == "\\use_refstyle") {
|
||||
lex >> use_refstyle;
|
||||
} else {
|
||||
lyxerr << "BufferParams::readToken(): Unknown token: " <<
|
||||
lyxerr << "BufferParams::readToken(): Unknown token: " <<
|
||||
token << endl;
|
||||
return token;
|
||||
}
|
||||
@ -906,14 +906,14 @@ void BufferParams::writeFile(ostream & os) const
|
||||
}
|
||||
|
||||
// use the class options defined in the layout?
|
||||
os << "\\use_default_options "
|
||||
os << "\\use_default_options "
|
||||
<< convert<string>(use_default_options) << "\n";
|
||||
|
||||
// the master document
|
||||
if (!master.empty()) {
|
||||
os << "\\master " << master << '\n';
|
||||
}
|
||||
|
||||
|
||||
// removed modules
|
||||
if (!removed_modules_.empty()) {
|
||||
os << "\\begin_removed_modules" << '\n';
|
||||
@ -948,7 +948,7 @@ void BufferParams::writeFile(ostream & os) const
|
||||
|
||||
// local layout information
|
||||
if (!local_layout.empty()) {
|
||||
// remove '\n' from the end
|
||||
// remove '\n' from the end
|
||||
string const tmplocal = rtrim(local_layout, "\n");
|
||||
os << "\\begin_local_layout\n"
|
||||
<< tmplocal
|
||||
@ -1062,7 +1062,7 @@ void BufferParams::writeFile(ostream & os) const
|
||||
os << "\\footskip "
|
||||
<< VSpace(footskip).asLyXCommand() << '\n';
|
||||
if (!columnsep.empty())
|
||||
os << "\\columnsep "
|
||||
os << "\\columnsep "
|
||||
<< VSpace(columnsep).asLyXCommand() << '\n';
|
||||
os << "\\secnumdepth " << secnumdepth
|
||||
<< "\n\\tocdepth " << tocdepth
|
||||
@ -1102,7 +1102,7 @@ void BufferParams::writeFile(ostream & os) const
|
||||
<< "\\html_math_output " << html_math_output << '\n'
|
||||
<< "\\html_css_as_file " << html_css_as_file << '\n'
|
||||
<< "\\html_be_strict " << convert<string>(html_be_strict) << '\n';
|
||||
|
||||
|
||||
if (html_math_img_scale != 1.0)
|
||||
os << "\\html_math_img_scale " << convert<string>(html_math_img_scale) << '\n';
|
||||
if (!html_latex_start.empty())
|
||||
@ -1145,7 +1145,7 @@ void BufferParams::validate(LaTeXFeatures & features) const
|
||||
features.require("ulem");
|
||||
features.require("xcolor");
|
||||
// improves color handling in PDF output
|
||||
features.require("pdfcolmk");
|
||||
features.require("pdfcolmk");
|
||||
} else {
|
||||
features.require("ct-none");
|
||||
}
|
||||
@ -1179,7 +1179,7 @@ void BufferParams::validate(LaTeXFeatures & features) const
|
||||
// the bullet shapes are buffer level not paragraph level
|
||||
// so they are tested here
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (user_defined_bullet(i) == ITEMIZE_DEFAULTS[i])
|
||||
if (user_defined_bullet(i) == ITEMIZE_DEFAULTS[i])
|
||||
continue;
|
||||
int const font = user_defined_bullet(i).getFont();
|
||||
if (font == 0) {
|
||||
@ -1423,7 +1423,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
|
||||
mangledFileName();
|
||||
if (!features.runparams().nice)
|
||||
incfile = mangled;
|
||||
// \includeonly doesn't want an extension
|
||||
// \includeonly doesn't want an extension
|
||||
incfile = changeExtension(incfile, string());
|
||||
incfile = support::latex_path(incfile);
|
||||
if (!incfile.empty()) {
|
||||
@ -1441,7 +1441,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
|
||||
|
||||
if (!listings_params.empty()) {
|
||||
os << "\\lstset{";
|
||||
// do not test validity because listings_params is
|
||||
// do not test validity because listings_params is
|
||||
// supposed to be valid
|
||||
string par =
|
||||
InsetListingsParams(listings_params).separatedParams(true);
|
||||
@ -1604,7 +1604,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
|
||||
if (isbackgroundcolor == true) {
|
||||
// only require color here, the background color will be defined
|
||||
// in LaTeXFeatures.cpp to avoid interferences with the LaTeX
|
||||
// package pdfpages
|
||||
// package pdfpages
|
||||
features.require("color");
|
||||
features.require("pagecolor");
|
||||
}
|
||||
@ -1613,7 +1613,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
|
||||
if (isfontcolor == true) {
|
||||
// only require color here, the font color will be defined
|
||||
// in LaTeXFeatures.cpp to avoid interferences with the LaTeX
|
||||
// package pdfpages
|
||||
// package pdfpages
|
||||
features.require("color");
|
||||
features.require("fontcolor");
|
||||
}
|
||||
@ -1684,7 +1684,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
|
||||
// we decided therefore to load color always before babel, see
|
||||
// http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg144349.html
|
||||
lyxpreamble += from_ascii(features.getColorOptions());
|
||||
|
||||
|
||||
// If we use hyperref, jurabib, japanese, or vietnamese, we have to call babel before them.
|
||||
if (use_babel
|
||||
&& (features.isRequired("jurabib")
|
||||
@ -1727,7 +1727,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
|
||||
// avoid errors with algorithm floats.
|
||||
// use hyperref explicitly if it is required
|
||||
if (features.isRequired("hyperref")) {
|
||||
// pass what we have to stream here, since we need
|
||||
// pass what we have to stream here, since we need
|
||||
// to access the stream itself in PDFOptions.
|
||||
os << lyxpreamble;
|
||||
|
||||
@ -1858,7 +1858,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
|
||||
lyxpreamble += "[" + from_ascii(language->polyglossiaOpts()) + "]";
|
||||
lyxpreamble += "{" + from_ascii(language->polyglossia()) + "}\n";
|
||||
// now setup the other languages
|
||||
std::map<std::string, std::string> const polylangs =
|
||||
std::map<std::string, std::string> const polylangs =
|
||||
features.getPolyglossiaLanguages();
|
||||
for (std::map<std::string, std::string>::const_iterator mit = polylangs.begin();
|
||||
mit != polylangs.end() ; ++mit) {
|
||||
@ -1933,7 +1933,7 @@ bool BufferParams::setBaseClass(string const & classname)
|
||||
LYXERR(Debug::TCLASS, "setBaseClass: " << classname);
|
||||
LayoutFileList & bcl = LayoutFileList::get();
|
||||
if (!bcl.haveClass(classname)) {
|
||||
docstring s =
|
||||
docstring s =
|
||||
bformat(_("The layout file:\n"
|
||||
"%1$s\n"
|
||||
"could not be found. A default textclass with default\n"
|
||||
@ -1946,7 +1946,7 @@ bool BufferParams::setBaseClass(string const & classname)
|
||||
|
||||
bool const success = bcl[classname].load();
|
||||
if (!success) {
|
||||
docstring s =
|
||||
docstring s =
|
||||
bformat(_("Due to some error in it, the layout file:\n"
|
||||
"%1$s\n"
|
||||
"could not be loaded. A default textclass with default\n"
|
||||
@ -1967,7 +1967,7 @@ LayoutFile const * BufferParams::baseClass() const
|
||||
{
|
||||
if (LayoutFileList::get().haveClass(pimpl_->baseClass_))
|
||||
return &(LayoutFileList::get()[pimpl_->baseClass_]);
|
||||
else
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2007,7 +2007,7 @@ bool BufferParams::addLayoutModule(string const & modName)
|
||||
LayoutModuleList::const_iterator it = layout_modules_.begin();
|
||||
LayoutModuleList::const_iterator end = layout_modules_.end();
|
||||
for (; it != end; it++)
|
||||
if (*it == modName)
|
||||
if (*it == modName)
|
||||
return false;
|
||||
layout_modules_.push_back(modName);
|
||||
return true;
|
||||
@ -2238,7 +2238,7 @@ void BufferParams::readLanguage(Lexer & lex)
|
||||
|
||||
void BufferParams::readGraphicsDriver(Lexer & lex)
|
||||
{
|
||||
if (!lex.next())
|
||||
if (!lex.next())
|
||||
return;
|
||||
|
||||
string const tmptok = lex.getString();
|
||||
@ -2264,7 +2264,7 @@ void BufferParams::readGraphicsDriver(Lexer & lex)
|
||||
|
||||
void BufferParams::readBullets(Lexer & lex)
|
||||
{
|
||||
if (!lex.next())
|
||||
if (!lex.next())
|
||||
return;
|
||||
|
||||
int const index = lex.getInteger();
|
||||
@ -2284,7 +2284,7 @@ void BufferParams::readBullets(Lexer & lex)
|
||||
void BufferParams::readBulletsLaTeX(Lexer & lex)
|
||||
{
|
||||
// The bullet class should be able to read this.
|
||||
if (!lex.next())
|
||||
if (!lex.next())
|
||||
return;
|
||||
int const index = lex.getInteger();
|
||||
lex.next(true);
|
||||
@ -2326,9 +2326,9 @@ void BufferParams::readRemovedModules(Lexer & lex)
|
||||
removed_modules_.push_back(mod);
|
||||
lex.eatLine();
|
||||
}
|
||||
// now we want to remove any removed modules that were previously
|
||||
// added. normally, that will be because default modules were added in
|
||||
// setBaseClass(), which gets called when \textclass is read at the
|
||||
// now we want to remove any removed modules that were previously
|
||||
// added. normally, that will be because default modules were added in
|
||||
// setBaseClass(), which gets called when \textclass is read at the
|
||||
// start of the read.
|
||||
list<string>::const_iterator rit = removed_modules_.begin();
|
||||
list<string>::const_iterator const ren = removed_modules_.end();
|
||||
@ -2713,7 +2713,7 @@ string const BufferParams::loadFonts(string const & rm,
|
||||
* -- add more GUI options?
|
||||
* -- add more fonts (fonts for other scripts)
|
||||
* -- if there's a way to find out if a font really supports
|
||||
* OldStyle, enable/disable the widget accordingly.
|
||||
* OldStyle, enable/disable the widget accordingly.
|
||||
*/
|
||||
if (use_systemfonts && features.isAvailable("fontspec")) {
|
||||
// "Mapping=tex-text" and "Ligatures=TeX" are equivalent.
|
||||
@ -2737,8 +2737,8 @@ string const BufferParams::loadFonts(string const & rm,
|
||||
if (sf != "default") {
|
||||
string const sans = parseFontName(sf);
|
||||
if (sfscale != 100)
|
||||
os << "\\setsansfont[Scale="
|
||||
<< float(sfscale) / 100
|
||||
os << "\\setsansfont[Scale="
|
||||
<< float(sfscale) / 100
|
||||
<< "," << texmapping << "]{"
|
||||
<< sans << "}\n";
|
||||
else
|
||||
@ -2748,8 +2748,8 @@ string const BufferParams::loadFonts(string const & rm,
|
||||
if (tt != "default") {
|
||||
string const mono = parseFontName(tt);
|
||||
if (ttscale != 100)
|
||||
os << "\\setmonofont[Scale="
|
||||
<< float(ttscale) / 100
|
||||
os << "\\setmonofont[Scale="
|
||||
<< float(ttscale) / 100
|
||||
<< "]{"
|
||||
<< mono << "}\n";
|
||||
else
|
||||
|
@ -117,7 +117,7 @@ public:
|
||||
///
|
||||
LayoutFileIndex const & baseClassID() const;
|
||||
/// Set the LyX layout file this document is using.
|
||||
/// NOTE: This does not call makeDocumentClass() to update the local
|
||||
/// NOTE: This does not call makeDocumentClass() to update the local
|
||||
/// DocumentClass. That needs to be done manually.
|
||||
/// \param filename the name of the layout file
|
||||
bool setBaseClass(std::string const & classname);
|
||||
@ -127,8 +127,8 @@ public:
|
||||
/// Returns the DocumentClass currently in use: the BaseClass as modified
|
||||
/// by modules.
|
||||
DocumentClass const & documentClass() const;
|
||||
/// \return A pointer to the DocumentClass currently in use: the BaseClass
|
||||
/// as modified by modules.
|
||||
/// \return A pointer to the DocumentClass currently in use: the BaseClass
|
||||
/// as modified by modules.
|
||||
DocumentClass const * documentClassPtr() const;
|
||||
/// This bypasses the baseClass and sets the textClass directly.
|
||||
/// Should be called with care and would be better not being here,
|
||||
@ -137,7 +137,7 @@ public:
|
||||
/// List of modules in use
|
||||
LayoutModuleList const & getModules() const { return layout_modules_; }
|
||||
/// List of default modules the user has removed
|
||||
std::list<std::string> const & getRemovedModules() const
|
||||
std::list<std::string> const & getRemovedModules() const
|
||||
{ return removed_modules_; }
|
||||
///
|
||||
/// Add a module to the list of modules in use. This checks only that the
|
||||
@ -149,7 +149,7 @@ public:
|
||||
/// not conflict with already-present modules, isn't already loaded, etc.
|
||||
bool moduleCanBeAdded(std::string const & modName) const;
|
||||
///
|
||||
void addRemovedModule(std::string const & modName)
|
||||
void addRemovedModule(std::string const & modName)
|
||||
{ removed_modules_.push_back(modName); }
|
||||
/// Clear the list
|
||||
void clearLayoutModules() { layout_modules_.clear(); }
|
||||
@ -180,10 +180,10 @@ public:
|
||||
std::vector<std::string> backends() const;
|
||||
|
||||
/// List of included children (for includeonly)
|
||||
std::list<std::string> const & getIncludedChildren() const
|
||||
std::list<std::string> const & getIncludedChildren() const
|
||||
{ return included_children_; }
|
||||
///
|
||||
void addIncludedChildren(std::string const & child)
|
||||
void addIncludedChildren(std::string const & child)
|
||||
{ included_children_.push_back(child); }
|
||||
/// Clear the list of included children
|
||||
void clearIncludedChildren() { included_children_.clear(); }
|
||||
@ -473,7 +473,7 @@ private:
|
||||
CiteEngine cite_engine_;
|
||||
///
|
||||
DocumentClass * doc_class_;
|
||||
///
|
||||
///
|
||||
LayoutModuleList layout_modules_;
|
||||
/// this is for modules that are required by the document class but that
|
||||
/// the user has chosen not to use
|
||||
|
@ -13,7 +13,7 @@
|
||||
#define CITATION_H
|
||||
|
||||
namespace lyx {
|
||||
|
||||
|
||||
class Buffer;
|
||||
|
||||
enum CiteEngine {
|
||||
|
@ -161,7 +161,7 @@ static docstring const mathcircumflex_def = from_ascii(
|
||||
static docstring const tabularnewline_def = from_ascii(
|
||||
"%% Because html converters don't know tabularnewline\n"
|
||||
"\\providecommand{\\tabularnewline}{\\\\}\n");
|
||||
|
||||
|
||||
static docstring const lyxgreyedout_def = from_ascii(
|
||||
"%% The greyedout annotation environment\n"
|
||||
"\\newenvironment{lyxgreyedout}\n"
|
||||
@ -266,10 +266,10 @@ static docstring const ogonek_def = from_ascii(
|
||||
|
||||
static docstring const lyxref_def = from_ascii(
|
||||
"\\RS@ifundefined{subref}\n"
|
||||
" {\\def\\RSsubtxt{section~}\\newref{sub}{name = \\RSsubtxt}}\n"
|
||||
" {\\def\\RSsubtxt{section~}\\newref{sub}{name = \\RSsubtxt}}\n"
|
||||
" {}\n"
|
||||
"\\RS@ifundefined{thmref}\n"
|
||||
" {\\def\\RSthmtxt{theorem~}\\newref{thm}{name = \\RSthmtxt}}\n"
|
||||
" {\\def\\RSthmtxt{theorem~}\\newref{thm}{name = \\RSthmtxt}}\n"
|
||||
" {}\n"
|
||||
"\\RS@ifundefined{lemref}\n"
|
||||
" {\\def\\RSlemtxt{lemma~}\\newref{lem}{name = \\RSlemtxt}}\n"
|
||||
@ -348,7 +348,7 @@ void LaTeXFeatures::useLayout(docstring const & layoutname)
|
||||
DocumentClass const & tclass = params_.documentClass();
|
||||
if (tclass.hasLayout(layoutname)) {
|
||||
// Is this layout already in usedLayouts?
|
||||
if (find(usedLayouts_.begin(), usedLayouts_.end(), layoutname)
|
||||
if (find(usedLayouts_.begin(), usedLayouts_.end(), layoutname)
|
||||
!= usedLayouts_.end())
|
||||
return;
|
||||
|
||||
@ -380,7 +380,7 @@ void LaTeXFeatures::useInsetLayout(InsetLayout const & lay)
|
||||
if (!tclass.hasInsetLayout(lname))
|
||||
return;
|
||||
// Is this layout already in usedInsetLayouts?
|
||||
if (find(usedInsetLayouts_.begin(), usedInsetLayouts_.end(), lname)
|
||||
if (find(usedInsetLayouts_.begin(), usedInsetLayouts_.end(), lname)
|
||||
!= usedInsetLayouts_.end())
|
||||
return;
|
||||
|
||||
@ -716,7 +716,7 @@ string const LaTeXFeatures::getPackages() const
|
||||
packages << "\\usepackage{undertilde}\n";
|
||||
|
||||
// [x]color and pdfcolmk are handled in getColorOptions() above
|
||||
|
||||
|
||||
// makeidx.sty
|
||||
if (isRequired("makeidx") || isRequired("splitidx")) {
|
||||
if (!tclass.provides("makeidx") && !isRequired("splitidx"))
|
||||
@ -735,7 +735,7 @@ string const LaTeXFeatures::getPackages() const
|
||||
<< params_.graphics_driver
|
||||
<< "]{graphicx}\n";
|
||||
}
|
||||
|
||||
|
||||
// lyxskak.sty --- newer chess support based on skak.sty
|
||||
if (mustProvide("chess"))
|
||||
packages << "\\usepackage[ps,mover]{lyxskak}\n";
|
||||
@ -766,7 +766,7 @@ string const LaTeXFeatures::getPackages() const
|
||||
// jurabib -- we need version 0.6 at least.
|
||||
if (mustProvide("jurabib"))
|
||||
packages << "\\usepackage{jurabib}[2004/01/25]\n";
|
||||
|
||||
|
||||
// xargs -- we need version 1.09 at least
|
||||
if (mustProvide("xargs"))
|
||||
packages << "\\usepackage{xargs}[2008/03/08]\n";
|
||||
@ -811,7 +811,7 @@ string const LaTeXFeatures::getPackages() const
|
||||
}
|
||||
|
||||
|
||||
string LaTeXFeatures::getPreambleSnippets() const
|
||||
string LaTeXFeatures::getPreambleSnippets() const
|
||||
{
|
||||
ostringstream snip;
|
||||
SnippetList::const_iterator pit = preamble_snippets_.begin();
|
||||
@ -942,17 +942,17 @@ docstring const LaTeXFeatures::getMacros() const
|
||||
|
||||
// floats
|
||||
getFloatDefinitions(macros);
|
||||
|
||||
if (mustProvide("refstyle"))
|
||||
macros << lyxref_def << '\n';
|
||||
|
||||
|
||||
if (mustProvide("refstyle"))
|
||||
macros << lyxref_def << '\n';
|
||||
|
||||
// change tracking
|
||||
if (mustProvide("ct-dvipost"))
|
||||
macros << changetracking_dvipost_def;
|
||||
|
||||
|
||||
if (mustProvide("ct-xcolor-ulem")) {
|
||||
streamsize const prec = macros.precision(2);
|
||||
|
||||
|
||||
RGBColor cadd = rgbFromHexName(lcolor.getX11Name(Color_addedtext));
|
||||
macros << "\\providecolor{lyxadded}{rgb}{"
|
||||
<< cadd.r / 255.0 << ',' << cadd.g / 255.0 << ',' << cadd.b / 255.0 << "}\n";
|
||||
@ -962,7 +962,7 @@ docstring const LaTeXFeatures::getMacros() const
|
||||
<< cdel.r / 255.0 << ',' << cdel.g / 255.0 << ',' << cdel.b / 255.0 << "}\n";
|
||||
|
||||
macros.precision(prec);
|
||||
|
||||
|
||||
if (isRequired("hyperref"))
|
||||
macros << changetracking_xcolor_ulem_hyperref_def;
|
||||
else
|
||||
@ -1075,7 +1075,7 @@ docstring const LaTeXFeatures::getTClassPreamble() const
|
||||
}
|
||||
|
||||
|
||||
docstring const LaTeXFeatures::getTClassHTMLPreamble() const
|
||||
docstring const LaTeXFeatures::getTClassHTMLPreamble() const
|
||||
{
|
||||
DocumentClass const & tclass = params_.documentClass();
|
||||
odocstringstream tcpreamble;
|
||||
@ -1183,7 +1183,7 @@ docstring const LaTeXFeatures::getTClassI18nPreamble(bool use_babel, bool use_po
|
||||
UsedFloats::const_iterator fend = usedFloats_.end();
|
||||
for (; fit != fend; ++fit) {
|
||||
Floating const & fl = floats.getType(fit->first);
|
||||
// we assume builtin floats are translated
|
||||
// we assume builtin floats are translated
|
||||
if (fl.isPredefined())
|
||||
continue;
|
||||
docstring const type = from_ascii(fl.floattype());
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
std::string const getBabelPresettings() const;
|
||||
/// Extra preamble code after babel is called
|
||||
std::string const getBabelPostsettings() const;
|
||||
/// Do we need to pass the languages to babel directly?
|
||||
/// Do we need to pass the languages to babel directly?
|
||||
bool needBabelLangOptions() const;
|
||||
/// Load AMS packages when appropriate
|
||||
std::string const loadAMSPackages() const;
|
||||
|
@ -49,19 +49,19 @@ using namespace lyx::support;
|
||||
|
||||
namespace lyx {
|
||||
|
||||
// Keep the changes documented in the Customization manual.
|
||||
// Keep the changes documented in the Customization manual.
|
||||
//
|
||||
// If you change this format, then you MUST also make sure that
|
||||
// your changes do not invalidate the hardcoded layout file in
|
||||
// your changes do not invalidate the hardcoded layout file in
|
||||
// LayoutFile.cpp. Additions will never do so, but syntax changes
|
||||
// could. See LayoutFileList::addEmptyClass() and, especially, the
|
||||
// definition of the layoutpost string.
|
||||
// definition of the layoutpost string.
|
||||
// You should also run (or ask someone who has bash to run) the
|
||||
// development/updatelayouts.sh script, to update the format of
|
||||
// development/updatelayouts.sh script, to update the format of
|
||||
// all of our layout files.
|
||||
//
|
||||
int const LAYOUT_FORMAT = 35;
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
class LayoutNamesEqual : public unary_function<Layout, bool> {
|
||||
@ -104,7 +104,7 @@ bool layout2layout(FileName const & filename, FileName const & tempfile)
|
||||
}
|
||||
|
||||
|
||||
string translateReadType(TextClass::ReadType rt)
|
||||
string translateReadType(TextClass::ReadType rt)
|
||||
{
|
||||
switch (rt) {
|
||||
case TextClass::BASECLASS:
|
||||
@ -123,7 +123,7 @@ string translateReadType(TextClass::ReadType rt)
|
||||
} // namespace anon
|
||||
|
||||
|
||||
// This string should not be translated here,
|
||||
// This string should not be translated here,
|
||||
// because it is a layout identifier.
|
||||
docstring const TextClass::plain_layout_ = from_ascii("Plain Layout");
|
||||
|
||||
@ -252,7 +252,7 @@ namespace {
|
||||
{ "titlelatextype", TC_TITLELATEXTYPE },
|
||||
{ "tocdepth", TC_TOCDEPTH }
|
||||
};
|
||||
|
||||
|
||||
} //namespace anon
|
||||
|
||||
|
||||
@ -302,8 +302,8 @@ TextClass::ReturnValues TextClass::readWithoutConv(FileName const & filename, Re
|
||||
LYXERR(Debug::TCLASS, "Reading " + translateReadType(rt) + ": " +
|
||||
to_utf8(makeDisplayPath(filename.absFileName())));
|
||||
|
||||
// Define the plain layout used in table cells, ert, etc. Note that
|
||||
// we do this before loading any layout file, so that classes can
|
||||
// Define the plain layout used in table cells, ert, etc. Note that
|
||||
// we do this before loading any layout file, so that classes can
|
||||
// override features of this layout if they should choose to do so.
|
||||
if (rt == BASECLASS && !hasLayout(plain_layout_))
|
||||
layoutlist_.push_back(createBasicLayout(plain_layout_));
|
||||
@ -311,7 +311,7 @@ TextClass::ReturnValues TextClass::readWithoutConv(FileName const & filename, Re
|
||||
Lexer lexrc(textClassTags);
|
||||
lexrc.setFile(filename);
|
||||
ReturnValues retval = read(lexrc, rt);
|
||||
|
||||
|
||||
LYXERR(Debug::TCLASS, "Finished reading " + translateReadType(rt) + ": " +
|
||||
to_utf8(makeDisplayPath(filename.absFileName())));
|
||||
|
||||
@ -327,7 +327,7 @@ bool TextClass::read(FileName const & filename, ReadType rt)
|
||||
|
||||
bool const worx = convertLayoutFormat(filename, rt);
|
||||
if (!worx)
|
||||
LYXERR0 ("Unable to convert " << filename <<
|
||||
LYXERR0 ("Unable to convert " << filename <<
|
||||
" to format " << LAYOUT_FORMAT);
|
||||
return worx;
|
||||
}
|
||||
@ -347,7 +347,7 @@ TextClass::ReturnValues TextClass::read(std::string const & str, ReadType rt)
|
||||
lexrc.setStream(is);
|
||||
ReturnValues retval = read(lexrc, rt);
|
||||
|
||||
if (retval != FORMAT_MISMATCH)
|
||||
if (retval != FORMAT_MISMATCH)
|
||||
return retval;
|
||||
|
||||
// write the layout string to a temporary file
|
||||
@ -363,7 +363,7 @@ TextClass::ReturnValues TextClass::read(std::string const & str, ReadType rt)
|
||||
// now try to convert it
|
||||
bool const worx = convertLayoutFormat(tempfile, rt);
|
||||
if (!worx) {
|
||||
LYXERR0("Unable to convert internal layout information to format "
|
||||
LYXERR0("Unable to convert internal layout information to format "
|
||||
<< LAYOUT_FORMAT);
|
||||
return ERROR;
|
||||
}
|
||||
@ -373,7 +373,7 @@ TextClass::ReturnValues TextClass::read(std::string const & str, ReadType rt)
|
||||
|
||||
|
||||
// Reads a textclass structure from file.
|
||||
TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt)
|
||||
TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt)
|
||||
{
|
||||
if (!lexrc.isOK())
|
||||
return ERROR;
|
||||
@ -567,7 +567,7 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt)
|
||||
case TC_HTMLPREAMBLE:
|
||||
htmlpreamble_ = from_utf8(lexrc.getLongString("EndPreamble"));
|
||||
break;
|
||||
|
||||
|
||||
case TC_HTMLTOCSECTION:
|
||||
html_toc_section_ = from_utf8(trim(lexrc.getString()));
|
||||
break;
|
||||
@ -593,7 +593,7 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt)
|
||||
|
||||
case TC_REQUIRES: {
|
||||
lexrc.eatLine();
|
||||
vector<string> const req
|
||||
vector<string> const req
|
||||
= getVectorFromString(lexrc.getString());
|
||||
requires_.insert(req.begin(), req.end());
|
||||
break;
|
||||
@ -671,7 +671,7 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt)
|
||||
case TC_FLOAT:
|
||||
error = !readFloat(lexrc);
|
||||
break;
|
||||
|
||||
|
||||
case TC_CITEFORMAT:
|
||||
readCiteFormat(lexrc);
|
||||
break;
|
||||
@ -744,8 +744,8 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt)
|
||||
<< "' is missing a defaultstyle.");
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
// Try to erase "stdinsets" from the provides_ set.
|
||||
|
||||
// Try to erase "stdinsets" from the provides_ set.
|
||||
// The
|
||||
// Provides stdinsets 1
|
||||
// declaration simply tells us that the standard insets have been
|
||||
@ -1004,7 +1004,7 @@ bool TextClass::readFloat(Lexer & lexrc)
|
||||
ispredefined = fl.isPredefined();
|
||||
listcommand = fl.listCommand();
|
||||
refprefix = fl.refPrefix();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FT_NAME:
|
||||
lexrc.next();
|
||||
@ -1087,8 +1087,8 @@ bool TextClass::readFloat(Lexer & lexrc)
|
||||
"for the float `" << type << "'. LyX will " <<
|
||||
"not be able to produce a float list.");
|
||||
}
|
||||
Floating fl(type, placement, ext, within, style, name,
|
||||
listname, listcommand, refprefix,
|
||||
Floating fl(type, placement, ext, within, style, name,
|
||||
listname, listcommand, refprefix,
|
||||
htmltag, htmlattr, htmlstyle, usesfloat, ispredefined);
|
||||
floatlist_.newFloat(fl);
|
||||
// each float has its own counter
|
||||
@ -1104,12 +1104,12 @@ bool TextClass::readFloat(Lexer & lexrc)
|
||||
|
||||
|
||||
string const & TextClass::prerequisites() const
|
||||
{
|
||||
{
|
||||
if (contains(prerequisites_, ',')) {
|
||||
vector<string> const pres = getVectorFromString(prerequisites_);
|
||||
prerequisites_ = getStringFromVector(pres, "\n\t");
|
||||
}
|
||||
return prerequisites_;
|
||||
return prerequisites_;
|
||||
}
|
||||
|
||||
bool TextClass::hasLayout(docstring const & n) const
|
||||
@ -1124,7 +1124,7 @@ bool TextClass::hasLayout(docstring const & n) const
|
||||
|
||||
bool TextClass::hasInsetLayout(docstring const & n) const
|
||||
{
|
||||
if (n.empty())
|
||||
if (n.empty())
|
||||
return false;
|
||||
InsetLayouts::const_iterator it = insetlayoutlist_.begin();
|
||||
InsetLayouts::const_iterator en = insetlayoutlist_.end();
|
||||
@ -1139,7 +1139,7 @@ Layout const & TextClass::operator[](docstring const & name) const
|
||||
{
|
||||
LASSERT(!name.empty(), /**/);
|
||||
|
||||
const_iterator it =
|
||||
const_iterator it =
|
||||
find_if(begin(), end(), LayoutNamesEqual(name));
|
||||
|
||||
if (it == end()) {
|
||||
@ -1213,7 +1213,7 @@ bool TextClass::load(string const & path) const
|
||||
<< to_utf8(makeDisplayPath(layout_file.absFileName()))
|
||||
<< "'\n(Check `" << name_
|
||||
<< "')\nCheck your installation and "
|
||||
"try Options/Reconfigure..."
|
||||
"try Options/Reconfigure..."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
@ -1231,7 +1231,7 @@ bool DocumentClass::addLayoutIfNeeded(docstring const & n) const
|
||||
}
|
||||
|
||||
|
||||
InsetLayout const & DocumentClass::insetLayout(docstring const & name) const
|
||||
InsetLayout const & DocumentClass::insetLayout(docstring const & name) const
|
||||
{
|
||||
// FIXME The fix for the InsetLayout part of 4812 would be here:
|
||||
// Add the InsetLayout to the document class if it is not found.
|
||||
@ -1262,13 +1262,13 @@ Layout const & TextClass::defaultLayout() const
|
||||
}
|
||||
|
||||
|
||||
bool TextClass::isDefaultLayout(Layout const & layout) const
|
||||
bool TextClass::isDefaultLayout(Layout const & layout) const
|
||||
{
|
||||
return layout.name() == defaultLayoutName();
|
||||
}
|
||||
|
||||
|
||||
bool TextClass::isPlainLayout(Layout const & layout) const
|
||||
bool TextClass::isPlainLayout(Layout const & layout) const
|
||||
{
|
||||
return layout.name() == plainLayoutName();
|
||||
}
|
||||
@ -1329,8 +1329,8 @@ DocumentClass & DocumentClassBundle::newClass(LayoutFile const & baseClass)
|
||||
|
||||
DocumentClassBundle & DocumentClassBundle::get()
|
||||
{
|
||||
static DocumentClassBundle singleton;
|
||||
return singleton;
|
||||
static DocumentClassBundle singleton;
|
||||
return singleton;
|
||||
}
|
||||
|
||||
|
||||
@ -1438,7 +1438,7 @@ Layout const & DocumentClass::htmlTOCLayout() const
|
||||
string const & DocumentClass::getCiteFormat(string const & entry_type) const
|
||||
{
|
||||
static string default_format = "{%author%[[%author%, ]][[{%editor%[[%editor%, ed., ]]}]]}\"%title%\"{%journal%[[, {!<i>!}%journal%{!</i>!}]][[{%publisher%[[, %publisher%]][[{%institution%[[, %institution%]]}]]}]]}{%year%[[ (%year%)]]}{%pages%[[, %pages%]]}.";
|
||||
|
||||
|
||||
map<string, string>::const_iterator it = cite_formats_.find(entry_type);
|
||||
if (it != cite_formats_.end())
|
||||
return it->second;
|
||||
|
@ -55,24 +55,24 @@ private:
|
||||
};
|
||||
|
||||
|
||||
/// A TextClass represents a collection of layout information: At the
|
||||
/// A TextClass represents a collection of layout information: At the
|
||||
/// moment, this includes Layout's and InsetLayout's.
|
||||
///
|
||||
/// There are two major subclasses of TextClass: LayoutFile and
|
||||
/// DocumentClass. These subclasses are what are actually used in LyX.
|
||||
/// Simple TextClass objects are not directly constructed in the main
|
||||
/// Simple TextClass objects are not directly constructed in the main
|
||||
/// LyX code---the constructor is protected. (That said, in tex2lyx
|
||||
/// there are what amount to simple TextClass objects.)
|
||||
///
|
||||
/// A LayoutFile (see LayoutFile.{h,cpp}) represents a *.layout file.
|
||||
/// These are generally static objects---though they can be reloaded
|
||||
/// from disk via LFUN_LAYOUT_RELOAD, so one should not assume that
|
||||
/// These are generally static objects---though they can be reloaded
|
||||
/// from disk via LFUN_LAYOUT_RELOAD, so one should not assume that
|
||||
/// they will never change.
|
||||
///
|
||||
/// A DocumentClass (see below) represents the layout information that
|
||||
/// is associated with a given Buffer. These are static, in the sense
|
||||
/// that they will not themselves change, but which DocumentClass is
|
||||
/// associated with a Buffer can change, as modules are loaded and
|
||||
/// associated with a Buffer can change, as modules are loaded and
|
||||
/// unloaded, for example.
|
||||
///
|
||||
class TextClass : protected ProtectCopy {
|
||||
@ -84,7 +84,7 @@ public:
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// NOTE Do NOT try to make this a container of Layout pointers, e.g.,
|
||||
// std::list<Layout *>. This will lead to problems. The reason is
|
||||
// that DocumentClass objects are generally created by copying a
|
||||
// that DocumentClass objects are generally created by copying a
|
||||
// LayoutFile, which serves as a base for the DocumentClass. If the
|
||||
// LayoutList is a container of pointers, then every DocumentClass
|
||||
// that derives from a given LayoutFile (e.g., article) will SHARE
|
||||
@ -120,14 +120,14 @@ public:
|
||||
docstring const & defaultLayoutName() const;
|
||||
///
|
||||
bool isDefaultLayout(Layout const &) const;
|
||||
///
|
||||
///
|
||||
bool isPlainLayout(Layout const &) const;
|
||||
/// returns a special layout for use when we don't really want one,
|
||||
/// e.g., in table cells
|
||||
Layout const & plainLayout() const
|
||||
Layout const & plainLayout() const
|
||||
{ return operator[](plain_layout_); }
|
||||
/// the name of the plain layout
|
||||
docstring const & plainLayoutName() const
|
||||
docstring const & plainLayoutName() const
|
||||
{ return plain_layout_; }
|
||||
/// Enumerate the paragraph styles.
|
||||
size_t layoutCount() const { return layoutlist_.size(); }
|
||||
@ -144,7 +144,7 @@ public:
|
||||
// reading routines
|
||||
///////////////////////////////////////////////////////////////////
|
||||
/// Enum used with TextClass::read
|
||||
enum ReadType {
|
||||
enum ReadType {
|
||||
BASECLASS, //>This is a base class, i.e., top-level layout file
|
||||
MERGE, //>This is a file included in a layout file
|
||||
MODULE, //>This is a layout module
|
||||
@ -204,14 +204,14 @@ protected:
|
||||
///
|
||||
Layout & operator[](docstring const & name);
|
||||
/** Create an new, very basic layout for this textclass. This is used for
|
||||
the Plain Layout common to all TextClass objects and also, in
|
||||
the Plain Layout common to all TextClass objects and also, in
|
||||
DocumentClass, for the creation of new layouts `on the fly' when
|
||||
previously unknown layouts are encountered.
|
||||
\param unknown Set to true if this layout is used to represent an
|
||||
\param unknown Set to true if this layout is used to represent an
|
||||
unknown layout
|
||||
*/
|
||||
Layout createBasicLayout(docstring const & name, bool unknown = false) const;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// non-const iterators
|
||||
///////////////////////////////////////////////////////////////////
|
||||
@ -343,17 +343,17 @@ private:
|
||||
|
||||
/// A DocumentClass represents the layout information associated with a
|
||||
/// Buffer. It is based upon a LayoutFile, but may be modified by loading
|
||||
/// various Modules.
|
||||
///
|
||||
/// various Modules.
|
||||
///
|
||||
/// In that regard, DocumentClass objects are "dynamic". But this is really
|
||||
/// an illusion, since DocumentClass objects are not (currently) changed
|
||||
/// when, say, a new Module is loaded. Rather, the old DocumentClass is
|
||||
/// discarded---actually, it's kept around in case something on the cut
|
||||
/// stack needs it---and a new one is created from scratch.
|
||||
///
|
||||
/// stack needs it---and a new one is created from scratch.
|
||||
///
|
||||
/// In the main LyX code, DocumentClass objects are created only by
|
||||
/// DocumentClassBundle, for which see below.
|
||||
///
|
||||
///
|
||||
class DocumentClass : public TextClass, boost::noncopyable {
|
||||
public:
|
||||
///
|
||||
@ -452,15 +452,15 @@ private:
|
||||
};
|
||||
|
||||
|
||||
/// DocumentClassBundle is a container for DocumentClass objects, so that
|
||||
/// DocumentClassBundle is a container for DocumentClass objects, so that
|
||||
/// they stay in memory for use by Insets, CutAndPaste, and the like, even
|
||||
/// when their associated Buffers are destroyed.
|
||||
/// FIXME Some sort of garbage collection or reference counting wouldn't
|
||||
/// be a bad idea here. It might be enough to check when a Buffer is closed
|
||||
/// (or makeDocumentClass is called) whether the old DocumentClass is in use
|
||||
/// (or makeDocumentClass is called) whether the old DocumentClass is in use
|
||||
/// anywhere.
|
||||
///
|
||||
/// This is a singleton class. Its sole instance is accessed via
|
||||
/// This is a singleton class. Its sole instance is accessed via
|
||||
/// DocumentClassBundle::get().
|
||||
class DocumentClassBundle : boost::noncopyable {
|
||||
public:
|
||||
@ -468,7 +468,7 @@ public:
|
||||
static DocumentClassBundle & get();
|
||||
/// \return A new DocumentClass based on baseClass, with info added
|
||||
/// from the modules in modlist.
|
||||
DocumentClass & makeDocumentClass(LayoutFile const & baseClass,
|
||||
DocumentClass & makeDocumentClass(LayoutFile const & baseClass,
|
||||
LayoutModuleList const & modlist);
|
||||
private:
|
||||
/// control instantiation
|
||||
|
@ -419,7 +419,7 @@ void GuiBibtex::applyView()
|
||||
// use \nocite{*}
|
||||
params_["btprint"] = from_ascii("btPrintAll");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,14 +99,14 @@ GuiCitation::GuiCitation(GuiView & lv)
|
||||
this, SLOT(changed()));
|
||||
connect(textAfterED, SIGNAL(textChanged(QString)),
|
||||
this, SLOT(changed()));
|
||||
connect(findLE, SIGNAL(returnPressed()),
|
||||
connect(findLE, SIGNAL(returnPressed()),
|
||||
this, SLOT(on_searchPB_clicked()));
|
||||
connect(textBeforeED, SIGNAL(returnPressed()),
|
||||
this, SLOT(on_okPB_clicked()));
|
||||
connect(textAfterED, SIGNAL(returnPressed()),
|
||||
this, SLOT(on_okPB_clicked()));
|
||||
|
||||
selectionManager = new GuiSelectionManager(availableLV, selectedLV,
|
||||
selectionManager = new GuiSelectionManager(availableLV, selectedLV,
|
||||
addPB, deletePB, upPB, downPB, &available_model_, &selected_model_);
|
||||
connect(selectionManager, SIGNAL(selectionChanged()),
|
||||
this, SLOT(setCitedKeys()));
|
||||
@ -290,16 +290,16 @@ void GuiCitation::fillStyles(BiblioInfo const & bi)
|
||||
|
||||
QStringList sty = citationStyles(bi, curr);
|
||||
|
||||
if (sty.isEmpty()) {
|
||||
if (sty.isEmpty()) {
|
||||
// some error
|
||||
citationStyleCO->setEnabled(false);
|
||||
citationStyleLA->setEnabled(false);
|
||||
citationStyleCO->clear();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
citationStyleCO->blockSignals(true);
|
||||
|
||||
|
||||
// save old index
|
||||
int const oldIndex = citationStyleCO->currentIndex();
|
||||
citationStyleCO->clear();
|
||||
@ -375,38 +375,38 @@ void GuiCitation::updateInfo(BiblioInfo const & bi, QModelIndex const & idx)
|
||||
void GuiCitation::findText(QString const & text, bool reset)
|
||||
{
|
||||
//"All Fields" and "Keys" are the first two
|
||||
int index = fieldsCO->currentIndex() - 2;
|
||||
int index = fieldsCO->currentIndex() - 2;
|
||||
BiblioInfo const & bi = bibInfo();
|
||||
vector<docstring> const & fields = bi.getFields();
|
||||
docstring field;
|
||||
|
||||
|
||||
if (index <= -1 || index >= int(fields.size()))
|
||||
//either "All Fields" or "Keys" or an invalid value
|
||||
field = from_ascii("");
|
||||
else
|
||||
field = fields[index];
|
||||
|
||||
|
||||
//Was it "Keys"?
|
||||
bool const onlyKeys = index == -1;
|
||||
|
||||
|
||||
//"All Entry Types" is first.
|
||||
index = entriesCO->currentIndex() - 1;
|
||||
index = entriesCO->currentIndex() - 1;
|
||||
vector<docstring> const & entries = bi.getEntries();
|
||||
docstring entry_type;
|
||||
if (index < 0 || index >= int(entries.size()))
|
||||
entry_type = from_ascii("");
|
||||
else
|
||||
else
|
||||
entry_type = entries[index];
|
||||
|
||||
|
||||
bool const case_sentitive = caseCB->checkState();
|
||||
bool const reg_exp = regexCB->checkState();
|
||||
findKey(bi, text, onlyKeys, field, entry_type,
|
||||
findKey(bi, text, onlyKeys, field, entry_type,
|
||||
case_sentitive, reg_exp, reset);
|
||||
//FIXME
|
||||
//It'd be nice to save and restore the current selection in
|
||||
//It'd be nice to save and restore the current selection in
|
||||
//availableLV. Currently, we get an automatic reset, since the
|
||||
//model is reset.
|
||||
|
||||
|
||||
updateControls(bi);
|
||||
}
|
||||
|
||||
@ -531,10 +531,10 @@ void GuiCitation::init()
|
||||
selectedLV->blockSignals(true);
|
||||
selectedLV->setFocus();
|
||||
QModelIndex idx = selected_model_.index(0, 0);
|
||||
selectedLV->selectionModel()->select(idx,
|
||||
selectedLV->selectionModel()->select(idx,
|
||||
QItemSelectionModel::ClearAndSelect);
|
||||
selectedLV->blockSignals(false);
|
||||
|
||||
|
||||
// set the style combo appropriately
|
||||
string const & command = params_.getCmdName();
|
||||
vector<CiteStyle> const & styles = citeStyles_;
|
||||
@ -594,18 +594,18 @@ void GuiCitation::findKey(BiblioInfo const & bi,
|
||||
last_searched_string = str;
|
||||
|
||||
QStringList result;
|
||||
|
||||
// First, filter by entry_type, which will be faster than
|
||||
|
||||
// First, filter by entry_type, which will be faster than
|
||||
// what follows, so we may get to do that on less.
|
||||
vector<docstring> keyVector = to_docstring_vector(keys);
|
||||
filterByEntryType(bi, keyVector, entry_type);
|
||||
|
||||
|
||||
if (str.isEmpty())
|
||||
result = to_qstring_list(keyVector);
|
||||
else
|
||||
result = to_qstring_list(searchKeys(bi, keyVector, only_keys,
|
||||
result = to_qstring_list(searchKeys(bi, keyVector, only_keys,
|
||||
qstring_to_ucs4(str), field, case_sensitive, reg_exp));
|
||||
|
||||
|
||||
available_model_.setStringList(result);
|
||||
}
|
||||
|
||||
@ -617,7 +617,7 @@ QStringList GuiCitation::citationStyles(BiblioInfo const & bi, int sel)
|
||||
}
|
||||
|
||||
|
||||
void GuiCitation::setCitedKeys()
|
||||
void GuiCitation::setCitedKeys()
|
||||
{
|
||||
cited_keys_ = selected_model_.stringList();
|
||||
}
|
||||
@ -640,11 +640,11 @@ void GuiCitation::clearParams()
|
||||
|
||||
|
||||
void GuiCitation::filterByEntryType(BiblioInfo const & bi,
|
||||
vector<docstring> & keyVector, docstring entry_type)
|
||||
vector<docstring> & keyVector, docstring entry_type)
|
||||
{
|
||||
if (entry_type.empty())
|
||||
return;
|
||||
|
||||
|
||||
vector<docstring>::iterator it = keyVector.begin();
|
||||
vector<docstring>::iterator end = keyVector.end();
|
||||
|
||||
@ -690,7 +690,7 @@ static docstring escape_special_chars(docstring const & expr)
|
||||
}
|
||||
|
||||
|
||||
vector<docstring> GuiCitation::searchKeys(BiblioInfo const & bi,
|
||||
vector<docstring> GuiCitation::searchKeys(BiblioInfo const & bi,
|
||||
vector<docstring> const & keys_to_search, bool only_keys,
|
||||
docstring const & search_expression, docstring field,
|
||||
bool case_sensitive, bool regex)
|
||||
@ -723,16 +723,16 @@ vector<docstring> GuiCitation::searchKeys(BiblioInfo const & bi,
|
||||
BiblioInfo::const_iterator info = bi.find(*it);
|
||||
if (info == bi.end())
|
||||
continue;
|
||||
|
||||
|
||||
BibTeXInfo const & kvm = info->second;
|
||||
string data;
|
||||
if (only_keys)
|
||||
data = to_utf8(*it);
|
||||
else if (field.empty())
|
||||
data = to_utf8(*it) + ' ' + to_utf8(kvm.allData());
|
||||
else
|
||||
else
|
||||
data = to_utf8(kvm[field]);
|
||||
|
||||
|
||||
if (data.empty())
|
||||
continue;
|
||||
|
||||
|
@ -61,7 +61,7 @@ private Q_SLOTS:
|
||||
void setCitedKeys();
|
||||
/// performs a limited update, suitable for internal call
|
||||
void updateControls();
|
||||
|
||||
|
||||
|
||||
private:
|
||||
/// Dialog inherited methods
|
||||
@ -109,7 +109,7 @@ private:
|
||||
void init();
|
||||
/// Clear selected keys
|
||||
void clearSelection();
|
||||
|
||||
|
||||
/// Find keys containing a string.
|
||||
void findKey(
|
||||
BiblioInfo const & bi, //< optimize by passing this
|
||||
@ -148,7 +148,7 @@ private:
|
||||
); //
|
||||
|
||||
/// The BibTeX information available to the dialog
|
||||
/// Calls to this method will lead to checks of modification times and
|
||||
/// Calls to this method will lead to checks of modification times and
|
||||
/// the like, so it should be avoided.
|
||||
BiblioInfo const & bibInfo() const;
|
||||
|
||||
|
@ -211,7 +211,7 @@ public:
|
||||
namespace frontend {
|
||||
namespace {
|
||||
|
||||
vector<string> getRequiredList(string const & modName)
|
||||
vector<string> getRequiredList(string const & modName)
|
||||
{
|
||||
LyXModule const * const mod = theModuleList[modName];
|
||||
if (!mod)
|
||||
@ -266,16 +266,16 @@ bool isModuleAvailable(string const & modName)
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// SelectionManager for use with modules
|
||||
class ModuleSelectionManager : public GuiSelectionManager
|
||||
class ModuleSelectionManager : public GuiSelectionManager
|
||||
{
|
||||
public:
|
||||
///
|
||||
ModuleSelectionManager(
|
||||
QTreeView * availableLV,
|
||||
QListView * selectedLV,
|
||||
QPushButton * addPB,
|
||||
QPushButton * delPB,
|
||||
QPushButton * upPB,
|
||||
QPushButton * addPB,
|
||||
QPushButton * delPB,
|
||||
QPushButton * upPB,
|
||||
QPushButton * downPB,
|
||||
GuiIdListModel * availableModel,
|
||||
GuiIdListModel * selectedModel,
|
||||
@ -284,10 +284,10 @@ public:
|
||||
upPB, downPB, availableModel, selectedModel), container_(container)
|
||||
{}
|
||||
///
|
||||
void updateProvidedModules(LayoutModuleList const & pm)
|
||||
void updateProvidedModules(LayoutModuleList const & pm)
|
||||
{ provided_modules_ = pm.list(); }
|
||||
///
|
||||
void updateExcludedModules(LayoutModuleList const & em)
|
||||
void updateExcludedModules(LayoutModuleList const & em)
|
||||
{ excluded_modules_ = em.list(); }
|
||||
private:
|
||||
///
|
||||
@ -299,12 +299,12 @@ private:
|
||||
///
|
||||
virtual void updateDelPB();
|
||||
/// returns availableModel as a GuiIdListModel
|
||||
GuiIdListModel * getAvailableModel()
|
||||
GuiIdListModel * getAvailableModel()
|
||||
{
|
||||
return dynamic_cast<GuiIdListModel *>(availableModel);
|
||||
}
|
||||
/// returns selectedModel as a GuiIdListModel
|
||||
GuiIdListModel * getSelectedModel()
|
||||
GuiIdListModel * getSelectedModel()
|
||||
{
|
||||
return dynamic_cast<GuiIdListModel *>(selectedModel);
|
||||
}
|
||||
@ -312,14 +312,14 @@ private:
|
||||
list<string> provided_modules_;
|
||||
/// similarly...
|
||||
list<string> excluded_modules_;
|
||||
///
|
||||
///
|
||||
GuiDocument const * container_;
|
||||
};
|
||||
|
||||
void ModuleSelectionManager::updateAddPB()
|
||||
void ModuleSelectionManager::updateAddPB()
|
||||
{
|
||||
int const arows = availableModel->rowCount();
|
||||
QModelIndexList const avail_sels =
|
||||
QModelIndexList const avail_sels =
|
||||
availableLV->selectionModel()->selectedIndexes();
|
||||
|
||||
// disable if there aren't any modules (?), if none of them is chosen
|
||||
@ -332,7 +332,7 @@ void ModuleSelectionManager::updateAddPB()
|
||||
QModelIndex const & idx = availableLV->selectionModel()->currentIndex();
|
||||
string const modname = getAvailableModel()->getIDString(idx.row());
|
||||
|
||||
bool const enable =
|
||||
bool const enable =
|
||||
container_->params().moduleCanBeAdded(modname);
|
||||
addPB->setEnabled(enable);
|
||||
}
|
||||
@ -365,13 +365,13 @@ void ModuleSelectionManager::updateDownPB()
|
||||
}
|
||||
|
||||
// Enable it if this module isn't required.
|
||||
// FIXME This should perhaps be more flexible and check whether, even
|
||||
// FIXME This should perhaps be more flexible and check whether, even
|
||||
// if the next one is required, there is also an earlier one that will do.
|
||||
downPB->setEnabled(
|
||||
find(reqs.begin(), reqs.end(), curmodname) == reqs.end());
|
||||
}
|
||||
|
||||
void ModuleSelectionManager::updateUpPB()
|
||||
void ModuleSelectionManager::updateUpPB()
|
||||
{
|
||||
int const srows = selectedModel->rowCount();
|
||||
if (srows == 0) {
|
||||
@ -398,13 +398,13 @@ void ModuleSelectionManager::updateUpPB()
|
||||
|
||||
|
||||
// Enable it if the preceding module isn't required.
|
||||
// NOTE This is less flexible than it might be. We could check whether, even
|
||||
// NOTE This is less flexible than it might be. We could check whether, even
|
||||
// if the previous one is required, there is an earlier one that would do.
|
||||
string const premod = getSelectedModel()->getIDString(curRow - 1);
|
||||
upPB->setEnabled(find(reqs.begin(), reqs.end(), premod) == reqs.end());
|
||||
}
|
||||
|
||||
void ModuleSelectionManager::updateDelPB()
|
||||
void ModuleSelectionManager::updateDelPB()
|
||||
{
|
||||
int const srows = selectedModel->rowCount();
|
||||
if (srows == 0) {
|
||||
@ -412,7 +412,7 @@ void ModuleSelectionManager::updateDelPB()
|
||||
return;
|
||||
}
|
||||
|
||||
QModelIndex const & curidx =
|
||||
QModelIndex const & curidx =
|
||||
selectedLV->selectionModel()->currentIndex();
|
||||
int const curRow = curidx.row();
|
||||
if (curRow < 0 || curRow >= srows) { // invalid index?
|
||||
@ -445,7 +445,7 @@ void ModuleSelectionManager::updateDelPB()
|
||||
for (int j = 0; j < curRow; ++j) {
|
||||
string const mod = getSelectedModel()->getIDString(j);
|
||||
// lyxerr << "In loop: Testing " << mod << endl;
|
||||
// do we satisfy the require?
|
||||
// do we satisfy the require?
|
||||
if (find(reqs.begin(), reqs.end(), mod) != reqs.end()) {
|
||||
// lyxerr << mod << " does the trick." << endl;
|
||||
foundone = true;
|
||||
@ -599,14 +599,14 @@ void LocalLayout::convertPressed() {
|
||||
void LocalLayout::validate() {
|
||||
static const QString valid = qt_("Layout is valid!");
|
||||
static const QString vtext =
|
||||
toqstr("<p style=\"font-weight: bold; \">")
|
||||
toqstr("<p style=\"font-weight: bold; \">")
|
||||
+ valid + toqstr("</p>");
|
||||
static const QString invalid = qt_("Layout is invalid!");
|
||||
static const QString ivtext =
|
||||
toqstr("<p style=\"color: #c00000; font-weight: bold; \">")
|
||||
toqstr("<p style=\"color: #c00000; font-weight: bold; \">")
|
||||
+ invalid + toqstr("</p>");
|
||||
|
||||
string const layout =
|
||||
string const layout =
|
||||
fromqstr(locallayoutTE->document()->toPlainText().trimmed());
|
||||
if (layout.empty()) {
|
||||
is_valid_ = true;
|
||||
@ -874,7 +874,7 @@ GuiDocument::GuiDocument(GuiView & lv)
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(pageLayoutModule->pagestyleCO, SIGNAL(activated(int)),
|
||||
this, SLOT(change_adaptor()));
|
||||
|
||||
|
||||
pageLayoutModule->pagestyleCO->addItem(qt_("Default"));
|
||||
pageLayoutModule->pagestyleCO->addItem(qt_("empty"));
|
||||
pageLayoutModule->pagestyleCO->addItem(qt_("plain"));
|
||||
@ -1151,7 +1151,7 @@ GuiDocument::GuiDocument(GuiView & lv)
|
||||
mathsModule->mathdotsCB, SLOT(setDisabled(bool)));
|
||||
connect(mathsModule->undertildeautoCB, SIGNAL(toggled(bool)),
|
||||
mathsModule->undertildeCB, SLOT(setDisabled(bool)));
|
||||
|
||||
|
||||
connect(mathsModule->amsCB, SIGNAL(clicked()),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(mathsModule->amsautoCB, SIGNAL(clicked()),
|
||||
@ -1172,7 +1172,7 @@ GuiDocument::GuiDocument(GuiView & lv)
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(mathsModule->undertildeautoCB, SIGNAL(clicked()),
|
||||
this, SLOT(change_adaptor()));
|
||||
|
||||
|
||||
|
||||
// latex class
|
||||
latexModule = new UiWidget<Ui::LaTeXUi>;
|
||||
@ -1241,7 +1241,7 @@ GuiDocument::GuiDocument(GuiView & lv)
|
||||
preambleModule = new PreambleModule;
|
||||
connect(preambleModule, SIGNAL(changed()),
|
||||
this, SLOT(change_adaptor()));
|
||||
|
||||
|
||||
localLayout = new LocalLayout;
|
||||
connect(localLayout, SIGNAL(changed()),
|
||||
this, SLOT(change_adaptor()));
|
||||
@ -1332,9 +1332,9 @@ GuiDocument::GuiDocument(GuiView & lv)
|
||||
listingsModule = new UiWidget<Ui::ListingsSettingsUi>;
|
||||
connect(listingsModule->listingsED, SIGNAL(textChanged()),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(listingsModule->bypassCB, SIGNAL(clicked()),
|
||||
connect(listingsModule->bypassCB, SIGNAL(clicked()),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(listingsModule->bypassCB, SIGNAL(clicked()),
|
||||
connect(listingsModule->bypassCB, SIGNAL(clicked()),
|
||||
this, SLOT(setListingsMessage()));
|
||||
connect(listingsModule->listingsED, SIGNAL(textChanged()),
|
||||
this, SLOT(setListingsMessage()));
|
||||
@ -1405,7 +1405,7 @@ void GuiDocument::includeonlyClicked(QTreeWidgetItem * item, int)
|
||||
includeonlys_.remove(child);
|
||||
else
|
||||
includeonlys_.push_back(child);
|
||||
|
||||
|
||||
updateIncludeonlys();
|
||||
changed();
|
||||
}
|
||||
@ -1417,7 +1417,7 @@ QString GuiDocument::validateListingsParameters()
|
||||
// of the same parameters
|
||||
static string param_cache;
|
||||
static QString msg_cache;
|
||||
|
||||
|
||||
if (listingsModule->bypassCB->isChecked())
|
||||
return QString();
|
||||
|
||||
@ -1563,7 +1563,7 @@ void GuiDocument::setCustomMargins(bool custom)
|
||||
marginsModule->footskipLE->setEnabled(!custom);
|
||||
marginsModule->footskipUnit->setEnabled(!custom);
|
||||
|
||||
bool const enableColSep = !custom &&
|
||||
bool const enableColSep = !custom &&
|
||||
textLayoutModule->twoColumnCB->checkState() == Qt::Checked;
|
||||
marginsModule->columnsepL->setEnabled(enableColSep);
|
||||
marginsModule->columnsepLE->setEnabled(enableColSep);
|
||||
@ -1710,7 +1710,7 @@ void GuiDocument::osFontsChanged(bool nontexfonts)
|
||||
font = tex_fonts_roman[fontModule->fontsRomanCO->currentIndex()];
|
||||
fontModule->fontScCB->setEnabled(providesSC(font));
|
||||
fontModule->fontOsfCB->setEnabled(providesOSF(font));
|
||||
|
||||
|
||||
fontModule->fontencLA->setEnabled(tex_fonts);
|
||||
fontModule->fontencCO->setEnabled(tex_fonts);
|
||||
if (!tex_fonts)
|
||||
@ -1749,7 +1749,7 @@ void GuiDocument::updateFontlist()
|
||||
fontModule->fontsRomanCO->addItem(qt_("Default"), QString("default"));
|
||||
fontModule->fontsSansCO->addItem(qt_("Default"), QString("default"));
|
||||
fontModule->fontsTypewriterCO->addItem(qt_("Default"), QString("default"));
|
||||
|
||||
|
||||
QFontDatabase fontdb;
|
||||
QStringList families(fontdb.families());
|
||||
for (QStringList::Iterator it = families.begin(); it != families.end(); ++it) {
|
||||
@ -1862,7 +1862,7 @@ void GuiDocument::browseLayout()
|
||||
|
||||
FileName layoutFile = support::makeAbsPath(fromqstr(file),
|
||||
fromqstr(bufferFilePath()));
|
||||
|
||||
|
||||
int const ret = Alert::prompt(_("Local layout file"),
|
||||
_("The layout file you have selected is a local layout\n"
|
||||
"file, not one in the system or user directory. Your\n"
|
||||
@ -1882,14 +1882,14 @@ void GuiDocument::browseLayout()
|
||||
|
||||
if (name.empty()) {
|
||||
Alert::error(_("Error"),
|
||||
_("Unable to read local layout file."));
|
||||
_("Unable to read local layout file."));
|
||||
return;
|
||||
}
|
||||
|
||||
// do not trigger classChanged if there is no change.
|
||||
if (latexModule->classCO->currentText() == toqstr(name))
|
||||
return;
|
||||
|
||||
|
||||
// add to combo box
|
||||
int idx = latexModule->classCO->findText(toqstr(name));
|
||||
if (idx == -1) {
|
||||
@ -1897,7 +1897,7 @@ void GuiDocument::browseLayout()
|
||||
latexModule->classCO->setCurrentIndex(0);
|
||||
} else
|
||||
latexModule->classCO->setCurrentIndex(idx);
|
||||
|
||||
|
||||
classChanged();
|
||||
}
|
||||
|
||||
@ -1920,7 +1920,7 @@ void GuiDocument::browseMaster()
|
||||
void GuiDocument::classChanged()
|
||||
{
|
||||
int idx = latexModule->classCO->currentIndex();
|
||||
if (idx < 0)
|
||||
if (idx < 0)
|
||||
return;
|
||||
string const classname = classes_model_.getIDString(idx);
|
||||
|
||||
@ -1952,8 +1952,8 @@ void GuiDocument::classChanged()
|
||||
|
||||
// We load the TextClass as soon as it is selected. This is
|
||||
// necessary so that other options in the dialog can be updated
|
||||
// according to the new class. Note, however, that, if you use
|
||||
// the scroll wheel when sitting on the combo box, we'll load a
|
||||
// according to the new class. Note, however, that, if you use
|
||||
// the scroll wheel when sitting on the combo box, we'll load a
|
||||
// lot of TextClass objects very quickly....
|
||||
if (!bp_.setBaseClass(classname)) {
|
||||
Alert::error(_("Error"), _("Unable to set document class."));
|
||||
@ -1962,11 +1962,11 @@ void GuiDocument::classChanged()
|
||||
if (lyxrc.auto_reset_options)
|
||||
bp_.useClassDefaults();
|
||||
|
||||
// With the introduction of modules came a distinction between the base
|
||||
// class and the document class. The former corresponds to the main layout
|
||||
// With the introduction of modules came a distinction between the base
|
||||
// class and the document class. The former corresponds to the main layout
|
||||
// file; the latter is that plus the modules (or the document-specific layout,
|
||||
// or whatever else there could be). Our parameters come from the document
|
||||
// class. So when we set the base class, we also need to recreate the document
|
||||
// or whatever else there could be). Our parameters come from the document
|
||||
// class. So when we set the base class, we also need to recreate the document
|
||||
// class. Otherwise, we still have the old one.
|
||||
bp_.makeDocumentClass();
|
||||
paramsToDialog();
|
||||
@ -1989,17 +1989,17 @@ void GuiDocument::bibtexChanged(int n)
|
||||
|
||||
|
||||
namespace {
|
||||
// FIXME unicode
|
||||
// FIXME unicode
|
||||
// both of these should take a vector<docstring>
|
||||
|
||||
|
||||
// This is an insanely complicated attempt to make this sort of thing
|
||||
// work with RTL languages.
|
||||
docstring formatStrVec(vector<string> const & v, docstring const & s)
|
||||
docstring formatStrVec(vector<string> const & v, docstring const & s)
|
||||
{
|
||||
//this mess formats the list as "v[0], v[1], ..., [s] v[n]"
|
||||
if (v.size() == 0)
|
||||
return docstring();
|
||||
if (v.size() == 1)
|
||||
if (v.size() == 1)
|
||||
return translateIfPossible(from_utf8(v[0]));
|
||||
if (v.size() == 2) {
|
||||
docstring retval = _("%1$s and %2$s");
|
||||
@ -2012,14 +2012,14 @@ namespace {
|
||||
docstring t2 = _("%1$s, %2$s");
|
||||
docstring retval = translateIfPossible(from_utf8(v[0]));
|
||||
for (int i = 1; i < vSize - 2; ++i)
|
||||
retval = bformat(t2, retval, translateIfPossible(from_utf8(v[i])));
|
||||
retval = bformat(t2, retval, translateIfPossible(from_utf8(v[i])));
|
||||
//...and then to plug them, and the last two, into this schema
|
||||
docstring t = _("%1$s, %2$s, and %3$s");
|
||||
t = subst(t, _("and"), s);
|
||||
return bformat(t, retval, translateIfPossible(from_utf8(v[vSize - 2])),
|
||||
translateIfPossible(from_utf8(v[vSize - 1])));
|
||||
}
|
||||
|
||||
|
||||
vector<string> idsToNames(vector<string> const & idList)
|
||||
{
|
||||
vector<string> retval;
|
||||
@ -2028,7 +2028,7 @@ namespace {
|
||||
for (; it != end; ++it) {
|
||||
LyXModule const * const mod = theModuleList[*it];
|
||||
if (!mod)
|
||||
retval.push_back(to_utf8(bformat(_("%1$s (unavailable)"),
|
||||
retval.push_back(to_utf8(bformat(_("%1$s (unavailable)"),
|
||||
translateIfPossible(from_utf8(*it)))));
|
||||
else
|
||||
retval.push_back(mod->getName());
|
||||
@ -2081,7 +2081,7 @@ void GuiDocument::modulesChanged()
|
||||
void GuiDocument::updateModuleInfo()
|
||||
{
|
||||
selectionManager->update();
|
||||
|
||||
|
||||
//Module description
|
||||
bool const focus_on_selected = selectionManager->selectedFocused();
|
||||
QAbstractItemView * lv;
|
||||
@ -2094,7 +2094,7 @@ void GuiDocument::updateModuleInfo()
|
||||
return;
|
||||
}
|
||||
QModelIndex const & idx = lv->selectionModel()->currentIndex();
|
||||
GuiIdListModel const & id_model =
|
||||
GuiIdListModel const & id_model =
|
||||
focus_on_selected ? modules_sel_model_ : modules_av_model_;
|
||||
string const modName = id_model.getIDString(idx.row());
|
||||
docstring desc = getModuleDescription(modName);
|
||||
@ -2303,7 +2303,7 @@ void GuiDocument::applyView()
|
||||
QString const lang = langModule->languageCO->itemData(
|
||||
langModule->languageCO->currentIndex()).toString();
|
||||
bp_.language = lyx::languages.getLanguage(fromqstr(lang));
|
||||
|
||||
|
||||
QString const pack = langModule->languagePackageCO->itemData(
|
||||
langModule->languagePackageCO->currentIndex()).toString();
|
||||
if (pack == "custom")
|
||||
@ -2335,7 +2335,7 @@ void GuiDocument::applyView()
|
||||
// packages
|
||||
bp_.graphics_driver =
|
||||
tex_graphics[latexModule->psdriverCO->currentIndex()];
|
||||
|
||||
|
||||
// text layout
|
||||
int idx = latexModule->classCO->currentIndex();
|
||||
if (idx >= 0) {
|
||||
@ -2387,7 +2387,7 @@ void GuiDocument::applyView()
|
||||
else
|
||||
bp_.use_undertilde = BufferParams::package_off;
|
||||
}
|
||||
|
||||
|
||||
// Page Layout
|
||||
if (pageLayoutModule->pagestyleCO->currentIndex() == 0)
|
||||
bp_.pagestyle = "default";
|
||||
@ -2779,7 +2779,7 @@ void GuiDocument::paramsToDialog()
|
||||
if (nitem >= 0)
|
||||
latexModule->psdriverCO->setCurrentIndex(nitem);
|
||||
updateModuleInfo();
|
||||
|
||||
|
||||
mathsModule->amsCB->setChecked(
|
||||
bp_.use_amsmath == BufferParams::package_on);
|
||||
mathsModule->amsautoCB->setChecked(
|
||||
@ -2941,7 +2941,7 @@ void GuiDocument::paramsToDialog()
|
||||
updateDefaultFormat();
|
||||
int index = outputModule->defaultFormatCO->findData(toqstr(
|
||||
bp_.default_output_format));
|
||||
// set to default if format is not found
|
||||
// set to default if format is not found
|
||||
if (index == -1)
|
||||
index = 0;
|
||||
outputModule->defaultFormatCO->setCurrentIndex(index);
|
||||
@ -3010,7 +3010,7 @@ void GuiDocument::paramsToDialog()
|
||||
fontModule->fontOsfCB->setChecked(bp_.fonts_old_figures);
|
||||
fontModule->scaleSansSB->setValue(bp_.fonts_sans_scale);
|
||||
fontModule->scaleTypewriterSB->setValue(bp_.fonts_typewriter_scale);
|
||||
|
||||
|
||||
int nn = findToken(GuiDocument::fontfamilies, bp_.fonts_default_family);
|
||||
if (nn >= 0)
|
||||
fontModule->fontsDefaultCO->setCurrentIndex(nn);
|
||||
@ -3128,26 +3128,26 @@ void GuiDocument::saveDocDefault()
|
||||
}
|
||||
|
||||
|
||||
void GuiDocument::updateAvailableModules()
|
||||
void GuiDocument::updateAvailableModules()
|
||||
{
|
||||
modules_av_model_.clear();
|
||||
list<modInfoStruct> const & modInfoList = getModuleInfo();
|
||||
list<modInfoStruct>::const_iterator mit = modInfoList.begin();
|
||||
list<modInfoStruct>::const_iterator men = modInfoList.end();
|
||||
for (int i = 0; mit != men; ++mit, ++i)
|
||||
modules_av_model_.insertRow(i, mit->name, mit->id,
|
||||
modules_av_model_.insertRow(i, mit->name, mit->id,
|
||||
mit->description);
|
||||
}
|
||||
|
||||
|
||||
void GuiDocument::updateSelectedModules()
|
||||
void GuiDocument::updateSelectedModules()
|
||||
{
|
||||
modules_sel_model_.clear();
|
||||
list<modInfoStruct> const selModList = getSelectedModules();
|
||||
list<modInfoStruct>::const_iterator mit = selModList.begin();
|
||||
list<modInfoStruct>::const_iterator men = selModList.end();
|
||||
for (int i = 0; mit != men; ++mit, ++i)
|
||||
modules_sel_model_.insertRow(i, mit->name, mit->id,
|
||||
modules_sel_model_.insertRow(i, mit->name, mit->id,
|
||||
mit->description);
|
||||
}
|
||||
|
||||
@ -3233,31 +3233,31 @@ void GuiDocument::setLayoutComboByIDString(string const & idString)
|
||||
{
|
||||
int idx = classes_model_.findIDString(idString);
|
||||
if (idx < 0)
|
||||
Alert::warning(_("Can't set layout!"),
|
||||
Alert::warning(_("Can't set layout!"),
|
||||
bformat(_("Unable to set layout for ID: %1$s"), from_utf8(idString)));
|
||||
else
|
||||
else
|
||||
latexModule->classCO->setCurrentIndex(idx);
|
||||
}
|
||||
|
||||
|
||||
bool GuiDocument::isValid()
|
||||
{
|
||||
return
|
||||
return
|
||||
validateListingsParameters().isEmpty() &&
|
||||
localLayout->isValid() &&
|
||||
(
|
||||
// if we're asking for skips between paragraphs
|
||||
!textLayoutModule->skipRB->isChecked() ||
|
||||
// then either we haven't chosen custom
|
||||
textLayoutModule->skipCO->currentIndex() != 3 ||
|
||||
textLayoutModule->skipCO->currentIndex() != 3 ||
|
||||
// or else a length has been given
|
||||
!textLayoutModule->skipLE->text().isEmpty()
|
||||
) &&
|
||||
) &&
|
||||
(
|
||||
// if we're asking for indentation
|
||||
!textLayoutModule->indentRB->isChecked() ||
|
||||
!textLayoutModule->indentRB->isChecked() ||
|
||||
// then either we haven't chosen custom
|
||||
textLayoutModule->indentCO->currentIndex() != 1 ||
|
||||
textLayoutModule->indentCO->currentIndex() != 1 ||
|
||||
// or else a length has been given
|
||||
!textLayoutModule->indentLE->text().isEmpty()
|
||||
);
|
||||
@ -3313,7 +3313,7 @@ list<GuiDocument::modInfoStruct> const & GuiDocument::getModuleInfo()
|
||||
}
|
||||
|
||||
|
||||
list<GuiDocument::modInfoStruct> const
|
||||
list<GuiDocument::modInfoStruct> const
|
||||
GuiDocument::makeModuleInfo(LayoutModuleList const & mods)
|
||||
{
|
||||
LayoutModuleList::const_iterator it = mods.begin();
|
||||
@ -3326,7 +3326,7 @@ list<GuiDocument::modInfoStruct> const
|
||||
if (mod)
|
||||
// FIXME Unicode
|
||||
m.name = toqstr(translateIfPossible(from_utf8(mod->getName())));
|
||||
else
|
||||
else
|
||||
m.name = toqstr(*it) + toqstr(" (") + qt_("Not Found") + toqstr(")");
|
||||
mInfo.push_back(m);
|
||||
}
|
||||
@ -3381,12 +3381,12 @@ void GuiDocument::dispatchParams()
|
||||
if (master->isChild(const_cast<Buffer *>(&buffer())))
|
||||
const_cast<Buffer &>(buffer()).setParent(master);
|
||||
else
|
||||
Alert::warning(_("Assigned master does not include this file"),
|
||||
Alert::warning(_("Assigned master does not include this file"),
|
||||
bformat(_("You must include this file in the document\n"
|
||||
"'%1$s' in order to use the master document\n"
|
||||
"feature."), from_utf8(params().master)));
|
||||
} else
|
||||
Alert::warning(_("Could not load master"),
|
||||
Alert::warning(_("Could not load master"),
|
||||
bformat(_("The master document '%1$s'\n"
|
||||
"could not be loaded."),
|
||||
from_utf8(params().master)));
|
||||
@ -3415,7 +3415,7 @@ void GuiDocument::dispatchParams()
|
||||
executeBranchRenaming();
|
||||
// and clear changed branches cache
|
||||
changedBranches_.clear();
|
||||
|
||||
|
||||
// Generate the colours requested by indices.
|
||||
IndicesList & indiceslist = params().indiceslist();
|
||||
if (!indiceslist.empty()) {
|
||||
|
@ -139,7 +139,7 @@ private:
|
||||
UiWidget<Ui::ListingsSettingsUi> *listingsModule;
|
||||
PreambleModule * preambleModule;
|
||||
LocalLayout * localLayout;
|
||||
|
||||
|
||||
GuiBranches * branchesModule;
|
||||
GuiIndices * indicesModule;
|
||||
|
||||
@ -217,7 +217,7 @@ private:
|
||||
///
|
||||
std::list<modInfoStruct> const getProvidedModules();
|
||||
///
|
||||
std::list<modInfoStruct> const
|
||||
std::list<modInfoStruct> const
|
||||
makeModuleInfo(LayoutModuleList const & mods);
|
||||
///
|
||||
void setLanguage() const;
|
||||
|
@ -108,9 +108,9 @@ public:
|
||||
menuitem is in a submenu, the submenu is enabled to make sure the
|
||||
user sees the information. */
|
||||
Help,
|
||||
/** This type of item merely shows that there might be a list or
|
||||
/** This type of item merely shows that there might be a list or
|
||||
something alike at this position, but the list is still empty.
|
||||
If this item is in a submenu, the submenu will not always be
|
||||
If this item is in a submenu, the submenu will not always be
|
||||
enabled. */
|
||||
Info,
|
||||
/** This is the list of last opened file,
|
||||
@ -204,8 +204,8 @@ public:
|
||||
~MenuItem() {}
|
||||
|
||||
/// The label of a given menuitem
|
||||
QString label() const
|
||||
{
|
||||
QString label() const
|
||||
{
|
||||
int const index = label_.lastIndexOf('|');
|
||||
return index == -1 ? label_ : label_.left(index);
|
||||
}
|
||||
@ -214,7 +214,7 @@ public:
|
||||
QString shortcut() const
|
||||
{
|
||||
int const index = label_.lastIndexOf('|');
|
||||
return index == -1 ? QString() : label_.mid(index + 1);
|
||||
return index == -1 ? QString() : label_.mid(index + 1);
|
||||
}
|
||||
/// The complete label, with label and shortcut separated by a '|'
|
||||
QString fulllabel() const { return label_; }
|
||||
@ -315,7 +315,7 @@ public:
|
||||
void cat(MenuDefinition const & other);
|
||||
///
|
||||
void catSub(docstring const & name);
|
||||
|
||||
|
||||
// search for func in this menu iteratively, and put menu
|
||||
// names in a stack.
|
||||
bool searchMenu(FuncRequest const & func, docstring_list & names)
|
||||
@ -745,7 +745,7 @@ void MenuDefinition::expandGraphicsGroups(BufferView const * bv)
|
||||
|
||||
set<string>::const_iterator it = grp.begin();
|
||||
set<string>::const_iterator end = grp.end();
|
||||
add(MenuItem(MenuItem::Command, qt_("No Group"),
|
||||
add(MenuItem(MenuItem::Command, qt_("No Group"),
|
||||
FuncRequest(LFUN_SET_GRAPHICS_GROUP)));
|
||||
for (; it != end; it++) {
|
||||
addWithStatusCheck(MenuItem(MenuItem::Command, toqstr(*it) + '|',
|
||||
@ -781,7 +781,7 @@ void MenuDefinition::expandSpellingSuggestions(BufferView const * bv)
|
||||
docstring const & suggestion = suggestions[i];
|
||||
LYXERR(Debug::GUI, suggestion);
|
||||
MenuItem w(MenuItem::Command, toqstr(suggestion),
|
||||
FuncRequest(LFUN_WORD_REPLACE,
|
||||
FuncRequest(LFUN_WORD_REPLACE,
|
||||
replace2string(suggestion, selection,
|
||||
true, true, false, true, false)));
|
||||
if (i < m)
|
||||
@ -829,7 +829,7 @@ void MenuDefinition::expandLanguageSelector(Buffer const * buf)
|
||||
|
||||
std::set<Language const *> languages_buffer =
|
||||
buf->masterBuffer()->getLanguages();
|
||||
|
||||
|
||||
if (languages_buffer.size() < 2)
|
||||
return;
|
||||
|
||||
@ -959,8 +959,8 @@ void MenuDefinition::expandDocuments()
|
||||
++i;
|
||||
}
|
||||
b = theBufferList().next(b);
|
||||
} while (b != first);
|
||||
|
||||
} while (b != first);
|
||||
|
||||
if (!item.submenu().empty())
|
||||
add(item);
|
||||
}
|
||||
@ -1016,7 +1016,7 @@ void MenuDefinition::expandFormats(MenuItem::Kind const kind, Buffer const * buf
|
||||
LASSERT(false, /* */);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
bool const view_update = (kind == MenuItem::ViewFormats
|
||||
|| kind == MenuItem::UpdateFormats);
|
||||
|
||||
@ -1037,7 +1037,7 @@ void MenuDefinition::expandFormats(MenuItem::Kind const kind, Buffer const * buf
|
||||
docstring lab = from_utf8((*fit)->prettyname());
|
||||
docstring const scut = from_utf8((*fit)->shortcut());
|
||||
docstring const tmplab = lab;
|
||||
|
||||
|
||||
if (!scut.empty())
|
||||
lab += char_type('|') + scut;
|
||||
docstring const lab_i18n = translateIfPossible(lab);
|
||||
@ -1073,7 +1073,7 @@ void MenuDefinition::expandFormats(MenuItem::Kind const kind, Buffer const * buf
|
||||
|
||||
if (view_update) {
|
||||
if (buf)
|
||||
item.submenu().addWithStatusCheck(MenuItem(MenuItem::Command,
|
||||
item.submenu().addWithStatusCheck(MenuItem(MenuItem::Command,
|
||||
toqstr(label), FuncRequest(action, (*fit)->name())));
|
||||
else
|
||||
item.submenu().add(MenuItem(MenuItem::Command, toqstr(label),
|
||||
@ -1158,7 +1158,7 @@ void MenuDefinition::expandFlexInsert(
|
||||
// we remove the "Flex:" prefix, if it is present
|
||||
if (prefixIs(label, from_utf8("Flex:")))
|
||||
label = label.substr(5);
|
||||
addWithStatusCheck(MenuItem(MenuItem::Command,
|
||||
addWithStatusCheck(MenuItem(MenuItem::Command,
|
||||
toqstr(translateIfPossible(label)),
|
||||
FuncRequest(LFUN_FLEX_INSERT, Lexer::quoteString(label))));
|
||||
}
|
||||
@ -1251,7 +1251,7 @@ void MenuDefinition::expandToc(Buffer const * buf)
|
||||
}
|
||||
|
||||
MenuDefinition other_lists;
|
||||
|
||||
|
||||
FloatList const & floatlist = buf->params().documentClass().floats();
|
||||
TocList const & toc_list = buf->tocBackend().tocs();
|
||||
TocList::const_iterator cit = toc_list.begin();
|
||||
@ -1295,7 +1295,7 @@ void MenuDefinition::expandToc(Buffer const * buf)
|
||||
if (cit == end)
|
||||
LYXERR(Debug::GUI, "No table of contents.");
|
||||
else {
|
||||
if (cit->second.size() > 0 )
|
||||
if (cit->second.size() > 0 )
|
||||
expandToc2(cit->second, 0, cit->second.size(), 0);
|
||||
else
|
||||
add(MenuItem(MenuItem::Info, qt_("<Empty Table of Contents>")));
|
||||
@ -1365,12 +1365,12 @@ void MenuDefinition::expandBranches(Buffer const * buf)
|
||||
FuncRequest(LFUN_BRANCH_INSERT,
|
||||
cit->branch())));
|
||||
}
|
||||
|
||||
|
||||
if (buf == buf->masterBuffer())
|
||||
return;
|
||||
|
||||
|
||||
MenuDefinition child_branches;
|
||||
|
||||
|
||||
BranchList::const_iterator ccit = params.branchlist().begin();
|
||||
BranchList::const_iterator cend = params.branchlist().end();
|
||||
|
||||
@ -1386,7 +1386,7 @@ void MenuDefinition::expandBranches(Buffer const * buf)
|
||||
FuncRequest(LFUN_BRANCH_INSERT,
|
||||
ccit->branch())));
|
||||
}
|
||||
|
||||
|
||||
if (!child_branches.empty()) {
|
||||
MenuItem item(MenuItem::Submenu, qt_("Child Document"));
|
||||
item.setSubmenu(child_branches);
|
||||
@ -1423,12 +1423,12 @@ void MenuDefinition::expandIndices(Buffer const * buf, bool listof)
|
||||
|
||||
for (int ii = 1; cit != end; ++cit, ++ii) {
|
||||
if (listof) {
|
||||
docstring const label =
|
||||
docstring const label =
|
||||
bformat(_("Index: %1$s"), cit->index());
|
||||
addWithStatusCheck(MenuItem(MenuItem::Command, toqstr(label),
|
||||
FuncRequest(LFUN_INDEX_PRINT, cit->shortcut())));
|
||||
} else {
|
||||
docstring const label =
|
||||
docstring const label =
|
||||
bformat(_("Index Entry (%1$s)"), cit->index());
|
||||
addWithStatusCheck(MenuItem(MenuItem::Command, toqstr(label),
|
||||
FuncRequest(LFUN_INDEX_INSERT, cit->shortcut())));
|
||||
@ -1457,7 +1457,7 @@ void MenuDefinition::expandIndicesContext(Buffer const * buf, bool listof)
|
||||
addWithStatusCheck(MenuItem(MenuItem::Command, toqstr(cit->index()),
|
||||
FuncRequest(LFUN_INSET_MODIFY, data)));
|
||||
} else {
|
||||
docstring const label =
|
||||
docstring const label =
|
||||
bformat(_("Index Entry (%1$s)"), cit->index());
|
||||
addWithStatusCheck(MenuItem(MenuItem::Command, toqstr(label),
|
||||
FuncRequest(LFUN_INSET_MODIFY,
|
||||
@ -1481,7 +1481,7 @@ void MenuDefinition::expandCiteStyles(BufferView const * bv)
|
||||
}
|
||||
InsetCommand const * citinset =
|
||||
static_cast<InsetCommand const *>(inset);
|
||||
|
||||
|
||||
Buffer const * buf = &bv->buffer();
|
||||
docstring key = citinset->getParam("key");
|
||||
// we can only handle one key currently
|
||||
@ -1569,7 +1569,7 @@ void Menu::Impl::populate(QMenu & qMenu, MenuDefinition const & menu)
|
||||
subMenu->setEnabled(m->status().enabled());
|
||||
} else {
|
||||
// we have a MenuItem::Command
|
||||
qMenu.addAction(new Action(view, QIcon(), label(*m),
|
||||
qMenu.addAction(new Action(view, QIcon(), label(*m),
|
||||
m->func(), m->tooltip(), &qMenu));
|
||||
}
|
||||
}
|
||||
@ -1579,7 +1579,7 @@ void Menu::Impl::populate(QMenu & qMenu, MenuDefinition const & menu)
|
||||
class AlwaysMnemonicStyle : public QProxyStyle {
|
||||
public:
|
||||
int styleHint(StyleHint hint, const QStyleOption *opt = 0, const QWidget *widget = 0,
|
||||
QStyleHintReturn *returnData = 0) const
|
||||
QStyleHintReturn *returnData = 0) const
|
||||
{
|
||||
if (hint == QStyle::SH_UnderlineShortcut)
|
||||
return 1;
|
||||
@ -1606,7 +1606,7 @@ Menu::Menu(GuiView * gv, QString const & name, bool top_level, bool keyboard)
|
||||
d->name = name;
|
||||
setTitle(name);
|
||||
if (d->top_level_menu)
|
||||
connect(this, SIGNAL(aboutToShow()), this, SLOT(updateView()));
|
||||
connect(this, SIGNAL(aboutToShow()), this, SLOT(updateView()));
|
||||
}
|
||||
|
||||
|
||||
@ -1930,7 +1930,7 @@ MenuDefinition & Menus::Impl::getMenu(QString const & name)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menus
|
||||
// Menus
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -2094,7 +2094,7 @@ void Menus::updateMenu(Menu * qmenu)
|
||||
MenuDefinition cat_menu = d->getMenu(toqstr(menu_name));
|
||||
//FIXME: 50 is a wild guess. We should take into account here
|
||||
//the expansion of menu items, disabled optional items etc.
|
||||
bool const in_sub_menu = fromLyxMenu.size() > 0
|
||||
bool const in_sub_menu = fromLyxMenu.size() > 0
|
||||
&& fromLyxMenu.size() + cat_menu.size() > 50 ;
|
||||
if (in_sub_menu)
|
||||
fromLyxMenu.catSub(menu_name);
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
|
||||
/// QMenu::clear() reimplementation to handle the deletion of submenus.
|
||||
void clear();
|
||||
|
||||
|
||||
private Q_SLOTS:
|
||||
///
|
||||
void updateView();
|
||||
@ -66,7 +66,7 @@ public:
|
||||
|
||||
///
|
||||
void reset();
|
||||
|
||||
|
||||
///
|
||||
bool searchMenu(FuncRequest const & func,
|
||||
docstring_list & names) const;
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "FuncRequest.h"
|
||||
#include "InsetIterator.h"
|
||||
#include "InsetList.h"
|
||||
#include "Language.h"
|
||||
#include "Language.h"
|
||||
#include "Lexer.h"
|
||||
#include "output_xhtml.h"
|
||||
#include "OutputParams.h"
|
||||
@ -316,7 +316,7 @@ void InsetBibitem::collectBibKeys(InsetIterator const & it) const
|
||||
docstring const key = getParam("key");
|
||||
BibTeXInfo keyvalmap(false);
|
||||
keyvalmap.label(bibLabel());
|
||||
DocIterator doc_it(it);
|
||||
DocIterator doc_it(it);
|
||||
doc_it.forwardPos();
|
||||
keyvalmap[from_ascii("ref")] = doc_it.paragraph().asString();
|
||||
buffer().addBibTeXInfo(key, keyvalmap);
|
||||
|
@ -71,7 +71,7 @@ public:
|
||||
///
|
||||
static std::string defaultCommand() { return "bibitem"; }
|
||||
///
|
||||
static bool isCompatibleCommand(std::string const & s)
|
||||
static bool isCompatibleCommand(std::string const & s)
|
||||
{ return s == "bibitem"; }
|
||||
///@}
|
||||
|
||||
|
@ -100,7 +100,7 @@ void InsetBibtex::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
if (message.type_ == WarningException) {
|
||||
Alert::warning(message.title_, message.details_);
|
||||
cur.noScreenUpdate();
|
||||
} else
|
||||
} else
|
||||
throw message;
|
||||
break;
|
||||
}
|
||||
@ -211,7 +211,7 @@ docstring InsetBibtex::toolTip(BufferView const & /*bv*/, int /*x*/, int /*y*/)
|
||||
tip += _("all uncited references");
|
||||
else
|
||||
tip += _("all cited references");
|
||||
|
||||
|
||||
if (toc) {
|
||||
tip += ", ";
|
||||
tip += _("included in TOC");
|
||||
@ -307,7 +307,7 @@ void InsetBibtex::latex(otexstream & os, OutputParams const & runparams) const
|
||||
|
||||
if (didone)
|
||||
dbs << ',';
|
||||
else
|
||||
else
|
||||
didone = true;
|
||||
// FIXME UNICODE
|
||||
dbs << from_utf8(latex_path(database));
|
||||
@ -334,7 +334,7 @@ void InsetBibtex::latex(otexstream & os, OutputParams const & runparams) const
|
||||
|
||||
if (!style.empty()) {
|
||||
string base = normalizeName(buffer(), runparams, style, ".bst");
|
||||
FileName const try_in_file =
|
||||
FileName const try_in_file =
|
||||
makeAbsPath(base + ".bst", buffer().filePath());
|
||||
bool const not_from_texmf = try_in_file.isReadableFile();
|
||||
// If this style does not come from texmf and we are not
|
||||
@ -405,9 +405,9 @@ support::FileNameList InsetBibtex::getBibFiles() const
|
||||
{
|
||||
FileName path(buffer().filePath());
|
||||
support::PathChanger p(path);
|
||||
|
||||
|
||||
support::FileNameList vec;
|
||||
|
||||
|
||||
vector<docstring> bibfilelist = getVectorFromString(getParam("bibfiles"));
|
||||
vector<docstring>::const_iterator it = bibfilelist.begin();
|
||||
vector<docstring>::const_iterator en = bibfilelist.end();
|
||||
@ -419,7 +419,7 @@ support::FileNameList InsetBibtex::getBibFiles() const
|
||||
else
|
||||
LYXERR0("Couldn't find " + to_utf8(*it) + " in InsetBibtex::getBibFiles()!");
|
||||
}
|
||||
|
||||
|
||||
return vec;
|
||||
|
||||
}
|
||||
@ -478,7 +478,7 @@ namespace {
|
||||
/// @return true if a string of length > 0 could be read.
|
||||
///
|
||||
bool readTypeOrKey(docstring & val, ifdocstream & ifs,
|
||||
docstring const & delimChars, docstring const & illegalChars,
|
||||
docstring const & delimChars, docstring const & illegalChars,
|
||||
charCase chCase) {
|
||||
|
||||
char_type ch;
|
||||
@ -498,10 +498,10 @@ namespace {
|
||||
|
||||
// read value
|
||||
bool legalChar = true;
|
||||
while (ifs && !isSpace(ch) &&
|
||||
while (ifs && !isSpace(ch) &&
|
||||
delimChars.find(ch) == docstring::npos &&
|
||||
(legalChar = (illegalChars.find(ch) == docstring::npos))
|
||||
)
|
||||
)
|
||||
{
|
||||
if (chCase == makeLowerCase)
|
||||
val += lowercase(ch);
|
||||
@ -509,7 +509,7 @@ namespace {
|
||||
val += ch;
|
||||
ifs.get(ch);
|
||||
}
|
||||
|
||||
|
||||
if (!legalChar) {
|
||||
ifs.putback(ch);
|
||||
return false;
|
||||
@ -570,33 +570,33 @@ namespace {
|
||||
do {
|
||||
ifs.get(ch);
|
||||
} while (ifs && isSpace(ch));
|
||||
|
||||
|
||||
if (!ifs)
|
||||
return false;
|
||||
|
||||
|
||||
// We now have the first non-whitespace character
|
||||
// We'll collapse adjacent whitespace.
|
||||
bool lastWasWhiteSpace = false;
|
||||
|
||||
|
||||
// inside this delimited text braces must match.
|
||||
// Thus we can have a closing delimiter only
|
||||
// when nestLevel == 0
|
||||
int nestLevel = 0;
|
||||
|
||||
|
||||
while (ifs && (nestLevel > 0 || ch != delim)) {
|
||||
if (isSpace(ch)) {
|
||||
lastWasWhiteSpace = true;
|
||||
ifs.get(ch);
|
||||
continue;
|
||||
}
|
||||
// We output the space only after we stop getting
|
||||
// We output the space only after we stop getting
|
||||
// whitespace so as not to output any whitespace
|
||||
// at the end of the value.
|
||||
if (lastWasWhiteSpace) {
|
||||
lastWasWhiteSpace = false;
|
||||
val += ' ';
|
||||
}
|
||||
|
||||
|
||||
val += ch;
|
||||
|
||||
// update nesting level
|
||||
@ -606,7 +606,7 @@ namespace {
|
||||
break;
|
||||
case '}':
|
||||
--nestLevel;
|
||||
if (nestLevel < 0)
|
||||
if (nestLevel < 0)
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
@ -763,13 +763,13 @@ void InsetBibtex::parseBibTeXFiles() const
|
||||
// next char must be an equal sign
|
||||
ifs.get(ch);
|
||||
if (!ifs || ch != '=') {
|
||||
lyxerr << "BibTeX Parser: No `=' after string name: " <<
|
||||
lyxerr << "BibTeX Parser: No `=' after string name: " <<
|
||||
name << "." << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!readValue(value, ifs, strings)) {
|
||||
lyxerr << "BibTeX Parser: Unable to read value for string: " <<
|
||||
lyxerr << "BibTeX Parser: Unable to read value for string: " <<
|
||||
name << "." << std::endl;
|
||||
continue;
|
||||
}
|
||||
@ -804,7 +804,7 @@ void InsetBibtex::parseBibTeXFiles() const
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////
|
||||
// now we have a key, so we will add an entry
|
||||
// now we have a key, so we will add an entry
|
||||
// (even if it's empty, as bibtex does)
|
||||
//
|
||||
// we now read the field = value pairs.
|
||||
@ -815,13 +815,13 @@ void InsetBibtex::parseBibTeXFiles() const
|
||||
docstring value;
|
||||
docstring data;
|
||||
BibTeXInfo keyvalmap(key, entryType);
|
||||
|
||||
|
||||
bool readNext = removeWSAndComma(ifs);
|
||||
|
||||
|
||||
while (ifs && readNext) {
|
||||
|
||||
// read field name
|
||||
if (!readTypeOrKey(name, ifs, from_ascii("="),
|
||||
if (!readTypeOrKey(name, ifs, from_ascii("="),
|
||||
from_ascii("{}(),"), makeLowerCase) || !ifs)
|
||||
break;
|
||||
|
||||
@ -867,7 +867,7 @@ void InsetBibtex::parseBibTeXFiles() const
|
||||
FileName InsetBibtex::getBibTeXPath(docstring const & filename, Buffer const & buf)
|
||||
{
|
||||
string texfile = changeExtension(to_utf8(filename), "bib");
|
||||
// note that, if the filename can be found directly from the path,
|
||||
// note that, if the filename can be found directly from the path,
|
||||
// findtexfile will just return a FileName object for that path.
|
||||
FileName file(findtexfile(texfile, "bib"));
|
||||
if (file.empty())
|
||||
@ -924,7 +924,7 @@ void InsetBibtex::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
// FIXME
|
||||
// FIXME
|
||||
// docstring InsetBibtex::entriesAsXHTML(vector<docstring> const & entries)
|
||||
// And then here just: entriesAsXHTML(buffer().masterBibInfo().citedEntries())
|
||||
docstring InsetBibtex::xhtml(XHTMLStream & xs, OutputParams const &) const
|
||||
@ -932,14 +932,14 @@ docstring InsetBibtex::xhtml(XHTMLStream & xs, OutputParams const &) const
|
||||
BiblioInfo const & bibinfo = buffer().masterBibInfo();
|
||||
vector<docstring> const & cites = bibinfo.citedEntries();
|
||||
CiteEngine const engine = buffer().params().citeEngine();
|
||||
bool const numbers =
|
||||
bool const numbers =
|
||||
(engine == ENGINE_BASIC || engine == ENGINE_NATBIB_NUMERICAL);
|
||||
|
||||
docstring reflabel = from_ascii("References");
|
||||
Language const * l = buffer().params().language;
|
||||
if (l)
|
||||
reflabel = translateIfPossible(reflabel, l->code());
|
||||
|
||||
|
||||
xs << html::StartTag("h2", "class='bibtex'")
|
||||
<< reflabel
|
||||
<< html::EndTag("h2")
|
||||
@ -980,7 +980,7 @@ docstring InsetBibtex::xhtml(XHTMLStream & xs, OutputParams const &) const
|
||||
// FIXME Right now, we are calling BibInfo::getInfo on the key,
|
||||
// which will give us all the cross-referenced info. But for every
|
||||
// entry, so there's a lot of repitition. This should be fixed.
|
||||
xs << html::StartTag("span", "class='bibtexinfo'")
|
||||
xs << html::StartTag("span", "class='bibtexinfo'")
|
||||
<< XHTMLStream::ESCAPE_AND
|
||||
<< bibinfo.getInfo(entry.key(), buffer(), true)
|
||||
<< html::EndTag("span")
|
||||
|
@ -68,13 +68,13 @@ public:
|
||||
///
|
||||
static std::string defaultCommand() { return "bibtex"; }
|
||||
///
|
||||
static bool isCompatibleCommand(std::string const & s)
|
||||
static bool isCompatibleCommand(std::string const & s)
|
||||
{ return s == "bibtex"; }
|
||||
//@}
|
||||
|
||||
private:
|
||||
/// look up the path to the file using TeX
|
||||
static support::FileName
|
||||
static support::FileName
|
||||
getBibTeXPath(docstring const & filename, Buffer const & buf);
|
||||
///
|
||||
void editDatabases() const;
|
||||
|
@ -141,7 +141,7 @@ docstring InsetCitation::toolTip(BufferView const & bv, int, int) const
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
// FIXME See the header for the issue.
|
||||
string defaultCiteCommand(CiteEngine engine)
|
||||
{
|
||||
@ -163,7 +163,7 @@ string defaultCiteCommand(CiteEngine engine)
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
string asValidLatexCommand(string const & input, CiteEngine const engine)
|
||||
{
|
||||
string const default_str = defaultCiteCommand(engine);
|
||||
@ -210,7 +210,7 @@ string asValidLatexCommand(string const & input, CiteEngine const engine)
|
||||
}
|
||||
|
||||
|
||||
inline docstring wrapCitation(docstring const & key,
|
||||
inline docstring wrapCitation(docstring const & key,
|
||||
docstring const & content, bool for_xhtml)
|
||||
{
|
||||
if (!for_xhtml)
|
||||
@ -341,11 +341,11 @@ docstring InsetCitation::complexLabel(bool for_xhtml) const
|
||||
else
|
||||
label += wrapCitation(*it, author, for_xhtml) + sep_str;
|
||||
}
|
||||
}
|
||||
}
|
||||
// nocite
|
||||
else if (cite_type == "nocite") {
|
||||
label += *it + sep_str;
|
||||
}
|
||||
}
|
||||
// (authors1 (<before> year); ... ;
|
||||
// authors_last (<before> year, <after>)
|
||||
else if (cite_type == "citet") {
|
||||
@ -365,8 +365,8 @@ docstring InsetCitation::complexLabel(bool for_xhtml) const
|
||||
case ENGINE_BASIC:
|
||||
break;
|
||||
}
|
||||
}
|
||||
// author, year; author, year; ...
|
||||
}
|
||||
// author, year; author, year; ...
|
||||
else if (cite_type == "citep" ||
|
||||
cite_type == "citealp") {
|
||||
if (engine == ENGINE_NATBIB_NUMERICAL) {
|
||||
@ -375,7 +375,7 @@ docstring InsetCitation::complexLabel(bool for_xhtml) const
|
||||
label += wrapCitation(*it, author + ", " + year, for_xhtml) + sep_str;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// (authors1 <before> year;
|
||||
// authors_last <before> year, <after>)
|
||||
else if (cite_type == "citealt") {
|
||||
@ -389,15 +389,15 @@ docstring InsetCitation::complexLabel(bool for_xhtml) const
|
||||
wrapCitation(*it, citenum, for_xhtml) + sep_str;
|
||||
break;
|
||||
case ENGINE_JURABIB:
|
||||
label += before_str +
|
||||
label += before_str +
|
||||
wrapCitation(*it, author + ' ' + year, for_xhtml) + sep_str;
|
||||
break;
|
||||
case ENGINE_BASIC:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// author; author; ...
|
||||
else if (cite_type == "citeauthor") {
|
||||
label += wrapCitation(*it, author, for_xhtml) + sep_str;
|
||||
@ -430,7 +430,7 @@ docstring InsetCitation::complexLabel(bool for_xhtml) const
|
||||
label = before_str + label;
|
||||
}
|
||||
|
||||
if (cite_type == "citep" || cite_type == "citeyearpar" ||
|
||||
if (cite_type == "citep" || cite_type == "citeyearpar" ||
|
||||
(cite_type == "cite" && engine == ENGINE_BASIC) )
|
||||
label = op + label + cp;
|
||||
|
||||
|
@ -99,7 +99,7 @@ private:
|
||||
docstring screenLabel() const;
|
||||
//@}
|
||||
|
||||
/// we'll eventually want to be able to get info on this from the
|
||||
/// we'll eventually want to be able to get info on this from the
|
||||
/// various CiteEngines
|
||||
static ParamInfo param_info_;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user