mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Loop refactoring
This commit is contained in:
parent
6b86a5a395
commit
7d38a4d126
@ -31,8 +31,8 @@ static int computeHash(docstring const & name,
|
|||||||
string const full_author_string = to_utf8(name + email);
|
string const full_author_string = to_utf8(name + email);
|
||||||
// Bernstein's hash function
|
// Bernstein's hash function
|
||||||
unsigned int hash = 5381;
|
unsigned int hash = 5381;
|
||||||
for (unsigned int i = 0; i < full_author_string.length(); ++i)
|
for (char c : full_author_string)
|
||||||
hash = ((hash << 5) + hash) + (unsigned int)(full_author_string[i]);
|
hash = ((hash << 5) + hash) + (unsigned int)c;
|
||||||
return int(hash);
|
return int(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1903,9 +1903,9 @@ Buffer::ExportStatus Buffer::writeLaTeXSource(otexstream & os,
|
|||||||
docstring uncodable_glyphs;
|
docstring uncodable_glyphs;
|
||||||
Encoding const * const enc = runparams.encoding;
|
Encoding const * const enc = runparams.encoding;
|
||||||
if (enc) {
|
if (enc) {
|
||||||
for (size_t n = 0; n < inputpath.size(); ++n) {
|
for (char_type n : inputpath) {
|
||||||
if (!enc->encodable(inputpath[n])) {
|
if (!enc->encodable(n)) {
|
||||||
docstring const glyph(1, inputpath[n]);
|
docstring const glyph(1, n);
|
||||||
LYXERR0("Uncodable character '"
|
LYXERR0("Uncodable character '"
|
||||||
<< glyph
|
<< glyph
|
||||||
<< "' in input path!");
|
<< "' in input path!");
|
||||||
|
@ -1741,8 +1741,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
|
|||||||
docstring options_encodable;
|
docstring options_encodable;
|
||||||
Encoding const * const enc = features.runparams().encoding;
|
Encoding const * const enc = features.runparams().encoding;
|
||||||
if (enc) {
|
if (enc) {
|
||||||
for (size_t n = 0; n < strOptions.size(); ++n) {
|
for (char_type c : strOptions) {
|
||||||
char_type c = strOptions[n];
|
|
||||||
if (!enc->encodable(c)) {
|
if (!enc->encodable(c)) {
|
||||||
docstring const glyph(1, c);
|
docstring const glyph(1, c);
|
||||||
LYXERR0("Uncodable character '"
|
LYXERR0("Uncodable character '"
|
||||||
@ -2184,8 +2183,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
|
|||||||
docstring uncodable_glyphs;
|
docstring uncodable_glyphs;
|
||||||
Encoding const * const enc = features.runparams().encoding;
|
Encoding const * const enc = features.runparams().encoding;
|
||||||
if (enc) {
|
if (enc) {
|
||||||
for (size_t n = 0; n < preamble.size(); ++n) {
|
for (char_type c : preamble) {
|
||||||
char_type c = preamble[n];
|
|
||||||
if (!enc->encodable(c)) {
|
if (!enc->encodable(c)) {
|
||||||
docstring const glyph(1, c);
|
docstring const glyph(1, c);
|
||||||
LYXERR0("Uncodable character '"
|
LYXERR0("Uncodable character '"
|
||||||
|
@ -228,8 +228,7 @@ pair<docstring, docstring> Encoding::latexString(docstring const & input, bool d
|
|||||||
docstring result;
|
docstring result;
|
||||||
docstring uncodable;
|
docstring uncodable;
|
||||||
bool terminate = false;
|
bool terminate = false;
|
||||||
for (size_t n = 0; n < input.size(); ++n) {
|
for (char_type const c : input) {
|
||||||
char_type const c = input[n];
|
|
||||||
try {
|
try {
|
||||||
pair<docstring, bool> latex_char = latexChar(c);
|
pair<docstring, bool> latex_char = latexChar(c);
|
||||||
docstring const latex = latex_char.first;
|
docstring const latex = latex_char.first;
|
||||||
@ -252,10 +251,10 @@ pair<docstring, docstring> Encoding::latexString(docstring const & input, bool d
|
|||||||
if (dryrun) {
|
if (dryrun) {
|
||||||
result += "<" + _("LyX Warning: ")
|
result += "<" + _("LyX Warning: ")
|
||||||
+ _("uncodable character") + " '";
|
+ _("uncodable character") + " '";
|
||||||
result += docstring(1, input[n]);
|
result += docstring(1, c);
|
||||||
result += "'>";
|
result += "'>";
|
||||||
} else
|
} else
|
||||||
uncodable += input[n];
|
uncodable += c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return make_pair(result, uncodable);
|
return make_pair(result, uncodable);
|
||||||
@ -733,14 +732,14 @@ void Encodings::read(FileName const & encfile, FileName const & symbolsfile)
|
|||||||
} else if (prefixIs(flag, "force=")) {
|
} else if (prefixIs(flag, "force=")) {
|
||||||
vector<string> encs =
|
vector<string> encs =
|
||||||
getVectorFromString(flag.substr(6), ";");
|
getVectorFromString(flag.substr(6), ";");
|
||||||
for (size_t i = 0; i < encs.size(); ++i)
|
for (auto const & enc : encs)
|
||||||
forcedselected[encs[i]].insert(symbol);
|
forcedselected[enc].insert(symbol);
|
||||||
flags |= CharInfoForceSelected;
|
flags |= CharInfoForceSelected;
|
||||||
} else if (prefixIs(flag, "force!=")) {
|
} else if (prefixIs(flag, "force!=")) {
|
||||||
vector<string> encs =
|
vector<string> encs =
|
||||||
getVectorFromString(flag.substr(7), ";");
|
getVectorFromString(flag.substr(7), ";");
|
||||||
for (size_t i = 0; i < encs.size(); ++i)
|
for (auto const & enc : encs)
|
||||||
forcednotselected[encs[i]].insert(symbol);
|
forcednotselected[enc].insert(symbol);
|
||||||
flags |= CharInfoForceSelected;
|
flags |= CharInfoForceSelected;
|
||||||
} else if (flag == "mathalpha") {
|
} else if (flag == "mathalpha") {
|
||||||
mathalpha.insert(symbol);
|
mathalpha.insert(symbol);
|
||||||
|
@ -1163,10 +1163,6 @@ char const * bibliofeatures[] = {
|
|||||||
"named"
|
"named"
|
||||||
};
|
};
|
||||||
|
|
||||||
int const nb_bibliofeatures = sizeof(bibliofeatures) / sizeof(char const *);
|
|
||||||
|
|
||||||
int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *);
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
@ -1258,9 +1254,9 @@ string const LaTeXFeatures::getPackages() const
|
|||||||
|
|
||||||
// These are all the 'simple' includes. i.e
|
// These are all the 'simple' includes. i.e
|
||||||
// packages which we just \usepackage{package}
|
// packages which we just \usepackage{package}
|
||||||
for (int i = 0; i < nb_simplefeatures; ++i) {
|
for (char const * feature : simplefeatures) {
|
||||||
if (mustProvide(simplefeatures[i]))
|
if (mustProvide(feature))
|
||||||
packages << "\\usepackage{" << simplefeatures[i] << "}\n";
|
packages << "\\usepackage{" << feature << "}\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// The rest of these packages are somewhat more complicated
|
// The rest of these packages are somewhat more complicated
|
||||||
@ -1420,10 +1416,9 @@ string const LaTeXFeatures::getPackages() const
|
|||||||
packages << "\\usepackage{esint}\n";
|
packages << "\\usepackage{esint}\n";
|
||||||
|
|
||||||
// Known bibliography packages (simple \usepackage{package})
|
// Known bibliography packages (simple \usepackage{package})
|
||||||
for (int i = 0; i < nb_bibliofeatures; ++i) {
|
for (char const * feature : bibliofeatures) {
|
||||||
if (mustProvide(bibliofeatures[i]))
|
if (mustProvide(feature))
|
||||||
packages << "\\usepackage{"
|
packages << "\\usepackage{" << feature << "}\n";
|
||||||
<< bibliofeatures[i] << "}\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compatibility between achicago and natbib
|
// Compatibility between achicago and natbib
|
||||||
@ -1944,8 +1939,8 @@ docstring const getFloatI18nPreamble(docstring const & type,
|
|||||||
{
|
{
|
||||||
// Check whether name can be encoded in the buffer encoding
|
// Check whether name can be encoded in the buffer encoding
|
||||||
bool encodable = true;
|
bool encodable = true;
|
||||||
for (size_t i = 0; i < name.size(); ++i) {
|
for (char_type c : name) {
|
||||||
if (!enc.encodable(name[i])) {
|
if (!enc.encodable(c)) {
|
||||||
encodable = false;
|
encodable = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -57,8 +57,8 @@ bool LaTeXFont::available(bool ot1, bool nomath)
|
|||||||
&& LaTeXFeatures::isAvailable(to_ascii(package_)))
|
&& LaTeXFeatures::isAvailable(to_ascii(package_)))
|
||||||
return true;
|
return true;
|
||||||
else if (!altfonts_.empty()) {
|
else if (!altfonts_.empty()) {
|
||||||
for (size_t i = 0; i < altfonts_.size(); ++i) {
|
for (auto const & name : altfonts_) {
|
||||||
if (altFont(altfonts_[i]).available(ot1, nomath))
|
if (altFont(name).available(ot1, nomath))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -163,8 +163,8 @@ bool LaTeXFont::provides(std::string const & name, bool ot1, bool complete, bool
|
|||||||
else if (provides_.empty())
|
else if (provides_.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (size_t i = 0; i < provides_.size(); ++i) {
|
for (auto const & provide : provides_) {
|
||||||
if (provides_[i] == name)
|
if (provide == name)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -200,8 +200,8 @@ docstring const LaTeXFont::getUsedFont(bool ot1, bool complete, bool nomath, boo
|
|||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
else if (!altfonts_.empty()) {
|
else if (!altfonts_.empty()) {
|
||||||
for (size_t i = 0; i < altfonts_.size(); ++i) {
|
for (auto const & name : altfonts_) {
|
||||||
LaTeXFont altf = altFont(altfonts_[i]);
|
LaTeXFont altf = altFont(name);
|
||||||
if (altf.available(ot1, nomath))
|
if (altf.available(ot1, nomath))
|
||||||
return altf.getUsedFont(ot1, complete, nomath, osf);
|
return altf.getUsedFont(ot1, complete, nomath, osf);
|
||||||
}
|
}
|
||||||
|
@ -159,8 +159,8 @@ void PDFOptions::writeLaTeX(OutputParams & runparams, otexstream & os,
|
|||||||
docstring const hs = from_utf8(hyperset);
|
docstring const hs = from_utf8(hyperset);
|
||||||
bool need_unicode = false;
|
bool need_unicode = false;
|
||||||
if (enc) {
|
if (enc) {
|
||||||
for (size_t n = 0; n < hs.size(); ++n) {
|
for (char_type h : hs) {
|
||||||
if (!enc->encodable(hs[n]))
|
if (!enc->encodable(h))
|
||||||
need_unicode = true;
|
need_unicode = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4368,10 +4368,8 @@ void Paragraph::changeCase(BufferParams const & bparams, pos_type pos,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int erasePos = pos - changes.size();
|
int erasePos = pos - changes.size();
|
||||||
for (size_t i = 0; i < changes.size(); i++) {
|
for (auto const & change : changes) {
|
||||||
insertChar(pos, changes[i].first,
|
insertChar(pos, change.first, change.second, trackChanges);
|
||||||
changes[i].second,
|
|
||||||
trackChanges);
|
|
||||||
if (!eraseChar(erasePos, trackChanges)) {
|
if (!eraseChar(erasePos, trackChanges)) {
|
||||||
++erasePos;
|
++erasePos;
|
||||||
++pos; // advance
|
++pos; // advance
|
||||||
|
@ -144,8 +144,8 @@ void LastOpenedSection::read(istream & is)
|
|||||||
void LastOpenedSection::write(ostream & os) const
|
void LastOpenedSection::write(ostream & os) const
|
||||||
{
|
{
|
||||||
os << '\n' << sec_lastopened << '\n';
|
os << '\n' << sec_lastopened << '\n';
|
||||||
for (size_t i = 0; i < lastopened.size(); ++i)
|
for (auto const & last : lastopened)
|
||||||
os << lastopened[i].active << ", " << lastopened[i].file_name << '\n';
|
os << last.active << ", " << last.file_name << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -158,8 +158,8 @@ void LastOpenedSection::add(FileName const & file, bool active)
|
|||||||
// currently, we even crash in some cases (see #9483).
|
// currently, we even crash in some cases (see #9483).
|
||||||
// FIXME: Add session support for multiple views of
|
// FIXME: Add session support for multiple views of
|
||||||
// the same buffer (split-view etc.).
|
// the same buffer (split-view etc.).
|
||||||
for (size_t i = 0; i < lastopened.size(); ++i) {
|
for (auto const & last : lastopened) {
|
||||||
if (lastopened[i].file_name == file)
|
if (last.file_name == file)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
lastopened.push_back(lof);
|
lastopened.push_back(lof);
|
||||||
|
@ -186,14 +186,14 @@ void Trans::addDeadkey(tex_accent accent, docstring const & keys)
|
|||||||
tmp.accent = accent;
|
tmp.accent = accent;
|
||||||
kmod_list_[accent] = tmp;
|
kmod_list_[accent] = tmp;
|
||||||
|
|
||||||
for (docstring::size_type i = 0; i < keys.length(); ++i) {
|
for (char_type key : keys) {
|
||||||
// FIXME This is a hack.
|
// FIXME This is a hack.
|
||||||
// tmp is no valid UCS4 string, but misused to store the
|
// tmp is no valid UCS4 string, but misused to store the
|
||||||
// accent.
|
// accent.
|
||||||
docstring tmpd;
|
docstring tmpd;
|
||||||
tmpd += char_type(0);
|
tmpd += char_type(0);
|
||||||
tmpd += char_type(accent);
|
tmpd += char_type(accent);
|
||||||
keymap_[keys[i]] = tmpd;
|
keymap_[key] = tmpd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,11 +81,7 @@ class ButtonController::Private
|
|||||||
public:
|
public:
|
||||||
typedef QList<CheckedLineEdit> CheckedWidgetList;
|
typedef QList<CheckedLineEdit> CheckedWidgetList;
|
||||||
|
|
||||||
Private()
|
Private() {}
|
||||||
: okay_(nullptr), apply_(nullptr), cancel_(nullptr),
|
|
||||||
restore_(nullptr), auto_apply_(nullptr), default_(nullptr),
|
|
||||||
policy_(ButtonPolicy::IgnorantPolicy)
|
|
||||||
{}
|
|
||||||
|
|
||||||
/// \return true if all CheckedWidgets are in a valid state.
|
/// \return true if all CheckedWidgets are in a valid state.
|
||||||
bool checkWidgets() const
|
bool checkWidgets() const
|
||||||
@ -99,17 +95,17 @@ public:
|
|||||||
public:
|
public:
|
||||||
CheckedWidgetList checked_widgets_;
|
CheckedWidgetList checked_widgets_;
|
||||||
|
|
||||||
QPushButton * okay_;
|
QPushButton * okay_ = nullptr;
|
||||||
QPushButton * apply_;
|
QPushButton * apply_ = nullptr;
|
||||||
QPushButton * cancel_;
|
QPushButton * cancel_ = nullptr;
|
||||||
QPushButton * restore_;
|
QPushButton * restore_ = nullptr;
|
||||||
QCheckBox * auto_apply_;
|
QCheckBox * auto_apply_ = nullptr;
|
||||||
QPushButton * default_;
|
QPushButton * default_ = nullptr;
|
||||||
|
|
||||||
typedef QList<QWidget *> Widgets;
|
typedef QList<QWidget *> Widgets;
|
||||||
Widgets read_only_;
|
Widgets read_only_;
|
||||||
|
|
||||||
ButtonPolicy policy_;
|
ButtonPolicy policy_ {ButtonPolicy::IgnorantPolicy};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,10 +49,6 @@ Dialog::Dialog(GuiView & lv, QString const & name, QString const & title)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Dialog::~Dialog()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
bool Dialog::canApply() const
|
bool Dialog::canApply() const
|
||||||
{
|
{
|
||||||
FuncRequest const fr(getLfun(), fromqstr(name_));
|
FuncRequest const fr(getLfun(), fromqstr(name_));
|
||||||
|
@ -56,7 +56,7 @@ public:
|
|||||||
/// \param title is the window title used for decoration.
|
/// \param title is the window title used for decoration.
|
||||||
Dialog(GuiView & lv, QString const & name, QString const & title);
|
Dialog(GuiView & lv, QString const & name, QString const & title);
|
||||||
|
|
||||||
virtual ~Dialog();
|
virtual ~Dialog() {}
|
||||||
|
|
||||||
virtual QWidget * asQWidget() = 0;
|
virtual QWidget * asQWidget() = 0;
|
||||||
virtual QWidget const * asQWidget() const = 0;
|
virtual QWidget const * asQWidget() const = 0;
|
||||||
|
@ -123,10 +123,6 @@ void FancyLineEdit::checkButtons(const QString &text)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FancyLineEdit::~FancyLineEdit()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void FancyLineEdit::setButtonVisible(Side side, bool visible)
|
void FancyLineEdit::setButtonVisible(Side side, bool visible)
|
||||||
{
|
{
|
||||||
m_d->m_iconbutton[side]->setVisible(visible);
|
m_d->m_iconbutton[side]->setVisible(visible);
|
||||||
|
@ -69,7 +69,7 @@ Q_SIGNALS:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FancyLineEdit(QWidget *parent = 0);
|
explicit FancyLineEdit(QWidget *parent = 0);
|
||||||
~FancyLineEdit();
|
~FancyLineEdit() {}
|
||||||
|
|
||||||
QPixmap buttonPixmap(Side side) const;
|
QPixmap buttonPixmap(Side side) const;
|
||||||
void setButtonPixmap(Side side, const QPixmap &pixmap);
|
void setButtonPixmap(Side side, const QPixmap &pixmap);
|
||||||
|
@ -2645,8 +2645,8 @@ void GuiApplication::restoreGuiSession()
|
|||||||
// do not add to the lastfile list since these files are restored from
|
// do not add to the lastfile list since these files are restored from
|
||||||
// last session, and should be already there (regular files), or should
|
// last session, and should be already there (regular files), or should
|
||||||
// not be added at all (help files).
|
// not be added at all (help files).
|
||||||
for (size_t i = 0; i < lastopened.size(); ++i) {
|
for (auto const & last : lastopened) {
|
||||||
FileName const & file_name = lastopened[i].file_name;
|
FileName const & file_name = last.file_name;
|
||||||
if (!current_view_ || (!lyxrc.open_buffers_in_tabs
|
if (!current_view_ || (!lyxrc.open_buffers_in_tabs
|
||||||
&& current_view_->documentBufferView() != 0)) {
|
&& current_view_->documentBufferView() != 0)) {
|
||||||
boost::crc_32_type crc;
|
boost::crc_32_type crc;
|
||||||
@ -2656,7 +2656,7 @@ void GuiApplication::restoreGuiSession()
|
|||||||
}
|
}
|
||||||
current_view_->loadDocument(file_name, false);
|
current_view_->loadDocument(file_name, false);
|
||||||
|
|
||||||
if (lastopened[i].active)
|
if (last.active)
|
||||||
active_file = file_name;
|
active_file = file_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -706,8 +706,7 @@ void GuiCitation::setPreTexts(vector<docstring> const & m)
|
|||||||
selected_model_.match(selected_model_.index(0, 1),
|
selected_model_.match(selected_model_.index(0, 1),
|
||||||
Qt::DisplayRole, toqstr(key), -1,
|
Qt::DisplayRole, toqstr(key), -1,
|
||||||
Qt::MatchFlags(Qt::MatchExactly | Qt::MatchWrap));
|
Qt::MatchFlags(Qt::MatchExactly | Qt::MatchWrap));
|
||||||
for (int i = 0; i < qmil.size(); ++i){
|
for (auto const & idx : qmil) {
|
||||||
QModelIndex idx = qmil[i];
|
|
||||||
if (!handled.contains(idx)) {
|
if (!handled.contains(idx)) {
|
||||||
selected_model_.setItem(idx.row(), 0, si);
|
selected_model_.setItem(idx.row(), 0, si);
|
||||||
handled.append(idx);
|
handled.append(idx);
|
||||||
@ -745,8 +744,7 @@ void GuiCitation::setPostTexts(vector<docstring> const & m)
|
|||||||
selected_model_.match(selected_model_.index(0, 1),
|
selected_model_.match(selected_model_.index(0, 1),
|
||||||
Qt::DisplayRole, toqstr(key), -1,
|
Qt::DisplayRole, toqstr(key), -1,
|
||||||
Qt::MatchFlags(Qt::MatchExactly | Qt::MatchWrap));
|
Qt::MatchFlags(Qt::MatchExactly | Qt::MatchWrap));
|
||||||
for (int i = 0; i < qmil.size(); ++i){
|
for (auto const & idx : qmil) {
|
||||||
QModelIndex idx = qmil[i];
|
|
||||||
if (!handled.contains(idx)) {
|
if (!handled.contains(idx)) {
|
||||||
selected_model_.setItem(idx.row(), 2, si);
|
selected_model_.setItem(idx.row(), 2, si);
|
||||||
handled.append(idx);
|
handled.append(idx);
|
||||||
|
@ -2623,10 +2623,10 @@ void GuiDocument::updateFontlist()
|
|||||||
|
|
||||||
QFontDatabase fontdb;
|
QFontDatabase fontdb;
|
||||||
QStringList families(fontdb.families());
|
QStringList families(fontdb.families());
|
||||||
for (QStringList::Iterator it = families.begin(); it != families.end(); ++it) {
|
for (auto const & family : families) {
|
||||||
fontModule->fontsRomanCO->addItem(*it, *it);
|
fontModule->fontsRomanCO->addItem(family, family);
|
||||||
fontModule->fontsSansCO->addItem(*it, *it);
|
fontModule->fontsSansCO->addItem(family, family);
|
||||||
fontModule->fontsTypewriterCO->addItem(*it, *it);
|
fontModule->fontsTypewriterCO->addItem(family, family);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2754,9 +2754,9 @@ void GuiDocument::updatePagestyle(string const & items, string const & sel)
|
|||||||
|
|
||||||
int nn = 0;
|
int nn = 0;
|
||||||
|
|
||||||
for (size_t i = 0; i < pagestyles.size(); ++i)
|
for (auto const & pagestyle : pagestyles)
|
||||||
if (pagestyles[i].first == sel)
|
if (pagestyle.first == sel)
|
||||||
nn = pageLayoutModule->pagestyleCO->findText(pagestyles[i].second);
|
nn = pageLayoutModule->pagestyleCO->findText(pagestyle.second);
|
||||||
|
|
||||||
if (nn > 0)
|
if (nn > 0)
|
||||||
pageLayoutModule->pagestyleCO->setCurrentIndex(nn);
|
pageLayoutModule->pagestyleCO->setCurrentIndex(nn);
|
||||||
|
@ -463,10 +463,10 @@ void GuiLyXFiles::updateContents()
|
|||||||
QTreeWidgetItem * subcatItem = nullptr;
|
QTreeWidgetItem * subcatItem = nullptr;
|
||||||
if (cats.contains(catsave)) {
|
if (cats.contains(catsave)) {
|
||||||
QList<QTreeWidgetItem *> pcats = filesLW->findItems(cat, Qt::MatchExactly);
|
QList<QTreeWidgetItem *> pcats = filesLW->findItems(cat, Qt::MatchExactly);
|
||||||
for (int iit = 0; iit < pcats.size(); ++iit) {
|
for (auto const & pcat : pcats) {
|
||||||
for (int cit = 0; cit < pcats.at(iit)->childCount(); ++cit) {
|
for (int cit = 0; cit < pcat->childCount(); ++cit) {
|
||||||
if (pcats.at(iit)->child(cit)->text(0) == subcat) {
|
if (pcat->child(cit)->text(0) == subcat) {
|
||||||
subcatItem = pcats.at(iit)->child(cit);
|
subcatItem = pcat->child(cit);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -923,10 +923,10 @@ PrefScreenFonts::PrefScreenFonts(GuiPreferences * form)
|
|||||||
|
|
||||||
QFontDatabase fontdb;
|
QFontDatabase fontdb;
|
||||||
QStringList families(fontdb.families());
|
QStringList families(fontdb.families());
|
||||||
for (QStringList::Iterator it = families.begin(); it != families.end(); ++it) {
|
for (auto const & family : families) {
|
||||||
screenRomanCO->addItem(*it);
|
screenRomanCO->addItem(family);
|
||||||
screenSansCO->addItem(*it);
|
screenSansCO->addItem(family);
|
||||||
screenTypewriterCO->addItem(*it);
|
screenTypewriterCO->addItem(family);
|
||||||
}
|
}
|
||||||
connect(screenRomanCO, SIGNAL(activated(QString)),
|
connect(screenRomanCO, SIGNAL(activated(QString)),
|
||||||
this, SIGNAL(changed()));
|
this, SIGNAL(changed()));
|
||||||
@ -3039,9 +3039,9 @@ QTreeWidgetItem * PrefShortcuts::insertShortcutItem(FuncRequest const & lfun,
|
|||||||
if (tag == KeyMap::UserUnbind) {
|
if (tag == KeyMap::UserUnbind) {
|
||||||
QList<QTreeWidgetItem*> const items = shortcutsTW->findItems(lfun_name,
|
QList<QTreeWidgetItem*> const items = shortcutsTW->findItems(lfun_name,
|
||||||
Qt::MatchFlags(Qt::MatchExactly | Qt::MatchRecursive), 0);
|
Qt::MatchFlags(Qt::MatchExactly | Qt::MatchRecursive), 0);
|
||||||
for (int i = 0; i < items.size(); ++i) {
|
for (auto const & item : items) {
|
||||||
if (items[i]->text(1) == shortcut) {
|
if (item->text(1) == shortcut) {
|
||||||
newItem = items[i];
|
newItem = item;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3128,8 +3128,7 @@ void PrefShortcuts::unhideEmpty(QString const & lfun, bool select)
|
|||||||
// list of items that match lfun
|
// list of items that match lfun
|
||||||
QList<QTreeWidgetItem*> items = shortcutsTW->findItems(lfun,
|
QList<QTreeWidgetItem*> items = shortcutsTW->findItems(lfun,
|
||||||
Qt::MatchFlags(Qt::MatchExactly | Qt::MatchRecursive), 0);
|
Qt::MatchFlags(Qt::MatchExactly | Qt::MatchRecursive), 0);
|
||||||
for (int i = 0; i < items.size(); ++i) {
|
for (auto const & item : items) {
|
||||||
QTreeWidgetItem * item = items[i];
|
|
||||||
if (isAlwaysHidden(*item)) {
|
if (isAlwaysHidden(*item)) {
|
||||||
setItemType(item, KeyMap::System);
|
setItemType(item, KeyMap::System);
|
||||||
if (select)
|
if (select)
|
||||||
@ -3145,24 +3144,24 @@ void PrefShortcuts::removeShortcut()
|
|||||||
// it seems that only one item can be selected, but I am
|
// it seems that only one item can be selected, but I am
|
||||||
// removing all selected items anyway.
|
// removing all selected items anyway.
|
||||||
QList<QTreeWidgetItem*> items = shortcutsTW->selectedItems();
|
QList<QTreeWidgetItem*> items = shortcutsTW->selectedItems();
|
||||||
for (int i = 0; i < items.size(); ++i) {
|
for (auto & item : items) {
|
||||||
string shortcut = fromqstr(items[i]->data(1, Qt::UserRole).toString());
|
string shortcut = fromqstr(item->data(1, Qt::UserRole).toString());
|
||||||
string lfun = fromqstr(items[i]->text(0));
|
string lfun = fromqstr(item->text(0));
|
||||||
FuncRequest func = lyxaction.lookupFunc(lfun);
|
FuncRequest func = lyxaction.lookupFunc(lfun);
|
||||||
|
|
||||||
switch (itemType(*items[i])) {
|
switch (itemType(*item)) {
|
||||||
case KeyMap::System: {
|
case KeyMap::System: {
|
||||||
// for system bind, we do not touch the item
|
// for system bind, we do not touch the item
|
||||||
// but add an user unbind item
|
// but add an user unbind item
|
||||||
user_unbind_.bind(shortcut, func);
|
user_unbind_.bind(shortcut, func);
|
||||||
setItemType(items[i], KeyMap::UserUnbind);
|
setItemType(item, KeyMap::UserUnbind);
|
||||||
removePB->setText(qt_("Res&tore"));
|
removePB->setText(qt_("Res&tore"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case KeyMap::UserBind: {
|
case KeyMap::UserBind: {
|
||||||
// for user_bind, we remove this bind
|
// for user_bind, we remove this bind
|
||||||
QTreeWidgetItem * parent = items[i]->parent();
|
QTreeWidgetItem * parent = item->parent();
|
||||||
int itemIdx = parent->indexOfChild(items[i]);
|
int itemIdx = parent->indexOfChild(item);
|
||||||
parent->takeChild(itemIdx);
|
parent->takeChild(itemIdx);
|
||||||
if (itemIdx > 0)
|
if (itemIdx > 0)
|
||||||
shortcutsTW->scrollToItem(parent->child(itemIdx - 1));
|
shortcutsTW->scrollToItem(parent->child(itemIdx - 1));
|
||||||
@ -3171,7 +3170,7 @@ void PrefShortcuts::removeShortcut()
|
|||||||
user_bind_.unbind(shortcut, func);
|
user_bind_.unbind(shortcut, func);
|
||||||
// If this user binding hid an empty system binding, unhide the
|
// If this user binding hid an empty system binding, unhide the
|
||||||
// latter and select it.
|
// latter and select it.
|
||||||
unhideEmpty(items[i]->text(0), true);
|
unhideEmpty(item->text(0), true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case KeyMap::UserUnbind: {
|
case KeyMap::UserUnbind: {
|
||||||
@ -3183,15 +3182,15 @@ void PrefShortcuts::removeShortcut()
|
|||||||
if (!validateNewShortcut(func, seq, QString()))
|
if (!validateNewShortcut(func, seq, QString()))
|
||||||
break;
|
break;
|
||||||
user_unbind_.unbind(shortcut, func);
|
user_unbind_.unbind(shortcut, func);
|
||||||
setItemType(items[i], KeyMap::System);
|
setItemType(item, KeyMap::System);
|
||||||
removePB->setText(qt_("Remo&ve"));
|
removePB->setText(qt_("Remo&ve"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case KeyMap::UserExtraUnbind: {
|
case KeyMap::UserExtraUnbind: {
|
||||||
// for user unbind that is not in system bind file,
|
// for user unbind that is not in system bind file,
|
||||||
// remove this unbind file
|
// remove this unbind file
|
||||||
QTreeWidgetItem * parent = items[i]->parent();
|
QTreeWidgetItem * parent = item->parent();
|
||||||
parent->takeChild(parent->indexOfChild(items[i]));
|
parent->takeChild(parent->indexOfChild(item));
|
||||||
user_unbind_.unbind(shortcut, func);
|
user_unbind_.unbind(shortcut, func);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3201,26 +3200,26 @@ void PrefShortcuts::removeShortcut()
|
|||||||
|
|
||||||
void PrefShortcuts::deactivateShortcuts(QList<QTreeWidgetItem*> const & items)
|
void PrefShortcuts::deactivateShortcuts(QList<QTreeWidgetItem*> const & items)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < items.size(); ++i) {
|
for (auto item : items) {
|
||||||
string shortcut = fromqstr(items[i]->data(1, Qt::UserRole).toString());
|
string shortcut = fromqstr(item->data(1, Qt::UserRole).toString());
|
||||||
string lfun = fromqstr(items[i]->text(0));
|
string lfun = fromqstr(item->text(0));
|
||||||
FuncRequest func = lyxaction.lookupFunc(lfun);
|
FuncRequest func = lyxaction.lookupFunc(lfun);
|
||||||
|
|
||||||
switch (itemType(*items[i])) {
|
switch (itemType(*item)) {
|
||||||
case KeyMap::System:
|
case KeyMap::System:
|
||||||
// for system bind, we do not touch the item
|
// for system bind, we do not touch the item
|
||||||
// but add an user unbind item
|
// but add an user unbind item
|
||||||
user_unbind_.bind(shortcut, func);
|
user_unbind_.bind(shortcut, func);
|
||||||
setItemType(items[i], KeyMap::UserUnbind);
|
setItemType(item, KeyMap::UserUnbind);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KeyMap::UserBind: {
|
case KeyMap::UserBind: {
|
||||||
// for user_bind, we remove this bind
|
// for user_bind, we remove this bind
|
||||||
QTreeWidgetItem * parent = items[i]->parent();
|
QTreeWidgetItem * parent = item->parent();
|
||||||
int itemIdx = parent->indexOfChild(items[i]);
|
int itemIdx = parent->indexOfChild(item);
|
||||||
parent->takeChild(itemIdx);
|
parent->takeChild(itemIdx);
|
||||||
user_bind_.unbind(shortcut, func);
|
user_bind_.unbind(shortcut, func);
|
||||||
unhideEmpty(items[i]->text(0), false);
|
unhideEmpty(item->text(0), false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -3287,11 +3286,11 @@ void PrefShortcuts::on_searchLE_textEdited()
|
|||||||
while (*it)
|
while (*it)
|
||||||
(*it++)->setHidden(true);
|
(*it++)->setHidden(true);
|
||||||
// show matched items
|
// show matched items
|
||||||
for (int i = 0; i < matched.size(); ++i)
|
for (auto & item : matched)
|
||||||
if (!isAlwaysHidden(*matched[i])) {
|
if (!isAlwaysHidden(*item)) {
|
||||||
matched[i]->setHidden(false);
|
item->setHidden(false);
|
||||||
if (matched[i]->parent())
|
if (item->parent())
|
||||||
matched[i]->parent()->setExpanded(true);
|
item->parent()->setExpanded(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,8 +276,8 @@ void StaticMenuButton::updateTriggered()
|
|||||||
|
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
QList<QAction *> acts = menu()->actions();
|
QList<QAction *> acts = menu()->actions();
|
||||||
for (int i = 0; i < acts.size(); ++i)
|
for (auto const & act : acts)
|
||||||
if (acts[i]->isEnabled()) {
|
if (act->isEnabled()) {
|
||||||
enabled = true;
|
enabled = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -561,8 +561,8 @@ void GuiToolbar::update(int context)
|
|||||||
|
|
||||||
// This is a speed bottleneck because this is called on every keypress
|
// This is a speed bottleneck because this is called on every keypress
|
||||||
// and update calls getStatus, which copies the cursor at least two times
|
// and update calls getStatus, which copies the cursor at least two times
|
||||||
for (int i = 0; i < actions_.size(); ++i)
|
for (auto const & action : actions_)
|
||||||
actions_[i]->update();
|
action->update();
|
||||||
|
|
||||||
LayoutBox * layout = owner_.getLayoutDialog();
|
LayoutBox * layout = owner_.getLayoutDialog();
|
||||||
if (layout)
|
if (layout)
|
||||||
|
@ -204,9 +204,9 @@ docstring InsetParamsDialog::checkWidgets(bool immediate)
|
|||||||
immediateApplyCB->setEnabled(ins && !read_only);
|
immediateApplyCB->setEnabled(ins && !read_only);
|
||||||
// This seems to be the only way to access custom buttons
|
// This seems to be the only way to access custom buttons
|
||||||
QList<QAbstractButton*> buttons = buttonBox->buttons();
|
QList<QAbstractButton*> buttons = buttonBox->buttons();
|
||||||
for (int i = 0; i < buttons.size(); ++i) {
|
for (auto & button : buttons) {
|
||||||
if (buttonBox->buttonRole(buttons.at(i)) == QDialogButtonBox::ActionRole)
|
if (buttonBox->buttonRole(button) == QDialogButtonBox::ActionRole)
|
||||||
buttons.at(i)->setEnabled(widget_ok && !read_only
|
button->setEnabled(widget_ok && !read_only
|
||||||
&& valid_argument
|
&& valid_argument
|
||||||
&& newInsetAllowed());
|
&& newInsetAllowed());
|
||||||
}
|
}
|
||||||
|
@ -712,8 +712,8 @@ void MenuDefinition::read(Lexer & lex)
|
|||||||
|
|
||||||
bool MenuDefinition::hasFunc(FuncRequest const & func) const
|
bool MenuDefinition::hasFunc(FuncRequest const & func) const
|
||||||
{
|
{
|
||||||
for (const_iterator it = begin(), et = end(); it != et; ++it)
|
for (auto const & it : *this)
|
||||||
if (*it->func() == func)
|
if (*it.func() == func)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -501,8 +501,7 @@ docstring InsetCommandParams::prepareCommand(OutputParams const & runparams,
|
|||||||
// we can only output characters covered by the current
|
// we can only output characters covered by the current
|
||||||
// encoding!
|
// encoding!
|
||||||
docstring uncodable;
|
docstring uncodable;
|
||||||
for (size_type i = 0 ; i < command.size() ; ++i) {
|
for (char_type c : command) {
|
||||||
char_type c = command[i];
|
|
||||||
try {
|
try {
|
||||||
if (runparams.encoding->encodable(c))
|
if (runparams.encoding->encodable(c))
|
||||||
result += c;
|
result += c;
|
||||||
|
@ -883,8 +883,7 @@ void InsetGraphics::latex(otexstream & os,
|
|||||||
// encoding!
|
// encoding!
|
||||||
docstring uncodable;
|
docstring uncodable;
|
||||||
docstring encodable_file_path;
|
docstring encodable_file_path;
|
||||||
for (size_type i = 0 ; i < file_path.size() ; ++i) {
|
for (char_type c : file_path) {
|
||||||
char_type c = file_path[i];
|
|
||||||
try {
|
try {
|
||||||
if (runparams.encoding->encodable(c))
|
if (runparams.encoding->encodable(c))
|
||||||
encodable_file_path += c;
|
encodable_file_path += c;
|
||||||
|
@ -819,8 +819,7 @@ void InsetInfo::updateBuffer(ParIterator const & it, UpdateType utype, bool cons
|
|||||||
string const lcode = params_.lang->code();
|
string const lcode = params_.lang->code();
|
||||||
docstring trans;
|
docstring trans;
|
||||||
bool is_translated = sequence != seq_untranslated;
|
bool is_translated = sequence != seq_untranslated;
|
||||||
for (size_t n = 0; n < sequence.size(); ++n) {
|
for (char_type const c : sequence) {
|
||||||
char_type const c = sequence[n];
|
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case 0x21b5://Return
|
case 0x21b5://Return
|
||||||
gui = _("Return[[Key]]");
|
gui = _("Return[[Key]]");
|
||||||
|
@ -232,8 +232,8 @@ docstring ListingsParam::validate(string const & par) const
|
|||||||
return bformat(_("Please specify one or more of '%1$s'."),
|
return bformat(_("Please specify one or more of '%1$s'."),
|
||||||
from_utf8(info_));
|
from_utf8(info_));
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < par2.size(); ++i)
|
for (char c : par2)
|
||||||
if (info_.find(par2[i], 0) == string::npos)
|
if (info_.find(c, 0) == string::npos)
|
||||||
return bformat(_("Should be composed of one or more of %1$s."),
|
return bformat(_("Should be composed of one or more of %1$s."),
|
||||||
from_utf8(info_));
|
from_utf8(info_));
|
||||||
if (unclosed)
|
if (unclosed)
|
||||||
@ -1073,8 +1073,8 @@ void InsetListingsParams::addParam(string const & key,
|
|||||||
// non-ascii/number characters, just to be safe
|
// non-ascii/number characters, just to be safe
|
||||||
else {
|
else {
|
||||||
bool has_special_char = false;
|
bool has_special_char = false;
|
||||||
for (size_t i = 0; i < value.size(); ++i)
|
for (char c : value)
|
||||||
if (!isAlnumASCII(value[i])) {
|
if (!isAlnumASCII(c)) {
|
||||||
has_special_char = true;
|
has_special_char = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1283,8 +1283,8 @@ static void buildaccent(string n, string param, string values)
|
|||||||
const char delim = '|';
|
const char delim = '|';
|
||||||
while (getline(s, name, delim)) {
|
while (getline(s, name, delim)) {
|
||||||
size_t start = 0;
|
size_t start = 0;
|
||||||
for (size_t i = 0; i < param.size(); i++) {
|
for (char c : param) {
|
||||||
string key = name + "{" + param[i] + "}";
|
string key = name + "{" + c + "}";
|
||||||
// get the corresponding utf8-value
|
// get the corresponding utf8-value
|
||||||
if ((values[start] & 0xc0) != 0xc0) {
|
if ((values[start] & 0xc0) != 0xc0) {
|
||||||
// should not happen, utf8 encoding starts at least with 11xxxxxx
|
// should not happen, utf8 encoding starts at least with 11xxxxxx
|
||||||
|
@ -281,9 +281,9 @@ void InsetMathGrid::setHorizontalAlignments(docstring const & hh)
|
|||||||
InsetMathGrid::col_type InsetMathGrid::guessColumns(docstring const & hh)
|
InsetMathGrid::col_type InsetMathGrid::guessColumns(docstring const & hh)
|
||||||
{
|
{
|
||||||
col_type col = 0;
|
col_type col = 0;
|
||||||
for (docstring::const_iterator it = hh.begin(); it != hh.end(); ++it)
|
for (char_type const c : hh)
|
||||||
if (*it == 'c' || *it == 'l' || *it == 'r'||
|
if (c == 'c' || c == 'l' || c == 'r'||
|
||||||
*it == 'p' || *it == 'm' || *it == 'b')
|
c == 'p' || c == 'm' || c == 'b')
|
||||||
++col;
|
++col;
|
||||||
// let's have at least one column, even if we did not recognize its
|
// let's have at least one column, even if we did not recognize its
|
||||||
// alignment
|
// alignment
|
||||||
|
@ -228,8 +228,8 @@ InsetMathHull::InsetMathHull(InsetMathHull const & other) : InsetMathGrid(other)
|
|||||||
|
|
||||||
InsetMathHull::~InsetMathHull()
|
InsetMathHull::~InsetMathHull()
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < label_.size(); ++i)
|
for (auto & i : label_)
|
||||||
delete label_[i];
|
delete i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -248,8 +248,8 @@ InsetMathHull & InsetMathHull::operator=(InsetMathHull const & other)
|
|||||||
numbered_ = other.numbered_;
|
numbered_ = other.numbered_;
|
||||||
numbers_ = other.numbers_;
|
numbers_ = other.numbers_;
|
||||||
buffer_ = other.buffer_;
|
buffer_ = other.buffer_;
|
||||||
for (size_t i = 0; i < label_.size(); ++i)
|
for (auto & i : label_)
|
||||||
delete label_[i];
|
delete i;
|
||||||
label_ = other.label_;
|
label_ = other.label_;
|
||||||
for (size_t i = 0; i != label_.size(); ++i) {
|
for (size_t i = 0; i != label_.size(); ++i) {
|
||||||
if (label_[i])
|
if (label_[i])
|
||||||
@ -995,8 +995,8 @@ bool InsetMathHull::ams() const
|
|||||||
case hullEqnArray:
|
case hullEqnArray:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
for (size_t row = 0; row < numbered_.size(); ++row)
|
for (auto const & row : numbered_)
|
||||||
if (numbered_[row] == NOTAG)
|
if (row == NOTAG)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -859,10 +859,10 @@ bool InsetMathMacro::validName() const
|
|||||||
|
|
||||||
// valid characters?
|
// valid characters?
|
||||||
if (n.size() > 1) {
|
if (n.size() > 1) {
|
||||||
for (size_t i = 0; i<n.size(); ++i) {
|
for (char_type c : n) {
|
||||||
if (!(n[i] >= 'a' && n[i] <= 'z')
|
if (!(c >= 'a' && c <= 'z')
|
||||||
&& !(n[i] >= 'A' && n[i] <= 'Z')
|
&& !(c >= 'A' && c <= 'Z')
|
||||||
&& n[i] != '*')
|
&& c != '*')
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1293,10 +1293,10 @@ bool InsetMathMacroTemplate::validName() const
|
|||||||
|
|
||||||
// valid characters?
|
// valid characters?
|
||||||
if (n.size() > 1) {
|
if (n.size() > 1) {
|
||||||
for (size_t i = 0; i < n.size(); ++i) {
|
for (char_type c : n) {
|
||||||
if (!(n[i] >= 'a' && n[i] <= 'z')
|
if (!(c >= 'a' && c <= 'z')
|
||||||
&& !(n[i] >= 'A' && n[i] <= 'Z')
|
&& !(c >= 'A' && c <= 'Z')
|
||||||
&& n[i] != '*')
|
&& c != '*')
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -372,9 +372,9 @@ void MathData::drawT(TextPainter & pain, int x, int y) const
|
|||||||
// FIXME: Abdel 16/10/2006
|
// FIXME: Abdel 16/10/2006
|
||||||
// This drawT() method is never used, this is dead code.
|
// This drawT() method is never used, this is dead code.
|
||||||
|
|
||||||
for (const_iterator it = begin(), et = end(); it != et; ++it) {
|
for (auto const & it : *this) {
|
||||||
(*it)->drawT(pain, x, y);
|
it->drawT(pain, x, y);
|
||||||
//x += (*it)->width_;
|
//x += it->width_;
|
||||||
x += 2;
|
x += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1962,8 +1962,8 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
cmd = Encodings::fromLaTeXCommand(cmd,
|
cmd = Encodings::fromLaTeXCommand(cmd,
|
||||||
Encodings::MATH_CMD | Encodings::TEXT_CMD,
|
Encodings::MATH_CMD | Encodings::TEXT_CMD,
|
||||||
termination, rem);
|
termination, rem);
|
||||||
for (size_t i = 0; i < cmd.size(); ++i)
|
for (char_type c : cmd)
|
||||||
cell->push_back(MathAtom(new InsetMathChar(cmd[i])));
|
cell->push_back(MathAtom(new InsetMathChar(c)));
|
||||||
if (!rem.empty()) {
|
if (!rem.empty()) {
|
||||||
char_type c = rem[0];
|
char_type c = rem[0];
|
||||||
cell->push_back(MathAtom(new InsetMathChar(c)));
|
cell->push_back(MathAtom(new InsetMathChar(c)));
|
||||||
|
@ -577,11 +577,9 @@ void mathed_string_dim(FontInfo const & font,
|
|||||||
frontend::FontMetrics const & fm = theFontMetrics(font);
|
frontend::FontMetrics const & fm = theFontMetrics(font);
|
||||||
dim.asc = 0;
|
dim.asc = 0;
|
||||||
dim.des = 0;
|
dim.des = 0;
|
||||||
for (docstring::const_iterator it = s.begin();
|
for (char_type const c : s) {
|
||||||
it != s.end();
|
dim.asc = max(dim.asc, fm.ascent(c));
|
||||||
++it) {
|
dim.des = max(dim.des, fm.descent(c));
|
||||||
dim.asc = max(dim.asc, fm.ascent(*it));
|
|
||||||
dim.des = max(dim.des, fm.descent(*it));
|
|
||||||
}
|
}
|
||||||
dim.wid = fm.width(s);
|
dim.wid = fm.width(s);
|
||||||
}
|
}
|
||||||
|
@ -1197,8 +1197,7 @@ docstring const escape(docstring const & lab)
|
|||||||
char_type hexdigit[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
|
char_type hexdigit[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
|
||||||
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
|
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
|
||||||
docstring enc;
|
docstring enc;
|
||||||
for (size_t i = 0; i < lab.length(); ++i) {
|
for (char_type const c : lab) {
|
||||||
char_type c = lab[i];
|
|
||||||
if (c >= 128 || c == '=' || c == '%' || c == '#' || c == '$'
|
if (c >= 128 || c == '=' || c == '%' || c == '#' || c == '$'
|
||||||
|| c == '}' || c == '{' || c == ']' || c == '[' || c == '&'
|
|| c == '}' || c == '{' || c == ']' || c == '[' || c == '&'
|
||||||
|| c == '\\') {
|
|| c == '\\') {
|
||||||
|
@ -72,8 +72,7 @@ std::string fromqstr(QString const & str)
|
|||||||
QString charFilterRegExp(QString const & filter)
|
QString charFilterRegExp(QString const & filter)
|
||||||
{
|
{
|
||||||
QString re = ".*";
|
QString re = ".*";
|
||||||
for (int i = 0; i < filter.length(); ++i) {
|
for (QChar const & c : filter) {
|
||||||
QChar c = filter[i];
|
|
||||||
if (c.isLower())
|
if (c.isLower())
|
||||||
re += "["+ QRegExp::escape(c) + QRegExp::escape(c.toUpper()) + "]";
|
re += "["+ QRegExp::escape(c) + QRegExp::escape(c.toUpper()) + "]";
|
||||||
else
|
else
|
||||||
@ -85,8 +84,7 @@ QString charFilterRegExp(QString const & filter)
|
|||||||
QString charFilterRegExpC(QString const & filter)
|
QString charFilterRegExpC(QString const & filter)
|
||||||
{
|
{
|
||||||
QString re = "(";
|
QString re = "(";
|
||||||
for (int i = 0; i < filter.length(); ++i) {
|
for (QChar const & c : filter) {
|
||||||
QChar c = filter[i];
|
|
||||||
if (c.isLower())
|
if (c.isLower())
|
||||||
re += "["+ QRegExp::escape(c) + QRegExp::escape(c.toUpper()) + "]";
|
re += "["+ QRegExp::escape(c) + QRegExp::escape(c.toUpper()) + "]";
|
||||||
else
|
else
|
||||||
|
@ -589,8 +589,8 @@ void fix_colalign(vector<ColInfo> & colinfo)
|
|||||||
}
|
}
|
||||||
// Move the lines and alignment settings to the special field if
|
// Move the lines and alignment settings to the special field if
|
||||||
// necessary
|
// necessary
|
||||||
for (size_t col = 0; col < colinfo.size(); ++col)
|
for (auto & col : colinfo)
|
||||||
fix_colalign(colinfo[col]);
|
fix_colalign(col);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -921,16 +921,16 @@ void parse_table(Parser & p, ostream & os, bool is_long_tabular,
|
|||||||
void handle_hline_above(RowInfo & ri, vector<CellInfo> & ci)
|
void handle_hline_above(RowInfo & ri, vector<CellInfo> & ci)
|
||||||
{
|
{
|
||||||
ri.topline = true;
|
ri.topline = true;
|
||||||
for (size_t col = 0; col < ci.size(); ++col)
|
for (auto & col : ci)
|
||||||
ci[col].topline = true;
|
col.topline = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void handle_hline_below(RowInfo & ri, vector<CellInfo> & ci)
|
void handle_hline_below(RowInfo & ri, vector<CellInfo> & ci)
|
||||||
{
|
{
|
||||||
ri.bottomline = true;
|
ri.bottomline = true;
|
||||||
for (size_t col = 0; col < ci.size(); ++col)
|
for (auto & col : ci)
|
||||||
ci[col].bottomline = true;
|
col.bottomline = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1516,8 +1516,8 @@ void handle_tabular(Parser & p, ostream & os, string const & name,
|
|||||||
//cerr << "// output what we have\n";
|
//cerr << "// output what we have\n";
|
||||||
// output what we have
|
// output what we have
|
||||||
size_type cols = colinfo.size();
|
size_type cols = colinfo.size();
|
||||||
for (size_t col = 0; col < colinfo.size(); ++col) {
|
for (auto const & col : colinfo) {
|
||||||
if (colinfo[col].decimal_point != '\0' && colinfo[col].align != 'd')
|
if (col.decimal_point != '\0' && col.align != 'd')
|
||||||
--cols;
|
--cols;
|
||||||
}
|
}
|
||||||
os << "\n<lyxtabular version=\"3\" rows=\"" << rowinfo.size()
|
os << "\n<lyxtabular version=\"3\" rows=\"" << rowinfo.size()
|
||||||
@ -1545,18 +1545,18 @@ void handle_tabular(Parser & p, ostream & os, string const & name,
|
|||||||
os << write_attribute("tabularwidth", tabularwidth) << ">\n";
|
os << write_attribute("tabularwidth", tabularwidth) << ">\n";
|
||||||
|
|
||||||
//cerr << "// after header\n";
|
//cerr << "// after header\n";
|
||||||
for (size_t col = 0; col < colinfo.size(); ++col) {
|
for (auto const & col : colinfo) {
|
||||||
if (colinfo[col].decimal_point != '\0' && colinfo[col].align != 'd')
|
if (col.decimal_point != '\0' && col.align != 'd')
|
||||||
continue;
|
continue;
|
||||||
os << "<column alignment=\""
|
os << "<column alignment=\""
|
||||||
<< verbose_align(colinfo[col].align) << "\"";
|
<< verbose_align(col.align) << "\"";
|
||||||
if (colinfo[col].decimal_point != '\0')
|
if (col.decimal_point != '\0')
|
||||||
os << " decimal_point=\"" << colinfo[col].decimal_point << "\"";
|
os << " decimal_point=\"" << col.decimal_point << "\"";
|
||||||
os << " valignment=\""
|
os << " valignment=\""
|
||||||
<< verbose_valign(colinfo[col].valign) << "\""
|
<< verbose_valign(col.valign) << "\""
|
||||||
<< write_attribute("width", translate_len(colinfo[col].width))
|
<< write_attribute("width", translate_len(col.width))
|
||||||
<< write_attribute("special", colinfo[col].special)
|
<< write_attribute("special", col.special)
|
||||||
<< write_attribute("varwidth", colinfo[col].varwidth)
|
<< write_attribute("varwidth", col.varwidth)
|
||||||
<< ">\n";
|
<< ">\n";
|
||||||
}
|
}
|
||||||
//cerr << "// after cols\n";
|
//cerr << "// after cols\n";
|
||||||
|
@ -927,10 +927,10 @@ bool tex2lyx(idocstream & is, ostream & os, string const & encoding,
|
|||||||
// class may not be known before. It neds to be done before parsing
|
// class may not be known before. It neds to be done before parsing
|
||||||
// body, since otherwise the commands/environments provided by the
|
// body, since otherwise the commands/environments provided by the
|
||||||
// modules would be parsed as ERT.
|
// modules would be parsed as ERT.
|
||||||
for (size_t i = 0; i < preloaded_modules.size(); ++i) {
|
for (auto const & module : preloaded_modules) {
|
||||||
if (!addModule(preloaded_modules[i])) {
|
if (!addModule(module)) {
|
||||||
cerr << "Error: Could not load module \""
|
cerr << "Error: Could not load module \""
|
||||||
<< preloaded_modules[i] << "\"." << endl;
|
<< module << "\"." << endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -695,14 +695,14 @@ string convert_literate_command_inset_arg(string s)
|
|||||||
void output_ert(ostream & os, string const & s, Context & context)
|
void output_ert(ostream & os, string const & s, Context & context)
|
||||||
{
|
{
|
||||||
context.check_layout(os);
|
context.check_layout(os);
|
||||||
for (string::const_iterator it = s.begin(), et = s.end(); it != et; ++it) {
|
for (char const c : s) {
|
||||||
if (*it == '\\')
|
if (c == '\\')
|
||||||
os << "\n\\backslash\n";
|
os << "\n\\backslash\n";
|
||||||
else if (*it == '\n') {
|
else if (c == '\n') {
|
||||||
context.new_paragraph(os);
|
context.new_paragraph(os);
|
||||||
context.check_layout(os);
|
context.check_layout(os);
|
||||||
} else
|
} else
|
||||||
os << *it;
|
os << c;
|
||||||
}
|
}
|
||||||
context.check_end_layout(os);
|
context.check_end_layout(os);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user