mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
src/*.cpp: reformatting to increase consistency
This commit is contained in:
parent
76a5f726a7
commit
6b2232a29c
@ -55,9 +55,9 @@ AppleSpellChecker::Private::~Private()
|
||||
}
|
||||
|
||||
|
||||
AppleSpellChecker::AppleSpellChecker(): d(new Private)
|
||||
{
|
||||
}
|
||||
AppleSpellChecker::AppleSpellChecker()
|
||||
: d(new Private)
|
||||
{}
|
||||
|
||||
|
||||
AppleSpellChecker::~AppleSpellChecker()
|
||||
|
@ -53,7 +53,8 @@ typedef map<std::string, PersonalWordList *> LangPersonalWordList;
|
||||
|
||||
struct AspellChecker::Private
|
||||
{
|
||||
Private() {}
|
||||
Private()
|
||||
{}
|
||||
|
||||
~Private();
|
||||
|
||||
@ -91,27 +92,38 @@ struct AspellChecker::Private
|
||||
|
||||
/// the location below system/user directory
|
||||
/// there the rws files lookup will happen
|
||||
const string dictDirectory(void) { return "dicts"; }
|
||||
const string dictDirectory(void)
|
||||
{
|
||||
return "dicts";
|
||||
}
|
||||
/// there the dat+cmap files lookup will happen
|
||||
const string dataDirectory(void) { return "data"; }
|
||||
const string dataDirectory(void)
|
||||
{
|
||||
return "data";
|
||||
}
|
||||
/// os package directory constants
|
||||
/// macports on Mac OS X or
|
||||
/// aspell rpms on Linux
|
||||
const string osPackageBase(void) {
|
||||
const string osPackageBase(void)
|
||||
{
|
||||
#ifdef USE_MACOSX_PACKAGING
|
||||
return "/opt/local";
|
||||
#else
|
||||
return "/usr";
|
||||
#endif
|
||||
}
|
||||
const string osPackageDictDirectory(void) {
|
||||
const string osPackageDictDirectory(void)
|
||||
{
|
||||
#ifdef USE_MACOSX_PACKAGING
|
||||
return "/share/aspell";
|
||||
#else
|
||||
return "/lib/aspell-0.60";
|
||||
#endif
|
||||
}
|
||||
const string osPackageDataDirectory(void) { return "/lib/aspell-0.60"; }
|
||||
const string osPackageDataDirectory(void)
|
||||
{
|
||||
return "/lib/aspell-0.60";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@ -404,9 +416,9 @@ bool AspellChecker::Private::learned(WordLangTuple const & word)
|
||||
}
|
||||
|
||||
|
||||
AspellChecker::AspellChecker(): d(new Private)
|
||||
{
|
||||
}
|
||||
AspellChecker::AspellChecker()
|
||||
: d(new Private)
|
||||
{}
|
||||
|
||||
|
||||
AspellChecker::~AspellChecker()
|
||||
@ -483,12 +495,14 @@ void AspellChecker::suggest(WordLangTuple const & wl,
|
||||
delete_aspell_string_enumeration(els);
|
||||
}
|
||||
|
||||
|
||||
void AspellChecker::remove(WordLangTuple const & word)
|
||||
{
|
||||
d->remove(word);
|
||||
advanceChangeNumber();
|
||||
}
|
||||
|
||||
|
||||
bool AspellChecker::hasDictionary(Language const * lang) const
|
||||
{
|
||||
bool have = false;
|
||||
|
@ -57,6 +57,7 @@ ostream & operator<<(ostream & os, Author const & a)
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
istream & operator>>(istream & is, Author & a)
|
||||
{
|
||||
string s;
|
||||
@ -69,15 +70,15 @@ istream & operator>>(istream & is, Author & a)
|
||||
}
|
||||
|
||||
|
||||
bool author_smaller(Author const & lhs, Author const & rhs) {
|
||||
bool author_smaller(Author const & lhs, Author const & rhs)
|
||||
{
|
||||
return lhs.bufferId() < rhs.bufferId();
|
||||
}
|
||||
|
||||
|
||||
AuthorList::AuthorList()
|
||||
: last_id_(0)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
int AuthorList::record(Author const & a)
|
||||
@ -133,12 +134,14 @@ AuthorList::Authors::const_iterator AuthorList::end() const
|
||||
}
|
||||
|
||||
|
||||
void AuthorList::sort() {
|
||||
void AuthorList::sort()
|
||||
{
|
||||
std::sort(authors_.begin(), authors_.end(), author_smaller);
|
||||
}
|
||||
|
||||
|
||||
ostream & operator<<(ostream & os, AuthorList const & a) {
|
||||
ostream & operator<<(ostream & os, AuthorList const & a)
|
||||
{
|
||||
// Copy the authorlist, because we don't want to sort the original
|
||||
AuthorList sorted = a;
|
||||
sorted.sort();
|
||||
|
@ -89,6 +89,7 @@ docstring familyName(docstring const & name)
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
// converts a string containing LaTeX commands into unicode
|
||||
// for display.
|
||||
docstring convertLaTeXCommands(docstring const & str)
|
||||
@ -288,115 +289,117 @@ docstring const BibTeXInfo::getXRef() const
|
||||
|
||||
|
||||
namespace {
|
||||
string parseOptions(string const & format, string & optkey,
|
||||
string & ifpart, string & elsepart);
|
||||
|
||||
// Calls parseOptions to deal with an embedded option, such as:
|
||||
// {%number%[[, no.~%number%]]}
|
||||
// which must appear at the start of format. ifelsepart gets the
|
||||
// whole of the option, and we return what's left after the option.
|
||||
// we return format if there is an error.
|
||||
string parseEmbeddedOption(string const & format, string & ifelsepart)
|
||||
{
|
||||
LASSERT(format[0] == '{' && format[1] == '%', return format);
|
||||
string optkey;
|
||||
string ifpart;
|
||||
string elsepart;
|
||||
string const rest = parseOptions(format, optkey, ifpart, elsepart);
|
||||
if (format == rest) { // parse error
|
||||
LYXERR0("ERROR! Couldn't parse `" << format <<"'.");
|
||||
return format;
|
||||
}
|
||||
LASSERT(rest.size() <= format.size(), /* */);
|
||||
ifelsepart = format.substr(0, format.size() - rest.size());
|
||||
return rest;
|
||||
string parseOptions(string const & format, string & optkey,
|
||||
string & ifpart, string & elsepart);
|
||||
|
||||
// Calls parseOptions to deal with an embedded option, such as:
|
||||
// {%number%[[, no.~%number%]]}
|
||||
// which must appear at the start of format. ifelsepart gets the
|
||||
// whole of the option, and we return what's left after the option.
|
||||
// we return format if there is an error.
|
||||
string parseEmbeddedOption(string const & format, string & ifelsepart)
|
||||
{
|
||||
LASSERT(format[0] == '{' && format[1] == '%', return format);
|
||||
string optkey;
|
||||
string ifpart;
|
||||
string elsepart;
|
||||
string const rest = parseOptions(format, optkey, ifpart, elsepart);
|
||||
if (format == rest) { // parse error
|
||||
LYXERR0("ERROR! Couldn't parse `" << format <<"'.");
|
||||
return format;
|
||||
}
|
||||
LASSERT(rest.size() <= format.size(), /* */);
|
||||
ifelsepart = format.substr(0, format.size() - rest.size());
|
||||
return rest;
|
||||
}
|
||||
|
||||
|
||||
// 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)
|
||||
{
|
||||
string fmt = format;
|
||||
// remove '[['
|
||||
fmt = fmt.substr(2);
|
||||
// we'll remove characters from the front of fmt as we
|
||||
// deal with them
|
||||
while (!fmt.empty()) {
|
||||
if (fmt[0] == ']' && fmt.size() > 1 && fmt[1] == ']') {
|
||||
// that's the end
|
||||
fmt = fmt.substr(2);
|
||||
break;
|
||||
// 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)
|
||||
{
|
||||
string fmt = format;
|
||||
// remove '[['
|
||||
fmt = fmt.substr(2);
|
||||
// we'll remove characters from the front of fmt as we
|
||||
// deal with them
|
||||
while (!fmt.empty()) {
|
||||
if (fmt[0] == ']' && fmt.size() > 1 && fmt[1] == ']') {
|
||||
// that's the end
|
||||
fmt = fmt.substr(2);
|
||||
break;
|
||||
}
|
||||
// check for an embedded option
|
||||
if (fmt[0] == '{' && fmt.size() > 1 && fmt[1] == '%') {
|
||||
string part;
|
||||
string const rest = parseEmbeddedOption(fmt, part);
|
||||
if (fmt == rest) {
|
||||
LYXERR0("ERROR! Couldn't parse embedded option in `" << format <<"'.");
|
||||
return format;
|
||||
}
|
||||
// check for an embedded option
|
||||
if (fmt[0] == '{' && fmt.size() > 1 && fmt[1] == '%') {
|
||||
string part;
|
||||
string const rest = parseEmbeddedOption(fmt, part);
|
||||
if (fmt == rest) {
|
||||
LYXERR0("ERROR! Couldn't parse embedded option in `" << format <<"'.");
|
||||
return format;
|
||||
}
|
||||
clause += part;
|
||||
fmt = rest;
|
||||
} else { // it's just a normal character
|
||||
clause += part;
|
||||
fmt = rest;
|
||||
} else { // it's just a normal character
|
||||
clause += fmt[0];
|
||||
fmt = fmt.substr(1);
|
||||
}
|
||||
}
|
||||
return fmt;
|
||||
}
|
||||
return fmt;
|
||||
}
|
||||
|
||||
|
||||
// parse an options string, which must appear at the start of the
|
||||
// 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)
|
||||
{
|
||||
LASSERT(format[0] == '{' && format[1] == '%', return format);
|
||||
// strip '{%'
|
||||
string fmt = format.substr(2);
|
||||
size_t pos = fmt.find('%'); // end of key
|
||||
if (pos == string::npos) {
|
||||
LYXERR0("Error parsing `" << format <<"'. Can't find end of key.");
|
||||
return format;
|
||||
}
|
||||
optkey = fmt.substr(0,pos);
|
||||
fmt = fmt.substr(pos + 1);
|
||||
// [[format]] should be next
|
||||
if (fmt[0] != '[' || fmt[1] != '[') {
|
||||
LYXERR0("Error parsing `" << format <<"'. Can't find '[[' after key.");
|
||||
return format;
|
||||
}
|
||||
|
||||
string curfmt = fmt;
|
||||
fmt = getClause(curfmt, ifpart);
|
||||
if (fmt == curfmt) {
|
||||
LYXERR0("Error parsing `" << format <<"'. Couldn't get if clause.");
|
||||
return format;
|
||||
}
|
||||
|
||||
// parse an options string, which must appear at the start of the
|
||||
// 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)
|
||||
{
|
||||
LASSERT(format[0] == '{' && format[1] == '%', return format);
|
||||
// strip '{%'
|
||||
string fmt = format.substr(2);
|
||||
size_t pos = fmt.find('%'); // end of key
|
||||
if (pos == string::npos) {
|
||||
LYXERR0("Error parsing `" << format <<"'. Can't find end of key.");
|
||||
return format;
|
||||
}
|
||||
optkey = fmt.substr(0,pos);
|
||||
fmt = fmt.substr(pos + 1);
|
||||
// [[format]] should be next
|
||||
if (fmt[0] != '[' || fmt[1] != '[') {
|
||||
LYXERR0("Error parsing `" << format <<"'. Can't find '[[' after key.");
|
||||
return format;
|
||||
}
|
||||
|
||||
string curfmt = fmt;
|
||||
fmt = getClause(curfmt, ifpart);
|
||||
if (fmt == curfmt) {
|
||||
LYXERR0("Error parsing `" << format <<"'. Couldn't get if clause.");
|
||||
return format;
|
||||
}
|
||||
|
||||
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
|
||||
if (fmt == curfmt || fmt[0] != '}') {
|
||||
LYXERR0("Error parsing `" << format <<"'. Can't find end of option.");
|
||||
return format;
|
||||
}
|
||||
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
|
||||
if (fmt == curfmt || fmt[0] != '}') {
|
||||
LYXERR0("Error parsing `" << format <<"'. Can't find end of option.");
|
||||
return format;
|
||||
}
|
||||
return fmt.substr(1);
|
||||
}
|
||||
|
||||
|
||||
} // anon namespace
|
||||
|
||||
|
||||
@ -650,14 +653,16 @@ docstring BibTeXInfo::getValueForKey(string const & key,
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace {
|
||||
|
||||
// A functor for use with sort, leading to case insensitive sorting
|
||||
class compareNoCase: public binary_function<docstring, docstring, bool>
|
||||
{
|
||||
public:
|
||||
bool operator()(docstring const & s1, docstring const & s2) const {
|
||||
return compare_no_case(s1, s2) < 0;
|
||||
}
|
||||
};
|
||||
class compareNoCase: public binary_function<docstring, docstring, bool>
|
||||
{
|
||||
public:
|
||||
bool operator()(docstring const & s1, docstring const & s2) const {
|
||||
return compare_no_case(s1, s2) < 0;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
@ -827,19 +832,21 @@ void BiblioInfo::mergeBiblioInfo(BiblioInfo const & info)
|
||||
|
||||
|
||||
namespace {
|
||||
// used in xhtml to sort a list of BibTeXInfo objects
|
||||
bool lSorter(BibTeXInfo const * lhs, BibTeXInfo const * rhs)
|
||||
{
|
||||
docstring const lauth = lhs->getAbbreviatedAuthor();
|
||||
docstring const rauth = rhs->getAbbreviatedAuthor();
|
||||
docstring const lyear = lhs->getYear();
|
||||
docstring const ryear = rhs->getYear();
|
||||
docstring const ltitl = lhs->operator[]("title");
|
||||
docstring const rtitl = rhs->operator[]("title");
|
||||
return (lauth < rauth)
|
||||
|| (lauth == rauth && lyear < ryear)
|
||||
|| (lauth == rauth && lyear == ryear && ltitl < rtitl);
|
||||
}
|
||||
|
||||
// used in xhtml to sort a list of BibTeXInfo objects
|
||||
bool lSorter(BibTeXInfo const * lhs, BibTeXInfo const * rhs)
|
||||
{
|
||||
docstring const lauth = lhs->getAbbreviatedAuthor();
|
||||
docstring const rauth = rhs->getAbbreviatedAuthor();
|
||||
docstring const lyear = lhs->getYear();
|
||||
docstring const ryear = rhs->getYear();
|
||||
docstring const ltitl = lhs->operator[]("title");
|
||||
docstring const rtitl = rhs->operator[]("title");
|
||||
return (lauth < rauth)
|
||||
|| (lauth == rauth && lyear < ryear)
|
||||
|| (lauth == rauth && lyear == ryear && ltitl < rtitl);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -46,6 +46,7 @@ bool Bidi::inRange(pos_type pos) const
|
||||
return start_ == -1 || (start_ <= pos && pos <= end_);
|
||||
}
|
||||
|
||||
|
||||
bool Bidi::same_direction() const
|
||||
{
|
||||
return same_direction_;
|
||||
|
@ -30,7 +30,9 @@ namespace {
|
||||
class BranchNamesEqual : public std::unary_function<Branch, bool>
|
||||
{
|
||||
public:
|
||||
BranchNamesEqual(docstring const & name) : name_(name) {}
|
||||
BranchNamesEqual(docstring const & name)
|
||||
: name_(name)
|
||||
{}
|
||||
|
||||
bool operator()(Branch const & branch) const
|
||||
{
|
||||
@ -39,6 +41,7 @@ public:
|
||||
private:
|
||||
docstring name_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -282,7 +282,8 @@ public:
|
||||
|
||||
/// This is here to force the test to be done whenever parent_buffer
|
||||
/// is accessed.
|
||||
Buffer const * parent() const {
|
||||
Buffer const * parent() const
|
||||
{
|
||||
// ignore_parent temporarily "orphans" a buffer
|
||||
// (e.g. if a child is compiled standalone)
|
||||
if (ignore_parent)
|
||||
@ -299,7 +300,8 @@ public:
|
||||
}
|
||||
|
||||
///
|
||||
void setParent(Buffer const * pb) {
|
||||
void setParent(Buffer const * pb)
|
||||
{
|
||||
if (parent_buffer == pb)
|
||||
// nothing to do
|
||||
return;
|
||||
@ -324,10 +326,14 @@ public:
|
||||
/// \p from initial position
|
||||
/// \p to points to the end position
|
||||
void updateStatistics(DocIterator & from, DocIterator & to,
|
||||
bool skipNoOutput = true);
|
||||
bool skipNoOutput = true);
|
||||
/// statistics accessor functions
|
||||
int wordCount() const { return word_count_; }
|
||||
int charCount(bool with_blanks) const {
|
||||
int wordCount() const
|
||||
{
|
||||
return word_count_;
|
||||
}
|
||||
int charCount(bool with_blanks) const
|
||||
{
|
||||
return char_count_
|
||||
+ (with_blanks ? blank_count_ : 0);
|
||||
}
|
||||
|
@ -265,11 +265,13 @@ bool BufferList::exists(FileName const & fname) const
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
struct equivalent_to : public binary_function<FileName, FileName, bool>
|
||||
{
|
||||
bool operator()(FileName const & x, FileName const & y) const
|
||||
{ return equivalent(x, y); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -2127,9 +2127,12 @@ bool BufferParams::isExportable(string const & format) const
|
||||
|
||||
|
||||
namespace {
|
||||
bool formatSorter(Format const * lhs, Format const * rhs) {
|
||||
|
||||
bool formatSorter(Format const * lhs, Format const * rhs)
|
||||
{
|
||||
return _(lhs->prettyname()) < _(rhs->prettyname());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -105,6 +105,7 @@ T * getInsetByCode(Cursor const & cur, InsetCode code)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/// Note that comparing contents can only be used for InsetCommand
|
||||
bool findNextInset(DocIterator & dit, vector<InsetCode> const & codes,
|
||||
docstring const & contents)
|
||||
|
@ -340,6 +340,7 @@ void Changes::merge()
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
docstring getLaTeXMarkup(docstring const & macro, docstring const & author,
|
||||
docstring const & chgTime,
|
||||
OutputParams const & runparams)
|
||||
@ -379,6 +380,7 @@ docstring getLaTeXMarkup(docstring const & macro, docstring const & author,
|
||||
|
||||
return ods.str();
|
||||
}
|
||||
|
||||
} //namespace anon
|
||||
|
||||
|
||||
|
@ -31,8 +31,7 @@ namespace lyx {
|
||||
|
||||
Chktex::Chktex(string const & chktex, string const & f, string const & p)
|
||||
: cmd(chktex), file(f), path(p)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
int Chktex::run(TeXErrors &terr)
|
||||
|
@ -152,7 +152,7 @@ void CmdDef::release(string const & name)
|
||||
|
||||
|
||||
CmdDef::newCmdDefResult CmdDef::newCmdDef(string const & name,
|
||||
string const & def)
|
||||
string const & def)
|
||||
{
|
||||
string const name2 = trim(name);
|
||||
|
||||
|
@ -85,6 +85,7 @@ RGBColor rgbFromHexName(string const & x11hexname)
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
string const outputLaTeXColor(RGBColor const & color)
|
||||
{
|
||||
// this routine returns a LaTeX readable color string in the form
|
||||
|
@ -97,13 +97,15 @@ size_t DocRange::length() const
|
||||
|
||||
class DocPair {
|
||||
public:
|
||||
DocPair() {}
|
||||
DocPair()
|
||||
{}
|
||||
|
||||
DocPair(DocIterator o_, DocIterator n_)
|
||||
: o(o_), n(n_)
|
||||
{}
|
||||
|
||||
bool operator!=(DocPair const & rhs) {
|
||||
bool operator!=(DocPair const & rhs)
|
||||
{
|
||||
// this might not be intuitive but correct for our purpose
|
||||
return o != rhs.o && n != rhs.n;
|
||||
}
|
||||
@ -146,10 +148,16 @@ public:
|
||||
{}
|
||||
|
||||
/// Returns the from pair
|
||||
DocPair from() const { return DocPair(o.from, n.from); }
|
||||
DocPair from() const
|
||||
{
|
||||
return DocPair(o.from, n.from);
|
||||
}
|
||||
|
||||
/// Returns the to pair
|
||||
DocPair to() const { return DocPair(o.to, n.to); }
|
||||
DocPair to() const
|
||||
{
|
||||
return DocPair(o.to, n.to);
|
||||
}
|
||||
|
||||
DocRange o;
|
||||
DocRange n;
|
||||
@ -181,7 +189,8 @@ static DocRangePair stepIntoInset(DocPair const & inset_location)
|
||||
template<class T>
|
||||
class compl_vector {
|
||||
public:
|
||||
compl_vector() {}
|
||||
compl_vector()
|
||||
{}
|
||||
|
||||
void reset(T const & def)
|
||||
{
|
||||
@ -223,7 +232,8 @@ public:
|
||||
{}
|
||||
|
||||
///
|
||||
~Impl() {}
|
||||
~Impl()
|
||||
{}
|
||||
|
||||
// Algorithm to find the shortest edit string. This algorithm
|
||||
// only needs a linear amount of memory (linear with the sum
|
||||
@ -235,7 +245,8 @@ public:
|
||||
bool abort_;
|
||||
|
||||
///
|
||||
QString status() {
|
||||
QString status()
|
||||
{
|
||||
QString status;
|
||||
status += toqstr("recursion level:") + " " + QString::number(recursion_level_)
|
||||
+ " " + toqstr("differences:") + " " + QString::number(D_);
|
||||
@ -444,7 +455,8 @@ static bool equal(Inset const * i_o, Inset const * i_n)
|
||||
}
|
||||
|
||||
|
||||
static bool equal(DocIterator & o, DocIterator & n) {
|
||||
static bool equal(DocIterator & o, DocIterator & n)
|
||||
{
|
||||
// Explicitly check for this, so we won't call
|
||||
// Paragraph::getChar for the last pos.
|
||||
bool const o_lastpos = o.pos() == o.lastpos();
|
||||
|
@ -54,7 +54,8 @@ static FileName cache_dir;
|
||||
|
||||
class CacheItem {
|
||||
public:
|
||||
CacheItem() {}
|
||||
CacheItem()
|
||||
{}
|
||||
CacheItem(FileName const & orig_from, string const & to_format,
|
||||
time_t t, unsigned long c)
|
||||
: timestamp(t), checksum(c)
|
||||
@ -67,7 +68,8 @@ public:
|
||||
<< ' ' << to_format << ' ' << cache_name
|
||||
<< ' ' << long(timestamp) << ' ' << checksum << '.');
|
||||
}
|
||||
~CacheItem() {}
|
||||
~CacheItem()
|
||||
{}
|
||||
FileName cache_name;
|
||||
time_t timestamp;
|
||||
unsigned long checksum;
|
||||
|
@ -32,6 +32,7 @@ Point::Point(int x, int y)
|
||||
LASSERT(y < 1000000, /**/);
|
||||
}
|
||||
|
||||
|
||||
// just a helper to be able to set a breakpoint
|
||||
void lyxbreaker(void const * data, const char * hint, int size)
|
||||
{
|
||||
|
@ -109,6 +109,7 @@ bool Counter::read(Lexer & lex)
|
||||
return getout;
|
||||
}
|
||||
|
||||
|
||||
void Counter::set(int v)
|
||||
{
|
||||
value_ = v;
|
||||
@ -363,7 +364,6 @@ char hebrewCounter(int const n)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// On the special cases, see http://mathworld.wolfram.com/RomanNumerals.html
|
||||
// and for a list of roman numerals up to and including 3999, see
|
||||
// http://www.research.att.com/~njas/sequences/a006968.txt. (Thanks to Joost
|
||||
|
314
src/Cursor.cpp
314
src/Cursor.cpp
@ -214,9 +214,10 @@ bool bruteFind3(Cursor & cur, int x, int y, bool up)
|
||||
for ( ; it != et; it.forwardPos()) {
|
||||
// avoid invalid nesting when selecting
|
||||
if (bv.cursorStatus(it) == CUR_INSIDE
|
||||
&& (!cur.selection() || positionable(it, cur.realAnchor()))) {
|
||||
// If this function is ever used again, check whether this
|
||||
// is the same as "bv.getPos(it, false)" with boundary = false.
|
||||
&& (!cur.selection() || positionable(it, cur.realAnchor()))) {
|
||||
// If this function is ever used again, check
|
||||
// whether this is the same as "bv.getPos(it,
|
||||
// false)" with boundary = false.
|
||||
Point p = bv.getPos(it);
|
||||
int xo = p.x_;
|
||||
int yo = p.y_;
|
||||
@ -638,8 +639,9 @@ bool Cursor::posVisRight(bool skip_inset)
|
||||
new_cur.boundary(false);
|
||||
if (!skip_inset &&
|
||||
text()->checkAndActivateInsetVisual(new_cur, right_pos >= pos(), false)) {
|
||||
// we actually move the cursor at the end of this function, for now
|
||||
// we just keep track of the new position in new_cur...
|
||||
// we actually move the cursor at the end of this
|
||||
// function, for now we just keep track of the new
|
||||
// position in new_cur...
|
||||
LYXERR(Debug::RTL, "entering inset at: " << new_cur.pos());
|
||||
}
|
||||
|
||||
@ -652,8 +654,9 @@ bool Cursor::posVisRight(bool skip_inset)
|
||||
return false;
|
||||
}
|
||||
|
||||
// we actually move the cursor at the end of this function, for now
|
||||
// just keep track of the new position in new_cur...
|
||||
// we actually move the cursor at the end of this
|
||||
// function, for now just keep track of the new
|
||||
// position in new_cur...
|
||||
LYXERR(Debug::RTL, "right edge, moving: " << int(new_cur.pit()) << ","
|
||||
<< int(new_cur.pos()) << "," << (new_cur.boundary() ? 1 : 0));
|
||||
|
||||
@ -661,28 +664,33 @@ bool Cursor::posVisRight(bool skip_inset)
|
||||
// normal movement to the right
|
||||
else {
|
||||
new_cur = *this;
|
||||
// Recall, if the cursor is at position 'x', that means *before*
|
||||
// the character at position 'x'. In RTL, "before" means "to the
|
||||
// right of", in LTR, "to the left of". So currently our situation
|
||||
// is this: the position to our right is 'right_pos' (i.e., we're
|
||||
// currently to the left of 'right_pos'). In order to move to the
|
||||
// right, it depends whether or not the character at 'right_pos' is RTL.
|
||||
// Recall, if the cursor is at position 'x', that
|
||||
// means *before* the character at position 'x'. In
|
||||
// RTL, "before" means "to the right of", in LTR, "to
|
||||
// the left of". So currently our situation is this:
|
||||
// the position to our right is 'right_pos' (i.e.,
|
||||
// we're currently to the left of 'right_pos'). In
|
||||
// order to move to the right, it depends whether or
|
||||
// not the character at 'right_pos' is RTL.
|
||||
new_pos_is_RTL = paragraph().getFontSettings(
|
||||
buffer()->params(), right_pos).isVisibleRightToLeft();
|
||||
// If the character at 'right_pos' *is* LTR, then in order to move to
|
||||
// the right of it, we need to be *after* 'right_pos', i.e., move to
|
||||
// position 'right_pos' + 1.
|
||||
// If the character at 'right_pos' *is* LTR, then in
|
||||
// order to move to the right of it, we need to be
|
||||
// *after* 'right_pos', i.e., move to position
|
||||
// 'right_pos' + 1.
|
||||
if (!new_pos_is_RTL) {
|
||||
new_cur.pos() = right_pos + 1;
|
||||
// set the boundary to true in two situations:
|
||||
if (
|
||||
// 1. if new_pos is now lastpos, and we're in an RTL paragraph
|
||||
// (this means that we're moving right to the end of an LTR chunk
|
||||
// 1. if new_pos is now lastpos, and we're in
|
||||
// an RTL paragraph (this means that we're
|
||||
// moving right to the end of an LTR chunk
|
||||
// which is at the end of an RTL paragraph);
|
||||
(new_cur.pos() == lastpos()
|
||||
&& paragraph().isRTL(buffer()->params()))
|
||||
// 2. if the position *after* right_pos is RTL (we want to be
|
||||
// *after* right_pos, not before right_pos + 1!)
|
||||
// 2. if the position *after* right_pos is RTL
|
||||
// (we want to be *after* right_pos, not
|
||||
// before right_pos + 1!)
|
||||
|| paragraph().getFontSettings(buffer()->params(),
|
||||
new_cur.pos()).isVisibleRightToLeft()
|
||||
)
|
||||
@ -690,9 +698,9 @@ bool Cursor::posVisRight(bool skip_inset)
|
||||
else // set the boundary to false
|
||||
new_cur.boundary(false);
|
||||
}
|
||||
// Otherwise (if the character at position 'right_pos' is RTL), then
|
||||
// moving to the right of it is as easy as setting the new position
|
||||
// to 'right_pos'.
|
||||
// Otherwise (if the character at position 'right_pos'
|
||||
// is RTL), then moving to the right of it is as easy
|
||||
// as setting the new position to 'right_pos'.
|
||||
else {
|
||||
new_cur.pos() = right_pos;
|
||||
new_cur.boundary(false);
|
||||
@ -731,8 +739,9 @@ bool Cursor::posVisLeft(bool skip_inset)
|
||||
new_cur.boundary(false);
|
||||
if (!skip_inset &&
|
||||
text()->checkAndActivateInsetVisual(new_cur, left_pos >= pos(), true)) {
|
||||
// we actually move the cursor at the end of this function, for now
|
||||
// we just keep track of the new position in new_cur...
|
||||
// we actually move the cursor at the end of this
|
||||
// function, for now we just keep track of the new
|
||||
// position in new_cur...
|
||||
LYXERR(Debug::RTL, "entering inset at: " << new_cur.pos());
|
||||
}
|
||||
|
||||
@ -745,8 +754,9 @@ bool Cursor::posVisLeft(bool skip_inset)
|
||||
return false;
|
||||
}
|
||||
|
||||
// we actually move the cursor at the end of this function, for now
|
||||
// just keep track of the new position in new_cur...
|
||||
// we actually move the cursor at the end of this
|
||||
// function, for now just keep track of the new
|
||||
// position in new_cur...
|
||||
LYXERR(Debug::RTL, "left edge, moving: " << int(new_cur.pit()) << ","
|
||||
<< int(new_cur.pos()) << "," << (new_cur.boundary() ? 1 : 0));
|
||||
|
||||
@ -754,28 +764,33 @@ bool Cursor::posVisLeft(bool skip_inset)
|
||||
// normal movement to the left
|
||||
else {
|
||||
new_cur = *this;
|
||||
// Recall, if the cursor is at position 'x', that means *before*
|
||||
// the character at position 'x'. In RTL, "before" means "to the
|
||||
// right of", in LTR, "to the left of". So currently our situation
|
||||
// is this: the position to our left is 'left_pos' (i.e., we're
|
||||
// currently to the right of 'left_pos'). In order to move to the
|
||||
// left, it depends whether or not the character at 'left_pos' is RTL.
|
||||
// Recall, if the cursor is at position 'x', that
|
||||
// means *before* the character at position 'x'. In
|
||||
// RTL, "before" means "to the right of", in LTR, "to
|
||||
// the left of". So currently our situation is this:
|
||||
// the position to our left is 'left_pos' (i.e., we're
|
||||
// currently to the right of 'left_pos'). In order to
|
||||
// move to the left, it depends whether or not the
|
||||
// character at 'left_pos' is RTL.
|
||||
new_pos_is_RTL = paragraph().getFontSettings(
|
||||
buffer()->params(), left_pos).isVisibleRightToLeft();
|
||||
// If the character at 'left_pos' *is* RTL, then in order to move to
|
||||
// the left of it, we need to be *after* 'left_pos', i.e., move to
|
||||
// position 'left_pos' + 1.
|
||||
// If the character at 'left_pos' *is* RTL, then in
|
||||
// order to move to the left of it, we need to be
|
||||
// *after* 'left_pos', i.e., move to position
|
||||
// 'left_pos' + 1.
|
||||
if (new_pos_is_RTL) {
|
||||
new_cur.pos() = left_pos + 1;
|
||||
// set the boundary to true in two situations:
|
||||
if (
|
||||
// 1. if new_pos is now lastpos and we're in an LTR paragraph
|
||||
// (this means that we're moving left to the end of an RTL chunk
|
||||
// 1. if new_pos is now lastpos and we're in
|
||||
// an LTR paragraph (this means that we're
|
||||
// moving left to the end of an RTL chunk
|
||||
// which is at the end of an LTR paragraph);
|
||||
(new_cur.pos() == lastpos()
|
||||
&& !paragraph().isRTL(buffer()->params()))
|
||||
// 2. if the position *after* left_pos is not RTL (we want to be
|
||||
// *after* left_pos, not before left_pos + 1!)
|
||||
// 2. if the position *after* left_pos is not
|
||||
// RTL (we want to be *after* left_pos, not
|
||||
// before left_pos + 1!)
|
||||
|| !paragraph().getFontSettings(buffer()->params(),
|
||||
new_cur.pos()).isVisibleRightToLeft()
|
||||
)
|
||||
@ -783,9 +798,9 @@ bool Cursor::posVisLeft(bool skip_inset)
|
||||
else // set the boundary to false
|
||||
new_cur.boundary(false);
|
||||
}
|
||||
// Otherwise (if the character at position 'left_pos' is LTR), then
|
||||
// moving to the left of it is as easy as setting the new position
|
||||
// to 'left_pos'.
|
||||
// Otherwise (if the character at position 'left_pos'
|
||||
// is LTR), then moving to the left of it is as easy
|
||||
// as setting the new position to 'left_pos'.
|
||||
else {
|
||||
new_cur.pos() = left_pos;
|
||||
new_cur.boundary(false);
|
||||
@ -818,14 +833,16 @@ void Cursor::getSurroundingPos(pos_type & left_pos, pos_type & right_pos)
|
||||
|
||||
LYXERR(Debug::RTL, "bidi: " << row.pos() << "--" << row.endpos());
|
||||
|
||||
// The cursor is painted *before* the character at pos(), or, if 'boundary'
|
||||
// is true, *after* the character at (pos() - 1). So we already have one
|
||||
// known position around the cursor:
|
||||
// The cursor is painted *before* the character at pos(), or,
|
||||
// if 'boundary' is true, *after* the character at (pos() -
|
||||
// 1). So we already have one known position around the
|
||||
// cursor:
|
||||
pos_type const known_pos = boundary() && pos() > 0 ? pos() - 1 : pos();
|
||||
|
||||
// edge case: if we're at the end of the paragraph, things are a little
|
||||
// different (because lastpos is a position which does not really "exist"
|
||||
// --- there's no character there yet).
|
||||
// edge case: if we're at the end of the paragraph, things are
|
||||
// a little different (because lastpos is a position which
|
||||
// does not really "exist" --- there's no character there
|
||||
// yet).
|
||||
if (known_pos == lastpos()) {
|
||||
if (par.isRTL(buf.params())) {
|
||||
left_pos = -1;
|
||||
@ -838,28 +855,31 @@ void Cursor::getSurroundingPos(pos_type & left_pos, pos_type & right_pos)
|
||||
return;
|
||||
}
|
||||
|
||||
// Whether 'known_pos' is to the left or to the right of the cursor depends
|
||||
// on whether it is an RTL or LTR character...
|
||||
// Whether 'known_pos' is to the left or to the right of the
|
||||
// cursor depends on whether it is an RTL or LTR character...
|
||||
bool const cur_is_RTL =
|
||||
par.getFontSettings(buf.params(), known_pos).isVisibleRightToLeft();
|
||||
// ... in the following manner:
|
||||
// For an RTL character, "before" means "to the right" and "after" means
|
||||
// "to the left"; and for LTR, it's the reverse. So, 'known_pos' is to the
|
||||
// right of the cursor if (RTL && boundary) or (!RTL && !boundary):
|
||||
// For an RTL character, "before"
|
||||
// means "to the right" and "after" means "to the left"; and
|
||||
// for LTR, it's the reverse. So, 'known_pos' is to the right
|
||||
// of the cursor if (RTL && boundary) or (!RTL && !boundary):
|
||||
bool const known_pos_on_right = cur_is_RTL == boundary();
|
||||
|
||||
// So we now know one of the positions surrounding the cursor. Let's
|
||||
// determine the other one:
|
||||
// So we now know one of the positions surrounding the cursor.
|
||||
// Let's determine the other one:
|
||||
if (known_pos_on_right) {
|
||||
right_pos = known_pos;
|
||||
// *visual* position of 'left_pos':
|
||||
pos_type v_left_pos = bidi.log2vis(right_pos) - 1;
|
||||
// If the position we just identified as 'left_pos' is a "skipped
|
||||
// separator" (a separator which is at the logical end of a row,
|
||||
// except for the last row in a paragraph; such separators are not
|
||||
// painted, so they "are not really there"; note that in bidi text,
|
||||
// such a separator could appear visually in the middle of a row),
|
||||
// set 'left_pos' to the *next* position to the left.
|
||||
// If the position we just identified as 'left_pos' is
|
||||
// a "skipped separator" (a separator which is at the
|
||||
// logical end of a row, except for the last row in a
|
||||
// paragraph; such separators are not painted, so they
|
||||
// "are not really there"; note that in bidi text,
|
||||
// such a separator could appear visually in the
|
||||
// middle of a row), set 'left_pos' to the *next*
|
||||
// position to the left.
|
||||
if (bidi.inRange(v_left_pos)
|
||||
&& bidi.vis2log(v_left_pos) + 1 == row.endpos()
|
||||
&& row.endpos() < lastpos()
|
||||
@ -871,8 +891,9 @@ void Cursor::getSurroundingPos(pos_type & left_pos, pos_type & right_pos)
|
||||
left_pos = -1;
|
||||
else
|
||||
left_pos = bidi.vis2log(v_left_pos);
|
||||
// If the position we identified as 'right_pos' is a "skipped
|
||||
// separator", set 'right_pos' to the *next* position to the right.
|
||||
// If the position we identified as 'right_pos' is a
|
||||
// "skipped separator", set 'right_pos' to the *next*
|
||||
// position to the right.
|
||||
if (right_pos + 1 == row.endpos() && row.endpos() < lastpos()
|
||||
&& par.isSeparator(right_pos)) {
|
||||
pos_type const v_right_pos = bidi.log2vis(right_pos) + 1;
|
||||
@ -886,8 +907,9 @@ void Cursor::getSurroundingPos(pos_type & left_pos, pos_type & right_pos)
|
||||
left_pos = known_pos;
|
||||
// *visual* position of 'right_pos'
|
||||
pos_type v_right_pos = bidi.log2vis(left_pos) + 1;
|
||||
// If the position we just identified as 'right_pos' is a "skipped
|
||||
// separator", set 'right_pos' to the *next* position to the right.
|
||||
// If the position we just identified as 'right_pos'
|
||||
// is a "skipped separator", set 'right_pos' to the
|
||||
// *next* position to the right.
|
||||
if (bidi.inRange(v_right_pos)
|
||||
&& bidi.vis2log(v_right_pos) + 1 == row.endpos()
|
||||
&& row.endpos() < lastpos()
|
||||
@ -899,8 +921,9 @@ void Cursor::getSurroundingPos(pos_type & left_pos, pos_type & right_pos)
|
||||
right_pos = -1;
|
||||
else
|
||||
right_pos = bidi.vis2log(v_right_pos);
|
||||
// If the position we identified as 'left_pos' is a "skipped
|
||||
// separator", set 'left_pos' to the *next* position to the left.
|
||||
// If the position we identified as 'left_pos' is a
|
||||
// "skipped separator", set 'left_pos' to the *next*
|
||||
// position to the left.
|
||||
if (left_pos + 1 == row.endpos() && row.endpos() < lastpos()
|
||||
&& par.isSeparator(left_pos)) {
|
||||
pos_type const v_left_pos = bidi.log2vis(left_pos) - 1;
|
||||
@ -921,16 +944,16 @@ bool Cursor::posVisToNewRow(bool movingLeft)
|
||||
Row const & row = textRow();
|
||||
bool par_is_LTR = !par.isRTL(buf.params());
|
||||
|
||||
// Inside a table, determining whether to move to the next or previous row
|
||||
// should be done based on the table's direction.
|
||||
// Inside a table, determining whether to move to the next or
|
||||
// previous row should be done based on the table's direction.
|
||||
int s = depth() - 1;
|
||||
if (s >= 1 && (*this)[s].inset().asInsetTabular()) {
|
||||
par_is_LTR = !(*this)[s].inset().asInsetTabular()->isRightToLeft(*this);
|
||||
LYXERR(Debug::RTL, "Inside table! par_is_LTR=" << (par_is_LTR ? 1 : 0));
|
||||
}
|
||||
|
||||
// if moving left in an LTR paragraph or moving right in an RTL one,
|
||||
// move to previous row
|
||||
// if moving left in an LTR paragraph or moving right in an
|
||||
// RTL one, move to previous row
|
||||
if (par_is_LTR == movingLeft) {
|
||||
if (row.pos() == 0) { // we're at first row in paragraph
|
||||
if (pit() == 0) // no previous paragraph! don't move
|
||||
@ -944,8 +967,8 @@ bool Cursor::posVisToNewRow(bool movingLeft)
|
||||
boundary(false);
|
||||
}
|
||||
}
|
||||
// if moving left in an RTL paragraph or moving right in an LTR one,
|
||||
// move to next row
|
||||
// if moving left in an RTL paragraph or moving right in an
|
||||
// LTR one, move to next row
|
||||
else {
|
||||
if (row.endpos() == lastpos()) { // we're at last row in paragraph
|
||||
if (pit() == lastpit()) // last paragraph! don't move
|
||||
@ -987,30 +1010,43 @@ void Cursor::posVisToRowExtremity(bool left)
|
||||
else {
|
||||
pos() = bidi.vis2log(row.pos());
|
||||
|
||||
// Moving to the leftmost position in the row, the cursor should
|
||||
// normally be placed to the *left* of the leftmost position.
|
||||
// A very common exception, though, is if the leftmost character
|
||||
// also happens to be the separator at the (logical) end of the row
|
||||
// --- in this case, the separator is positioned beyond the left
|
||||
// margin, and we don't want to move the cursor there (moving to
|
||||
// the left of the separator is equivalent to moving to the next
|
||||
// line). So, in this case we actually want to place the cursor
|
||||
// to the *right* of the leftmost position (the separator).
|
||||
// Another exception is if we're moving to the logically last
|
||||
// position in the row, which is *not* a separator: this means
|
||||
// that the entire row has no separators (if there were any, the
|
||||
// row would have been broken there); and therefore in this case
|
||||
// we also move to the *right* of the last position (this indicates
|
||||
// to the user that there is no space after this position, and is
|
||||
// consistent with the behavior in the middle of a row --- moving
|
||||
// right or left moves to the next/previous character; if we were
|
||||
// to move to the *left* of this position, that would simulate
|
||||
// a separator which is not really there!).
|
||||
// Finally, there is an exception to the previous exception: if
|
||||
// this non-separator-but-last-position-in-row is an inset, then
|
||||
// we *do* want to stay to the left of it anyway: this is the
|
||||
// Moving to the leftmost position in the row,
|
||||
// the cursor should normally be placed to the
|
||||
// *left* of the leftmost position. A very
|
||||
// common exception, though, is if the
|
||||
// leftmost character also happens to be the
|
||||
// separator at the (logical) end of the row
|
||||
// --- in this case, the separator is
|
||||
// positioned beyond the left margin, and we
|
||||
// don't want to move the cursor there (moving
|
||||
// to the left of the separator is equivalent
|
||||
// to moving to the next line). So, in this
|
||||
// case we actually want to place the cursor
|
||||
// to the *right* of the leftmost position
|
||||
// (the separator). Another exception is if
|
||||
// we're moving to the logically last position
|
||||
// in the row, which is *not* a separator:
|
||||
// this means that the entire row has no
|
||||
// separators (if there were any, the row
|
||||
// would have been broken there); and
|
||||
// therefore in this case we also move to the
|
||||
// *right* of the last position (this
|
||||
// indicates to the user that there is no
|
||||
// space after this position, and is
|
||||
// consistent with the behavior in the middle
|
||||
// of a row --- moving right or left moves to
|
||||
// the next/previous character; if we were to
|
||||
// move to the *left* of this position, that
|
||||
// would simulate a separator which is not
|
||||
// really there!). Finally, there is an
|
||||
// exception to the previous exception: if
|
||||
// this non-separator-but-last-position-in-row
|
||||
// is an inset, then we *do* want to stay to
|
||||
// the left of it anyway: this is the
|
||||
// "boundary" which we simulate at insets.
|
||||
// Another exception is when row.endpos() is 0.
|
||||
|
||||
// Another exception is when row.endpos() is
|
||||
// 0.
|
||||
|
||||
// do we want to be to the right of pos?
|
||||
// as explained above, if at last pos in row, stay to the right
|
||||
@ -1036,30 +1072,41 @@ void Cursor::posVisToRowExtremity(bool left)
|
||||
else {
|
||||
pos() = row.endpos() > 0 ? bidi.vis2log(row.endpos() - 1) : 0;
|
||||
|
||||
// Moving to the rightmost position in the row, the cursor should
|
||||
// normally be placed to the *right* of the rightmost position.
|
||||
// A very common exception, though, is if the rightmost character
|
||||
// also happens to be the separator at the (logical) end of the row
|
||||
// --- in this case, the separator is positioned beyond the right
|
||||
// margin, and we don't want to move the cursor there (moving to
|
||||
// the right of the separator is equivalent to moving to the next
|
||||
// line). So, in this case we actually want to place the cursor
|
||||
// to the *left* of the rightmost position (the separator).
|
||||
// Another exception is if we're moving to the logically last
|
||||
// position in the row, which is *not* a separator: this means
|
||||
// that the entire row has no separators (if there were any, the
|
||||
// row would have been broken there); and therefore in this case
|
||||
// we also move to the *left* of the last position (this indicates
|
||||
// to the user that there is no space after this position, and is
|
||||
// consistent with the behavior in the middle of a row --- moving
|
||||
// right or left moves to the next/previous character; if we were
|
||||
// to move to the *right* of this position, that would simulate
|
||||
// a separator which is not really there!).
|
||||
// Finally, there is an exception to the previous exception: if
|
||||
// this non-separator-but-last-position-in-row is an inset, then
|
||||
// we *do* want to stay to the right of it anyway: this is the
|
||||
// "boundary" which we simulate at insets.
|
||||
// Another exception is when row.endpos() is 0.
|
||||
// Moving to the rightmost position in the
|
||||
// row, the cursor should normally be placed
|
||||
// to the *right* of the rightmost position. A
|
||||
// very common exception, though, is if the
|
||||
// rightmost character also happens to be the
|
||||
// separator at the (logical) end of the row
|
||||
// --- in this case, the separator is
|
||||
// positioned beyond the right margin, and we
|
||||
// don't want to move the cursor there (moving
|
||||
// to the right of the separator is equivalent
|
||||
// to moving to the next line). So, in this
|
||||
// case we actually want to place the cursor
|
||||
// to the *left* of the rightmost position
|
||||
// (the separator). Another exception is if
|
||||
// we're moving to the logically last position
|
||||
// in the row, which is *not* a separator:
|
||||
// this means that the entire row has no
|
||||
// separators (if there were any, the row
|
||||
// would have been broken there); and
|
||||
// therefore in this case we also move to the
|
||||
// *left* of the last position (this indicates
|
||||
// to the user that there is no space after
|
||||
// this position, and is consistent with the
|
||||
// behavior in the middle of a row --- moving
|
||||
// right or left moves to the next/previous
|
||||
// character; if we were to move to the
|
||||
// *right* of this position, that would
|
||||
// simulate a separator which is not really
|
||||
// there!). Finally, there is an exception to
|
||||
// the previous exception: if this
|
||||
// non-separator-but-last-position-in-row is
|
||||
// an inset, then we *do* want to stay to the
|
||||
// right of it anyway: this is the "boundary"
|
||||
// which we simulate at insets. Another
|
||||
// exception is when row.endpos() is 0.
|
||||
|
||||
// do we want to be to the left of pos?
|
||||
// as explained above, if at last pos in row, stay to the left,
|
||||
@ -1915,6 +1962,7 @@ bool Cursor::atFirstOrLastRow(bool up)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Cursor::upDownInText(bool up, bool & updateNeeded)
|
||||
{
|
||||
LASSERT(text(), /**/);
|
||||
@ -1932,14 +1980,16 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded)
|
||||
setTargetX(xo);
|
||||
else if (xo - textTargetOffset() != x_target() &&
|
||||
depth() == beforeDispatchCursor_.depth()) {
|
||||
// In text mode inside the line (not left or right) possibly set a new target_x,
|
||||
// but only if we are somewhere else than the previous target-offset.
|
||||
// In text mode inside the line (not left or right)
|
||||
// possibly set a new target_x, but only if we are
|
||||
// somewhere else than the previous target-offset.
|
||||
|
||||
// We want to keep the x-target on subsequent up/down movements
|
||||
// that cross beyond the end of short lines. Thus a special
|
||||
// handling when the cursor is at the end of line: Use the new
|
||||
// x-target only if the old one was before the end of line
|
||||
// or the old one was after the beginning of the line
|
||||
// We want to keep the x-target on subsequent up/down
|
||||
// movements that cross beyond the end of short lines.
|
||||
// Thus a special handling when the cursor is at the
|
||||
// end of line: Use the new x-target only if the old
|
||||
// one was before the end of line or the old one was
|
||||
// after the beginning of the line
|
||||
bool inRTL = isWithinRtlParagraph(*this);
|
||||
bool left;
|
||||
bool right;
|
||||
@ -2128,6 +2178,7 @@ void Cursor::errorMessage(docstring const & msg) const
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
docstring parbreak(Cursor const * cur)
|
||||
{
|
||||
odocstringstream os;
|
||||
@ -2138,6 +2189,7 @@ docstring parbreak(Cursor const * cur)
|
||||
os << '\n';
|
||||
return os.str();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -2267,9 +2319,9 @@ void Cursor::noScreenUpdate() const
|
||||
|
||||
Font Cursor::getFont() const
|
||||
{
|
||||
// The logic here should more or less match to the Cursor::setCurrentFont
|
||||
// logic, i.e. the cursor height should give a hint what will happen
|
||||
// if a character is entered.
|
||||
// The logic here should more or less match to the
|
||||
// Cursor::setCurrentFont logic, i.e. the cursor height should
|
||||
// give a hint what will happen if a character is entered.
|
||||
|
||||
// HACK. far from being perfect...
|
||||
|
||||
|
@ -848,6 +848,7 @@ void copyInset(Cursor const & cur, Inset * inset, docstring const & plaintext)
|
||||
putClipboard(theCuts[0].first, theCuts[0].second, plaintext);
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
void copySelectionToStack(Cursor const & cur, CutStack & cutstack)
|
||||
|
@ -108,7 +108,8 @@ bool DepTable::sumchange() const
|
||||
DepList::const_iterator cit = deplist.begin();
|
||||
DepList::const_iterator end = deplist.end();
|
||||
for (; cit != end; ++cit) {
|
||||
if (cit->second.changed()) return true;
|
||||
if (cit->second.changed())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -144,9 +145,8 @@ bool DepTable::ext_exist(string const & ext) const
|
||||
DepList::const_iterator cit = deplist.begin();
|
||||
DepList::const_iterator end = deplist.end();
|
||||
for (; cit != end; ++cit) {
|
||||
if (suffixIs(cit->first.absFileName(), ext)) {
|
||||
if (suffixIs(cit->first.absFileName(), ext))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ DocIterator::DocIterator()
|
||||
: boundary_(false), inset_(0), buffer_(0)
|
||||
{}
|
||||
|
||||
|
||||
// We could be able to get rid of this if only every BufferView were
|
||||
// associated to a buffer on construction.
|
||||
DocIterator::DocIterator(Buffer * buf)
|
||||
|
@ -40,7 +40,8 @@ typedef map<string, Speller> Spellers;
|
||||
|
||||
struct EnchantChecker::Private
|
||||
{
|
||||
Private() {}
|
||||
Private()
|
||||
{}
|
||||
|
||||
~Private();
|
||||
|
||||
@ -60,9 +61,8 @@ EnchantChecker::Private::~Private()
|
||||
Spellers::iterator it = spellers_.begin();
|
||||
Spellers::iterator end = spellers_.end();
|
||||
|
||||
for (; it != end; ++it) {
|
||||
for (; it != end; ++it)
|
||||
delete it->second.speller;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -97,9 +97,9 @@ enchant::Dict * EnchantChecker::Private::speller(string const & lang)
|
||||
}
|
||||
|
||||
|
||||
EnchantChecker::EnchantChecker(): d(new Private)
|
||||
{
|
||||
}
|
||||
EnchantChecker::EnchantChecker()
|
||||
: d(new Private)
|
||||
{}
|
||||
|
||||
|
||||
EnchantChecker::~EnchantChecker()
|
||||
|
@ -852,8 +852,7 @@ Encoding const * Encodings::fromLaTeXName(string const & n) const
|
||||
|
||||
|
||||
Encodings::Encodings()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
void Encodings::read(FileName const & encfile, FileName const & symbolsfile)
|
||||
|
200
src/FontInfo.cpp
200
src/FontInfo.cpp
@ -101,6 +101,7 @@ FontInfo::FontInfo()
|
||||
*this = sane_font;
|
||||
}
|
||||
|
||||
|
||||
/// Decreases font size_ by one
|
||||
FontInfo & FontInfo::decSize()
|
||||
{
|
||||
@ -346,115 +347,116 @@ Color FontInfo::realColor() const
|
||||
|
||||
namespace {
|
||||
|
||||
void appendSep(string & s1, string const & s2) {
|
||||
if (s2.empty())
|
||||
return;
|
||||
s1 += s1.empty() ? "" : "\n";
|
||||
s1 += s2;
|
||||
void appendSep(string & s1, string const & s2)
|
||||
{
|
||||
if (s2.empty())
|
||||
return;
|
||||
s1 += s1.empty() ? "" : "\n";
|
||||
s1 += s2;
|
||||
}
|
||||
|
||||
|
||||
string makeCSSTag(string const & key, string const & val)
|
||||
{
|
||||
return key + ": " + val + ";";
|
||||
}
|
||||
|
||||
|
||||
string getFamilyCSS(FontFamily const & f)
|
||||
{
|
||||
switch (f) {
|
||||
case ROMAN_FAMILY:
|
||||
return "serif";
|
||||
case SANS_FAMILY:
|
||||
return "sans-serif";
|
||||
case TYPEWRITER_FAMILY:
|
||||
return "monospace";
|
||||
case SYMBOL_FAMILY:
|
||||
case CMR_FAMILY:
|
||||
case CMSY_FAMILY:
|
||||
case CMM_FAMILY:
|
||||
case CMEX_FAMILY:
|
||||
case MSA_FAMILY:
|
||||
case MSB_FAMILY:
|
||||
case EUFRAK_FAMILY:
|
||||
case RSFS_FAMILY:
|
||||
case WASY_FAMILY:
|
||||
case ESINT_FAMILY:
|
||||
case INHERIT_FAMILY:
|
||||
case IGNORE_FAMILY:
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
string makeCSSTag(string const & key, string const & val)
|
||||
{
|
||||
return key + ": " + val + ";";
|
||||
string getSeriesCSS(FontSeries const & s)
|
||||
{
|
||||
switch (s) {
|
||||
case MEDIUM_SERIES:
|
||||
return "normal";
|
||||
case BOLD_SERIES:
|
||||
return "bold";
|
||||
case INHERIT_SERIES:
|
||||
case IGNORE_SERIES:
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
string getFamilyCSS(FontFamily const & f)
|
||||
{
|
||||
switch (f) {
|
||||
case ROMAN_FAMILY:
|
||||
return "serif";
|
||||
case SANS_FAMILY:
|
||||
return "sans-serif";
|
||||
case TYPEWRITER_FAMILY:
|
||||
return "monospace";
|
||||
case SYMBOL_FAMILY:
|
||||
case CMR_FAMILY:
|
||||
case CMSY_FAMILY:
|
||||
case CMM_FAMILY:
|
||||
case CMEX_FAMILY:
|
||||
case MSA_FAMILY:
|
||||
case MSB_FAMILY:
|
||||
case EUFRAK_FAMILY:
|
||||
case RSFS_FAMILY:
|
||||
case WASY_FAMILY:
|
||||
case ESINT_FAMILY:
|
||||
case INHERIT_FAMILY:
|
||||
case IGNORE_FAMILY:
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
string getShapeCSS(FontShape const & s)
|
||||
{
|
||||
string fs = "normal";
|
||||
string fv = "normal";
|
||||
switch (s) {
|
||||
case UP_SHAPE: break;
|
||||
case ITALIC_SHAPE: fs = "italic"; break;
|
||||
case SLANTED_SHAPE: fs = "oblique"; break;
|
||||
case SMALLCAPS_SHAPE: fv = "small-caps"; break;
|
||||
case IGNORE_SHAPE:
|
||||
case INHERIT_SHAPE:
|
||||
fs = ""; fv = ""; break;
|
||||
}
|
||||
string retval;
|
||||
if (!fs.empty())
|
||||
appendSep(retval, makeCSSTag("font-style", fs));
|
||||
if (!fv.empty())
|
||||
appendSep(retval, makeCSSTag("font-variant", fv));
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
string getSeriesCSS(FontSeries const & s)
|
||||
{
|
||||
switch (s) {
|
||||
case MEDIUM_SERIES:
|
||||
return "normal";
|
||||
case BOLD_SERIES:
|
||||
return "bold";
|
||||
case INHERIT_SERIES:
|
||||
case IGNORE_SERIES:
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
string getShapeCSS(FontShape const & s)
|
||||
{
|
||||
string fs = "normal";
|
||||
string fv = "normal";
|
||||
switch (s) {
|
||||
case UP_SHAPE: break;
|
||||
case ITALIC_SHAPE: fs = "italic"; break;
|
||||
case SLANTED_SHAPE: fs = "oblique"; break;
|
||||
case SMALLCAPS_SHAPE: fv = "small-caps"; break;
|
||||
case IGNORE_SHAPE:
|
||||
case INHERIT_SHAPE:
|
||||
fs = ""; fv = ""; break;
|
||||
}
|
||||
string retval;
|
||||
if (!fs.empty())
|
||||
appendSep(retval, makeCSSTag("font-style", fs));
|
||||
if (!fv.empty())
|
||||
appendSep(retval, makeCSSTag("font-variant", fv));
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
string getSizeCSS(FontSize const & s)
|
||||
{
|
||||
switch (s) {
|
||||
case FONT_SIZE_TINY:
|
||||
return "xx-small";
|
||||
case FONT_SIZE_SCRIPT:
|
||||
return "x-small";
|
||||
case FONT_SIZE_FOOTNOTE:
|
||||
case FONT_SIZE_SMALL:
|
||||
return "small";
|
||||
case FONT_SIZE_NORMAL:
|
||||
return "medium";
|
||||
case FONT_SIZE_LARGE:
|
||||
return "large";
|
||||
case FONT_SIZE_LARGER:
|
||||
case FONT_SIZE_LARGEST:
|
||||
return "x-large";
|
||||
case FONT_SIZE_HUGE:
|
||||
case FONT_SIZE_HUGER:
|
||||
return "xx-large";
|
||||
case FONT_SIZE_INCREASE:
|
||||
return "larger";
|
||||
case FONT_SIZE_DECREASE:
|
||||
return "smaller";
|
||||
case FONT_SIZE_IGNORE:
|
||||
case FONT_SIZE_INHERIT:
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
string getSizeCSS(FontSize const & s)
|
||||
{
|
||||
switch (s) {
|
||||
case FONT_SIZE_TINY:
|
||||
return "xx-small";
|
||||
case FONT_SIZE_SCRIPT:
|
||||
return "x-small";
|
||||
case FONT_SIZE_FOOTNOTE:
|
||||
case FONT_SIZE_SMALL:
|
||||
return "small";
|
||||
case FONT_SIZE_NORMAL:
|
||||
return "medium";
|
||||
case FONT_SIZE_LARGE:
|
||||
return "large";
|
||||
case FONT_SIZE_LARGER:
|
||||
case FONT_SIZE_LARGEST:
|
||||
return "x-large";
|
||||
case FONT_SIZE_HUGE:
|
||||
case FONT_SIZE_HUGER:
|
||||
return "xx-large";
|
||||
case FONT_SIZE_INCREASE:
|
||||
return "larger";
|
||||
case FONT_SIZE_DECREASE:
|
||||
return "smaller";
|
||||
case FONT_SIZE_IGNORE:
|
||||
case FONT_SIZE_INHERIT:
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
} // namespace anonymous
|
||||
|
||||
|
@ -59,7 +59,8 @@ string const token_socket_format("$$a");
|
||||
class FormatNamesEqual : public unary_function<Format, bool> {
|
||||
public:
|
||||
FormatNamesEqual(string const & name)
|
||||
: name_(name) {}
|
||||
: name_(name)
|
||||
{}
|
||||
bool operator()(Format const & f) const
|
||||
{
|
||||
return f.name() == name_;
|
||||
@ -72,7 +73,8 @@ private:
|
||||
class FormatExtensionsEqual : public unary_function<Format, bool> {
|
||||
public:
|
||||
FormatExtensionsEqual(string const & extension)
|
||||
: extension_(extension) {}
|
||||
: extension_(extension)
|
||||
{}
|
||||
bool operator()(Format const & f) const
|
||||
{
|
||||
return f.hasExtension(extension_);
|
||||
@ -85,7 +87,8 @@ private:
|
||||
class FormatMimeEqual : public unary_function<Format, bool> {
|
||||
public:
|
||||
FormatMimeEqual(string const & mime)
|
||||
: mime_(mime) {}
|
||||
: mime_(mime)
|
||||
{}
|
||||
bool operator()(Format const & f) const
|
||||
{
|
||||
// The test for empty mime strings is needed since we allow
|
||||
@ -100,7 +103,8 @@ private:
|
||||
class FormatPrettyNameEqual : public unary_function<Format, bool> {
|
||||
public:
|
||||
FormatPrettyNameEqual(string const & prettyname)
|
||||
: prettyname_(prettyname) {}
|
||||
: prettyname_(prettyname)
|
||||
{}
|
||||
bool operator()(Format const & f) const
|
||||
{
|
||||
return f.prettyname() == prettyname_;
|
||||
@ -763,8 +767,10 @@ string const Formats::extensions(string const & name) const
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
typedef Translator<OutputParams::FLAVOR, string> FlavorTranslator;
|
||||
|
||||
|
||||
FlavorTranslator initFlavorTranslator()
|
||||
{
|
||||
FlavorTranslator f(OutputParams::LATEX, "latex");
|
||||
@ -784,6 +790,7 @@ FlavorTranslator const & flavorTranslator()
|
||||
static FlavorTranslator translator = initFlavorTranslator();
|
||||
return translator;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,8 +17,7 @@ namespace lyx {
|
||||
|
||||
FuncStatus::FuncStatus()
|
||||
: v_(OK)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
void FuncStatus::clear()
|
||||
|
@ -142,6 +142,7 @@ string HSpace::asHTMLLength() const
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int HSpace::inPixels(BufferView const & bv) const
|
||||
{
|
||||
switch (kind_) {
|
||||
|
@ -56,7 +56,7 @@ struct HunspellChecker::Private
|
||||
~Private();
|
||||
|
||||
void cleanCache();
|
||||
void setUserPath(std::string path);
|
||||
void setUserPath(std::string const & path);
|
||||
const string dictPath(int selector);
|
||||
bool haveLanguageFiles(string const & hpath);
|
||||
bool haveDictionary(Language const * lang, string & hpath);
|
||||
@ -107,7 +107,7 @@ HunspellChecker::Private::~Private()
|
||||
}
|
||||
|
||||
|
||||
void HunspellChecker::Private::setUserPath(std::string path)
|
||||
void HunspellChecker::Private::setUserPath(std::string const & path)
|
||||
{
|
||||
if (user_path_ != lyxrc.hunspelldir_path) {
|
||||
cleanCache();
|
||||
@ -167,9 +167,8 @@ const string HunspellChecker::Private::dictPath(int selector)
|
||||
|
||||
bool HunspellChecker::Private::haveDictionary(Language const * lang, string & hpath)
|
||||
{
|
||||
if (hpath.empty()) {
|
||||
if (hpath.empty())
|
||||
return false;
|
||||
}
|
||||
|
||||
LYXERR(Debug::FILES, "check hunspell path: " << hpath
|
||||
<< " for language " << (lang ? lang->lang() : "NULL" ));
|
||||
@ -183,9 +182,8 @@ bool HunspellChecker::Private::haveDictionary(Language const * lang, string & hp
|
||||
}
|
||||
// another try with code, '_' replaced by '-'
|
||||
h_path = addName(hpath, subst(lang->code(), '_', '-'));
|
||||
if (!haveLanguageFiles(h_path)) {
|
||||
if (!haveLanguageFiles(h_path))
|
||||
return false;
|
||||
}
|
||||
LYXERR(Debug::FILES, " found " << h_path);
|
||||
hpath = h_path;
|
||||
return true;
|
||||
@ -197,7 +195,7 @@ bool HunspellChecker::Private::haveDictionary(Language const * lang)
|
||||
bool result = false;
|
||||
|
||||
setUserPath(lyxrc.hunspelldir_path);
|
||||
for ( int p = 0; !result && p < maxLookupSelector(); p++ ) {
|
||||
for (int p = 0; !result && p < maxLookupSelector(); ++p) {
|
||||
string lpath = dictPath(p);
|
||||
result = haveDictionary(lang, lpath);
|
||||
}
|
||||
@ -213,9 +211,8 @@ Hunspell * HunspellChecker::Private::speller(Language const * lang)
|
||||
{
|
||||
setUserPath(lyxrc.hunspelldir_path);
|
||||
Spellers::iterator it = spellers_.find(lang->lang());
|
||||
if (it != spellers_.end()) {
|
||||
if (it != spellers_.end())
|
||||
return it->second;
|
||||
}
|
||||
return addSpeller(lang);
|
||||
}
|
||||
|
||||
@ -239,11 +236,11 @@ Hunspell * HunspellChecker::Private::addSpeller(Language const * lang,string & p
|
||||
Hunspell * HunspellChecker::Private::addSpeller(Language const * lang)
|
||||
{
|
||||
Hunspell * h = 0;
|
||||
for ( int p = 0; p < maxLookupSelector() && 0 == h; p++ ) {
|
||||
for (int p = 0; p < maxLookupSelector() && 0 == h; ++p) {
|
||||
string lpath = dictPath(p);
|
||||
h = addSpeller(lang, lpath);
|
||||
}
|
||||
if (0 != h) {
|
||||
if (h) {
|
||||
string const encoding = h->get_dic_encoding();
|
||||
PersonalWordList * pd = new PersonalWordList(lang->lang());
|
||||
pd->load();
|
||||
@ -265,9 +262,8 @@ int HunspellChecker::Private::numDictionaries() const
|
||||
Spellers::const_iterator it = spellers_.begin();
|
||||
Spellers::const_iterator et = spellers_.end();
|
||||
|
||||
for (; it != et; ++it) {
|
||||
for (; it != et; ++it)
|
||||
result += it->second != 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -276,9 +272,9 @@ bool HunspellChecker::Private::isIgnored(WordLangTuple const & wl) const
|
||||
{
|
||||
IgnoreList::const_iterator it = ignored_.begin();
|
||||
for (; it != ignored_.end(); ++it) {
|
||||
if ((*it).lang()->code() != wl.lang()->code())
|
||||
if (it->lang()->code() != wl.lang()->code())
|
||||
continue;
|
||||
if ((*it).word() == wl.word())
|
||||
if (it->word() == wl.word())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -324,9 +320,9 @@ bool HunspellChecker::Private::learned(WordLangTuple const & wl)
|
||||
}
|
||||
|
||||
|
||||
HunspellChecker::HunspellChecker(): d(new Private)
|
||||
{
|
||||
}
|
||||
HunspellChecker::HunspellChecker()
|
||||
: d(new Private)
|
||||
{}
|
||||
|
||||
|
||||
HunspellChecker::~HunspellChecker()
|
||||
@ -436,7 +432,7 @@ bool HunspellChecker::hasDictionary(Language const * lang) const
|
||||
{
|
||||
if (!lang)
|
||||
return false;
|
||||
return (d->haveDictionary(lang));
|
||||
return d->haveDictionary(lang);
|
||||
}
|
||||
|
||||
|
||||
|
@ -30,7 +30,9 @@ namespace {
|
||||
class IndexNamesEqual : public std::unary_function<Index, bool>
|
||||
{
|
||||
public:
|
||||
IndexNamesEqual(docstring const & name) : name_(name) {}
|
||||
IndexNamesEqual(docstring const & name)
|
||||
: name_(name)
|
||||
{}
|
||||
|
||||
bool operator()(Index const & index) const
|
||||
{
|
||||
@ -44,7 +46,9 @@ private:
|
||||
class IndexHasShortcut : public std::unary_function<Index, bool>
|
||||
{
|
||||
public:
|
||||
IndexHasShortcut(docstring const & shortcut) : shortc_(shortcut) {}
|
||||
IndexHasShortcut(docstring const & shortcut)
|
||||
: shortc_(shortcut)
|
||||
{}
|
||||
|
||||
bool operator()(Index const & index) const
|
||||
{
|
||||
|
@ -501,6 +501,7 @@ bool LaTeXFeatures::isProvided(string const & name) const
|
||||
nomath);
|
||||
}
|
||||
|
||||
|
||||
bool LaTeXFeatures::mustProvide(string const & name) const
|
||||
{
|
||||
return isRequired(name) && !isProvided(name);
|
||||
@ -1280,6 +1281,7 @@ docstring const LaTeXFeatures::getTClassHTMLStyles() const
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
docstring const getFloatI18nPreamble(docstring const & type,
|
||||
docstring const & name, Language const * lang,
|
||||
Encoding const & enc, bool const polyglossia)
|
||||
|
@ -911,7 +911,8 @@ string const & Layout::htmllabelattr() const
|
||||
}
|
||||
|
||||
|
||||
docstring Layout::htmlstyle() const {
|
||||
docstring Layout::htmlstyle() const
|
||||
{
|
||||
if (!htmlstyle_.empty() && !htmlforcecss_)
|
||||
return htmlstyle_;
|
||||
if (htmldefaultstyle_.empty())
|
||||
@ -951,15 +952,19 @@ string Layout::defaultCSSClass() const
|
||||
|
||||
|
||||
namespace {
|
||||
string makeMarginValue(char const * side, double d) {
|
||||
ostringstream os;
|
||||
os << "margin-" << side << ": " << d << "ex;\n";
|
||||
return os.str();
|
||||
}
|
||||
|
||||
string makeMarginValue(char const * side, double d)
|
||||
{
|
||||
ostringstream os;
|
||||
os << "margin-" << side << ": " << d << "ex;\n";
|
||||
return os.str();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Layout::makeDefaultCSS() const {
|
||||
void Layout::makeDefaultCSS() const
|
||||
{
|
||||
// this never needs to be redone, since reloading layouts will
|
||||
// wipe out what we did before.
|
||||
if (!htmldefaultstyle_.empty())
|
||||
|
@ -182,7 +182,8 @@ std::vector<LayoutFileIndex> LayoutFileList::classList() const
|
||||
}
|
||||
|
||||
|
||||
void LayoutFileList::reset(LayoutFileIndex const & classname) {
|
||||
void LayoutFileList::reset(LayoutFileIndex const & classname)
|
||||
{
|
||||
LASSERT(haveClass(classname), /**/);
|
||||
LayoutFile * tc = classmap_[classname];
|
||||
LayoutFile * tmpl =
|
||||
@ -216,6 +217,7 @@ string layoutpost =
|
||||
|
||||
}
|
||||
|
||||
|
||||
LayoutFileIndex LayoutFileList::addEmptyClass(string const & textclass)
|
||||
{
|
||||
FileName const tempLayout = FileName::tempName("basic_layout");
|
||||
@ -257,8 +259,8 @@ LayoutFileIndex LayoutFileList::addEmptyClass(string const & textclass)
|
||||
}
|
||||
|
||||
|
||||
LayoutFileIndex
|
||||
LayoutFileList::addLocalLayout(string const & textclass, string const & path)
|
||||
LayoutFileIndex LayoutFileList::addLocalLayout(
|
||||
string const & textclass, string const & path)
|
||||
{
|
||||
// FIXME There is a bug here: 4593
|
||||
//
|
||||
@ -321,7 +323,8 @@ LayoutFileIndex
|
||||
return textclass;
|
||||
}
|
||||
}
|
||||
// If .layout is not in local directory, or an invalid layout is found, return null
|
||||
// If .layout is not in local directory, or an invalid layout
|
||||
// is found, return null
|
||||
return string();
|
||||
}
|
||||
|
||||
|
10
src/LyX.cpp
10
src/LyX.cpp
@ -138,11 +138,10 @@ void reconfigureUserLyXDir()
|
||||
} // namespace anon
|
||||
|
||||
/// The main application class private implementation.
|
||||
struct LyX::Impl
|
||||
{
|
||||
Impl() : latexfonts_(0), spell_checker_(0), apple_spell_checker_(0), aspell_checker_(0), enchant_checker_(0), hunspell_checker_(0)
|
||||
{
|
||||
}
|
||||
struct LyX::Impl {
|
||||
Impl()
|
||||
: latexfonts_(0), spell_checker_(0), apple_spell_checker_(0), aspell_checker_(0), enchant_checker_(0), hunspell_checker_(0)
|
||||
{}
|
||||
|
||||
~Impl()
|
||||
{
|
||||
@ -205,6 +204,7 @@ struct LyX::Impl
|
||||
SpellChecker * hunspell_checker_;
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
frontend::Application * theApp()
|
||||
{
|
||||
|
@ -46,7 +46,8 @@ LyXModule::LyXModule(string const & n, string const & i,
|
||||
}
|
||||
|
||||
|
||||
vector<string> LyXModule::prerequisites() const {
|
||||
vector<string> LyXModule::prerequisites() const
|
||||
{
|
||||
#ifdef TEX2LYX
|
||||
return vector<string>();
|
||||
#else
|
||||
@ -57,7 +58,8 @@ vector<string> LyXModule::prerequisites() const {
|
||||
}
|
||||
|
||||
|
||||
bool LyXModule::isAvailable() const {
|
||||
bool LyXModule::isAvailable() const
|
||||
{
|
||||
#ifdef TEX2LYX
|
||||
return true;
|
||||
#else
|
||||
@ -115,8 +117,7 @@ bool LyXModule::areCompatible(string const & mod1, string const & mod2)
|
||||
|
||||
|
||||
// used when sorting the module list.
|
||||
class ModuleSorter
|
||||
{
|
||||
class ModuleSorter {
|
||||
public:
|
||||
int operator()(LyXModule const & lm1, LyXModule const & lm2) const
|
||||
{
|
||||
@ -265,6 +266,7 @@ LyXModule const * ModuleList::operator[](string const & str) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
LyXModule * ModuleList::operator[](string const & str)
|
||||
{
|
||||
LyXModuleList::iterator it = modlist_.begin();
|
||||
|
@ -69,8 +69,10 @@ using namespace lyx::support;
|
||||
namespace lyx {
|
||||
|
||||
namespace {
|
||||
|
||||
/// Inset identifier (above 0x10ffff, for ucs-4)
|
||||
char_type const META_INSET = 0x200001;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -129,7 +131,8 @@ private:
|
||||
|
||||
class SpellCheckerState {
|
||||
public:
|
||||
SpellCheckerState() {
|
||||
SpellCheckerState()
|
||||
{
|
||||
needs_refresh_ = true;
|
||||
current_change_number_ = 0;
|
||||
}
|
||||
@ -209,20 +212,24 @@ public:
|
||||
return empty_;
|
||||
}
|
||||
|
||||
bool needsRefresh() const {
|
||||
bool needsRefresh() const
|
||||
{
|
||||
return needs_refresh_;
|
||||
}
|
||||
|
||||
SpellChecker::ChangeNumber currentChangeNumber() const {
|
||||
SpellChecker::ChangeNumber currentChangeNumber() const
|
||||
{
|
||||
return current_change_number_;
|
||||
}
|
||||
|
||||
void refreshRange(pos_type & first, pos_type & last) const {
|
||||
void refreshRange(pos_type & first, pos_type & last) const
|
||||
{
|
||||
first = refresh_.first;
|
||||
last = refresh_.last;
|
||||
}
|
||||
|
||||
void needsRefresh(pos_type pos) {
|
||||
void needsRefresh(pos_type pos)
|
||||
{
|
||||
if (needs_refresh_ && pos != -1) {
|
||||
if (pos < refresh_.first)
|
||||
refresh_.first = pos;
|
||||
@ -237,13 +244,13 @@ public:
|
||||
needs_refresh_ = pos != -1;
|
||||
}
|
||||
|
||||
void needsCompleteRefresh(SpellChecker::ChangeNumber change_number) {
|
||||
void needsCompleteRefresh(SpellChecker::ChangeNumber change_number)
|
||||
{
|
||||
needs_refresh_ = true;
|
||||
refresh_.first = 0;
|
||||
refresh_.last = -1;
|
||||
current_change_number_ = change_number;
|
||||
}
|
||||
|
||||
private:
|
||||
typedef vector<SpellResultRange> Ranges;
|
||||
typedef Ranges::const_iterator RangesIterator;
|
||||
@ -384,9 +391,10 @@ public:
|
||||
Language * getSpellLanguage(pos_type const from) const;
|
||||
|
||||
Language * locateSpellRange(pos_type & from, pos_type & to,
|
||||
SkipPositions & skips) const;
|
||||
SkipPositions & skips) const;
|
||||
|
||||
bool hasSpellerChange() const {
|
||||
bool hasSpellerChange() const
|
||||
{
|
||||
SpellChecker::ChangeNumber speller_change_number = 0;
|
||||
if (theSpellChecker())
|
||||
speller_change_number = theSpellChecker()->changeNumber();
|
||||
@ -405,14 +413,16 @@ public:
|
||||
speller_state_.setRange(fp, state);
|
||||
}
|
||||
|
||||
void requestSpellCheck(pos_type pos) {
|
||||
void requestSpellCheck(pos_type pos)
|
||||
{
|
||||
if (pos == -1)
|
||||
speller_state_.needsCompleteRefresh(speller_state_.currentChangeNumber());
|
||||
else
|
||||
speller_state_.needsRefresh(pos);
|
||||
}
|
||||
|
||||
void readySpellCheck() {
|
||||
void readySpellCheck()
|
||||
{
|
||||
speller_state_.needsRefresh(-1);
|
||||
}
|
||||
|
||||
|
@ -257,9 +257,8 @@ bool ParagraphMetrics::hfillExpansion(Row const & row, pos_type pos) const
|
||||
}
|
||||
|
||||
// expand at the beginning of a row only if it is the first row of a paragraph
|
||||
if (pos == row.pos()) {
|
||||
if (pos == row.pos())
|
||||
return pos == 0;
|
||||
}
|
||||
|
||||
// do not expand in some labels
|
||||
if (par_->layout().margintype != MARGIN_MANUAL && pos < par_->beginOfBody())
|
||||
|
@ -92,6 +92,7 @@ void PersonalWordList::save()
|
||||
LYXERR(Debug::FILES, "count of saved items: " << words_.size());
|
||||
}
|
||||
|
||||
|
||||
bool PersonalWordList::equalwords(docstring const & w1, docstring const & w2) const
|
||||
{
|
||||
return w1 == w2;
|
||||
|
@ -695,6 +695,7 @@ string const LyXComm::pipeName(DWORD index) const
|
||||
LyXComm::LyXComm(string const &, Server *, ClientCallbackfct)
|
||||
{}
|
||||
|
||||
|
||||
void LyXComm::openConnection()
|
||||
{}
|
||||
|
||||
@ -716,6 +717,7 @@ void LyXComm::endPipe(int & fd, string const & filename, bool write)
|
||||
void LyXComm::emergencyCleanup()
|
||||
{}
|
||||
|
||||
|
||||
void LyXComm::read_ready()
|
||||
{}
|
||||
|
||||
@ -726,7 +728,6 @@ void LyXComm::send(string const & msg)
|
||||
|
||||
#else // defined (HAVE_MKFIFO)
|
||||
|
||||
|
||||
LyXComm::LyXComm(string const & pip, Server * cli, ClientCallbackfct ccb)
|
||||
: pipename_(pip), client_(cli), clientcb_(ccb)
|
||||
{
|
||||
@ -915,7 +916,6 @@ void LyXComm::read_ready()
|
||||
int status;
|
||||
// the single = is intended here.
|
||||
while ((status = ::read(infd_, charbuf, charbuf_size - 1))) {
|
||||
|
||||
if (status > 0) {
|
||||
charbuf[status] = '\0'; // turn it into a c string
|
||||
read_buffer_ += rtrim(charbuf, "\r");
|
||||
@ -966,7 +966,8 @@ void LyXComm::send(string const & msg)
|
||||
|
||||
LYXERR(Debug::LYXSERVER, "LyXComm: Sending '" << msg << '\'');
|
||||
|
||||
if (pipename_.empty()) return;
|
||||
if (pipename_.empty())
|
||||
return;
|
||||
|
||||
if (!ready_) {
|
||||
LYXERR0("LyXComm: Pipes are closed. Could not send " << msg);
|
||||
@ -1068,7 +1069,6 @@ Server::~Server()
|
||||
|
||||
int compare(char const * a, char const * b, unsigned int len)
|
||||
{
|
||||
using namespace std;
|
||||
return strncmp(a, b, len);
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,6 @@ using namespace std;
|
||||
using namespace lyx::support;
|
||||
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
// Address is the unix address for the socket.
|
||||
|
@ -40,7 +40,6 @@ string const sec_lastcommands = "[last commands]";
|
||||
|
||||
namespace lyx {
|
||||
|
||||
|
||||
LastFilesSection::LastFilesSection(unsigned int num) :
|
||||
default_num_last_files(4),
|
||||
absolute_max_last_files(100)
|
||||
|
@ -1812,6 +1812,7 @@ bool Text::read(Lexer & lex,
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
// Returns the current font and depth as a message.
|
||||
docstring Text::currentState(Cursor const & cur) const
|
||||
{
|
||||
|
@ -222,50 +222,50 @@ enum TextClassTags {
|
||||
|
||||
namespace {
|
||||
|
||||
LexerKeyword textClassTags[] = {
|
||||
{ "addtohtmlpreamble", TC_ADDTOHTMLPREAMBLE },
|
||||
{ "addtohtmlstyles", TC_ADDTOHTMLSTYLES },
|
||||
{ "addtopreamble", TC_ADDTOPREAMBLE },
|
||||
{ "citeengine", TC_CITEENGINE },
|
||||
{ "citeenginetype", TC_CITEENGINETYPE },
|
||||
{ "citeformat", TC_CITEFORMAT },
|
||||
{ "classoptions", TC_CLASSOPTIONS },
|
||||
{ "columns", TC_COLUMNS },
|
||||
{ "counter", TC_COUNTER },
|
||||
{ "defaultbiblio", TC_DEFAULTBIBLIO },
|
||||
{ "defaultfont", TC_DEFAULTFONT },
|
||||
{ "defaultmodule", TC_DEFAULTMODULE },
|
||||
{ "defaultstyle", TC_DEFAULTSTYLE },
|
||||
{ "excludesmodule", TC_EXCLUDESMODULE },
|
||||
{ "float", TC_FLOAT },
|
||||
{ "format", TC_FORMAT },
|
||||
{ "fullauthorlist", TC_FULLAUTHORLIST },
|
||||
{ "htmlpreamble", TC_HTMLPREAMBLE },
|
||||
{ "htmlstyles", TC_HTMLSTYLES },
|
||||
{ "htmltocsection", TC_HTMLTOCSECTION },
|
||||
{ "ifcounter", TC_IFCOUNTER },
|
||||
{ "ifstyle", TC_IFSTYLE },
|
||||
{ "input", TC_INPUT },
|
||||
{ "insetlayout", TC_INSETLAYOUT },
|
||||
{ "leftmargin", TC_LEFTMARGIN },
|
||||
{ "nocounter", TC_NOCOUNTER },
|
||||
{ "nofloat", TC_NOFLOAT },
|
||||
{ "nostyle", TC_NOSTYLE },
|
||||
{ "outputformat", TC_OUTPUTFORMAT },
|
||||
{ "outputtype", TC_OUTPUTTYPE },
|
||||
{ "pagestyle", TC_PAGESTYLE },
|
||||
{ "preamble", TC_PREAMBLE },
|
||||
{ "provides", TC_PROVIDES },
|
||||
{ "providesmodule", TC_PROVIDESMODULE },
|
||||
{ "requires", TC_REQUIRES },
|
||||
{ "rightmargin", TC_RIGHTMARGIN },
|
||||
{ "secnumdepth", TC_SECNUMDEPTH },
|
||||
{ "sides", TC_SIDES },
|
||||
{ "style", TC_STYLE },
|
||||
{ "titlelatexname", TC_TITLELATEXNAME },
|
||||
{ "titlelatextype", TC_TITLELATEXTYPE },
|
||||
{ "tocdepth", TC_TOCDEPTH }
|
||||
};
|
||||
LexerKeyword textClassTags[] = {
|
||||
{ "addtohtmlpreamble", TC_ADDTOHTMLPREAMBLE },
|
||||
{ "addtohtmlstyles", TC_ADDTOHTMLSTYLES },
|
||||
{ "addtopreamble", TC_ADDTOPREAMBLE },
|
||||
{ "citeengine", TC_CITEENGINE },
|
||||
{ "citeenginetype", TC_CITEENGINETYPE },
|
||||
{ "citeformat", TC_CITEFORMAT },
|
||||
{ "classoptions", TC_CLASSOPTIONS },
|
||||
{ "columns", TC_COLUMNS },
|
||||
{ "counter", TC_COUNTER },
|
||||
{ "defaultbiblio", TC_DEFAULTBIBLIO },
|
||||
{ "defaultfont", TC_DEFAULTFONT },
|
||||
{ "defaultmodule", TC_DEFAULTMODULE },
|
||||
{ "defaultstyle", TC_DEFAULTSTYLE },
|
||||
{ "excludesmodule", TC_EXCLUDESMODULE },
|
||||
{ "float", TC_FLOAT },
|
||||
{ "format", TC_FORMAT },
|
||||
{ "fullauthorlist", TC_FULLAUTHORLIST },
|
||||
{ "htmlpreamble", TC_HTMLPREAMBLE },
|
||||
{ "htmlstyles", TC_HTMLSTYLES },
|
||||
{ "htmltocsection", TC_HTMLTOCSECTION },
|
||||
{ "ifcounter", TC_IFCOUNTER },
|
||||
{ "ifstyle", TC_IFSTYLE },
|
||||
{ "input", TC_INPUT },
|
||||
{ "insetlayout", TC_INSETLAYOUT },
|
||||
{ "leftmargin", TC_LEFTMARGIN },
|
||||
{ "nocounter", TC_NOCOUNTER },
|
||||
{ "nofloat", TC_NOFLOAT },
|
||||
{ "nostyle", TC_NOSTYLE },
|
||||
{ "outputformat", TC_OUTPUTFORMAT },
|
||||
{ "outputtype", TC_OUTPUTTYPE },
|
||||
{ "pagestyle", TC_PAGESTYLE },
|
||||
{ "preamble", TC_PREAMBLE },
|
||||
{ "provides", TC_PROVIDES },
|
||||
{ "providesmodule", TC_PROVIDESMODULE },
|
||||
{ "requires", TC_REQUIRES },
|
||||
{ "rightmargin", TC_RIGHTMARGIN },
|
||||
{ "secnumdepth", TC_SECNUMDEPTH },
|
||||
{ "sides", TC_SIDES },
|
||||
{ "style", TC_STYLE },
|
||||
{ "titlelatexname", TC_TITLELATEXNAME },
|
||||
{ "titlelatextype", TC_TITLELATEXTYPE },
|
||||
{ "tocdepth", TC_TOCDEPTH }
|
||||
};
|
||||
|
||||
} //namespace anon
|
||||
|
||||
@ -1237,6 +1237,7 @@ string const & TextClass::prerequisites(string const & sep) const
|
||||
return prerequisites_;
|
||||
}
|
||||
|
||||
|
||||
bool TextClass::hasLayout(docstring const & n) const
|
||||
{
|
||||
docstring const name = n.empty() ? defaultLayoutName() : n;
|
||||
@ -1531,9 +1532,8 @@ Layout const & DocumentClass::getTOCLayout() const
|
||||
|
||||
Layout const & DocumentClass::htmlTOCLayout() const
|
||||
{
|
||||
if (html_toc_section_.empty()) {
|
||||
if (html_toc_section_.empty())
|
||||
html_toc_section_ = getTOCLayout().name();
|
||||
}
|
||||
return operator[](html_toc_section_);
|
||||
}
|
||||
|
||||
|
@ -128,9 +128,8 @@ pair<string,string> Thesaurus::Private::getThesaurus(string const & path, docstr
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (idx.empty()) {
|
||||
if (idx.empty())
|
||||
return make_pair(string(), string());
|
||||
}
|
||||
for (support::FileNameList::const_iterator it = data_files.begin(); it != data_files.end(); ++it) {
|
||||
if (contains(it->onlyFileName(), basename)) {
|
||||
data = it->absFileName();
|
||||
@ -150,9 +149,8 @@ pair<string,string> Thesaurus::Private::getThesaurus(docstring const & lang)
|
||||
if (thesaurusAvailable(lang))
|
||||
return make_pair(string(), string());
|
||||
|
||||
if (!thes_path.empty()) {
|
||||
if (!thes_path.empty())
|
||||
result = getThesaurus(thes_path, lang);
|
||||
}
|
||||
if (result.first.empty() || result.second.empty()) {
|
||||
string const sys_path = external_path(addName(lyx::support::package().system_support().absFileName(),dataDirectory())) ;
|
||||
result = getThesaurus(sys_path, lang);
|
||||
@ -271,7 +269,8 @@ Thesaurus::Meanings Thesaurus::lookup(WordLangTuple const & wl)
|
||||
}
|
||||
|
||||
|
||||
Thesaurus::Thesaurus() : d(new Thesaurus::Private)
|
||||
Thesaurus::Thesaurus()
|
||||
: d(new Thesaurus::Private)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -98,6 +98,7 @@ bool VCS::makeRCSRevision(string const &version, string &revis) const
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool VCS::checkparentdirs(FileName const & file, std::string const & pathname)
|
||||
{
|
||||
FileName dirname = file.onlyPath();
|
||||
|
@ -200,6 +200,7 @@ string VSpace::asHTMLLength() const
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int VSpace::inPixels(BufferView const & bv) const
|
||||
{
|
||||
// Height of a normal line in pixels (zoom factor considered)
|
||||
|
@ -42,7 +42,8 @@ WordList * theWordList(Language const & lang)
|
||||
}
|
||||
|
||||
|
||||
void WordList::cleanupWordLists() {
|
||||
void WordList::cleanupWordLists()
|
||||
{
|
||||
map<Language, WordList *>::const_iterator it = theGlobalWordList.begin();
|
||||
for (; it != theGlobalWordList.end(); ++it)
|
||||
delete it->second;
|
||||
|
@ -564,12 +564,15 @@ Inset * readInset(Lexer & lex, Buffer * buf)
|
||||
}
|
||||
inset->setBuffer(*buf);
|
||||
} else {
|
||||
// FIXME This branch should be made to use inset codes as the preceding
|
||||
// branch does. Unfortunately, that will take some doing. It requires
|
||||
// converting the representation of the insets in LyX files so that they
|
||||
// use the inset names listed in Inset.cpp. Then, as above, the inset names
|
||||
// can be translated to inset codes using insetCode(). And the insets'
|
||||
// write() routines should use insetName() rather than hardcoding it.
|
||||
// FIXME This branch should be made to use inset codes
|
||||
// as the preceding branch does. Unfortunately, that
|
||||
// will take some doing. It requires converting the
|
||||
// representation of the insets in LyX files so that
|
||||
// they use the inset names listed in Inset.cpp. Then,
|
||||
// as above, the inset names can be translated to
|
||||
// inset codes using insetCode(). And the insets'
|
||||
// write() routines should use insetName() rather than
|
||||
// hardcoding it.
|
||||
if (tmptok == "Quotes") {
|
||||
inset.reset(new InsetQuotes(buf));
|
||||
} else if (tmptok == "External") {
|
||||
|
@ -47,6 +47,7 @@ char const * const unit_name_gui[] = {
|
||||
N_("Column Width %"), N_("Page Width %"), N_("Line Width %"),
|
||||
N_("Text Height %"), N_("Page Height %"), "" };
|
||||
|
||||
|
||||
Length::UNIT unitFromString(string const & data)
|
||||
{
|
||||
int i = 0;
|
||||
@ -208,6 +209,7 @@ LaTeXLength table[] = {
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
const char * stringFromUnit(int unit)
|
||||
{
|
||||
if (unit < 0 || unit > num_units)
|
||||
|
@ -623,6 +623,7 @@ string escape_for_regex(string s, bool match_latex)
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
/// Wrapper for lyx::regex_replace with simpler interface
|
||||
bool regex_replace(string const & s, string & t, string const & searchstr,
|
||||
string const & replacestr)
|
||||
@ -637,6 +638,7 @@ bool regex_replace(string const & s, string & t, string const & searchstr,
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
/** Checks if supplied string segment is well-formed from the standpoint of matching open-closed braces.
|
||||
**
|
||||
** Verify that closed braces exactly match open braces. This avoids that, for example,
|
||||
@ -678,6 +680,7 @@ bool braces_match(string::const_iterator const & beg,
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/** The class performing a match between a position in the document and the FindAdvOptions.
|
||||
**/
|
||||
class MatchStringAdv {
|
||||
@ -762,7 +765,8 @@ static docstring buffer_to_latex(Buffer & buffer)
|
||||
}
|
||||
|
||||
|
||||
static docstring stringifySearchBuffer(Buffer & buffer, FindAndReplaceOptions const & opt) {
|
||||
static docstring stringifySearchBuffer(Buffer & buffer, FindAndReplaceOptions const & opt)
|
||||
{
|
||||
docstring str;
|
||||
if (!opt.ignoreformat) {
|
||||
str = buffer_to_latex(buffer);
|
||||
@ -787,7 +791,8 @@ static docstring stringifySearchBuffer(Buffer & buffer, FindAndReplaceOptions co
|
||||
|
||||
|
||||
/// Return separation pos between the leading material and the rest
|
||||
static size_t identifyLeading(string const & s) {
|
||||
static size_t identifyLeading(string const & s)
|
||||
{
|
||||
string t = s;
|
||||
// @TODO Support \item[text]
|
||||
while (regex_replace(t, t, "^\\\\(emph|textbf|subsubsection|subsection|section|subparagraph|paragraph|part)\\*?\\{", "")
|
||||
@ -801,7 +806,8 @@ static size_t identifyLeading(string const & s) {
|
||||
|
||||
|
||||
// Remove trailing closure of math, macros and environments, so to catch parts of them.
|
||||
static int identifyClosing(string & t) {
|
||||
static int identifyClosing(string & t)
|
||||
{
|
||||
int open_braces = 0;
|
||||
do {
|
||||
LYXERR(Debug::FIND, "identifyClosing(): t now is '" << t << "'");
|
||||
@ -1211,7 +1217,8 @@ int findMostBackwards(DocIterator & cur, MatchStringAdv const & match)
|
||||
|
||||
|
||||
/// Finds backwards
|
||||
int findBackwardsAdv(DocIterator & cur, MatchStringAdv & match) {
|
||||
int findBackwardsAdv(DocIterator & cur, MatchStringAdv & match)
|
||||
{
|
||||
if (! cur)
|
||||
return 0;
|
||||
// Backup of original position
|
||||
@ -1290,7 +1297,8 @@ namespace {
|
||||
|
||||
|
||||
/** Check if 'len' letters following cursor are all non-lowercase */
|
||||
static bool allNonLowercase(DocIterator const & cur, int len) {
|
||||
static bool allNonLowercase(DocIterator const & cur, int len)
|
||||
{
|
||||
pos_type end_pos = cur.pos() + len;
|
||||
for (pos_type pos = cur.pos(); pos != end_pos; ++pos)
|
||||
if (isLowerCase(cur.paragraph().getChar(pos)))
|
||||
@ -1300,7 +1308,8 @@ static bool allNonLowercase(DocIterator const & cur, int len) {
|
||||
|
||||
|
||||
/** Check if first letter is upper case and second one is lower case */
|
||||
static bool firstUppercase(DocIterator const & cur) {
|
||||
static bool firstUppercase(DocIterator const & cur)
|
||||
{
|
||||
char_type ch1, ch2;
|
||||
if (cur.pos() >= cur.lastpos() - 1) {
|
||||
LYXERR(Debug::FIND, "No upper-case at cur: " << cur);
|
||||
@ -1321,13 +1330,15 @@ static bool firstUppercase(DocIterator const & cur) {
|
||||
**
|
||||
** \fixme What to do with possible further paragraphs in replace buffer ?
|
||||
**/
|
||||
static void changeFirstCase(Buffer & buffer, TextCase first_case, TextCase others_case) {
|
||||
static void changeFirstCase(Buffer & buffer, TextCase first_case, TextCase others_case)
|
||||
{
|
||||
ParagraphList::iterator pit = buffer.paragraphs().begin();
|
||||
pos_type right = pos_type(1);
|
||||
pit->changeCase(buffer.params(), pos_type(0), right, first_case);
|
||||
right = pit->size() + 1;
|
||||
pit->changeCase(buffer.params(), right, right, others_case);
|
||||
}
|
||||
|
||||
} // anon namespace
|
||||
|
||||
///
|
||||
|
@ -42,7 +42,7 @@ namespace {
|
||||
|
||||
ParagraphList::const_iterator searchParagraph(
|
||||
ParagraphList::const_iterator p,
|
||||
ParagraphList::const_iterator const & pend)
|
||||
ParagraphList::const_iterator const & pend)
|
||||
{
|
||||
for (++p; p != pend && p->layout().latextype == LATEX_PARAGRAPH; ++p)
|
||||
;
|
||||
@ -52,8 +52,8 @@ ParagraphList::const_iterator searchParagraph(
|
||||
|
||||
|
||||
ParagraphList::const_iterator searchCommand(
|
||||
ParagraphList::const_iterator p,
|
||||
ParagraphList::const_iterator const & pend)
|
||||
ParagraphList::const_iterator p,
|
||||
ParagraphList::const_iterator const & pend)
|
||||
{
|
||||
Layout const & bstyle = p->layout();
|
||||
|
||||
@ -68,8 +68,8 @@ ParagraphList::const_iterator searchCommand(
|
||||
|
||||
|
||||
ParagraphList::const_iterator searchEnvironment(
|
||||
ParagraphList::const_iterator p,
|
||||
ParagraphList::const_iterator const & pend)
|
||||
ParagraphList::const_iterator p,
|
||||
ParagraphList::const_iterator const & pend)
|
||||
{
|
||||
Layout const & bstyle = p->layout();
|
||||
size_t const depth = p->params().depth();
|
||||
@ -95,12 +95,13 @@ ParagraphList::const_iterator searchEnvironment(
|
||||
}
|
||||
|
||||
|
||||
ParagraphList::const_iterator makeParagraph(Buffer const & buf,
|
||||
odocstream & os,
|
||||
OutputParams const & runparams,
|
||||
Text const & text,
|
||||
ParagraphList::const_iterator const & pbegin,
|
||||
ParagraphList::const_iterator const & pend)
|
||||
ParagraphList::const_iterator makeParagraph(
|
||||
Buffer const & buf,
|
||||
odocstream & os,
|
||||
OutputParams const & runparams,
|
||||
Text const & text,
|
||||
ParagraphList::const_iterator const & pbegin,
|
||||
ParagraphList::const_iterator const & pend)
|
||||
{
|
||||
ParagraphList const & paragraphs = text.paragraphs();
|
||||
for (ParagraphList::const_iterator par = pbegin; par != pend; ++par) {
|
||||
@ -123,12 +124,13 @@ ParagraphList::const_iterator makeParagraph(Buffer const & buf,
|
||||
}
|
||||
|
||||
|
||||
ParagraphList::const_iterator makeEnvironment(Buffer const & buf,
|
||||
odocstream & os,
|
||||
OutputParams const & runparams,
|
||||
Text const & text,
|
||||
ParagraphList::const_iterator const & pbegin,
|
||||
ParagraphList::const_iterator const & pend)
|
||||
ParagraphList::const_iterator makeEnvironment(
|
||||
Buffer const & buf,
|
||||
odocstream & os,
|
||||
OutputParams const & runparams,
|
||||
Text const & text,
|
||||
ParagraphList::const_iterator const & pbegin,
|
||||
ParagraphList::const_iterator const & pend)
|
||||
{
|
||||
ParagraphList const & paragraphs = text.paragraphs();
|
||||
ParagraphList::const_iterator par = pbegin;
|
||||
@ -244,12 +246,13 @@ ParagraphList::const_iterator makeEnvironment(Buffer const & buf,
|
||||
}
|
||||
|
||||
|
||||
ParagraphList::const_iterator makeCommand(Buffer const & buf,
|
||||
odocstream & os,
|
||||
OutputParams const & runparams,
|
||||
Text const & text,
|
||||
ParagraphList::const_iterator const & pbegin,
|
||||
ParagraphList::const_iterator const & pend)
|
||||
ParagraphList::const_iterator makeCommand(
|
||||
Buffer const & buf,
|
||||
odocstream & os,
|
||||
OutputParams const & runparams,
|
||||
Text const & text,
|
||||
ParagraphList::const_iterator const & pbegin,
|
||||
ParagraphList::const_iterator const & pend)
|
||||
{
|
||||
ParagraphList const & paragraphs = text.paragraphs();
|
||||
ParagraphList::const_iterator par = pbegin;
|
||||
|
@ -45,9 +45,9 @@ namespace lyx {
|
||||
namespace {
|
||||
|
||||
enum OpenEncoding {
|
||||
none,
|
||||
inputenc,
|
||||
CJK
|
||||
none,
|
||||
inputenc,
|
||||
CJK
|
||||
};
|
||||
|
||||
static int open_encoding_ = none;
|
||||
|
@ -71,6 +71,7 @@ static pair<int, docstring> addDepth(int depth, int ldepth)
|
||||
return make_pair(d, docstring(d, ' '));
|
||||
}
|
||||
|
||||
|
||||
void writePlaintextParagraph(Buffer const & buf,
|
||||
Paragraph const & par,
|
||||
odocstream & os,
|
||||
|
@ -71,7 +71,8 @@ docstring escapeChar(char_type c, XHTMLStream::EscapeSettings e)
|
||||
|
||||
|
||||
// escape what needs escaping
|
||||
docstring htmlize(docstring const & str, XHTMLStream::EscapeSettings e) {
|
||||
docstring htmlize(docstring const & str, XHTMLStream::EscapeSettings e)
|
||||
{
|
||||
odocstringstream d;
|
||||
docstring::const_iterator it = str.begin();
|
||||
docstring::const_iterator en = str.end();
|
||||
@ -109,7 +110,8 @@ string escapeChar(char c, XHTMLStream::EscapeSettings e)
|
||||
|
||||
|
||||
// escape what needs escaping
|
||||
string htmlize(string const & str, XHTMLStream::EscapeSettings e) {
|
||||
string htmlize(string const & str, XHTMLStream::EscapeSettings e)
|
||||
{
|
||||
ostringstream d;
|
||||
string::const_iterator it = str.begin();
|
||||
string::const_iterator en = str.end();
|
||||
@ -915,10 +917,10 @@ ParagraphList::const_iterator makeEnvironmentHtml(Buffer const & buf,
|
||||
|
||||
|
||||
void makeCommand(Buffer const & buf,
|
||||
XHTMLStream & xs,
|
||||
OutputParams const & runparams,
|
||||
Text const & text,
|
||||
ParagraphList::const_iterator const & pbegin)
|
||||
XHTMLStream & xs,
|
||||
OutputParams const & runparams,
|
||||
Text const & text,
|
||||
ParagraphList::const_iterator const & pbegin)
|
||||
{
|
||||
Layout const & style = pbegin->layout();
|
||||
if (!style.counter.empty())
|
||||
@ -1020,7 +1022,8 @@ void xhtmlParagraphs(Text const & text,
|
||||
}
|
||||
|
||||
|
||||
string alignmentToCSS(LyXAlignment align) {
|
||||
string alignmentToCSS(LyXAlignment align)
|
||||
{
|
||||
switch (align) {
|
||||
case LYX_ALIGN_BLOCK:
|
||||
// we are NOT going to use text-align: justify!!
|
||||
|
@ -54,6 +54,7 @@ namespace lyx {
|
||||
using frontend::Painter;
|
||||
using frontend::FontMetrics;
|
||||
|
||||
|
||||
RowPainter::RowPainter(PainterInfo & pi,
|
||||
Text const & text, pit_type pit, Row const & row, Bidi & bidi, int x, int y)
|
||||
: pi_(pi), text_(text),
|
||||
@ -693,6 +694,7 @@ void RowPainter::paintTopLevelLabel()
|
||||
pi_.pain.text(int(x), yo_ - maxdesc - labeladdon, str, font);
|
||||
}
|
||||
|
||||
|
||||
/** Check if the current paragraph is the last paragraph in a
|
||||
proof environment */
|
||||
static int getEndLabel(pit_type p, Text const & text)
|
||||
|
Loading…
Reference in New Issue
Block a user