From: Lars Gullik Bjønnes Date: Wed, 27 Nov 2002 10:30:28 +0000 (+0000) Subject: the string -> char patch X-Git-Tag: 1.6.10~17889 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=53274e31ec1cc715c0b48921ee67818790c2e99a;p=features.git the string -> char patch git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5725 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index d9b6cbba8b..6ffe902921 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -154,7 +154,7 @@ Painter & BufferView::Pimpl::painter() const void BufferView::Pimpl::buffer(Buffer * b) { lyxerr[Debug::INFO] << "Setting buffer in BufferView (" - << b << ")" << endl; + << b << ')' << endl; if (buffer_) { buffer_->delUser(bv_); @@ -918,11 +918,11 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filen) bool BufferView::Pimpl::dispatch(FuncRequest const & ev) { lyxerr[Debug::ACTION] << "BufferView::Pimpl::Dispatch:" - << " action[" << ev.action <<"]" - << " arg[" << ev.argument << "]" - << " x[" << ev.x << "]" - << " y[" << ev.y << "]" - << " button[" << ev.button() << "]" + << " action[" << ev.action << ']' + << " arg[" << ev.argument << ']' + << " x[" << ev.x << ']' + << " y[" << ev.y << ']' + << " button[" << ev.button() << ']' << endl; // e.g. Qt mouse press when no buffer diff --git a/src/ChangeLog b/src/ChangeLog index d3cb7ce95b..7a4fba5b24 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,15 @@ +2002-11-27 Lars Gullik Bjønnes + + * tabular.C (asciiPrintCell): use string(size, char) instead of + explicit loop. + + * sgml.C (openTag): fix order of arguments to string constructor + (closeTag): ditto + + * lyxfunc.C (dispatch): use boost.format + + * lots of files: change "c" -> 'c' + 2002-11-25 Dekel Tsur * encoding.C: Patch from Isam Bayazidi: Fix Arabic shaping. diff --git a/src/DepTable.C b/src/DepTable.C index dd487fcd39..6ee37d4093 100644 --- a/src/DepTable.C +++ b/src/DepTable.C @@ -225,12 +225,12 @@ void DepTable::write(string const & f) const // CRC value. // The older one is effectively set to 0 upon re-load. lyxerr << "Write dep: " - << cit->first << " " - << cit->second.crc_cur << " " + << cit->first << ' ' + << cit->second.crc_cur << ' ' << cit->second.mtime_cur << endl; } - ofs << cit->first << " " - << cit->second.crc_cur << " " + ofs << cit->first << ' ' + << cit->second.crc_cur << ' ' << cit->second.mtime_cur << endl; } } @@ -247,8 +247,8 @@ void DepTable::read(string const & f) while (ifs >> nome >> di.crc_cur >> di.mtime_cur) { if (lyxerr.debugging(Debug::DEPEND)) { lyxerr << "Read dep: " - << nome << " " - << di.crc_cur << " " + << nome << ' ' + << di.crc_cur << ' ' << di.mtime_cur << endl; } deplist[nome] = di; diff --git a/src/LaTeX.C b/src/LaTeX.C index c1740e1b5f..45355f8fdb 100644 --- a/src/LaTeX.C +++ b/src/LaTeX.C @@ -417,7 +417,7 @@ LaTeX::scanAuxFiles(string const & file) result.push_back(scanAuxFile(file)); for (int i = 1; i < 1000; ++i) { - string file2 = ChangeExtension(file, "") + "." + tostr(i) + string file2 = ChangeExtension(file, "") + '.' + tostr(i) + ".aux"; FileInfo fi(file2); if (!fi.exist()) @@ -473,7 +473,7 @@ void LaTeX::scanAuxFile(string const & file, Aux_Info & aux_info) data = split(data, database, ','); database = ChangeExtension(database, "bib"); lyxerr[Debug::LATEX] << "Bibtex database: `" - << database << "'" << endl; + << database << '\'' << endl; aux_info.databases.insert(database); } } else if (regex_match(STRCONV(token), sub, reg3)) { @@ -482,7 +482,7 @@ void LaTeX::scanAuxFile(string const & file, Aux_Info & aux_info) // pass it to the helper style = ChangeExtension(style, "bst"); lyxerr[Debug::LATEX] << "Bibtex style: `" - << style << "'" << endl; + << style << '\'' << endl; aux_info.styles.insert(style); } else if (regex_match(STRCONV(token), sub, reg4)) { string const file2 = STRCONV(sub.str(1)); @@ -589,7 +589,7 @@ int LaTeX::scanLogFile(TeXErrors & terr) << "We should rerun." << endl; retval |= RERUN; } - } else if (prefixIs(token, "(")) { + } else if (token[0] == '(') { if (contains(token, "Rerun LaTeX") || contains(token, "Rerun to get")) { // Used by natbib diff --git a/src/LaTeXFeatures.C b/src/LaTeXFeatures.C index c6e65beb99..b91ee8cbdb 100644 --- a/src/LaTeXFeatures.C +++ b/src/LaTeXFeatures.C @@ -473,10 +473,10 @@ void LaTeXFeatures::getFloatDefinitions(ostream & os) const string const name = fl.name(); os << "\\floatstyle{" << style << "}\n" << "\\newfloat{" << type << "}{" << placement - << "}{" << ext << "}"; + << "}{" << ext << '}'; if (!within.empty()) - os << "[" << within << "]"; - os << "\n" + os << '[' << within << ']'; + os << '\n' << "\\floatname{" << type << "}{" << name << "}\n"; diff --git a/src/LyXAction.C b/src/LyXAction.C index a7a5e794d5..96fe77c7f2 100644 --- a/src/LyXAction.C +++ b/src/LyXAction.C @@ -534,7 +534,7 @@ string const LyXAction::getActionName(int action) const { FuncRequest ev = retrieveActionArg(action); if (!ev.argument.empty()) - ev.argument.insert(0, " "); + ev.argument.insert(0, 1, ' '); info_map::const_iterator const it = lyx_info_map.find(ev.action); @@ -549,7 +549,7 @@ string const LyXAction::helpText(int pseudoaction) const FuncRequest ev = retrieveActionArg(pseudoaction); string help; - + info_map::const_iterator ici = lyx_info_map.find(ev.action); if (ici != lyx_info_map.end()) { if (lyxerr.debugging(Debug::ACTION)) { diff --git a/src/MenuBackend.C b/src/MenuBackend.C index 4e0f7d4ebd..7d118317f8 100644 --- a/src/MenuBackend.C +++ b/src/MenuBackend.C @@ -379,7 +379,7 @@ void expandFormats(MenuItem::Kind kind, Menu & tomenu, Buffer const * buf) else if ((*fit)->name() == "textparagraph") label = _("Ascii text as paragraphs"); if (!(*fit)->shortcut().empty()) - label += "|" + (*fit)->shortcut(); + label += '|' + (*fit)->shortcut(); int const action2 = lyxaction. getPseudoAction(action, (*fit)->name()); tomenu.add(MenuItem(MenuItem::Command, label, action2)); @@ -443,7 +443,7 @@ void expandToc2(Menu & tomenu, toc::Toc const & toc_list, label += limit_string_length(toc_list[i].str); if (toc_list[i].depth == depth && ++shortcut_count <= 9) { - label += "|" + tostr(shortcut_count); + label += '|' + tostr(shortcut_count); } tomenu.add(MenuItem(MenuItem::Command, label, action)); } diff --git a/src/Spacing.C b/src/Spacing.C index 26ef6edf13..8bc5080f59 100644 --- a/src/Spacing.C +++ b/src/Spacing.C @@ -70,7 +70,7 @@ void Spacing::writeFile(ostream & os, bool para) const os.setf(ios::showpoint|ios::fixed); os.precision(2); os << cmd << spacing_string[getSpace()] - << " " << getValue() << " \n"; + << ' ' << getValue() << " \n"; } else { os << cmd << spacing_string[getSpace()] << " \n"; } @@ -91,7 +91,7 @@ string const Spacing::writeEnvirBegin() const { ostringstream ost; ost << "\\begin{spacing}{" - << getValue() << "}"; + << getValue() << '}'; return STRCONV(ost.str()); } } diff --git a/src/ToolbarDefaults.C b/src/ToolbarDefaults.C index af42a4051a..21c6cf9c94 100644 --- a/src/ToolbarDefaults.C +++ b/src/ToolbarDefaults.C @@ -118,7 +118,7 @@ void ToolbarDefaults::read(LyXLex & lex) string const func = lex.getString(); lyxerr[Debug::PARSER] << "Toolbar::read TO_ADD func: `" - << func << "'" << endl; + << func << '\'' << endl; add(func); } break; diff --git a/src/box.C b/src/box.C index 3a3dc9f2ea..5da0e3f902 100644 --- a/src/box.C +++ b/src/box.C @@ -31,7 +31,7 @@ bool Box::contained(int x, int y) ostream & operator<<(ostream & o, Box const & b) { - return o << "x1,y1: " << b.x1 << "," << b.y1 - << " x2,y2: " << b.x2 << "," << b.y2 + return o << "x1,y1: " << b.x1 << ',' << b.y1 + << " x2,y2: " << b.x2 << ',' << b.y2 << std::endl; } diff --git a/src/buffer.C b/src/buffer.C index 0f54556775..31dd511ea8 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -339,7 +339,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, Paragraph * par) if (token.empty()) continue; lyxerr[Debug::PARSER] << "Handling token: `" - << token << "'" << endl; + << token << '\'' << endl; the_end_read = parseSingleLyXformat2Token(lex, par, first_par, @@ -574,7 +574,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par, if (layout->free_spacing || par->isFreeSpacing()) { if (lex.isOK()) { lex.next(); - string next_token = lex.getString(); + string const next_token = lex.getString(); if (next_token == "\\-") { par->insertChar(pos, '-', font); } else if (next_token == "~") { @@ -957,7 +957,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par, string const s = fmt.str(); #else string const s = _("Unknown token: ") + token - + " " + lex.text() + "\n"; + + ' ' + lex.text() + '\n'; #endif // we can do this here this way because we're actually reading // the buffer and don't care about LyXText right now. @@ -1169,7 +1169,7 @@ bool Buffer::readFile(LyXLex & lex, string const & filename, Paragraph * par) if (token == "\\lyxformat") { // the first token _must_ be... lex.eatLine(); string tmp_format = lex.getString(); - //lyxerr << "LyX Format: `" << tmp_format << "'" << endl; + //lyxerr << "LyX Format: `" << tmp_format << '\'' << endl; // if present remove ".," from string. string::size_type dot = tmp_format.find_first_of(".,"); //lyxerr << " dot found at " << dot << endl; @@ -1201,10 +1201,11 @@ bool Buffer::readFile(LyXLex & lex, string const & filename, Paragraph * par) return false; } command += " -t" - +tostr(LYX_FORMAT)+" " + +tostr(LYX_FORMAT) + ' ' + QuoteName(filename); lyxerr[Debug::INFO] << "Running '" - << command << "'" << endl; + << command << '\'' + << endl; cmd_ret const ret = RunCommand(command); if (ret.first) { Alert::alert(_("ERROR!"), @@ -1525,7 +1526,7 @@ string const Buffer::asciiParagraph(Paragraph const & par, default: { string const parlab = par.params().labelString(); - buffer << parlab << " "; + buffer << parlab << ' '; currlinelen += parlab.length() + 1; } break; @@ -2140,7 +2141,8 @@ void Buffer::makeLaTeXFile(ostream & os, texrow.newline(); lyxerr[Debug::INFO] << "Finished making latex file." << endl; - lyxerr[Debug::INFO] << "Row count was " << texrow.rows()-1 << "." << endl; + lyxerr[Debug::INFO] << "Row count was " << texrow.rows() - 1 + << '.' << endl; // we want this to be true outside previews (for insetexternal) niceFile = true; @@ -2272,7 +2274,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only) sgml::openTag(ofs, 0, false, top_element); else { string top = top_element; - top += " "; + top += ' '; top += params.options; sgml::openTag(ofs, 0, false, top); } @@ -2597,7 +2599,7 @@ void Buffer::simpleLinuxDocOnePar(ostream & os, while (!tag_state.empty() && tag_close) { PAR_TAG k = tag_state.top(); tag_state.pop(); - os << ""; + os << "'; if (tag_close & k) reset(tag_close,k); else @@ -2607,13 +2609,13 @@ void Buffer::simpleLinuxDocOnePar(ostream & os, for(list< PAR_TAG >::const_iterator j = temp.begin(); j != temp.end(); ++j) { tag_state.push(*j); - os << "<" << tag_name(*j) << ">"; + os << '<' << tag_name(*j) << '>'; } for(list< PAR_TAG >::const_iterator j = tag_open.begin(); j != tag_open.end(); ++j) { tag_state.push(*j); - os << "<" << tag_name(*j) << ">"; + os << '<' << tag_name(*j) << '>'; } char c = par->getChar(i); @@ -2656,7 +2658,7 @@ void Buffer::simpleLinuxDocOnePar(ostream & os, } while (!tag_state.empty()) { - os << ""; + os << "'; tag_state.pop(); } @@ -2729,10 +2731,10 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body) string top = top_element; top += " lang=\""; top += params.language->code(); - top += "\""; + top += '"'; if (!params.options.empty()) { - top += " "; + top += ' '; top += params.options; } sgml::openTag(ofs, 0, false, top); @@ -2845,14 +2847,14 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body) if (lyx_code == Inset::LABEL_CODE) { command_name += " id=\""; command_name += (static_cast(inset))->getContents(); - command_name += "\""; + command_name += '"'; desc_on = 3; } } sgml::openTag(ofs, depth + command_depth, false, command_name); - item_name = c_params.empty()?"title":c_params; + item_name = c_params.empty() ? "title" : c_params; sgml::openTag(ofs, depth + 1 + command_depth, false, item_name); break; @@ -2928,7 +2930,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body) break; case LATEX_ITEM_ENVIRONMENT: if (desc_on == 1) break; - end_tag= "para"; + end_tag = "para"; sgml::closeTag(ofs, depth + 1 + command_depth, false, end_tag); break; case LATEX_PARAGRAPH: diff --git a/src/bufferlist.C b/src/bufferlist.C index 8140a88150..1056443336 100644 --- a/src/bufferlist.C +++ b/src/bufferlist.C @@ -336,7 +336,7 @@ void BufferList::emergencyWrite(Buffer * buf) // 2) In HOME directory. string s = AddName(GetEnvPath("HOME"), buf->fileName()); s += ".emergency"; - lyxerr << " " << s << endl; + lyxerr << ' ' << s << endl; if (buf->writeFile(s)) { buf->markClean(); lyxerr << _(" Save seems successful. Phew.") << endl; @@ -350,7 +350,7 @@ void BufferList::emergencyWrite(Buffer * buf) // drive letter on OS/2 s = AddName(MakeAbsPath("/tmp/"), buf->fileName()); s += ".emergency"; - lyxerr << " " << s << endl; + lyxerr << ' ' << s << endl; if (buf->writeFile(s)) { buf->markClean(); lyxerr << _(" Save seems successful. Phew.") << endl; diff --git a/src/bufferview_funcs.C b/src/bufferview_funcs.C index 258613a1fe..bb7678b518 100644 --- a/src/bufferview_funcs.C +++ b/src/bufferview_funcs.C @@ -196,7 +196,7 @@ string const currentState(BufferView * bv) case Spacing::Other: state << _("Other (") << text->cursor.par()->params().spacing().getValue() - << ")"; + << ')'; break; case Spacing::Default: // should never happen, do nothing diff --git a/src/chset.C b/src/chset.C index 20e28319c5..0c9ccd97d8 100644 --- a/src/chset.C +++ b/src/chset.C @@ -66,7 +66,7 @@ bool CharacterSet::loadFile(string const & fname) string const str = STRCONV(sub.str(2)); if (lyxerr.debugging(Debug::KBMAP)) lyxerr << "Chardef: " << n - << " to [" << str << "]" << endl; + << " to [" << str << ']' << endl; map_[str] = n; } } @@ -77,7 +77,7 @@ bool CharacterSet::loadFile(string const & fname) pair const CharacterSet::encodeString(string const & str) const { - lyxerr[Debug::KBMAP] << "Checking if we know [" << str << "]" << endl; + lyxerr[Debug::KBMAP] << "Checking if we know [" << str << ']' << endl; bool ret = false; int val = 0; Cdef::const_iterator cit = map_.find(str); @@ -87,7 +87,7 @@ pair const CharacterSet::encodeString(string const & str) const } lyxerr[Debug::KBMAP] << " " << (ret ? "yes we" : "no we don't") - << " know [" << str << "]" << endl; + << " know [" << str << ']' << endl; return make_pair(ret, val); } diff --git a/src/converter.C b/src/converter.C index 7b37f0a68d..17e07d7d8a 100644 --- a/src/converter.C +++ b/src/converter.C @@ -193,18 +193,18 @@ bool Formats::view(Buffer const * buffer, string const & filename, if (format_name == "dvi" && !lyxrc.view_dvi_paper_option.empty()) { - command += " " + lyxrc.view_dvi_paper_option; + command += ' ' + lyxrc.view_dvi_paper_option; string paper_size = converters.papersize(buffer); if (paper_size == "letter") paper_size = "us"; - command += " " + paper_size; + command += ' ' + paper_size; if (buffer->params.orientation == BufferParams::ORIENTATION_LANDSCAPE) command += 'r'; } if (!contains(command, token_from)) - command += " " + token_from; + command += ' ' + token_from; command = subst(command, token_from, QuoteName(OnlyFilename(filename))); diff --git a/src/counters.C b/src/counters.C index cc5d3328ee..9bad96c367 100644 --- a/src/counters.C +++ b/src/counters.C @@ -261,11 +261,11 @@ string Counters::labelItem(string const & ctr, CounterList::iterator it = counterList.find(ctr); if (it == counterList.end()) { lyxerr << "Counter does not exist." << endl; - return ""; + return string(); } if (!first) { - s << "." << value(ctr); + s << '.' << value(ctr); } else { if (numbertype == "sectioning" || numbertype == "appendix") { if (numbertype == "appendix") { diff --git a/src/debug.C b/src/debug.C index cd9e465649..389efd5a85 100644 --- a/src/debug.C +++ b/src/debug.C @@ -117,7 +117,7 @@ void Debug::showLevel(ostream & o, Debug::type level) << endl; #else o << _("Debugging `") << errorTags[i].name << "' (" - << _(errorTags[i].desc) << ")" + << _(errorTags[i].desc) << ')' << endl; #endif } diff --git a/src/frontends/LyXView.C b/src/frontends/LyXView.C index cc95fc7cf3..d805fee371 100644 --- a/src/frontends/LyXView.C +++ b/src/frontends/LyXView.C @@ -4,7 +4,7 @@ * Licence details can be found in the file COPYING. * * \author Lars Gullik Bjønnes - * \author John Levon + * \author John Levon * * Full author contact details are available in file CREDITS */ @@ -162,7 +162,7 @@ void LyXView::updateWindowTitle() minimize_title = OnlyFilename(cur_title); if (!buffer()->isClean()) { maximize_title += _(" (changed)"); - minimize_title += "*"; + minimize_title += '*'; } if (buffer()->isReadonly()) maximize_title += _(" (read only)"); @@ -181,5 +181,5 @@ void LyXView::dispatch(FuncRequest const & req) // substitute the correct BufferView here FuncRequest r = req; r.setView(view().get()); - getLyXFunc().dispatch(r); + getLyXFunc().dispatch(r); } diff --git a/src/frontends/Painter.h b/src/frontends/Painter.h index 4d287f3b48..eb00a3e195 100644 --- a/src/frontends/Painter.h +++ b/src/frontends/Painter.h @@ -5,7 +5,7 @@ * Licence details can be found in the file COPYING. * * \author unknown - * \author John Levon + * \author John Levon * * Full author contact details are available in file CREDITS */ @@ -64,10 +64,10 @@ public: /// begin painting virtual void start() {} - + /// end painting virtual void end() {} - + /// return the width of the work area in pixels virtual int paperWidth() const = 0; /// return the height of the work area in pixels @@ -102,13 +102,13 @@ public: LColor::color = LColor::foreground, line_style = line_solid, line_width = line_thin) = 0; - + /// draw a filled rectangle virtual Painter & fillRectangle( int x, int y, int w, int h, LColor::color) = 0; - + /// draw a filled (irregular) polygon virtual Painter & fillPolygon( int const * xp, @@ -127,7 +127,7 @@ public: virtual Painter & point( int x, int y, LColor::color = LColor::foreground) = 0; - + /// draw a filled rectangle with the shape of a 3D button virtual Painter & button(int x, int y, int w, int h); @@ -136,7 +136,7 @@ public: virtual Painter & image(int x, int y, int w, int h, grfx::Image const & image) = 0; - + /// draw a string at position x, y (y is the baseline) virtual Painter & text(int x, int y, string const & str, LyXFont const & f) = 0; @@ -172,11 +172,11 @@ public: protected: /// check the font, and if set, draw an underline - void underline(LyXFont const & f, + void underline(LyXFont const & f, int x, int y, int width); - + /// draw a bevelled button border - Painter & buttonFrame(int x, int y, int w, int h); + Painter & buttonFrame(int x, int y, int w, int h); }; #endif // PAINTER_H diff --git a/src/frontends/controllers/ControlExternal.C b/src/frontends/controllers/ControlExternal.C index e66829189f..de11b7d535 100644 --- a/src/frontends/controllers/ControlExternal.C +++ b/src/frontends/controllers/ControlExternal.C @@ -149,7 +149,7 @@ string const ControlExternal::Browse(string const & input) const pattern = "*"; // FIXME: a temporary hack until the FileDialog interface is updated - pattern += "|"; + pattern += '|'; std::pair dir1(N_("Documents|#o#O"), string(lyxrc.document_path)); diff --git a/src/frontends/controllers/ControlMath.C b/src/frontends/controllers/ControlMath.C index 6004d5e1be..9a806dfadd 100644 --- a/src/frontends/controllers/ControlMath.C +++ b/src/frontends/controllers/ControlMath.C @@ -14,7 +14,7 @@ #include "ControlMath.h" #include "ViewBase.h" -#include "debug.h" +#include "debug.h" #include "funcrequest.h" #include "frontends/LyXView.h" @@ -259,7 +259,7 @@ char const * latex_ams_rel[] = { "lessdot", "lll", "lessgtr", "gtreqless", "gtreqqless", "eqcirc", "lesseqgtr", "lesseqqgtr", "doteqdot", "circeq", "triangleq", "thicksim", "risingdotseq", "fallingdotseq", "backsim", "thickapprox", "supseteqq", "Supset", - "backsimeq", "subseteqq", "Subset","sqsupset", "succcurlyeq", "curlyeqsucc", + "backsimeq", "subseteqq", "Subset", "sqsupset", "succcurlyeq", "curlyeqsucc", "sqsubset", "preccurlyeq", "curlyeqprec", "succsim", "succapprox", "vartriangleright", "precsim", "precapprox", "vartriangleleft", "trianglerighteq", "Vdash", "shortmid", "trianglelefteq", "vDash", "Vvdash", "shortparallel", "between", "pitchfork", @@ -271,15 +271,15 @@ int const nr_latex_ams_rel = sizeof(latex_ams_rel) / sizeof(char const *); char const * latex_ams_nrel[] = { "nless", "nleq", "nleqslant", "ngeqslant", "ngeqq", "gneq", - "nleqq", "lneq", "lneqq","gneqq", "gvertneqq", "gnsim", + "nleqq", "lneq", "lneqq", "gneqq", "gvertneqq", "gnsim", "lvertneqq", "lnsim", "lnapprox", "gnapprox", "nsucc", "nsucceq", "nprec", "npreceq", "precnsim","succnsim", "succnapprox", "ncong", "precnapprox", "nsim", "nshortmid", "nshortparallel", "nparallel", "nvDash", - "nmid", "nvdash", "nvDash","nVDash", "ntriangleright", "ntrianglerighteq", + "nmid", "nvdash", "nvDash", "nVDash", "ntriangleright", "ntrianglerighteq", "ntriangleleft", "ntrianglelefteq", "nsubseteq", "nsupseteq", "nsupseteqq", "supsetneq", "subsetneq", "varsubsetneq", "subsetneqq", "varsupsetneq", "supsetneqq", "varsupsetneqq", - "varsubsetneqq", "ngtr", "ngeq","", "", "" + "varsubsetneqq", "ngtr", "ngeq", "", "", "" }; int const nr_latex_ams_nrel = sizeof(latex_ams_nrel) / sizeof(char const *); @@ -298,9 +298,12 @@ char const * latex_ams_ops[] = { int const nr_latex_ams_ops = sizeof(latex_ams_ops) / sizeof(char const *); - + string const find_xpm(string const & name) { +#warning Use a static table for this (Lgb) + // And get O(log n) lookup (Lgb) + string xpm_name = subst(name, ' ', '_'); if (xpm_name == "(") xpm_name = "lparen"; else if (xpm_name == ")") xpm_name = "rparen"; @@ -346,7 +349,7 @@ string const find_xpm(string const & name) else if (xpm_name == "Xi") xpm_name = "xi2"; lyxerr[Debug::GUI] << "Looking for math XPM called \"" - << xpm_name << "\"" << std::endl; - + << xpm_name << '"' << std::endl; + return LibFileSearch("images/math/", xpm_name, "xpm"); } diff --git a/src/frontends/controllers/ControlPrefs.C b/src/frontends/controllers/ControlPrefs.C index 00ea4f672e..499968c329 100644 --- a/src/frontends/controllers/ControlPrefs.C +++ b/src/frontends/controllers/ControlPrefs.C @@ -15,7 +15,7 @@ #endif #include - + #include "ControlPrefs.h" #include "ViewBase.h" @@ -29,10 +29,10 @@ extern string system_lyxdir; extern string user_lyxdir; - + using std::endl; using std::pair; - + ControlPrefs::ControlPrefs(LyXView & lv, Dialogs & d) : ControlDialogBI(lv, d) {} @@ -47,7 +47,7 @@ void ControlPrefs::setParams() void ControlPrefs::apply() { view().apply(); - lyxrc = rc_; + lyxrc = rc_; } @@ -57,19 +57,19 @@ void ControlPrefs::OKButton() lv_.dispatch(FuncRequest(LFUN_SAVEPREFERENCES)); } - + string const ControlPrefs::browsebind(string const & file) { string dir = AddName(system_lyxdir, "bind"); // FIXME: stupid name string name = _("System Bind|#S#s"); pair dir1(name, dir); - + dir = AddName(user_lyxdir, "bind"); // FIXME: stupid name name = _("User Bind|#U#u"); pair dir2(name, dir); - + return browseFile(&lv_, file, _("Choose bind file"), "*.bind", false, dir1, dir2); } @@ -80,32 +80,32 @@ string const ControlPrefs::browseUI(string const & file) // FIXME: stupid name string name = _("Sys UI|#S#s"); pair dir1(name, dir); - + dir = AddName(user_lyxdir, "ui"); // FIXME: stupid name name = _("User UI|#U#u"); pair dir2(name, dir); - + return browseFile(&lv_, file, _("Choose UI file"), "*.ui", false, dir1, dir2); } - + string const ControlPrefs::browsekbmap(string const & file) { string const dir = AddName(system_lyxdir, "kbd"); string const name = _("Key maps|#K#k"); pair dir1(name, dir); - + return browseFile(&lv_, file, _("Choose keyboard map"), "*.kmap", false, dir1); } - + string const ControlPrefs::browsedict(string const & file) { return browseFile(&lv_, file, _("Choose personal dictionary"), "*.ispell"); } - - + + string const ControlPrefs::browse(string const & file, string const & title) { return browseFile(&lv_, file, title, "*", true); @@ -116,14 +116,14 @@ void ControlPrefs::redrawGUI() { // we must be sure to get the new values first lyxrc = rc_; - + lv_.getDialogs().redrawGUI(); } - + void ControlPrefs::setColor(LColor::color col, string const & hex) { - string const s = lcolor.getLyXName(col) + string(" ") + hex; + string const s = lcolor.getLyXName(col) + ' ' + hex; lv_.dispatch(FuncRequest(LFUN_SET_COLOR, s)); } @@ -132,13 +132,13 @@ void ControlPrefs::updateScreenFonts() { // we must be sure to get the new values first lyxrc = rc_; - + lv_.dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE)); } - - + + void ControlPrefs::setConverters(Converters const & conv) -{ +{ converters = conv; converters.update(formats); converters.buildGraph(); diff --git a/src/frontends/controllers/ControlPrint.C b/src/frontends/controllers/ControlPrint.C index 2b151bc4f3..a329ff71db 100644 --- a/src/frontends/controllers/ControlPrint.C +++ b/src/frontends/controllers/ControlPrint.C @@ -133,7 +133,7 @@ void ControlPrint::apply() + tostr(pp.count_copies) + ' '; } - + if (pp.reverse_order) { command += lyxrc.print_reverse_flag + ' '; } @@ -199,17 +199,18 @@ void ControlPrint::apply() // case 1: print to a file command += lyxrc.print_to_file + QuoteName(MakeAbsPath(pp.file_name, path)) - + ' ' + + ' ' + QuoteName(dviname); res = one.startscript(Systemcall::DontWait, command); break; } - lyxerr[Debug::LATEX] << "ControlPrint::apply(): print command = \"" << command << "\"" << endl; + lyxerr[Debug::LATEX] << "ControlPrint::apply(): print command = \"" + << command << '"' << endl; if (res != 0) { Alert::alert(_("Error:"), _("Unable to print"), _("Check that your parameters are correct")); - } + } } diff --git a/src/frontends/controllers/ControlTabularCreate.C b/src/frontends/controllers/ControlTabularCreate.C index 3c6ed9add5..3b35350808 100644 --- a/src/frontends/controllers/ControlTabularCreate.C +++ b/src/frontends/controllers/ControlTabularCreate.C @@ -48,6 +48,6 @@ void ControlTabularCreate::apply() view().apply(); - string const val = tostr(params().first) + " " + tostr(params().second); + string const val = tostr(params().first) + ' ' + tostr(params().second); lyxfunc().dispatch(FuncRequest(LFUN_TABULAR_INSERT, val)); } diff --git a/src/frontends/controllers/biblio.C b/src/frontends/controllers/biblio.C index d5ebf67a96..822c926380 100644 --- a/src/frontends/controllers/biblio.C +++ b/src/frontends/controllers/biblio.C @@ -41,10 +41,10 @@ string const familyName(string const & name) // "Surname, F." // "FirstName Surname" // "F. Surname" - string::size_type idx = fname.find(","); + string::size_type idx = fname.find(','); if (idx != string::npos) return ltrim(fname.substr(0, idx)); - idx = fname.rfind("."); + idx = fname.rfind('.'); if (idx != string::npos) fname = ltrim(fname.substr(idx + 1)); // test if we have a LaTeX Space in front @@ -291,7 +291,7 @@ struct RegexMatch string data = key; InfoMap::const_iterator info = map_.find(key); if (info != map_.end()) - data += " " + info->second; + data += ' ' + info->second; // Attempts to find a match for the current RE // somewhere in data. @@ -376,7 +376,7 @@ string const parseBibTeX(string data, string const & findkey) // with a space if (!dummy.empty()) { if (!contains(dummy, "=")) - data_ += (' ' + dummy); + data_ += ' ' + dummy; else data_ += dummy; } @@ -418,7 +418,7 @@ string const parseBibTeX(string data, string const & findkey) keyvalue = dummy; dummy = token(data, ',', Entries++); while (!contains(dummy, '=') && !dummy.empty()) { - keyvalue += (',' + dummy); + keyvalue += ',' + dummy; dummy = token(data, ',', Entries++); } @@ -551,7 +551,7 @@ string const getCiteCommand(CiteStyle command, bool full, bool forceUCase) if (full) { CiteStyle const * last = citeStylesFull + nCiteStylesFull; if (std::find(citeStylesFull, last, command) != last) - cite += "*"; + cite += '*'; } if (forceUCase) { @@ -629,7 +629,7 @@ getNumericalStrings(string const & key, break; case CITEYEARPAR: - str = "(" + year + ")"; + str = '(' + year + ')'; break; } @@ -660,15 +660,15 @@ getAuthorYearStrings(string const & key, switch (styles[i]) { case CITE: case CITET: - str = author + " (" + year + ")"; + str = author + " (" + year + ')'; break; case CITEP: - str = "(" + author + ", " + year + ")"; + str = '(' + author + ", " + year + ')'; break; case CITEALT: - str = author + " " + year ; + str = author + ' ' + year ; break; case CITEALP: @@ -684,7 +684,7 @@ getAuthorYearStrings(string const & key, break; case CITEYEARPAR: - str = "(" + year + ")"; + str = '(' + year + ')'; break; } diff --git a/src/frontends/gnome/GFloat.C b/src/frontends/gnome/GFloat.C index f89a50f8b5..7186cdfed9 100644 --- a/src/frontends/gnome/GFloat.C +++ b/src/frontends/gnome/GFloat.C @@ -3,7 +3,7 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author Michael Koziarski + * \author Michael Koziarski * * Full author contact details are available in file CREDITS */ @@ -46,19 +46,19 @@ void GFloat::apply() { string placement; if (here_definitely()->get_active()) { - placement += "H"; + placement += 'H'; } else { if (top_of_page()->get_active()) { - placement += "t"; + placement += 't'; } if (bottom_of_page()->get_active()) { - placement += "b"; + placement += 'b'; } if (page_of_floats()->get_active()) { - placement += "p"; + placement += 'p'; } if (here_if_possible()->get_active()) { - placement += "h"; + placement += 'h'; } } controller().params().placement = placement; @@ -92,7 +92,7 @@ void GFloat::update() here = true; } } - + top_of_page()->set_active(top); page_of_floats()->set_active(page); bottom_of_page()->set_active(bottom); @@ -123,7 +123,7 @@ void GFloat::connect_signals() ); } -void GFloat::disconnect_signals() +void GFloat::disconnect_signals() { conn_top_.disconnect(); conn_bottom_.disconnect(); @@ -133,41 +133,41 @@ void GFloat::disconnect_signals() conn_disable_.disconnect(); } -void GFloat::update_sensitive() +void GFloat::update_sensitive() { - if (here_definitely()->get_active()) + if (here_definitely()->get_active()) other_options()->set_sensitive(false); - else + else other_options()->set_sensitive(true); } -Gtk::HBox * GFloat::other_options() const +Gtk::HBox * GFloat::other_options() const { - return getWidget("r_other_options"); + return getWidget("r_other_options"); } -Gtk::CheckButton * GFloat::page_of_floats() const +Gtk::CheckButton * GFloat::page_of_floats() const { - return getWidget("r_page_of_floats"); + return getWidget("r_page_of_floats"); } -Gtk::CheckButton * GFloat::top_of_page() const +Gtk::CheckButton * GFloat::top_of_page() const { - return getWidget("r_top_of_page"); + return getWidget("r_top_of_page"); } -Gtk::CheckButton * GFloat::bottom_of_page() const +Gtk::CheckButton * GFloat::bottom_of_page() const { - return getWidget("r_bottom_of_page"); + return getWidget("r_bottom_of_page"); } -Gtk::CheckButton * GFloat::here_if_possible() const +Gtk::CheckButton * GFloat::here_if_possible() const { - return getWidget("r_here_if_possible"); + return getWidget("r_here_if_possible"); } -Gtk::RadioButton * GFloat::here_definitely() const +Gtk::RadioButton * GFloat::here_definitely() const { - return getWidget("r_here_definitely"); + return getWidget("r_here_definitely"); } -Gtk::Button * GFloat::close_btn() const +Gtk::Button * GFloat::close_btn() const { - return getWidget("r_close_btn"); + return getWidget("r_close_btn"); } diff --git a/src/frontends/qt2/Alert_pimpl.C b/src/frontends/qt2/Alert_pimpl.C index ea523bfda8..553bc0b0c5 100644 --- a/src/frontends/qt2/Alert_pimpl.C +++ b/src/frontends/qt2/Alert_pimpl.C @@ -26,6 +26,9 @@ #include "Alert.h" #include "Alert_pimpl.h" +#include "BoostFormat.h" + + using std::pair; using std::make_pair; @@ -33,20 +36,20 @@ using std::make_pair; void alert_pimpl(string const & s1, string const & s2, string const & s3) { QMessageBox::warning(0, "LyX", - (s1 + "\n" + "\n" + s2 + "\n" + s3).c_str()); + (s1 + '\n' + '\n' + s2 + '\n' + s3).c_str()); } bool askQuestion_pimpl(string const & s1, string const & s2, string const & s3) { - return !(QMessageBox::information(0, "LyX", (s1 + "\n" + s2 + "\n" + s3).c_str(), + return !(QMessageBox::information(0, "LyX", (s1 + '\n' + s2 + '\n' + s3).c_str(), _("&Yes"), _("&No"), 0, 1)); } int askConfirmation_pimpl(string const & s1, string const & s2, string const & s3) { - return (QMessageBox::information(0, "LyX", (s1 + "\n" + s2 + "\n" + s3).c_str(), + return (QMessageBox::information(0, "LyX", (s1 + '\n' + s2 + '\n' + s3).c_str(), _("&Yes"), _("&No"), _("&Cancel"), 0, 2)) + 1; } @@ -54,12 +57,16 @@ int askConfirmation_pimpl(string const & s1, string const & s2, string const & s pair const askForText_pimpl(string const & msg, string const & dflt) { - string title = _("LyX: "); - title += msg; - +#if USE_BOOST_FORMAT + boost::format fmt(_("LyX: %1$s")); + fmt % msg; + string const title = fmt.str(); +#else + string const title = _("LyX: ") + msg; +#endif QAskForTextDialog d(0, title.c_str(), true); // less than ideal ! - d.askLA->setText((string("&") + msg).c_str()); + d.askLA->setText(('&' + msg).c_str()); d.askLE->setText(dflt.c_str()); d.askLE->setFocus(); int ret = d.exec(); diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 074c35e4c8..2222bdee6a 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,9 +1,13 @@ +2002-11-27 Lars Gullik Bjønnes + + * Alert_pimpl.C (askForText_pimpl): use boost.format + 2002-11-26 John Levon * QMathDialog.C: * Toolbar_pimpl.h: * Toolbar_pimpl.C: Qt is the Lord of Suck - + 2002-11-25 John Levon * qscreen.C: use LColor::cursor properly @@ -11,7 +15,7 @@ * QPrefs.C: * ui/QPrefKeyboardModule.ui: * ui/QPrefUIModule.ui: UI fixes - + 2002-11-25 Herbert Voss * QVCLog.C (update_contents): fix USE_BOOST_FORMAT diff --git a/src/frontends/qt2/FileDialog.C b/src/frontends/qt2/FileDialog.C index 840d79bcd8..040039d8ff 100644 --- a/src/frontends/qt2/FileDialog.C +++ b/src/frontends/qt2/FileDialog.C @@ -80,7 +80,7 @@ FileDialog::Result const FileDialog::save(string const & path, return result; } - + FileDialog::Result const FileDialog::open(string const & path, string const & mask, string const & suggested) diff --git a/src/frontends/qt2/FileDialog_private.C b/src/frontends/qt2/FileDialog_private.C index f8e915f3d8..598b8f430c 100644 --- a/src/frontends/qt2/FileDialog_private.C +++ b/src/frontends/qt2/FileDialog_private.C @@ -38,7 +38,7 @@ string const getLabel(string const & str) { string::size_type pos = label.find(sc[1]); if (pos == string::npos) return label; - label.insert(pos, "&"); + label.insert(pos, 1, '&'); return label; } diff --git a/src/frontends/qt2/QCommandBuffer.C b/src/frontends/qt2/QCommandBuffer.C index e0b02d4b94..9d04a931e2 100644 --- a/src/frontends/qt2/QCommandBuffer.C +++ b/src/frontends/qt2/QCommandBuffer.C @@ -123,7 +123,7 @@ void QCommandBuffer::complete() if (comp.empty()) { edit_->setText(new_input.c_str()); - // show_info_suffix(("[only completion]"), new_input + " "); + // show_info_suffix(("[only completion]"), new_input + ' '); return; } @@ -159,7 +159,7 @@ void QCommandBuffer::complete() void QCommandBuffer::complete_selected(QString const & str) { - edit_->setText(str + " "); + edit_->setText(str + ' '); QWidget const * widget = static_cast(sender()); const_cast(widget)->hide(); } @@ -196,7 +196,7 @@ void XMiniBuffer::show_info_suffix(string const & suffix, string const & input) { stored_input_ = input; info_suffix_shown_ = true; - set_input(input + " " + suffix); + set_input(input + ' ' + suffix); suffix_timer_->start(); } diff --git a/src/frontends/qt2/QContentPane.C b/src/frontends/qt2/QContentPane.C index e5201be836..c7d42a2e21 100644 --- a/src/frontends/qt2/QContentPane.C +++ b/src/frontends/qt2/QContentPane.C @@ -142,8 +142,11 @@ void QContentPane::wheelEvent(QWheelEvent * e) void QContentPane::keyPressEvent(QKeyEvent * e) { lyxerr[Debug::KEY] << "Press key " << e->key() - << " text \"" << (e->text().isEmpty() ? "none" : e->text().latin1()) - << "\", ascii \"" << e->ascii() << "\"" << endl; + << " text \"" + << (e->text().isEmpty() ? + "none" : + e->text().latin1()) + << "\", ascii \"" << e->ascii() << '"' << endl; QLyXKeySym * sym = new QLyXKeySym(); sym->set(e); wa_->workAreaKeyPress(LyXKeySymPtr(sym), q_key_state(e->state())); @@ -196,8 +199,8 @@ void QContentPane::paintEvent(QPaintEvent * e) QRect r(e->rect()); lyxerr[Debug::GUI] << "repainting " << r.x() - << "," << r.y() << " " << r.width() - << "," << r.height() << endl; + << ',' << r.y() << ' ' << r.width() + << ',' << r.height() << endl; QPainter q(this); q.drawPixmap(QPoint(r.x(), r.y()), *pixmap_.get(), r); diff --git a/src/frontends/qt2/QDelimiterDialog.C b/src/frontends/qt2/QDelimiterDialog.C index 18a0dc656f..8de79d376d 100644 --- a/src/frontends/qt2/QDelimiterDialog.C +++ b/src/frontends/qt2/QDelimiterDialog.C @@ -85,9 +85,9 @@ QDelimiterDialog::QDelimiterDialog(QMath * form) leftIP->add(QPixmap(xpm.c_str()), delim[i], delim[i]); rightIP->add(QPixmap(xpm.c_str()), delim[i], delim[i]); } - + string empty_xpm(find_xpm("empty")); - + leftIP->add(QPixmap(empty_xpm.c_str()), "empty", "empty"); rightIP->add(QPixmap(empty_xpm.c_str()), "empty", "empty"); connect(leftIP, SIGNAL(button_clicked(string const &)), this, SLOT(ldelim_clicked(string const &))); @@ -99,7 +99,7 @@ QDelimiterDialog::QDelimiterDialog(QMath * form) void QDelimiterDialog::insertClicked() { - form_->insertDelim(fix_name(left_) + " " + fix_name(right_)); + form_->insertDelim(fix_name(left_) + ' ' + fix_name(right_)); } diff --git a/src/frontends/qt2/QFloat.C b/src/frontends/qt2/QFloat.C index fe947a2506..5b760ced4e 100644 --- a/src/frontends/qt2/QFloat.C +++ b/src/frontends/qt2/QFloat.C @@ -122,22 +122,22 @@ void QFloat::apply() string placement; if (dialog_->heredefinitelyCB->isChecked()) { - placement += "H"; + placement += 'H'; } else { if (dialog_->ignoreCB->isChecked()) { - placement += "!"; + placement += '!'; } if (dialog_->topCB->isChecked()) { - placement += "t"; + placement += 't'; } if (dialog_->bottomCB->isChecked()) { - placement += "b"; + placement += 'b'; } if (dialog_->pageCB->isChecked()) { - placement += "p"; + placement += 'p'; } if (dialog_->herepossiblyCB->isChecked()) { - placement += "h"; + placement += 'h'; } } params.placement = placement; diff --git a/src/frontends/qt2/QGraphics.C b/src/frontends/qt2/QGraphics.C index bdc1810a1a..401d2daf25 100644 --- a/src/frontends/qt2/QGraphics.C +++ b/src/frontends/qt2/QGraphics.C @@ -109,7 +109,7 @@ int getItemNo(vector v, string const & s) { find(v.begin(), v.end(), s); return (cit != v.end()) ? int(cit - v.begin()) : 0; } - + // returns the number of the unit in the array unit_name, // which is defined in lengthcommon.C int getUnitNo(char const * c[], string const & s) { @@ -118,7 +118,7 @@ int getUnitNo(char const * c[], string const & s) { ++i; return (i < num_units) ? i : 0; } - + } @@ -137,7 +137,7 @@ void QGraphics::update_contents() dialog_->rtXunit->insertItem((*it).c_str(), -1); dialog_->rtYunit->insertItem((*it).c_str(), -1); } - + InsetGraphicsParams & igp = controller().params(); // set the right default unit @@ -238,11 +238,11 @@ void QGraphics::update_contents() //// the output section (width/height) // set the length combo boxes // only the width has the possibility for scale%. The original - // units are defined in lengthcommon.C + // units are defined in lengthcommon.C // 1. the width (a listttype) dialog_->widthUnit->clear(); dialog_->widthUnit->insertItem(_("Scale%")); - for (int i = 0; i < num_units; i++) + for (int i = 0; i < num_units; i++) dialog_->widthUnit->insertItem(unit_name_gui[i], -1); if (!lyx::float_equal(igp.scale, 0.0, 0.05)) { @@ -274,7 +274,7 @@ void QGraphics::update_contents() dialog_->angle->setText(tostr(igp.rotateAngle).c_str()); dialog_->origin->clear(); - + using namespace frnt; vector origindata = getRotationOriginData(); vector const origin_lang = getFirst(origindata); @@ -283,14 +283,14 @@ void QGraphics::update_contents() for (vector::const_iterator it = origin_lang.begin(); it != origin_lang.end(); ++it) dialog_->origin->insertItem((*it).c_str(), -1); - + if (!igp.rotateOrigin.empty()) dialog_->origin->setCurrentItem( ::getItemNo(origin_ltx, igp.rotateOrigin)); else dialog_->origin->setCurrentItem(0); - //// latex section + //// latex section dialog_->latexoptions->setText(igp.special.c_str()); } @@ -309,8 +309,8 @@ void QGraphics::apply() string lbY(dialog_->lbY->text()); string rtX(dialog_->rtX->text()); string rtY(dialog_->rtY->text()); - int bb_sum = - strToInt(lbX) + strToInt(lbY) + + int bb_sum = + strToInt(lbX) + strToInt(lbY) + strToInt(rtX) + strToInt(rtX); if (bb_sum) { if (lbX.empty()) @@ -319,15 +319,15 @@ void QGraphics::apply() bb = lbX + dialog_->lbXunit->currentText().latin1() + ' '; if (lbY.empty()) bb += "0 "; - else + else bb += (lbY + dialog_->lbYunit->currentText().latin1() + ' '); if (rtX.empty()) bb += "0 "; - else + else bb += (rtX + dialog_->rtXunit->currentText().latin1() + ' '); if (rtY.empty()) - bb += "0"; - else + bb += '0'; + else bb += (rtY + dialog_->rtYunit->currentText().latin1()); igp.bb = bb; } @@ -352,17 +352,17 @@ void QGraphics::apply() string value(dialog_->width->text()); if (dialog_->widthUnit->currentItem() > 0) { // width/height combination - int const unitNo = getUnitNo(unit_name_gui, + int const unitNo = getUnitNo(unit_name_gui, string(dialog_->widthUnit->currentText())); igp.width = LyXLength(value + unit_name_ltx[unitNo]); - igp.scale = 0.0; + igp.scale = 0.0; } else { // scaling instead of a width - igp.scale = strToDbl(value); - igp.width = LyXLength(); + igp.scale = strToDbl(value); + igp.width = LyXLength(); } value = string(dialog_->height->text()); - int const unitNo = getUnitNo(unit_name_gui, + int const unitNo = getUnitNo(unit_name_gui, string(dialog_->heightUnit->currentText())); igp.height = LyXLength(value + unit_name_ltx[unitNo]); @@ -380,7 +380,7 @@ void QGraphics::apply() // save the latex name for the origin. If it is the default // then origin_ltx returns "" - igp.rotateOrigin = + igp.rotateOrigin = QGraphics::origin_ltx[dialog_->origin->currentItem()]; // more latex options diff --git a/src/frontends/qt2/QLImage.C b/src/frontends/qt2/QLImage.C index d7e1382d55..1d70b20ea6 100644 --- a/src/frontends/qt2/QLImage.C +++ b/src/frontends/qt2/QLImage.C @@ -161,7 +161,7 @@ bool QLImage::setPixmap(Params const & params) lyxerr[Debug::GRAPHICS] << "setPixmap()" << endl; // FIXME: it's a fake kind of grayscale ! - + switch (params.display) { case GrayscaleDisplay: case MonochromeDisplay: { @@ -169,7 +169,7 @@ bool QLImage::setPixmap(Params const & params) xformed_pixmap_.convertFromImage(i, QPixmap::Mono); break; } - + default: break; } @@ -254,9 +254,10 @@ void QLImage::scale(Params const & params) if (width == getWidth() && height == getHeight()) return; - lyxerr[Debug::GRAPHICS] << "resizing image to " << width << "(" << - (double(width)/getWidth()) << ")," << height << "(" << - (double(height)/getHeight()) << ")" << endl; + lyxerr[Debug::GRAPHICS] << "resizing image to " << width << '(' + << (double(width)/getWidth()) << ")," + << height << '(' + << (double(height)/getHeight()) << ')' << endl; QWMatrix m; m.scale(double(width) / getWidth(), double(height) / getHeight()); xformed_pixmap_ = xformed_pixmap_.xForm(m); diff --git a/src/frontends/qt2/QLPainter.C b/src/frontends/qt2/QLPainter.C index 4f63c944c8..aff7c6af40 100644 --- a/src/frontends/qt2/QLPainter.C +++ b/src/frontends/qt2/QLPainter.C @@ -142,7 +142,8 @@ Painter & QLPainter::rectangle(int x, int y, line_style ls, line_width lw) { - //lyxerr << "rectangle " << x<<","<fillRect(x, y, w, h, QColor(lcolor.getX11Name(col).c_str())); return *this; } @@ -184,8 +186,8 @@ Painter & QLPainter::arc(int x, int y, unsigned int w, unsigned int h, int a1, int a2, LColor::color col) { - lyxerr[Debug::GUI] << "arc: " << x<<","< - + using std::pair; using std::make_pair; - + extern boost::scoped_ptr toplevel_keymap; - + namespace { string const getLabel(MenuItem const & mi) @@ -44,16 +44,16 @@ string const getLabel(MenuItem const & mi) string::size_type pos = label.find(shortcut); if (pos == string::npos) return label; - label.insert(pos, "&"); - + label.insert(pos, 1, '&'); + if (mi.kind() == MenuItem::Command) { // FIXME: backend should do this string const accel(toplevel_keymap->findbinding(mi.action())); - + if (!accel.empty()) { - label += "\t" + accel.substr(1, accel.find(']') - 1); + label += '\t' + accel.substr(1, accel.find(']') - 1); } - + lyxerr[Debug::GUI] << "Label: " << mi.label() << " Shortcut: " << mi.shortcut() << " Accel: " << accel << endl; diff --git a/src/frontends/qt2/QPreambleDialog.C b/src/frontends/qt2/QPreambleDialog.C index 35311067e4..44ffb0519c 100644 --- a/src/frontends/qt2/QPreambleDialog.C +++ b/src/frontends/qt2/QPreambleDialog.C @@ -85,7 +85,7 @@ void QPreambleDialog::editClicked() file.close(); - editor += " " + filename; + editor += ' ' + filename; Forkedcall call; diff --git a/src/frontends/qt2/QPrefs.C b/src/frontends/qt2/QPrefs.C index be7e7282a5..647024c0aa 100644 --- a/src/frontends/qt2/QPrefs.C +++ b/src/frontends/qt2/QPrefs.C @@ -17,7 +17,7 @@ #include "support/lstrings.h" #include "Lsstream.h" #include - + #include "ControlPrefs.h" #include "QPrefsDialog.h" #include "ui/QPrefAsciiModule.h" @@ -45,17 +45,17 @@ #include #include #include -#include +#include #include #include #include "qcoloritem.h" - + using std::vector; using std::ostringstream; using std::setfill; using std::setw; using std::endl; - + typedef Qt2CB > base_class; @@ -73,9 +73,9 @@ void QPrefs::build_dialog() bc().setApply(dialog_->applyPB); bc().setCancel(dialog_->closePB); bc().setRestore(dialog_->restorePB); - + QPrefLanguageModule * langmod(dialog_->languageModule); - + langmod->defaultLanguageCO->clear(); // store the lang identifiers for later vector const langs = frnt::getLanguageData(false); @@ -93,40 +93,40 @@ void QPrefs::apply() { LyXRC & rc(controller().rc()); - // do something ... + // do something ... QPrefLanguageModule * langmod(dialog_->languageModule); - + // FIXME: remove rtl_support bool rc.rtl_support = langmod->rtlCB->isChecked(); - rc.mark_foreign_language = langmod->markForeignCB->isChecked(); - rc.language_auto_begin = langmod->autoBeginCB->isChecked(); - rc.language_auto_end = langmod->autoEndCB->isChecked(); + rc.mark_foreign_language = langmod->markForeignCB->isChecked(); + rc.language_auto_begin = langmod->autoBeginCB->isChecked(); + rc.language_auto_end = langmod->autoEndCB->isChecked(); rc.language_use_babel = langmod->useBabelCB->isChecked(); rc.language_global_options = langmod->globalCB->isChecked(); rc.language_package = langmod->languagePackageED->text().latin1(); rc.language_command_begin = langmod->startCommandED->text().latin1(); rc.language_command_end = langmod->endCommandED->text().latin1(); - rc.default_language = lang_[langmod->defaultLanguageCO->currentItem()]; + rc.default_language = lang_[langmod->defaultLanguageCO->currentItem()]; - QPrefUIModule * uimod(dialog_->uiModule); + QPrefUIModule * uimod(dialog_->uiModule); rc.ui_file = uimod->uiFileED->text().latin1(); rc.bind_file = uimod->bindFileED->text().latin1(); - rc.cursor_follows_scrollbar = uimod->cursorFollowsCB->isChecked(); + rc.cursor_follows_scrollbar = uimod->cursorFollowsCB->isChecked(); rc.wheel_jump = uimod->wheelMouseSB->value(); rc.autosave = uimod->autoSaveSB->value() * 60; rc.make_backup = uimod->autoSaveCB->isChecked(); rc.num_lastfiles = uimod->lastfilesSB->value(); - - + + QPrefKeyboardModule * keymod(dialog_->keyboardModule); - // FIXME: can derive CB from the two EDs + // FIXME: can derive CB from the two EDs rc.use_kbmap = keymod->keymapCB->isChecked(); rc.primary_kbmap = keymod->firstKeymapED->text().latin1(); rc.secondary_kbmap = keymod->secondKeymapED->text().latin1(); - + QPrefAsciiModule * ascmod(dialog_->asciiModule); @@ -142,7 +142,7 @@ void QPrefs::apply() QPrefLatexModule * latexmod(dialog_->latexModule); rc.fontenc = latexmod->latexEncodingED->text().latin1(); - rc.chktex_command = latexmod->latexChecktexED->text().latin1(); + rc.chktex_command = latexmod->latexChecktexED->text().latin1(); rc.auto_reset_options = latexmod->latexAutoresetCB->isChecked(); rc.view_dvi_paper_option = latexmod->latexDviPaperED->text().latin1(); rc.default_papersize = @@ -152,9 +152,9 @@ void QPrefs::apply() QPrefDisplayModule * displaymod(dialog_->displayModule); rc.preview = displaymod->previewCB->isChecked(); - + grfx::DisplayType dtype(grfx::ColorDisplay); - + switch (displaymod->displayGraphicsCO->currentItem()) { case 3: dtype = grfx::NoDisplay; break; case 2: dtype = grfx::ColorDisplay; break; @@ -162,7 +162,7 @@ void QPrefs::apply() case 0: dtype = grfx::MonochromeDisplay; break; } rc.display_graphics = dtype; - + #ifdef WITH_WARNINGS #warning FIXME!! The graphics cache no longer has a changeDisplay method. #endif @@ -172,9 +172,9 @@ void QPrefs::apply() gc.changeDisplay(); } #endif - + QPrefPathsModule * pathsmod(dialog_->pathsModule); - + rc.document_path = pathsmod->workingDirED->text().latin1(); rc.template_path = pathsmod->templateDirED->text().latin1(); rc.backupdir_path = pathsmod->backupDirED->text().latin1(); @@ -190,14 +190,14 @@ void QPrefs::apply() rc.isp_command = "ispell"; else rc.isp_command = "aspell"; - + // FIXME: remove isp_use_alt_lang rc.isp_alt_lang = spellmod->altLanguageED->text().latin1(); - rc.isp_use_alt_lang = !rc.isp_alt_lang.empty(); - // FIXME: remove isp_use_esc_chars + rc.isp_use_alt_lang = !rc.isp_alt_lang.empty(); + // FIXME: remove isp_use_esc_chars rc.isp_esc_chars = spellmod->escapeCharactersED->text().latin1(); rc.isp_use_esc_chars = !rc.isp_esc_chars.empty(); - // FIXME: remove isp_use_pers_dict + // FIXME: remove isp_use_pers_dict rc.isp_pers_dict = spellmod->persDictionaryED->text().latin1(); rc.isp_use_pers_dict = !rc.isp_pers_dict.empty(); rc.isp_accept_compound = spellmod->compoundWordCB->isChecked(); @@ -230,7 +230,7 @@ void QPrefs::apply() QPrefScreenFontsModule * fontmod(dialog_->screenfontsModule); LyXRC const oldrc(rc); - + rc.roman_font_name = fontmod->screenRomanCO->currentText().latin1(); rc.sans_font_name = fontmod->screenSansCO->currentText().latin1(); rc.typewriter_font_name = fontmod->screenTypewriterCO->currentText().latin1(); @@ -254,12 +254,12 @@ void QPrefs::apply() || rc.zoom != oldrc.zoom || rc.dpi != oldrc.dpi) { controller().updateScreenFonts(); } - + controller().setConverters(converters_); - controller().setFormats(formats_); + controller().setFormats(formats_); QPrefColorsModule * colmod(dialog_->colorsModule); - + unsigned int i; for (i = 0; i < colmod->lyxObjectsLB->count(); ++i) { @@ -267,12 +267,12 @@ void QPrefs::apply() QColorItem * ci(static_cast(ib)); ostringstream ostr; - - ostr << "#" << std::setbase(16) << setfill('0') + + ostr << '#' << std::setbase(16) << setfill('0') << setw(2) << ci->color().red() << setw(2) << ci->color().green() << setw(2) << ci->color().blue(); - + string newhex(STRCONV(ostr.str())); LColor::color col(dialog_->colors_[i]); @@ -285,9 +285,9 @@ void QPrefs::apply() } -// FIXME: move to helper_funcs.h +// FIXME: move to helper_funcs.h namespace { - + template typename std::vector::size_type findPos(std::vector const & vec, A const & val) @@ -306,12 +306,12 @@ void QPrefs::update_contents() LyXRC const & rc(controller().rc()); QPrefLanguageModule * langmod(dialog_->languageModule); - + // FIXME: remove rtl_support bool langmod->rtlCB->setChecked(rc.rtl_support); - langmod->markForeignCB->setChecked(rc.mark_foreign_language); - langmod->autoBeginCB->setChecked(rc.language_auto_begin); - langmod->autoEndCB->setChecked(rc.language_auto_end); + langmod->markForeignCB->setChecked(rc.mark_foreign_language); + langmod->autoBeginCB->setChecked(rc.language_auto_begin); + langmod->autoEndCB->setChecked(rc.language_auto_end); langmod->useBabelCB->setChecked(rc.language_use_babel); langmod->globalCB->setChecked(rc.language_global_options); langmod->languagePackageED->setText(rc.language_package.c_str()); @@ -321,11 +321,11 @@ void QPrefs::update_contents() int const pos = int(findPos(lang_, rc.default_language)); langmod->defaultLanguageCO->setCurrentItem(pos); - QPrefUIModule * uimod(dialog_->uiModule); + QPrefUIModule * uimod(dialog_->uiModule); uimod->uiFileED->setText(rc.ui_file.c_str()); uimod->bindFileED->setText(rc.bind_file.c_str()); - uimod->cursorFollowsCB->setChecked(rc.cursor_follows_scrollbar); + uimod->cursorFollowsCB->setChecked(rc.cursor_follows_scrollbar); uimod->wheelMouseSB->setValue(rc.wheel_jump); // convert to minutes int mins(rc.autosave / 60); @@ -334,11 +334,11 @@ void QPrefs::update_contents() uimod->autoSaveSB->setValue(mins); uimod->autoSaveCB->setChecked(rc.make_backup); uimod->lastfilesSB->setValue(rc.num_lastfiles); - - + + QPrefKeyboardModule * keymod(dialog_->keyboardModule); - // FIXME: can derive CB from the two EDs + // FIXME: can derive CB from the two EDs keymod->keymapCB->setChecked(rc.use_kbmap); // no idea why we need these. Fscking Qt. keymod->firstKeymapED->setEnabled(rc.use_kbmap); @@ -349,7 +349,7 @@ void QPrefs::update_contents() keymod->secondKeymapLA->setEnabled(rc.use_kbmap); keymod->firstKeymapED->setText(rc.primary_kbmap.c_str()); keymod->secondKeymapED->setText(rc.secondary_kbmap.c_str()); - + QPrefAsciiModule * ascmod(dialog_->asciiModule); @@ -365,7 +365,7 @@ void QPrefs::update_contents() QPrefLatexModule * latexmod(dialog_->latexModule); latexmod->latexEncodingED->setText(rc.fontenc.c_str()); - latexmod->latexChecktexED->setText(rc.chktex_command.c_str()); + latexmod->latexChecktexED->setText(rc.chktex_command.c_str()); latexmod->latexAutoresetCB->setChecked(rc.auto_reset_options); latexmod->latexDviPaperED->setText(rc.view_dvi_paper_option.c_str()); latexmod->latexPaperSizeCO->setCurrentItem(rc.default_papersize); @@ -374,9 +374,9 @@ void QPrefs::update_contents() QPrefDisplayModule * displaymod(dialog_->displayModule); displaymod->previewCB->setChecked(rc.preview); - + int item = 2; - + switch (rc.display_graphics) { case grfx::NoDisplay: item = 3; break; case grfx::ColorDisplay: item = 2; break; @@ -384,10 +384,10 @@ void QPrefs::update_contents() case grfx::MonochromeDisplay: item = 0; break; } displaymod->displayGraphicsCO->setCurrentItem(item); - + QPrefPathsModule * pathsmod(dialog_->pathsModule); - + pathsmod->workingDirED->setText(rc.document_path.c_str()); pathsmod->templateDirED->setText(rc.template_path.c_str()); pathsmod->backupDirED->setText(rc.backupdir_path.c_str()); @@ -403,9 +403,9 @@ void QPrefs::update_contents() spellmod->spellCommandCO->setCurrentItem(item); // FIXME: remove isp_use_alt_lang spellmod->altLanguageED->setText(rc.isp_alt_lang.c_str()); - // FIXME: remove isp_use_esc_chars + // FIXME: remove isp_use_esc_chars spellmod->escapeCharactersED->setText(rc.isp_esc_chars.c_str()); - // FIXME: remove isp_use_pers_dict + // FIXME: remove isp_use_pers_dict spellmod->persDictionaryED->setText(rc.isp_pers_dict.c_str()); spellmod->compoundWordCB->setChecked(rc.isp_accept_compound); spellmod->inputEncodingCB->setChecked(rc.isp_use_input_encoding); @@ -439,7 +439,7 @@ void QPrefs::update_contents() QString roman(rc.roman_font_name.c_str()); QString sans(rc.sans_font_name.c_str()); QString typewriter(rc.typewriter_font_name.c_str()); - + for (int i = 0; i < fontmod->screenRomanCO->count(); ++i) { if (fontmod->screenRomanCO->text(i) == roman) { fontmod->screenRomanCO->setCurrentItem(i); @@ -465,7 +465,7 @@ void QPrefs::update_contents() dialog_->select_roman(roman); dialog_->select_sans(sans); dialog_->select_typewriter(typewriter); - + fontmod->screenZoomSB->setValue(rc.zoom); fontmod->screenDpiSB->setValue(int(rc.dpi)); fontmod->screenTinyED->setText(tostr(rc.font_sizes[LyXFont::SIZE_TINY]).c_str()); @@ -482,7 +482,7 @@ void QPrefs::update_contents() formats_ = formats; dialog_->updateFormats(); - + converters_ = converters; dialog_->updateConverters(); diff --git a/src/frontends/qt2/QToc.C b/src/frontends/qt2/QToc.C index 174db3adf8..c25e578af6 100644 --- a/src/frontends/qt2/QToc.C +++ b/src/frontends/qt2/QToc.C @@ -149,7 +149,7 @@ void QToc::updateToc(int newdepth) << ", previous sibling \"" << (last ? last->text(0).latin1() : "0") << "\", parent \"" - << (parent ? parent->text(0).latin1() : "0") << "\"" + << (parent ? parent->text(0).latin1() : "0") << '"' << endl; item->setText(0,iter->str.c_str()); item->setOpen(iter->depth < depth_); diff --git a/src/frontends/qt2/Toolbar_pimpl.C b/src/frontends/qt2/Toolbar_pimpl.C index 2e125bffc7..330b49cbf3 100644 --- a/src/frontends/qt2/Toolbar_pimpl.C +++ b/src/frontends/qt2/Toolbar_pimpl.C @@ -28,7 +28,7 @@ #include "support/filetools.h" #include "support/lstrings.h" -#include "ControlMath.h" +#include "ControlMath.h" #include @@ -49,7 +49,7 @@ QPixmap getIconPixmap(int action) FuncRequest f = lyxaction.retrieveActionArg(action); string fullname; - + if (f.action == LFUN_INSERT_MATH && !f.argument.empty()) { fullname = find_xpm(f.argument.substr(1)); } else { @@ -58,18 +58,18 @@ QPixmap getIconPixmap(int action) if (!f.argument.empty()) xpm_name = subst(name + ' ' + f.argument, ' ','_'); - + fullname = LibFileSearch("images", xpm_name, "xpm"); } if (!fullname.empty()) { lyxerr[Debug::GUI] << "Full icon name is `" - << fullname << "'" << endl; + << fullname << '\'' << endl; return QPixmap(fullname.c_str()); } - lyxerr << "Unable to find icon `" << fullname << "'" << endl; + lyxerr << "Unable to find icon `" << fullname << '\'' << endl; fullname = LibFileSearch("images", "unknown", "xpm"); if (!fullname.empty()) { lyxerr[Debug::GUI] << "Using default `unknown' icon" diff --git a/src/frontends/qt2/iconpalette.C b/src/frontends/qt2/iconpalette.C index 8f09504414..0d75810cb4 100644 --- a/src/frontends/qt2/iconpalette.C +++ b/src/frontends/qt2/iconpalette.C @@ -71,7 +71,7 @@ void IconPalette::resizeEvent(QResizeEvent * e) QWidget::resizeEvent(e); lyxerr[Debug::GUI] << "resize panel to " - << e->size().width() << "," << e->size().height() << endl; + << e->size().width() << ',' << e->size().height() << endl; int maxcol = e->size().width() / button_size; @@ -84,7 +84,7 @@ void IconPalette::resizeEvent(QResizeEvent * e) ++rows; lyxerr[Debug::GUI] << "Laying out " << buttons_.size() << " widgets in a " - << cols << "x" << rows << " grid." << endl; + << cols << 'x' << rows << " grid." << endl; setUpdatesEnabled(false); diff --git a/src/frontends/qt2/qscreen.C b/src/frontends/qt2/qscreen.C index 8aae6ae4a1..ab6fb8c24b 100644 --- a/src/frontends/qt2/qscreen.C +++ b/src/frontends/qt2/qscreen.C @@ -148,8 +148,8 @@ void QScreen::repaint() void QScreen::expose(int x, int y, int w, int h) { - lyxerr[Debug::GUI] << "expose " << w << "x" << h - << "+" << x << "+" << y << endl; + lyxerr[Debug::GUI] << "expose " << w << 'x' << h + << '+' << x << '+' << y << endl; owner_.getContent()->update(x, y, w, h); } diff --git a/src/frontends/screen.C b/src/frontends/screen.C index c3c3affcc3..74fa21184b 100644 --- a/src/frontends/screen.C +++ b/src/frontends/screen.C @@ -3,7 +3,7 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author John Levon + * \author John Levon * * Full author contact details are available in file CREDITS * @@ -406,7 +406,7 @@ void LyXScreen::drawFromTo(LyXText * text, BufferView * bv, int y1, int y2, int yo, int xo, bool internal) { - lyxerr[Debug::GUI] << "screen: drawFromTo " << y1 << "-" << y2 << endl; + lyxerr[Debug::GUI] << "screen: drawFromTo " << y1 << '-' << y2 << endl; int y_text = text->first_y + y1; diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 57e9d8cab6..3e558ee08b 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,7 @@ +2002-11-27 Lars Gullik Bjønnes + + * XMiniBuffer.C (peek_event): add l10n on a string missing it. + 2002-11-26 Angus Leeming * forms_gettext.[Ch] (scex, idex): ditch the #defines and rename the @@ -22,7 +26,7 @@ 2002-11-26 Jean-Marc Lasgouttes * FileDialog.C (save): actually return the result from - FileDialog::open + FileDialog::open 2002-11-26 Jürgen Spitzmüller diff --git a/src/frontends/xforms/ColorHandler.C b/src/frontends/xforms/ColorHandler.C index 7b51fcbb1e..1fd18241d2 100644 --- a/src/frontends/xforms/ColorHandler.C +++ b/src/frontends/xforms/ColorHandler.C @@ -188,11 +188,11 @@ GC LyXColorHandler::getGCForeground(LColor::color c) lyxerr << _("LyX: Couldn't allocate '") << s << _("' for ") << lcolor.getGUIName(c) << _(" with (r,g,b)=(") - << xcol.red << "," << xcol.green << "," << xcol.blue + << xcol.red << ',' << xcol.green << ',' << xcol.blue << _(").\n") << _(" Using closest allocated color with (r,g,b)=(") - << cmap[closest_pixel].red << "," - << cmap[closest_pixel].green << "," + << cmap[closest_pixel].red << ',' + << cmap[closest_pixel].green << ',' << cmap[closest_pixel].blue << _(") instead.\nPixel [") << closest_pixel << _("] is used.") diff --git a/src/frontends/xforms/FileDialog.C b/src/frontends/xforms/FileDialog.C index 7427dd0620..e629237bf3 100644 --- a/src/frontends/xforms/FileDialog.C +++ b/src/frontends/xforms/FileDialog.C @@ -53,7 +53,7 @@ FileDialog::Result const FileDialog::save(string const & path, string const & ma return open(path, mask, suggested); } - + FileDialog::Result const FileDialog::open(string const & path, string const & mask, string const & suggested) { string filter = mask; @@ -67,7 +67,7 @@ FileDialog::Result const FileDialog::open(string const & path, string const & ma } lyxerr[Debug::GUI] << "filedialog open with path \"" << path << "\", mask \"" - << filter << "\", suggested \"" << suggested << "\"" << endl; + << filter << "\", suggested \"" << suggested << '"' << endl; // no support for asynchronous selection yet diff --git a/src/frontends/xforms/FontInfo.C b/src/frontends/xforms/FontInfo.C index 350116735e..9b3244e023 100644 --- a/src/frontends/xforms/FontInfo.C +++ b/src/frontends/xforms/FontInfo.C @@ -4,7 +4,7 @@ * Licence details can be found in the file COPYING. * * \author Asger Alstrup - * \author John Levon + * \author John Levon * * Full author contact details are available in file CREDITS */ @@ -133,7 +133,7 @@ void FontInfo::query() // We have matches. Run them through for (int i = 0; i < matches; ++i) { string name(list[i]); - lyxerr[Debug::FONT] << "match #" << i << " " + lyxerr[Debug::FONT] << "match #" << i << ' ' << name << endl; sizes[i] = lyx::atoi(token(name, '-', 7)); strings[i] = name; diff --git a/src/frontends/xforms/FormBibtex.C b/src/frontends/xforms/FormBibtex.C index cbe76f66c3..a8f11b22b5 100644 --- a/src/frontends/xforms/FormBibtex.C +++ b/src/frontends/xforms/FormBibtex.C @@ -3,7 +3,7 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author Angus Leeming + * \author Angus Leeming * \author John Levon * \author Herbert Voss * \author Rob Lahaye @@ -211,7 +211,7 @@ void FormBibtex::apply() string const bibtotoc = addtotoc ? "bibtotoc" : ""; if (addtotoc && !bibstyle.empty()) { // Both bibtotoc and style. - controller().params().setOptions(bibtotoc + "," + bibstyle); + controller().params().setOptions(bibtotoc + ',' + bibstyle); } else { // At least one of addtotoc and bibstyle is empty. No harm to output both! diff --git a/src/frontends/xforms/FormCharacter.C b/src/frontends/xforms/FormCharacter.C index 4e5ae3a9d3..2dc76414de 100644 --- a/src/frontends/xforms/FormCharacter.C +++ b/src/frontends/xforms/FormCharacter.C @@ -4,7 +4,7 @@ * Licence details can be found in the file COPYING. * * \author Edwin Leuven - * \author Angus Leeming + * \author Angus Leeming * * Full author contact details are available in file CREDITS */ @@ -74,22 +74,22 @@ void FormCharacter::build() // create a string of entries " entry1 | entry2 | entry3 | entry4 " // with which to initialise the xforms choice object. - string choice = " " + getStringFromVector(getFirst(family), " | ") +" "; + string choice = ' ' + getStringFromVector(getFirst(family), " | ") + ' '; fl_addto_choice(dialog_->choice_family, choice.c_str()); - choice = " " + getStringFromVector(getFirst(series), " | ") + " "; + choice = ' ' + getStringFromVector(getFirst(series), " | ") + ' '; fl_addto_choice(dialog_->choice_series, choice.c_str()); - choice = " " + getStringFromVector(getFirst(shape), " | ") + " "; + choice = ' ' + getStringFromVector(getFirst(shape), " | ") + ' '; fl_addto_choice(dialog_->choice_shape, choice.c_str()); - choice = " " + getStringFromVector(getFirst(size), " | ") + " "; + choice = ' ' + getStringFromVector(getFirst(size), " | ") + ' '; fl_addto_choice(dialog_->choice_size, choice.c_str()); - choice = " " + getStringFromVector(getFirst(bar), " | ") + " "; + choice = ' ' + getStringFromVector(getFirst(bar), " | ") + ' '; fl_addto_choice(dialog_->choice_bar, choice.c_str()); - choice = " " + getStringFromVector(getFirst(color), " | ") + " "; + choice = ' ' + getStringFromVector(getFirst(color), " | ") + ' '; fl_addto_choice(dialog_->choice_color, choice.c_str()); // xforms appears to need this to prevent a crash... diff --git a/src/frontends/xforms/FormExternal.C b/src/frontends/xforms/FormExternal.C index aee507a291..2ad4110baf 100644 --- a/src/frontends/xforms/FormExternal.C +++ b/src/frontends/xforms/FormExternal.C @@ -5,7 +5,7 @@ * * \author Asger Alstrup * \author John Levon - * \author Angus Leeming + * \author Angus Leeming * * Full author contact details are available in file CREDITS */ @@ -51,7 +51,7 @@ void FormExternal::build() dialog_.reset(build_external(this)); string const choice = - " " + getStringFromVector(controller().getTemplates(), " | ") + " "; + ' ' + getStringFromVector(controller().getTemplates(), " | ") + ' '; fl_addto_choice(dialog_->choice_template, choice.c_str()); fl_set_input_return (dialog_->input_filename, FL_RETURN_CHANGED); diff --git a/src/frontends/xforms/FormFloat.C b/src/frontends/xforms/FormFloat.C index 4a86e9c647..f62673db49 100644 --- a/src/frontends/xforms/FormFloat.C +++ b/src/frontends/xforms/FormFloat.C @@ -32,7 +32,7 @@ enum { HERE_DEFINITELY, ALTERNATIVES }; - + } // namespace anon @@ -99,24 +99,24 @@ void FormFloat::apply() case ALTERNATIVES: if (fl_get_button(dialog_->check_force)) { // Ignore internal LaTeX rules - placement += "!"; + placement += '!'; } if (fl_get_button(dialog_->check_top)) { // Top of page - placement += "t"; + placement += 't'; } if (fl_get_button(dialog_->check_bottom)) { // Bottom of page - placement += "b"; + placement += 'b'; } if (fl_get_button(dialog_->check_page)) { // Page of floats - placement += "p"; + placement += 'p'; } // ignore if wide is selected if (!wide && fl_get_button(dialog_->check_here)) { // Here, if possible - placement += "h"; + placement += 'h'; } if (placement == "!") { // ignore placement if only force is selected. diff --git a/src/frontends/xforms/FormGraphics.C b/src/frontends/xforms/FormGraphics.C index e30b3c3a17..60021430a4 100644 --- a/src/frontends/xforms/FormGraphics.C +++ b/src/frontends/xforms/FormGraphics.C @@ -367,18 +367,18 @@ void FormGraphics::apply() bb = getLengthFromWidgets(bbox_->input_bb_x0, bbox_->choice_bb_units); - bb += " "; + bb += ' '; if (getString(bbox_->input_bb_y0).empty()) - bb += "0"; + bb += '0'; else bb += getLengthFromWidgets(bbox_->input_bb_y0, bbox_->choice_bb_units); - bb += " " + x1_str + " "; + bb += ' ' + x1_str + ' '; if (getString(bbox_->input_bb_y1).empty()) - bb += "0"; + bb += '0'; else bb += getLengthFromWidgets(bbox_->input_bb_y1, bbox_->choice_bb_units); diff --git a/src/frontends/xforms/FormPreferences.C b/src/frontends/xforms/FormPreferences.C index 302712e240..af881c7581 100644 --- a/src/frontends/xforms/FormPreferences.C +++ b/src/frontends/xforms/FormPreferences.C @@ -117,12 +117,12 @@ void FormPreferences::redraw() } -#if 0 +#if 0 void FormPreferences::ok() { FormBaseDeprecated::ok(); -// FIXME !! +// FIXME !! if (colors_.modifiedXformsPrefs) { string const filename = AddName(user_lyxdir, "preferences.xform"); @@ -131,7 +131,7 @@ void FormPreferences::ok() lv_.dispatch(FuncRequest(LFUN_SAVEPREFERENCES)); } -#endif +#endif @@ -269,9 +269,9 @@ void FormPreferences::apply() // machines. lyxerr << "apply in form !" << endl; - + LyXRC & rc(controller().rc()); - + colors_.apply(); formats_.apply(); // Must be before converters_.apply() converters_.apply(); @@ -325,7 +325,7 @@ ButtonPolicy::SMInput FormPreferences::input(FL_OBJECT * ob, long) lyx::Assert(ob); bool valid = true; - + // whatever checks you need to ensure the user hasn't entered // some totally ridiculous value somewhere. Change activate to suit. // comments before each test describe what is _valid_ @@ -357,7 +357,7 @@ void FormPreferences::update() if (!dialog_.get()) return; LyXRC const & rc(controller().rc()); - + // read lyxrc entries colors_.update(); formats_.update(); // Must be before converters_.update() @@ -907,7 +907,7 @@ string const FormPreferences::Colors::X11hexname(RGBColor const & col) const { ostringstream ostr; - ostr << "#" << std::setbase(16) << setfill('0') + ostr << '#' << std::setbase(16) << setfill('0') << setw(2) << col.r << setw(2) << col.g << setw(2) << col.b; @@ -1166,10 +1166,10 @@ void FormPreferences::Converters::UpdateChoices() const if (!choice.empty()) choice += " | "; else - choice += " "; + choice += ' '; choice += cit->prettyname(); } - choice += " "; + choice += ' '; fl_clear_choice(dialog_->choice_from); fl_addto_choice(dialog_->choice_from, choice.c_str()); diff --git a/src/frontends/xforms/FormRef.C b/src/frontends/xforms/FormRef.C index 672c24cfa1..2886040162 100644 --- a/src/frontends/xforms/FormRef.C +++ b/src/frontends/xforms/FormRef.C @@ -3,7 +3,7 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author Angus Leeming + * \author Angus Leeming * * Full author contact details are available in file CREDITS */ @@ -119,7 +119,7 @@ void FormRef::update() // create a string of entries " entry1 | entry2 | entry3 " // with which to initialise the xforms choice object. string const choice = - " " + getStringFromVector(buffers, " | ") + " "; + ' ' + getStringFromVector(buffers, " | ") + ' '; fl_clear_choice(dialog_->choice_document); fl_addto_choice(dialog_->choice_document, choice.c_str()); @@ -154,7 +154,7 @@ void updateHighlight(FL_OBJECT * browser, fl_select_browser_line(browser, i+1); } } - + } // namespace anon diff --git a/src/frontends/xforms/FormToc.C b/src/frontends/xforms/FormToc.C index 37d0704d36..58533cd87d 100644 --- a/src/frontends/xforms/FormToc.C +++ b/src/frontends/xforms/FormToc.C @@ -3,7 +3,7 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author Angus Leeming + * \author Angus Leeming * * Full author contact details are available in file CREDITS */ @@ -42,10 +42,10 @@ void FormToc::build() dialog_.reset(build_toc(this)); vector types = controller().getTypes(); - - + + string const choice = - " " + getStringFromVector(controller().getTypes(), " | ") + " "; + ' ' + getStringFromVector(controller().getTypes(), " | ") + ' '; fl_addto_choice(dialog_->choice_toc_type, choice.c_str()); // Manage the cancel/close button diff --git a/src/frontends/xforms/Menubar_pimpl.C b/src/frontends/xforms/Menubar_pimpl.C index 042ba49280..996558f41c 100644 --- a/src/frontends/xforms/Menubar_pimpl.C +++ b/src/frontends/xforms/Menubar_pimpl.C @@ -119,7 +119,7 @@ void Menubar::Pimpl::makeMenubar(Menu const & menu) continue; } string const label = i->label(); - string const shortcut = "#" + i->shortcut(); + string const shortcut = '#' + i->shortcut(); int const width = string_width(label); obj = fl_add_button(FL_MENU_BUTTON, air + moffset, yloc, @@ -228,7 +228,7 @@ int Menubar::Pimpl::create_submenu(Window win, XFormsView * view, } lyxerr[Debug::GUI] << "max_width=" << max_width << ", widest_label=`" << widest_label - << "'" << endl; + << '\'' << endl; // Compute where to put separators vector extra_labels(menu.size()); @@ -322,7 +322,7 @@ int Menubar::Pimpl::create_submenu(Window win, XFormsView * view, << "\", binding \"" << accel << "\", shortcut \"" << shortcut << "\" (added to menu" - << curmenuid << ")" << endl; + << curmenuid << ')' << endl; break; } diff --git a/src/frontends/xforms/Toolbar_pimpl.C b/src/frontends/xforms/Toolbar_pimpl.C index a0cce76e10..bbe3fe40ac 100644 --- a/src/frontends/xforms/Toolbar_pimpl.C +++ b/src/frontends/xforms/Toolbar_pimpl.C @@ -78,7 +78,7 @@ Toolbar::Pimpl::toolbarItem::operator=(toolbarItem const & ti) // If we already have an icon, release it. // But we don't copy the icon from ti kill_icon(); - + action = ti.action; return *this; @@ -124,7 +124,7 @@ void Toolbar::Pimpl::update() if (!p->icon) continue; - + FuncStatus const status = owner_->getLyXFunc().getStatus(p->action); if (status.onoff(true)) { // I'd like to use a different color @@ -250,7 +250,7 @@ void setPixmap(FL_OBJECT * obj, int action) { string xpm_name; FuncRequest ev = lyxaction.retrieveActionArg(action); - + string const name = lyxaction.getActionName(ev.action); if (!ev.argument.empty()) xpm_name = subst(name + ' ' + ev.argument, ' ','_'); @@ -263,15 +263,15 @@ void setPixmap(FL_OBJECT * obj, int action) string arg = ev.argument.substr(1); fullname = LibFileSearch("images/math/", arg, "xpm"); } - + if (!fullname.empty()) { lyxerr[Debug::GUI] << "Full icon name is `" - << fullname << "'" << endl; + << fullname << '\'' << endl; fl_set_pixmapbutton_file(obj, fullname.c_str()); return; } - lyxerr << "Unable to find icon `" << xpm_name << "'" << endl; + lyxerr << "Unable to find icon `" << xpm_name << '\'' << endl; fullname = LibFileSearch("images", "unknown", "xpm"); if (!fullname.empty()) { lyxerr[Debug::GUI] << "Using default `unknown' icon" @@ -289,7 +289,7 @@ void Toolbar::Pimpl::add(int action) toolbarItem item; item.action = action; - + switch (action) { case ToolbarDefaults::SEPARATOR: xpos += sepspace; @@ -340,6 +340,6 @@ void Toolbar::Pimpl::add(int action) */ break; } - + toollist_.push_back(item); } diff --git a/src/frontends/xforms/XMiniBuffer.C b/src/frontends/xforms/XMiniBuffer.C index 71c4380eb3..815d13c067 100644 --- a/src/frontends/xforms/XMiniBuffer.C +++ b/src/frontends/xforms/XMiniBuffer.C @@ -130,7 +130,7 @@ int XMiniBuffer::peek_event(FL_OBJECT * ob, int event, if (comp.empty()) { set_input(new_input); - show_info(("[only completion]"), new_input + " "); + show_info(_("[only completion]"), new_input + ' '); break; } @@ -223,7 +223,7 @@ void XMiniBuffer::show_info(string const & info, string const & input, bool appe stored_input_ = input; info_shown_ = true; if (append) - set_input(input + " " + info); + set_input(input + ' ' + info); else set_input(info); info_timer_->start(); @@ -293,7 +293,7 @@ void XMiniBuffer::set_complete_input(string const & str) if (!str.empty()) { // add a space so the user can type // an argument immediately - set_input(str + " "); + set_input(str + ' '); } } diff --git a/src/frontends/xforms/XWorkArea.C b/src/frontends/xforms/XWorkArea.C index b616c6aa7d..fcbcb84488 100644 --- a/src/frontends/xforms/XWorkArea.C +++ b/src/frontends/xforms/XWorkArea.C @@ -244,7 +244,7 @@ void XWorkArea::redraw(int width, int height) if (lyxerr.debugging(Debug::WORKAREA)) { lyxerr << "(Re)creating pixmap (" - << width << 'x' << height << ")" << endl; + << width << 'x' << height << ')' << endl; } if (workareapixmap) { @@ -417,10 +417,10 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event, string const stm = (tmp ? tmp : ""); string const stm2 = (tmp2 ? tmp2 : ""); - lyxerr[Debug::KEY] << "XWorkArea: Key is `" << stm << "' [" - << key << "]" << endl; - lyxerr[Debug::KEY] << "XWorkArea: Keysym is `" << stm2 << "' [" - << keysym << "]" << endl; + lyxerr[Debug::KEY] << "XWorkArea: Key is `" << stm + << "' [" << key << ']' << endl; + lyxerr[Debug::KEY] << "XWorkArea: Keysym is `" << stm2 + << "' [" << keysym << ']' << endl; } #if FL_VERSION < 1 && (FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5)) diff --git a/src/frontends/xforms/lyx_gui.C b/src/frontends/xforms/lyx_gui.C index 7713c52822..944e78dba3 100644 --- a/src/frontends/xforms/lyx_gui.C +++ b/src/frontends/xforms/lyx_gui.C @@ -275,8 +275,8 @@ void lyx_gui::start(string const & batch, vector const & files) if (ypos == -1) ypos = (HeightOfScreen(s) - height) / 2; - lyxerr[Debug::GUI] << "Creating view: " << width << "x" << height - << "+" << xpos << "+" << ypos << endl; + lyxerr[Debug::GUI] << "Creating view: " << width << 'x' << height + << '+' << xpos << '+' << ypos << endl; XFormsView view(width, height); view.show(xpos, ypos, "LyX"); @@ -340,7 +340,7 @@ string const lyx_gui::hexname(LColor::color col) if (XLookupColor(display, cmap, name.c_str(), &xcol, &ccol) == 0) { lyxerr << "X can't find color \"" << lcolor.getLyXName(col) - << "\"" << endl; + << '"' << endl; return string(); } diff --git a/src/frontends/xforms/xforms_helpers.C b/src/frontends/xforms/xforms_helpers.C index fab98d9d8d..66e227fd44 100644 --- a/src/frontends/xforms/xforms_helpers.C +++ b/src/frontends/xforms/xforms_helpers.C @@ -329,7 +329,7 @@ bool XformsColor::write(string const & filename) << "### file " << filename << "\n\n" << "### This file is written by LyX, if you want to make your own\n" << "### modifications you should do them from inside LyX and save\n" - << "\n"; + << '\n'; for (int i = 0; i < xformCount; ++i) { string const tag = xformTags[i].tag; @@ -338,8 +338,8 @@ bool XformsColor::write(string const & filename) fl_getmcolor(colorID, &color.r, &color.g, &color.b); - os << tag << " " - << color.r << " " << color.g << " " << color.b << "\n"; + os << tag << ' ' + << color.r << ' ' << color.g << ' ' << color.b << '\n'; } return true; diff --git a/src/frontends/xforms/xscreen.C b/src/frontends/xforms/xscreen.C index 40d72f3953..1e7957e4cb 100644 --- a/src/frontends/xforms/xscreen.C +++ b/src/frontends/xforms/xscreen.C @@ -191,8 +191,8 @@ void XScreen::hideCursor() void XScreen::expose(int x, int y, int w, int h) { - lyxerr[Debug::GUI] << "expose " << w << "x" << h - << "+" << x << "+" << y << endl; + lyxerr[Debug::GUI] << "expose " << w << 'x' << h + << '+' << x << '+' << y << endl; XCopyArea(fl_get_display(), owner_.getPixmap(), owner_.getWin(), diff --git a/src/graphics/GraphicsCacheItem.C b/src/graphics/GraphicsCacheItem.C index c84ad76d39..04646d3837 100644 --- a/src/graphics/GraphicsCacheItem.C +++ b/src/graphics/GraphicsCacheItem.C @@ -3,9 +3,9 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author Baruch Even - * \author Herbert Voss - * \author Angus Leeming + * \author Baruch Even + * \author Herbert Voss + * \author Angus Leeming * * Full author contact details are available in file CREDITS */ @@ -248,7 +248,7 @@ void CacheItem::Impl::setStatus(ImageStatus new_status) void CacheItem::Impl::imageConverted(bool success) { string const text = success ? "succeeded" : "failed"; - lyxerr[Debug::GRAPHICS] << "Image conversion " << text << "." << endl; + lyxerr[Debug::GRAPHICS] << "Image conversion " << text << '.' << endl; file_to_load_ = converter_.get() ? converter_->convertedFile() : string(); @@ -290,7 +290,7 @@ void CacheItem::Impl::loadImage() void CacheItem::Impl::imageLoaded(bool success) { string const text = success ? "succeeded" : "failed"; - lyxerr[Debug::GRAPHICS] << "Image loading " << text << "." << endl; + lyxerr[Debug::GRAPHICS] << "Image loading " << text << '.' << endl; // Clean up after loading. if (zipped_) diff --git a/src/graphics/GraphicsConverter.C b/src/graphics/GraphicsConverter.C index d03270b7d2..90235b4334 100644 --- a/src/graphics/GraphicsConverter.C +++ b/src/graphics/GraphicsConverter.C @@ -180,8 +180,8 @@ Converter::Impl::Impl(string const & from_file, string const & to_file_base, // We create a dummy command for ease of understanding of the // list of forked processes. // Note that 'sh ' is absolutely essential, or execvp will fail. - script_command_ = "sh " + script_file_ + " " + - OnlyFilename(from_file) + " " + to_format; + script_command_ = "sh " + script_file_ + ' ' + + OnlyFilename(from_file) + ' ' + to_format; } // All is ready to go valid_process_ = true; diff --git a/src/graphics/GraphicsImageXPM.C b/src/graphics/GraphicsImageXPM.C index 274803ea49..5f9595e7cc 100644 --- a/src/graphics/GraphicsImageXPM.C +++ b/src/graphics/GraphicsImageXPM.C @@ -157,7 +157,7 @@ void ImageXPM::load(string const & filename) lyxerr[Debug::GRAPHICS] << "Error reading XPM file '" - << XpmGetErrorString(success) << "'" + << XpmGetErrorString(success) << '\'' << std::endl; } else { image_.reset(*xpm_image); @@ -235,7 +235,7 @@ bool ImageXPM::setPixmap(Params const & params) if (status != XpmSuccess) { lyxerr << "Error creating pixmap from xpm_image '" - << XpmGetErrorString(status) << "'" + << XpmGetErrorString(status) << '\'' << std::endl; pixmap_status_ = PIXMAP_FAILED; return false; @@ -644,14 +644,14 @@ void mapcolor(char const * c_color, char ** g_color_ptr, char ** m_color_ptr) int const gray = int((0.32 * r) + (0.5 * g) + (0.18 * b)); ostringstream gray_stream; - gray_stream << "#" << std::setbase(16) << std::setfill('0') + gray_stream << '#' << std::setbase(16) << std::setfill('0') << std::setw(2) << gray << std::setw(2) << gray << std::setw(2) << gray; int const mono = (gray < 128) ? 0 : 255; ostringstream mono_stream; - mono_stream << "#" << std::setbase(16) << std::setfill('0') + mono_stream << '#' << std::setbase(16) << std::setfill('0') << std::setw(2) << mono << std::setw(2) << mono << std::setw(2) << mono; diff --git a/src/graphics/PreviewLoader.C b/src/graphics/PreviewLoader.C index 20f57bf299..3568c32bbc 100644 --- a/src/graphics/PreviewLoader.C +++ b/src/graphics/PreviewLoader.C @@ -257,7 +257,7 @@ struct IncrementedFileName { StrPair const operator()(string const & snippet) { ostringstream os; - os << base_ << counter_++ << "." << to_format_; + os << base_ << counter_++ << '.' << to_format_; string const file = STRCONV(os.str()); return make_pair(snippet, file); @@ -475,8 +475,8 @@ void PreviewLoader::Impl::startLoading() // The conversion command. ostringstream cs; - cs << pconverter_->command << " " << latexfile << " " - << int(font_scaling_factor_) << " " << pconverter_->to; + cs << pconverter_->command << ' ' << latexfile << ' ' + << int(font_scaling_factor_) << ' ' << pconverter_->to; string const command = "sh " + LibScriptSearch(STRCONV(cs.str())); @@ -591,7 +591,7 @@ void PreviewLoader::Impl::dumpPreamble(ostream & os) const os << "\\AtBeginDocument{\\AtBeginDvi{%\n" << "\\special{!userdict begin/bop-hook{//bop-hook exec\n" - << "<" << fg << bg << ">{255 div}forall setrgbcolor\n" + << '<' << fg << bg << ">{255 div}forall setrgbcolor\n" << "clippath fill setrgbcolor}bind def end}}}\n"; } diff --git a/src/insets/insetbib.C b/src/insets/insetbib.C index 427d37fc55..d6e2eb114b 100644 --- a/src/insets/insetbib.C +++ b/src/insets/insetbib.C @@ -115,7 +115,7 @@ string const InsetBibKey::getBibLabel() const string const InsetBibKey::getScreenLabel(Buffer const *) const { - return getContents() + " [" + getBibLabel() + "]"; + return getContents() + " [" + getBibLabel() + ']'; } @@ -303,7 +303,7 @@ bool InsetBibtex::addDatabase(string const & db) string contents(getContents()); if (!contains(contents, db)) { if (!contents.empty()) - contents += ","; + contents += ','; setContents(contents + db); return true; } diff --git a/src/insets/insetcaption.C b/src/insets/insetcaption.C index 2b478145d0..fc48276338 100644 --- a/src/insets/insetcaption.C +++ b/src/insets/insetcaption.C @@ -97,7 +97,7 @@ void InsetCaption::draw(BufferView * bv, LyXFont const & f, string const label = frm.str(); #else // Generate the label - string const label = _(fl) + " " + num + ":"; + string const label = _(fl) + ' ' + num + ':'; #endif Painter & pain = bv->painter(); int const w = font_metrics::width(label, f); diff --git a/src/insets/insetcite.C b/src/insets/insetcite.C index 1be81b58d2..24f2b12325 100644 --- a/src/insets/insetcite.C +++ b/src/insets/insetcite.C @@ -130,9 +130,9 @@ string const getNatbibLabel(Buffer const * buffer, // puctuation mark separating citation entries. char const * const sep = ";"; - string const op_str(string(1, ' ') + string(1, op)); - string const cp_str(string(1, cp) + string(1, ' ')); - string const sep_str(string(sep) + " "); + string const op_str(' ' + string(1, op)); + string const cp_str(string(1, cp) + ' '); + string const sep_str(string(sep) + ' '); string label; vector keys = getVectorFromString(keyList); @@ -214,7 +214,7 @@ string const getBasicLabel(string const & keyList, string const & after) if (contains(keys, ",")) { // Final comma allows while loop to cover all keys - keys = ltrim(split(keys, label, ',')) + ","; + keys = ltrim(split(keys, label, ',')) + ','; while (contains(keys, ",")) { string key; keys = ltrim(split(keys, key, ',')); @@ -226,7 +226,7 @@ string const getBasicLabel(string const & keyList, string const & after) if (!after.empty()) label += ", " + after; - return "[" + label + "]"; + return '[' + label + ']'; } } // anon namespace @@ -375,14 +375,14 @@ int InsetCitation::latex(Buffer const * buffer, ostream & os, string const before = string(); string const after = getOptions(); if (!before.empty() && buffer->params.use_natbib) - os << "[" << before << "][" << after << "]"; + os << '[' << before << "][" << after << ']'; else if (!after.empty()) - os << "[" << after << "]"; + os << '[' << after << ']'; #else // and the cleaned up equvalent, should it just be changed? (Lgb) string const after = getOptions(); if (!after.empty()) - os << "[" << after << "]"; + os << '[' << after << ']'; #endif string::const_iterator it = getContents().begin(); string::const_iterator end = getContents().end(); @@ -396,7 +396,7 @@ int InsetCitation::latex(Buffer const * buffer, ostream & os, content += *it; } - os << "{" << content << "}"; + os << '{' << content << '}'; return 0; } diff --git a/src/insets/insetcommandparams.C b/src/insets/insetcommandparams.C index cbbca4463b..b6a4c015c3 100644 --- a/src/insets/insetcommandparams.C +++ b/src/insets/insetcommandparams.C @@ -164,9 +164,9 @@ void InsetCommandParams::write(ostream & os) const string const InsetCommandParams::getCommand() const { string s; - if (!getCmdName().empty()) s += "\\"+getCmdName(); - if (!getOptions().empty()) s += "["+getOptions()+']'; - s += "{"+getContents()+'}'; + if (!getCmdName().empty()) s += '\\' + getCmdName(); + if (!getOptions().empty()) s += '[' + getOptions() + ']'; + s += '{' + getContents() + '}'; return s; } diff --git a/src/insets/insetexternal.C b/src/insets/insetexternal.C index ed22c53cdf..bd4ce0116b 100644 --- a/src/insets/insetexternal.C +++ b/src/insets/insetexternal.C @@ -122,15 +122,15 @@ void InsetExternal::read(Buffer const *, LyXLex & lex) } // Parse string format... - string::size_type const pos1 = format.find(","); + string::size_type const pos1 = format.find(','); params_.templ = ExternalTemplateManager::get().getTemplateByName(format.substr(0, pos1)); string::size_type const pos2 = format.find("\",\"", pos1); params_.filename = format.substr(pos1 + 2, pos2 - (pos1 + 2)); params_.parameters = format.substr(pos2 + 3, format.length() - (pos2 + 4)); lyxerr[Debug::INFO] << "InsetExternal::Read: " << params_.templ.lyxName - << " " << params_.filename - << " " << params_.parameters << endl; + << ' ' << params_.filename + << ' ' << params_.parameters << endl; } @@ -224,7 +224,7 @@ void InsetExternal::executeCommand(string const & s, Systemcall one; if (lyxerr.debugging()) { lyxerr << "Executing '" << s << "' in '" - << buffer->filePath() << "'" << endl; + << buffer->filePath() << '\'' << endl; } one.startscript(Systemcall::Wait, s); } diff --git a/src/insets/insetfloat.C b/src/insets/insetfloat.C index 75a6746df9..3c9c62784b 100644 --- a/src/insets/insetfloat.C +++ b/src/insets/insetfloat.C @@ -241,7 +241,7 @@ int InsetFloat::latex(Buffer const * buf, if (!floatPlacement_.empty() && floatPlacement_ != def_placement) { placement = floatPlacement_; - } else if (floatPlacement_.empty() + } else if (floatPlacement_.empty() && !buf_placement.empty() && buf_placement != def_placement) { placement = buf_placement; @@ -250,12 +250,12 @@ int InsetFloat::latex(Buffer const * buf, // The \n is used to force \begin{} to appear in a new line. // The % is needed to prevent two consecutive \n chars in the case // when the current output line is empty. - os << "%\n\\begin{" << tmptype << "}"; + os << "%\n\\begin{" << tmptype << '}'; // We only output placement if different from the def_placement. if (!placement.empty()) { - os << "[" << placement << "]"; + os << '[' << placement << ']'; } - os << "\n"; + os << '\n'; int const i = inset.latex(buf, os, fragile, fp); @@ -269,9 +269,9 @@ int InsetFloat::latex(Buffer const * buf, int InsetFloat::docbook(Buffer const * buf, ostream & os, bool mixcont) const { - os << "<" << floatType_ << ">"; + os << '<' << floatType_ << '>'; int const i = inset.docbook(buf, os, mixcont); - os << ""; + os << "'; return i; } @@ -326,7 +326,7 @@ void InsetFloat::wide(bool w, BufferParams const & bp) lab += floatname(floatType_, bp); if (wide_) - lab += "*"; + lab += '*'; setLabel(lab); } @@ -346,7 +346,7 @@ void InsetFloat::addToToc(toc::TocList & toclist, Buffer const * buf) const // Find a caption layout in one of the (child inset's) pars for (; pit != end; ++pit) { Paragraph * tmp = *pit; - + if (tmp->layout()->name() == caplayout) { string const str = tostr(toclist[type()].size() + 1) diff --git a/src/insets/insetgraphicsParams.C b/src/insets/insetgraphicsParams.C index ad012fd9fe..0a8af2c574 100644 --- a/src/insets/insetgraphicsParams.C +++ b/src/insets/insetgraphicsParams.C @@ -210,7 +210,7 @@ bool InsetGraphicsParams::Read(LyXLex & lex, string const & token) bb.erase(); for (int i = 0; i < 4; ++i) { if (i != 0) - bb += " "; + bb += ' '; lex.next(); bb += lex.getString(); } @@ -266,22 +266,22 @@ grfx::Params InsetGraphicsParams::as_grfxParams(string const & filepath) const unsigned int const bb_orig_xl = strToInt(token(tmp, ' ', 0)); unsigned int const bb_orig_yb = strToInt(token(tmp, ' ', 1)); - // new pars.bb values must be >= zero + // new pars.bb values must be >= zero if (pars.bb.xl > bb_orig_xl) pars.bb.xl -= bb_orig_xl; else pars.bb.xl = 0; - + if (pars.bb.xr > bb_orig_xl) pars.bb.xr -= bb_orig_xl; else pars.bb.xr = 0; - + if (pars.bb.yb > bb_orig_yb) pars.bb.yb -= bb_orig_yb; else pars.bb.yb = 0; - + if (pars.bb.yt > bb_orig_yb) pars.bb.yt -= bb_orig_yb; else @@ -299,13 +299,13 @@ grfx::Params InsetGraphicsParams::as_grfxParams(string const & filepath) const pars.bb.yt = 0; } } - + if (display == grfx::DefaultDisplay) { pars.display = lyxrc.display_graphics; } else { pars.display = display; } - + // Override the above if we're not using a gui if (!lyxrc.use_gui) { pars.display = grfx::NoDisplay; diff --git a/src/insets/insetlabel.C b/src/insets/insetlabel.C index bfc43de3a1..d83a926336 100644 --- a/src/insets/insetlabel.C +++ b/src/insets/insetlabel.C @@ -83,7 +83,7 @@ int InsetLabel::latex(Buffer const *, ostream & os, int InsetLabel::ascii(Buffer const *, ostream & os, int) const { - os << "<" << getContents() << ">"; + os << '<' << getContents() << '>'; return 0; } diff --git a/src/insets/insetlatexaccent.C b/src/insets/insetlatexaccent.C index ea82702696..708685b571 100644 --- a/src/insets/insetlatexaccent.C +++ b/src/insets/insetlatexaccent.C @@ -211,7 +211,7 @@ void InsetLatexAccent::checkContents() break; } //ic = (modtype == DOT_LESS_J ? 'j' : 'i'); - lyxerr[Debug::KEY] << "Contents: [" << contents << "]" + lyxerr[Debug::KEY] << "Contents: [" << contents << ']' << ", ic: " << ic << ", top: " << plusasc << ", bot: " << plusdesc @@ -251,7 +251,7 @@ void InsetLatexAccent::checkContents() if (contents[++i] != '}' && contents[++i]) return; // fine, the char is properly decoded now (hopefully) - lyxerr[Debug::KEY] << "Contents: [" << contents << "]" + lyxerr[Debug::KEY] << "Contents: [" << contents << ']' << ", ic: " << ic << ", top: " << plusasc << ", bot: " << plusdesc diff --git a/src/insets/insetminipage.C b/src/insets/insetminipage.C index a4057dbfbd..1a748d8084 100644 --- a/src/insets/insetminipage.C +++ b/src/insets/insetminipage.C @@ -109,9 +109,9 @@ InsetMinipage::~InsetMinipage() void InsetMinipage::write(Buffer const * buf, ostream & os) const { - os << getInsetName() << "\n" - << "position " << pos_ << "\n" - << "inner_position " << inner_pos_ << "\n" + os << getInsetName() << '\n' + << "position " << pos_ << '\n' + << "inner_position " << inner_pos_ << '\n' << "height \"" << height_.asString() << "\"\n" << "width \"" << width_.asString() << "\"\n"; InsetCollapsable::write(buf, os); @@ -236,13 +236,13 @@ int InsetMinipage::latex(Buffer const * buf, string s_pos; switch (pos_) { case top: - s_pos += "t"; + s_pos += 't'; break; case center: - s_pos += "c"; + s_pos += 'c'; break; case bottom: - s_pos += "b"; + s_pos += 'b'; break; } os << "\\begin{minipage}[" << s_pos << "]{" diff --git a/src/insets/insetquotes.C b/src/insets/insetquotes.C index 1403f21a64..3fb7beda0c 100644 --- a/src/insets/insetquotes.C +++ b/src/insets/insetquotes.C @@ -176,9 +176,9 @@ string const InsetQuotes::dispString(Language const * loclang) const // in french, spaces are added inside double quotes if (times_ == DoubleQ && prefixIs(loclang->code(), "fr")) { if (side_ == LeftQ) - disp += " "; + disp += ' '; else - disp = " " + disp; + disp = ' ' + disp; } return disp; @@ -314,14 +314,14 @@ int InsetQuotes::latex(Buffer const * buf, ostream & os, int InsetQuotes::ascii(Buffer const *, ostream & os, int) const { - os << "\""; + os << '"'; return 0; } int InsetQuotes::linuxdoc(Buffer const *, ostream & os) const { - os << "\""; + os << '"'; return 0; } diff --git a/src/insets/insetref.C b/src/insets/insetref.C index e8e401473f..c899d8de94 100644 --- a/src/insets/insetref.C +++ b/src/insets/insetref.C @@ -79,7 +79,7 @@ int InsetRef::latex(Buffer const *, ostream & os, int InsetRef::ascii(Buffer const *, ostream & os, int) const { - os << "[" << getContents() << "]"; + os << '[' << getContents() << ']'; return 0; } diff --git a/src/insets/insetspecialchar.C b/src/insets/insetspecialchar.C index ce473a29f2..79956b56d3 100644 --- a/src/insets/insetspecialchar.C +++ b/src/insets/insetspecialchar.C @@ -96,21 +96,21 @@ void InsetSpecialChar::draw(BufferView * bv, LyXFont const & f, case HYPHENATION: { font.setColor(LColor::special); - pain.text(int(x), baseline, "-", font); + pain.text(int(x), baseline, '-', font); x += width(bv, font); break; } case LIGATURE_BREAK: { font.setColor(LColor::special); - pain.text(int(x), baseline, "|", font); + pain.text(int(x), baseline, '|', font); x += width(bv, font); break; } case END_OF_SENTENCE: { font.setColor(LColor::special); - pain.text(int(x), baseline, ".", font); + pain.text(int(x), baseline, '.', font); x += width(bv, font); break; } @@ -235,7 +235,7 @@ int InsetSpecialChar::latex(Buffer const *, ostream & os, bool /*fragile*/, os << "\\lyxarrow{}"; break; case PROTECTED_SEPARATOR: - os << (free_space ? " " : "~"); + os << (free_space ? ' ' : '~'); break; } return 0; @@ -249,7 +249,7 @@ int InsetSpecialChar::ascii(Buffer const *, ostream & os, int) const case LIGATURE_BREAK: break; case END_OF_SENTENCE: - os << "."; + os << '.'; break; case LDOTS: os << "..."; @@ -258,7 +258,7 @@ int InsetSpecialChar::ascii(Buffer const *, ostream & os, int) const os << "->"; break; case PROTECTED_SEPARATOR: - os << " "; + os << ' '; break; } return 0; @@ -272,7 +272,7 @@ int InsetSpecialChar::linuxdoc(Buffer const *, ostream & os) const case LIGATURE_BREAK: break; case END_OF_SENTENCE: - os << "."; + os << '.'; break; case LDOTS: os << "..."; @@ -295,7 +295,7 @@ int InsetSpecialChar::docbook(Buffer const *, ostream & os, bool) const case LIGATURE_BREAK: break; case END_OF_SENTENCE: - os << "."; + os << '.'; break; case LDOTS: os << "..."; diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 8b335ffc37..f5ab4e26c4 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -1704,10 +1704,10 @@ int InsetText::docbook(Buffer const * buf, ostream & os, bool mixcont) const desc_on = (style->labeltype == LABEL_MANUAL); - environment_inner[depth] = desc_on?"varlistentry":"listitem"; + environment_inner[depth] = desc_on ? "varlistentry" : "listitem"; lines += sgml::openTag(os, depth + 1 + command_depth, mixcont, environment_inner[depth]); - item_name = desc_on?"term":"para"; + item_name = desc_on ? "term" : "para"; lines += sgml::openTag(os, depth + 1 + command_depth, mixcont, item_name); break; diff --git a/src/insets/inseturl.C b/src/insets/inseturl.C index 46678467db..37c8c41b51 100644 --- a/src/insets/inseturl.C +++ b/src/insets/inseturl.C @@ -51,7 +51,7 @@ string const InsetUrl::getScreenLabel(Buffer const *) const temp = _("HtmlUrl: "); string url; - + if (!getOptions().empty()) url += getOptions(); else @@ -81,16 +81,16 @@ int InsetUrl::latex(Buffer const *, ostream & os, int InsetUrl::ascii(Buffer const *, ostream & os, int) const { if (getOptions().empty()) - os << "[" << getContents() << "]"; + os << '[' << getContents() << ']'; else - os << "[" << getContents() << "||" << getOptions() << "]"; + os << '[' << getContents() << "||" << getOptions() << ']'; return 0; } int InsetUrl::linuxdoc(Buffer const *, ostream & os) const { - os << "<" << getCmdName() + os << '<' << getCmdName() << " url=\"" << getContents() << "\"" << " name=\"" << getOptions() << "\">"; diff --git a/src/insets/insetwrap.C b/src/insets/insetwrap.C index 47c2f17255..43dc8afd50 100644 --- a/src/insets/insetwrap.C +++ b/src/insets/insetwrap.C @@ -148,11 +148,11 @@ string const InsetWrap::editMessage() const int InsetWrap::latex(Buffer const * buf, ostream & os, bool fragile, bool fp) const { - os << "\\begin{floating" << Type_ << "}"; + os << "\\begin{floating" << Type_ << '}'; if (!Placement_.empty()) { - os << "[" << Placement_ << "]"; + os << '[' << Placement_ << ']'; } - os << "{" << width_.asLatexString() << "}%\n"; + os << '{' << width_.asLatexString() << "}%\n"; int const i = inset.latex(buf, os, fragile, fp); @@ -163,9 +163,9 @@ int InsetWrap::latex(Buffer const * buf, int InsetWrap::docbook(Buffer const * buf, ostream & os, bool mixcont) const { - os << "<" << Type_ << ">"; + os << '<' << Type_ << '>'; int const i = inset.docbook(buf, os, mixcont); - os << ""; + os << "'; return i; } @@ -177,12 +177,13 @@ bool InsetWrap::insetAllowed(Inset::Code code) const case FLOAT_CODE: case FOOT_CODE: case MARGIN_CODE: - return false; + return false; default: return InsetCollapsable::insetAllowed(code); } } + int InsetWrap::getMaxWidth(BufferView * bv, UpdatableInset const * inset) const { @@ -191,8 +192,8 @@ int InsetWrap::getMaxWidth(BufferView * bv, UpdatableInset const * inset) return -1; } if (!width_.zero()) { - int ww1 = latexTextWidth(bv); - int ww2 = InsetCollapsable::getMaxWidth(bv, inset); + int const ww1 = latexTextWidth(bv); + int const ww2 = InsetCollapsable::getMaxWidth(bv, inset); if (ww2 > 0 && ww2 < ww1) { return ww2; } diff --git a/src/ispell.C b/src/ispell.C index 4159334427..9ac2625b50 100644 --- a/src/ispell.C +++ b/src/ispell.C @@ -19,7 +19,7 @@ #include #include -// FIXME: do we need any of this horrible gook ? +// FIXME: do we need any of this horrible gook ? #if TIME_WITH_SYS_TIME # include # include @@ -74,7 +74,7 @@ public: int * in, int * out) : params(p), lang(l), pipein(in), pipeout(out) {} /// - virtual ForkedProcess * clone() const { + virtual ForkedProcess * clone() const { return new LaunchIspell(*this); } /// @@ -99,7 +99,7 @@ int LaunchIspell::start() int LaunchIspell::generateChild() -{ +{ isp_pid = fork(); if (isp_pid != 0) { @@ -154,7 +154,7 @@ int LaunchIspell::generateChild() string("-w").copy(tmp, 2); tmp[2] = '\0'; argv[argc++] = tmp; // Put the escape chars in ""s - string tms = "\"" + lyxrc.isp_esc_chars + "\""; + string tms = '"' + lyxrc.isp_esc_chars + '"'; tmp = new char[tms.length() + 1]; tms.copy(tmp, tms.length()); tmp[tms.length()] = '\0'; argv[argc++] = tmp; @@ -251,7 +251,7 @@ ISpell::ISpell(BufferParams const & params, string const & lang) // Actually I used it to tell if it's truly Ispell or if it's // aspell -- (kevinatk@home.com) // But no code actually used the results for anything useful - // so I removed it again. Perhaps we can remove this code too. + // so I removed it again. Perhaps we can remove this code too. // - jbl char buf[2048]; fd_set infds; @@ -348,7 +348,7 @@ enum ISpell::Result ISpell::check(WordLangTuple const & word) // FIXME Please rewrite to use string. Result res; - + ::fputs(word.word().c_str(), out); ::fputc('\n', out); diff --git a/src/kbmap.C b/src/kbmap.C index 3d86b2c74c..64b3ed9913 100644 --- a/src/kbmap.C +++ b/src/kbmap.C @@ -45,7 +45,7 @@ string::size_type kb_keymap::bind(string const & seq, int action) if (lyxerr.debugging(Debug::KBMAP)) { lyxerr << "BIND: Sequence `" << seq << "' Action `" - << action << "'" << endl; + << action << '\'' << endl; } kb_sequence k(0, 0); @@ -77,7 +77,7 @@ int kb_keymap::lookup(LyXKeySymPtr key, key_modifier::state mask(cit->mod.second); key_modifier::state check = static_cast(mod & ~mask); - + if (*(cit->code) == *key && cit->mod.first == check) { // match found if (cit->table.get()) { @@ -177,9 +177,9 @@ string const kb_keymap::findbinding(int act, string const & prefix) const res += cit->table->findbinding(act, prefix + printKey((*cit)) - + " "); + + ' '); } else if (cit->action == act) { - res += "["; + res += '['; res += prefix + printKey((*cit)); res += "] "; } diff --git a/src/lyx_cb.C b/src/lyx_cb.C index 354f54ca31..757487b531 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -342,9 +342,9 @@ void AutoSave(BufferView * bv) // create autosave filename string fname = bv->buffer()->filePath(); - fname += "#"; + fname += '#'; fname += OnlyFilename(bv->buffer()->fileName()); - fname += "#"; + fname += '#'; AutoSaveBuffer autosave(*bv, fname); autosave.start(); @@ -491,7 +491,7 @@ void MenuInsertLabel(BufferView * bv, string const & arg) if (layout->latexname() == "theorem") text = "thm"; // Create a correct prefix for prettyref - text += ":"; + text += ':'; if (layout->latextype == LATEX_PARAGRAPH || lyxrc.label_init_length < 0) text.erase(); diff --git a/src/lyx_main.C b/src/lyx_main.C index 64ca76e3c9..b20b2aee64 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -136,7 +136,7 @@ LyX::LyX(int & argc, char * argv[]) // Execute batch commands if available if (!batch_command.empty()) { lyxerr[Debug::INIT] << "About to handle -x '" - << batch_command << "'" << endl; + << batch_command << '\'' << endl; Buffer * last_loaded = 0; @@ -886,7 +886,7 @@ int parse_import(string const & type, string const & file) exit(1); } - batch = "buffer-import " + type + " " + file; + batch = "buffer-import " + type + ' ' + file; return 2; } diff --git a/src/lyx_sty.C b/src/lyx_sty.C index 94078b90ff..9319529246 100644 --- a/src/lyx_sty.C +++ b/src/lyx_sty.C @@ -120,5 +120,5 @@ string const mathcircumflex_def = "\\newcommand{\\mathcircumflex}[0]{\\mbox{\\^{}}}\n"; string const tabularnewline_def = - "%% Because html converters don't know tabularnewline\n" - "\\providecommand{\\tabularnewline}{\\\\}\n"; + "%% Because html converters don't know tabularnewline\n" + "\\providecommand{\\tabularnewline}{\\\\}\n"; diff --git a/src/lyxcursor.h b/src/lyxcursor.h index 8c78d9f5d4..1d75d1e32a 100644 --- a/src/lyxcursor.h +++ b/src/lyxcursor.h @@ -19,7 +19,7 @@ class Paragraph; class Row; -/** +/** * The cursor class describes the position of a cursor within a document. * Several cursors exist within LyX; for example, when locking an inset, * the position of the cursor in the containing inset is stored. @@ -66,7 +66,7 @@ public: * blah blah blah blah blah blah * * When we move onto row 3, we would like to be vertically aligned - * with where we were in row 1, despite the fact that row 2 is + * with where we were in row 1, despite the fact that row 2 is * shorter than x() */ int x_fix() const; @@ -121,7 +121,7 @@ private: bool boundary_; /// the pixel x position int x_; - /// the stored next-row x position + /// the stored next-row x position int ix_; /// the cached x position int x_fix_; @@ -131,7 +131,7 @@ private: int iy_; /// the containing row Row * row_; - /// the containing row for the next line + /// the containing row for the next line Row * irow_; }; diff --git a/src/lyxfont.C b/src/lyxfont.C index 5c3da3a316..401b148acc 100644 --- a/src/lyxfont.C +++ b/src/lyxfont.C @@ -947,7 +947,7 @@ int LyXFont::latexWriteEndChanges(ostream & os, LyXFont const & base, } if (language() != base.language() && language() != next.language()) { - os << "}"; + os << '}'; ++count; } diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 319f418e4a..179156e157 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -179,7 +179,7 @@ void LyXFunc::processKeySym(LyXKeySymPtr keysym, cancel_meta_seq.reset(); int action = cancel_meta_seq.addkey(keysym, state); - lyxerr[Debug::KEY] << "action first set to [" << action << "]" << endl; + lyxerr[Debug::KEY] << "action first set to [" << action << ']' << endl; // When not cancel or meta-fake, do the normal lookup. // Note how the meta_fake Mod1 bit is OR-ed in and reset afterwards. @@ -188,7 +188,7 @@ void LyXFunc::processKeySym(LyXKeySymPtr keysym, // remove Caps Lock and Mod2 as a modifiers action = keyseq.addkey(keysym, (state | meta_fake_bit)); lyxerr[Debug::KEY] << "action now set to [" - << action << "]" << endl; + << action << ']' << endl; } // Dont remove this unless you know what you are doing. @@ -202,7 +202,7 @@ void LyXFunc::processKeySym(LyXKeySymPtr keysym, if (lyxerr.debugging(Debug::KEY)) { lyxerr << "Key [action=" << action << "][" - << keyseq.print() << "]" + << keyseq.print() << ']' << endl; } @@ -221,7 +221,7 @@ void LyXFunc::processKeySym(LyXKeySymPtr keysym, lyxerr[Debug::KEY] << "Removing modifiers...\n" << "Action now set to [" - << action << "]" << endl; + << action << ']' << endl; if (action == LFUN_UNKNOWN_ACTION) { owner->message(_("Unknown function.")); @@ -674,9 +674,15 @@ void LyXFunc::dispatch(string const & s, bool verbose) int const action = lyxaction.LookupFunc(s); if (action == LFUN_UNKNOWN_ACTION) { +#if USE_BOOST_FORMAT +boost::format fmt(_("Unknown function (%1$s)")); +fmt % s; +owner->message(fmt.str()); +#else string const msg = string(_("Unknown function (")) - + s + ")"; + + s + ')'; owner->message(msg); +#endif return; } @@ -694,7 +700,7 @@ void LyXFunc::dispatch(int ac, bool verbose) void LyXFunc::dispatch(FuncRequest const & ev, bool verbose) { lyxerr[Debug::ACTION] << "LyXFunc::dispatch: action[" << ev.action - <<"] arg[" << ev.argument << "]" << endl; + <<"] arg[" << ev.argument << ']' << endl; // we have not done anything wrong yet. errorstat = false; @@ -1283,7 +1289,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose) Paragraph * par = owner->buffer()->getParFromID(id); if (par == 0) { lyxerr[Debug::INFO] << "No matching paragraph found! [" - << id << "]" << endl; + << id << ']' << endl; break; } else { lyxerr[Debug::INFO] << "Paragraph " << par->id() @@ -1533,7 +1539,7 @@ void LyXFunc::sendDispatchMessage(string const & msg, FuncRequest const & ev, bo string dispatch_msg = msg; if (!dispatch_msg.empty()) - dispatch_msg += " "; + dispatch_msg += ' '; string comname = lyxaction.getActionName(ev.action); @@ -1547,7 +1553,7 @@ void LyXFunc::sendDispatchMessage(string const & msg, FuncRequest const & ev, bo if (pseudoaction == LFUN_UNKNOWN_ACTION) { pseudoaction = ev.action; } else { - comname += " " + ev.argument; + comname += ' ' + ev.argument; argsadded = true; } } @@ -1557,12 +1563,12 @@ void LyXFunc::sendDispatchMessage(string const & msg, FuncRequest const & ev, bo if (!shortcuts.empty()) { comname += ": " + shortcuts; } else if (!argsadded && !ev.argument.empty()) { - comname += " " + ev.argument; + comname += ' ' + ev.argument; } if (!comname.empty()) { comname = rtrim(comname); - dispatch_msg += "(" + comname + ')'; + dispatch_msg += '(' + comname + ')'; } lyxerr[Debug::ACTION] << "verbose dispatch msg " << dispatch_msg << endl; @@ -1761,7 +1767,7 @@ void LyXFunc::doImport(string const & argument) string const extension = "*." + formats.extension(format) + "| " + formats.prettyName(format) - + " (*." + formats.extension(format) + ")"; + + " (*." + formats.extension(format) + ')'; FileDialog::Result result = fileDlg.open(initpath, extension); diff --git a/src/lyxgluelength.C b/src/lyxgluelength.C index ae56a83268..d153dc3dcd 100644 --- a/src/lyxgluelength.C +++ b/src/lyxgluelength.C @@ -52,7 +52,7 @@ string const LyXGlueLength::asString() const if (minus_.zero()) { if (len_.unit() != plus_.unit()) buffer << unit_name[len_.unit()]; - buffer << "+" << plus_.value(); + buffer << '+' << plus_.value(); buffer << unit_name[plus_.unit()]; return STRCONV(buffer.str()); } @@ -61,7 +61,7 @@ string const LyXGlueLength::asString() const if (plus_.zero()) { if (len_.unit() != minus_.unit()) buffer << unit_name[len_.unit()]; - buffer << "-" << minus_.value(); + buffer << '-' << minus_.value(); buffer << unit_name[minus_.unit()]; return STRCONV(buffer.str()); } @@ -80,8 +80,8 @@ string const LyXGlueLength::asString() const // this is so rare a case, why bother minimising units ? buffer << unit_name[len_.unit()]; - buffer << "+" << plus_.value() << unit_name[plus_.unit()]; - buffer << "-" << minus_.value() << unit_name[minus_.unit()]; + buffer << '+' << plus_.value() << unit_name[plus_.unit()]; + buffer << '-' << minus_.value() << unit_name[minus_.unit()]; return STRCONV(buffer.str()); } diff --git a/src/lyxlayout.C b/src/lyxlayout.C index 0848e20bd6..0a95c43811 100644 --- a/src/lyxlayout.C +++ b/src/lyxlayout.C @@ -121,7 +121,7 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) { "alignpossible", LT_ALIGNPOSSIBLE }, { "bottomsep", LT_BOTTOMSEP }, { "copystyle", LT_COPYSTYLE }, - { "dependson", LT_DEPENDSON }, + { "dependson", LT_DEPENDSON }, { "end", LT_END }, { "endlabelstring", LT_ENDLABELSTRING }, { "endlabeltype", LT_ENDLABELTYPE }, @@ -221,7 +221,7 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) if (obsoleted_by().empty()) obsoleted_by_ = style; } else { - lyxerr << "Cannot replace with unknown style `" << style << "'" << endl; + lyxerr << "Cannot replace with unknown style `" << style << '\'' << endl; //lexrc.printError("Cannot replace with" // " unknown style " @@ -230,7 +230,7 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) } break; - case LT_DEPENDSON: + case LT_DEPENDSON: if (lexrc.next()) { depends_on_ = lexrc.getString(); } @@ -249,10 +249,10 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) break; case LT_OPTARGS: - if (lexrc.next()) { + if (lexrc.next()) { optionalargs = lexrc.getInteger(); } - break; + break; case LT_NEED_PROTECT: needprotect = lexrc.next() && lexrc.getInteger(); diff --git a/src/lyxlength.C b/src/lyxlength.C index 2e16c84ed3..ff1b580c09 100644 --- a/src/lyxlength.C +++ b/src/lyxlength.C @@ -62,27 +62,27 @@ string const LyXLength::asLatexString() const ostringstream buffer; switch (unit_) { case PTW: - buffer << abs(static_cast(val_/100)) << "." + buffer << abs(static_cast(val_/100)) << '.' << abs(static_cast(val_)%100) << "\\textwidth"; break; case PCW: - buffer << abs(static_cast(val_/100)) << "." + buffer << abs(static_cast(val_/100)) << '.' << abs(static_cast(val_)%100) << "\\columnwidth"; break; case PPW: - buffer << abs(static_cast(val_/100)) << "." + buffer << abs(static_cast(val_/100)) << '.' << abs(static_cast(val_)%100) << "\\paperwidth"; break; case PLW: - buffer << abs(static_cast(val_/100)) << "." + buffer << abs(static_cast(val_/100)) << '.' << abs(static_cast(val_)%100) << "\\linewidth"; break; case PPH: - buffer << abs(static_cast(val_/100)) << "." + buffer << abs(static_cast(val_/100)) << '.' << abs(static_cast(val_)%100) << "\\paperheight"; break; case PTH: - buffer << abs(static_cast(val_/100)) << "." + buffer << abs(static_cast(val_/100)) << '.' << abs(static_cast(val_)%100) << "\\textheight"; break; default: diff --git a/src/lyxlex_pimpl.C b/src/lyxlex_pimpl.C index a4e71bee93..4bca54ed31 100644 --- a/src/lyxlex_pimpl.C +++ b/src/lyxlex_pimpl.C @@ -172,7 +172,7 @@ bool LyXLex::Pimpl::next(bool esc /* = false */) #if 1 is.getline(buff, sizeof(buff)); lyxerr[Debug::LYXLEX] << "Comment read: `" << c - << buff << "'" << endl; + << buff << '\'' << endl; #else // unfortunately ignore is buggy (Lgb) is.ignore(100, '\n'); @@ -288,7 +288,7 @@ bool LyXLex::Pimpl::next(bool esc /* = false */) #if 1 is.getline(buff, sizeof(buff)); lyxerr[Debug::LYXLEX] << "Comment read: `" << c - << buff << "'" << endl; + << buff << '\'' << endl; #else // but ignore is also still buggy (Lgb) // This is fast (Lgb) @@ -408,7 +408,7 @@ bool LyXLex::Pimpl::eatLine() is.get(cc); c = cc; //lyxerr[Debug::LYXLEX] << "LyXLex::EatLine read char: `" - // << c << "'" << endl; + // << c << '\'' << endl; if (c != '\r') buff[i++] = c; } diff --git a/src/lyxrc.C b/src/lyxrc.C index cc25842280..81b5ab8547 100644 --- a/src/lyxrc.C +++ b/src/lyxrc.C @@ -1138,26 +1138,26 @@ void LyXRC::output(ostream & os) const os << "# Set to false to inhibit automatic replacement of\n" << "# the current selection.\n" << "\\auto_region_delete " << tostr(auto_region_delete) - << "\n"; + << '\n'; } case RC_AUTORESET_OPTIONS: if (auto_reset_options != system_lyxrc.auto_reset_options) { os << "# Set to false to inhibit automatic reset of\n" << "# the class options to defaults on class change.\n" << "\\auto_reset_options " << tostr(auto_reset_options) - << "\n"; + << '\n'; } case RC_AUTOSAVE: if (autosave != system_lyxrc.autosave) { os << "# The time interval between auto-saves in seconds.\n" - << "\\autosave " << autosave << "\n"; + << "\\autosave " << autosave << '\n'; } case RC_DISPLAY_GRAPHICS: if (display_graphics != system_lyxrc.display_graphics) { os << "# Display graphics within LyX\n" << "# monochrome|grayscale|color|none\n" << "\\display_graphics " << grfx::displayTranslator.find(display_graphics) - << "\n"; + << '\n'; } case RC_VIEWDVI_PAPEROPTION: @@ -1202,7 +1202,7 @@ void LyXRC::output(ostream & os) const } case RC_KBMAP: if (use_kbmap != system_lyxrc.use_kbmap) { - os << "\\kbmap " << tostr(use_kbmap) << "\n"; + os << "\\kbmap " << tostr(use_kbmap) << '\n'; } case RC_KBMAP_PRIMARY: if (primary_kbmap != system_lyxrc.primary_kbmap) { @@ -1225,30 +1225,30 @@ void LyXRC::output(ostream & os) const case RC_LABEL_INIT_LENGTH: if (label_init_length != system_lyxrc.label_init_length) { os << "\\label_init_length " << label_init_length - << "\n"; + << '\n'; } case RC_SHOW_BANNER: if (show_banner != system_lyxrc.show_banner) { - os << "\\show_banner " << tostr(show_banner) << "\n"; + os << "\\show_banner " << tostr(show_banner) << '\n'; } case RC_PREVIEW: if (preview != system_lyxrc.preview) { - os << "\\preview " << tostr(preview) << "\n"; + os << "\\preview " << tostr(preview) << '\n'; } case RC_PREVIEW_HASHED_LABELS: if (preview_hashed_labels != system_lyxrc.preview_hashed_labels) { os << "\\preview_hashed_labels " - << tostr(preview_hashed_labels) << "\n"; + << tostr(preview_hashed_labels) << '\n'; } case RC_PREVIEW_SCALE_FACTOR: if (preview_scale_factor != system_lyxrc.preview_scale_factor) { os << "\\preview_scale_factor " - << preview_scale_factor << "\n"; + << preview_scale_factor << '\n'; } os << "\n#\n" @@ -1272,27 +1272,27 @@ void LyXRC::output(ostream & os) const } case RC_SCREEN_DPI: if (dpi != system_lyxrc.dpi) { - os << "\\screen_dpi " << dpi << "\n"; + os << "\\screen_dpi " << dpi << '\n'; } case RC_SCREEN_ZOOM: if (zoom != system_lyxrc.zoom) { - os << "\\screen_zoom " << zoom << "\n"; + os << "\\screen_zoom " << zoom << '\n'; } case RC_WHEEL_JUMP: if (wheel_jump != system_lyxrc.wheel_jump) { - os << "\\wheel_jump " << wheel_jump << "\n"; + os << "\\wheel_jump " << wheel_jump << '\n'; } case RC_CURSOR_FOLLOWS_SCROLLBAR: if (cursor_follows_scrollbar != system_lyxrc.cursor_follows_scrollbar) { os << "\\cursor_follows_scrollbar " - << tostr(cursor_follows_scrollbar) << "\n"; + << tostr(cursor_follows_scrollbar) << '\n'; } case RC_DIALOGS_ICONIFY_WITH_MAIN: if (dialogs_iconify_with_main != system_lyxrc.dialogs_iconify_with_main) { os << "\\dialogs_iconify_with_main " - << tostr(dialogs_iconify_with_main) << "\n"; + << tostr(dialogs_iconify_with_main) << '\n'; } case RC_SCREEN_FONT_ROMAN: if (roman_font_name != system_lyxrc.roman_font_name) { @@ -1313,7 +1313,7 @@ void LyXRC::output(ostream & os) const if (use_scalable_fonts != system_lyxrc.use_scalable_fonts) { os << "\\screen_font_scalable " << tostr(use_scalable_fonts) - << "\n"; + << '\n'; } case RC_SCREEN_FONT_ENCODING: if (font_norm != system_lyxrc.font_norm) { @@ -1344,17 +1344,17 @@ void LyXRC::output(ostream & os) const os.setf(ios::fixed); os.precision(2); os << "\\screen_font_sizes" - << " " << font_sizes[LyXFont::SIZE_TINY] - << " " << font_sizes[LyXFont::SIZE_SCRIPT] - << " " << font_sizes[LyXFont::SIZE_FOOTNOTE] - << " " << font_sizes[LyXFont::SIZE_SMALL] - << " " << font_sizes[LyXFont::SIZE_NORMAL] - << " " << font_sizes[LyXFont::SIZE_LARGE] - << " " << font_sizes[LyXFont::SIZE_LARGER] - << " " << font_sizes[LyXFont::SIZE_LARGEST] - << " " << font_sizes[LyXFont::SIZE_HUGE] - << " " << font_sizes[LyXFont::SIZE_HUGER] - << "\n"; + << ' ' << font_sizes[LyXFont::SIZE_TINY] + << ' ' << font_sizes[LyXFont::SIZE_SCRIPT] + << ' ' << font_sizes[LyXFont::SIZE_FOOTNOTE] + << ' ' << font_sizes[LyXFont::SIZE_SMALL] + << ' ' << font_sizes[LyXFont::SIZE_NORMAL] + << ' ' << font_sizes[LyXFont::SIZE_LARGE] + << ' ' << font_sizes[LyXFont::SIZE_LARGER] + << ' ' << font_sizes[LyXFont::SIZE_LARGEST] + << ' ' << font_sizes[LyXFont::SIZE_HUGE] + << ' ' << font_sizes[LyXFont::SIZE_HUGER] + << '\n'; } os << "\n#\n" @@ -1385,7 +1385,7 @@ void LyXRC::output(ostream & os) const if (print_adapt_output != system_lyxrc.print_adapt_output) { os << "\\print_adapt_output " << tostr(print_adapt_output) - << "\n"; + << '\n'; } case RC_PRINT_COMMAND: if (print_command != system_lyxrc.print_command) { @@ -1512,12 +1512,12 @@ void LyXRC::output(ostream & os) const } case RC_NUMLASTFILES: if (num_lastfiles != system_lyxrc.num_lastfiles) { - os << "\\num_lastfiles " << num_lastfiles << "\n"; + os << "\\num_lastfiles " << num_lastfiles << '\n'; } case RC_CHECKLASTFILES: if (check_lastfiles != system_lyxrc.check_lastfiles) { os << "\\check_lastfiles " << tostr(check_lastfiles) - << "\n"; + << '\n'; } case RC_TEMPLATEPATH: if (template_path != system_lyxrc.template_path) { @@ -1529,15 +1529,15 @@ void LyXRC::output(ostream & os) const } case RC_USETEMPDIR: if (use_tempdir != system_lyxrc.use_tempdir) { - os << "\\use_tempdir " << tostr(use_tempdir) << "\n"; + os << "\\use_tempdir " << tostr(use_tempdir) << '\n'; } case RC_ASCII_LINELEN: if (ascii_linelen != system_lyxrc.ascii_linelen) { - os << "\\ascii_linelen " << ascii_linelen << "\n"; + os << "\\ascii_linelen " << ascii_linelen << '\n'; } case RC_MAKE_BACKUP: if (make_backup != system_lyxrc.make_backup) { - os << "\\make_backup " << tostr(make_backup) << "\n"; + os << "\\make_backup " << tostr(make_backup) << '\n'; } case RC_BACKUPDIR_PATH: if (backupdir_path != system_lyxrc.backupdir_path) { @@ -1560,7 +1560,7 @@ void LyXRC::output(ostream & os) const #ifdef USE_PSPELL case RC_USE_PSPELL: if (use_pspell != system_lyxrc.use_pspell) { - os << "\\use_pspell " << tostr(use_pspell) << "\n"; + os << "\\use_pspell " << tostr(use_pspell) << '\n'; } #endif case RC_SPELL_COMMAND: @@ -1570,12 +1570,12 @@ void LyXRC::output(ostream & os) const case RC_ACCEPT_COMPOUND: if (isp_accept_compound != system_lyxrc.isp_accept_compound) { os << "\\accept_compound " << tostr(isp_accept_compound) - << "\n"; + << '\n'; } case RC_USE_ALT_LANG: if (isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) { os << "\\use_alt_language " << tostr(isp_use_alt_lang) - << "\n"; + << '\n'; } case RC_ALT_LANG: if (isp_alt_lang != system_lyxrc.isp_alt_lang) { @@ -1585,7 +1585,7 @@ void LyXRC::output(ostream & os) const case RC_USE_ESC_CHARS: if (isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) { os << "\\use_escape_chars " << tostr(isp_use_esc_chars) - << "\n"; + << '\n'; } case RC_ESC_CHARS: if (isp_esc_chars != system_lyxrc.isp_esc_chars) { @@ -1595,7 +1595,7 @@ void LyXRC::output(ostream & os) const if (isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) { os << "\\use_personal_dictionary " << tostr(isp_use_pers_dict) - << "\n"; + << '\n'; } case RC_PERS_DICT: if (isp_pers_dict != system_lyxrc.isp_pers_dict) { @@ -1607,7 +1607,7 @@ void LyXRC::output(ostream & os) const != system_lyxrc.isp_use_input_encoding) { os << "\\use_input_encoding " << tostr(isp_use_input_encoding) - << "\n"; + << '\n'; } os << "\n#\n" @@ -1616,7 +1616,7 @@ void LyXRC::output(ostream & os) const case RC_RTL_SUPPORT: if (rtl_support != system_lyxrc.rtl_support) { - os << "\\rtl " << tostr(rtl_support) << "\n"; + os << "\\rtl " << tostr(rtl_support) << '\n'; } case RC_LANGUAGE_PACKAGE: if (language_package != system_lyxrc.language_package) { @@ -1659,18 +1659,18 @@ void LyXRC::output(ostream & os) const case RC_LANGUAGE_AUTO_BEGIN: if (language_auto_begin != system_lyxrc.language_auto_begin) { os << "\\language_auto_begin " - << tostr(language_auto_begin) << "\n"; + << tostr(language_auto_begin) << '\n'; } case RC_LANGUAGE_AUTO_END: if (language_auto_end != system_lyxrc.language_auto_end) { os << "\\language_auto_end " - << tostr(language_auto_end) << "\n"; + << tostr(language_auto_end) << '\n'; } case RC_MARK_FOREIGN_LANGUAGE: if (mark_foreign_language != system_lyxrc.mark_foreign_language) { os << "\\mark_foreign_language " << - tostr(mark_foreign_language) << "\n"; + tostr(mark_foreign_language) << '\n'; } os << "\n#\n" @@ -1680,15 +1680,15 @@ void LyXRC::output(ostream & os) const case RC_OVERRIDE_X_DEADKEYS: if (override_x_deadkeys != system_lyxrc.override_x_deadkeys) { os << "\\override_x_deadkeys " - << tostr(override_x_deadkeys) << "\n"; + << tostr(override_x_deadkeys) << '\n'; } case RC_AUTO_NUMBER: if (auto_number != system_lyxrc.auto_number) { - os << "\\auto_number " << tostr(auto_number) << "\n"; + os << "\\auto_number " << tostr(auto_number) << '\n'; } case RC_DEFAULT_LANGUAGE: if (default_language != system_lyxrc.default_language) { - os << "\\default_language " << default_language << "\n"; + os << "\\default_language " << default_language << '\n'; } os << "\n#\n" diff --git a/src/lyxserver.C b/src/lyxserver.C index b6c3e96d28..26d11f542d 100644 --- a/src/lyxserver.C +++ b/src/lyxserver.C @@ -214,7 +214,7 @@ void LyXComm::endPipe(int & fd, string const & filename, bool write) if (!write) { lyx_gui::remove_read_callback(fd); } - + #ifdef __EMX__ APIRET rc; int errnum; @@ -281,14 +281,14 @@ void LyXComm::read_ready() read_buffer_.erase(); } - // reset connection + // reset connection closeConnection(); openConnection(); break; } else { // errno == EAGAIN - // Nothing new has arrived, so now's the time + // Nothing new has arrived, so now's the time // to tell the outside world if there's anything // in the read buffer. break; @@ -384,7 +384,8 @@ void LyXServer::callback(LyXServer * serv, string const & msg) if (compare(p, "LYXSRV:", 7) == 0) { server_only = true; } else if (0 != compare(p, "LYXCMD:", 7)) { - lyxerr << "LyXServer: Unknown request \"" << p << "\"" << endl; + lyxerr << "LyXServer: Unknown request \"" + << p << '"' << endl; return; } p += 7; @@ -460,7 +461,7 @@ void LyXServer::callback(LyXServer * serv, string const & msg) } } else { lyxerr <<"LyXServer: Undefined server command " - << cmd << "." << endl; + << cmd << '.' << endl; } return; } @@ -486,7 +487,7 @@ void LyXServer::callback(LyXServer * serv, string const & msg) buf = "ERROR:"; else buf = "INFO:"; - buf += client + ":" + cmd + ":" + rval + "\n"; + buf += client + ':' + cmd + ':' + rval + '\n'; serv->pipes.send(buf); // !!! we don't do any error checking - diff --git a/src/lyxtextclass.C b/src/lyxtextclass.C index 376f20975a..c3cbdc05a7 100644 --- a/src/lyxtextclass.C +++ b/src/lyxtextclass.C @@ -79,7 +79,7 @@ bool LyXTextClass::do_readStyle(LyXLex & lexrc, LyXLayout & lay) lay.reslabelfont.realize(defaultfont()); return false; // no errors } - lyxerr << "Error parsing style `" << lay.name() << "'" << endl; + lyxerr << "Error parsing style `" << lay.name() << '\'' << endl; return true; } @@ -228,7 +228,8 @@ bool LyXTextClass::Read(string const & filename, bool merge) string const style = subst(lexrc.getString(), '_', ' '); if (!delete_layout(style)) - lyxerr << "Cannot delete style `" << style << "'" << endl; + lyxerr << "Cannot delete style `" + << style << '\'' << endl; // lexrc.printError("Cannot delete style" // " `$$Token'"); } @@ -898,10 +899,10 @@ ostream & operator<<(ostream & os, LyXTextClass::PageSides p) { switch (p) { case LyXTextClass::OneSide: - os << "1"; + os << '1'; break; case LyXTextClass::TwoSides: - os << "2"; + os << '2'; break; } return os; diff --git a/src/lyxtextclasslist.C b/src/lyxtextclasslist.C index 389e7ddfbc..861b33e261 100644 --- a/src/lyxtextclasslist.C +++ b/src/lyxtextclasslist.C @@ -80,7 +80,7 @@ bool LyXTextClassList::Read () LyXLex lex(0, 0); string real_file = LibFileSearch("", "textclass.lst"); lyxerr[Debug::TCLASS] << "Reading textclasses from `" - << real_file << "'" << endl; + << real_file << '\'' << endl; if (real_file.empty()) { lyxerr << "LyXTextClassList::Read: unable to find " diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 6211f70198..cdf72c02c0 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,7 @@ +2002-11-27 Lars Gullik Bjønnes + + * math_inferinset.C: remove unused "using std::max" + 2002-11-21 Lars Gullik Bjønnes * formulamacro.C (prefix): use boost::format diff --git a/src/mathed/command_inset.C b/src/mathed/command_inset.C index 42a0f5c1e7..5c070513c8 100644 --- a/src/mathed/command_inset.C +++ b/src/mathed/command_inset.C @@ -43,10 +43,10 @@ CommandInset::dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos) void CommandInset::write(WriteStream & os) const { - os << "\\" << name_.c_str(); + os << '\\' << name_.c_str(); if (cell(1).size()) - os << "[" << cell(1) << "]"; - os << "{" << cell(0) << "}"; + os << '[' << cell(1) << ']'; + os << '{' << cell(0) << '}'; } diff --git a/src/mathed/formula.C b/src/mathed/formula.C index 440648d582..670cb182b1 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -127,7 +127,7 @@ Inset * InsetFormula::clone(Buffer const &, bool) const void InsetFormula::write(Buffer const *, ostream & os) const { WriteStream wi(os, false, false); - os << par_->fileInsetLabel() << " "; + os << par_->fileInsetLabel() << ' '; par_->write(wi); } diff --git a/src/mathed/formulabase.C b/src/mathed/formulabase.C index 3d9764da34..b56b8979e4 100644 --- a/src/mathed/formulabase.C +++ b/src/mathed/formulabase.C @@ -227,17 +227,17 @@ void InsetFormulaBase::getCursorPos(BufferView *, int & x, int & y) const x = mathcursor->targetX(); x -= xo_; y -= yo_; - //lyxerr << "getCursorPos: " << x << " " << y << "\n"; + //lyxerr << "getCursorPos: " << x << ' ' << y << endl; } void InsetFormulaBase::toggleInsetCursor(BufferView * bv) { if (!mathcursor) { - lyxerr << "toggleInsetCursor impossible\n"; + lyxerr << "toggleInsetCursor impossible" << endl; return; } - //lyxerr << "toggleInsetCursor: " << isCursorVisible() << "\n"; + //lyxerr << "toggleInsetCursor: " << isCursorVisible() << endl; if (isCursorVisible()) hideInsetCursor(bv); else @@ -248,7 +248,7 @@ void InsetFormulaBase::toggleInsetCursor(BufferView * bv) void InsetFormulaBase::showInsetCursor(BufferView * bv, bool) { if (!mathcursor) { - lyxerr << "showInsetCursor impossible\n"; + lyxerr << "showInsetCursor impossible" << endl; return; } if (isCursorVisible()) @@ -258,7 +258,7 @@ void InsetFormulaBase::showInsetCursor(BufferView * bv, bool) math_font_max_dim(font_, asc, des); bv->showLockedInsetCursor(x, y - yo_, asc, des); setCursorVisible(true); - //lyxerr << "showInsetCursor: " << x << " " << y << "\n"; + //lyxerr << "showInsetCursor: " << x << ' ' << y << endl; } @@ -270,7 +270,7 @@ void InsetFormulaBase::hideInsetCursor(BufferView * bv) return; bv->hideLockedInsetCursor(); setCursorVisible(false); - //lyxerr << "hideInsetCursor: \n"; + //lyxerr << "hideInsetCursor: " << endl; } @@ -282,7 +282,7 @@ void InsetFormulaBase::fitInsetCursor(BufferView * bv) const math_font_max_dim(font_, asc, des); getCursorPos(bv, x, y); //y += yo_; - //lyxerr << "fitInsetCursor: x: " << x << " y: " << y << " yo: " << yo_ << "\n"; + //lyxerr << "fitInsetCursor: x: " << x << " y: " << y << " yo: " << yo_ << endl; bv->fitLockedInsetCursor(x, y, asc, des); } @@ -315,7 +315,7 @@ Inset::RESULT InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd) hideInsetCursor(bv); showInsetCursor(bv); bv->updateInset(this, false); - //lyxerr << "lfunMouseRelease: buttons: " << cmd.button() << "\n"; + //lyxerr << "lfunMouseRelease: buttons: " << cmd.button() << endl; if (cmd.button() == mouse_button::button3) { // try to dispatch to enclosed insets first @@ -353,10 +353,10 @@ Inset::RESULT InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd) Inset::RESULT InsetFormulaBase::lfunMousePress(FuncRequest const & cmd) { BufferView * bv = cmd.view(); - //lyxerr << "lfunMousePress: buttons: " << cmd.button() << "\n"; + //lyxerr << "lfunMousePress: buttons: " << cmd.button() << endl; if (!mathcursor || mathcursor->formula() != this) { - lyxerr << "re-create cursor\n"; + lyxerr << "re-create cursor" << endl; releaseMathCursor(bv); mathcursor = new MathCursor(this, cmd.x == 0); metrics(bv); @@ -418,7 +418,7 @@ Inset::RESULT InsetFormulaBase::localDispatch(FuncRequest const & cmd) // << " arg: '" << cmd.argument // << " x: '" << cmd.x // << " y: '" << cmd.y - // << "' button: " << cmd.button() << "\n"; + // << "' button: " << cmd.button() << endl; switch (cmd.action) { case LFUN_MOUSE_PRESS: diff --git a/src/mathed/math_amsarrayinset.C b/src/mathed/math_amsarrayinset.C index 914a463db8..0f13ce3511 100644 --- a/src/mathed/math_amsarrayinset.C +++ b/src/mathed/math_amsarrayinset.C @@ -82,16 +82,15 @@ void MathAMSArrayInset::draw(MathPainterInfo & pi, int x, int y) const void MathAMSArrayInset::write(WriteStream & os) const { - os << "\\begin{" << name_ << "}"; + os << "\\begin{" << name_ << '}'; MathGridInset::write(os); - os << "\\end{" << name_ << "}"; + os << "\\end{" << name_ << '}'; } void MathAMSArrayInset::normalize(NormalStream & os) const { - os << "[" << name_ << " "; + os << '[' << name_ << ' '; MathGridInset::normalize(os); - os << "]"; + os << ']'; } - diff --git a/src/mathed/math_arrayinset.C b/src/mathed/math_arrayinset.C index 767992f59b..6bddbe3be5 100644 --- a/src/mathed/math_arrayinset.C +++ b/src/mathed/math_arrayinset.C @@ -84,7 +84,7 @@ void MathArrayInset::write(WriteStream & os) const { if (os.fragile()) os << "\\protect"; - os << "\\begin{" << name_ << "}"; + os << "\\begin{" << name_ << '}'; if (v_align_ == 't' || v_align_ == 'b') os << '[' << char(v_align_) << ']'; @@ -94,7 +94,7 @@ void MathArrayInset::write(WriteStream & os) const if (os.fragile()) os << "\\protect"; - os << "\\end{" << name_ << "}"; + os << "\\end{" << name_ << '}'; // adding a \n here is bad if the array is the last item // in an \eqnarray... } @@ -102,9 +102,9 @@ void MathArrayInset::write(WriteStream & os) const void MathArrayInset::normalize(NormalStream & os) const { - os << "[" << name_ << " "; + os << '[' << name_ << ' '; MathGridInset::normalize(os); - os << "]"; + os << ']'; } @@ -112,5 +112,5 @@ void MathArrayInset::maplize(MapleStream & os) const { os << "array("; MathGridInset::maplize(os); - os << ")"; + os << ')'; } diff --git a/src/mathed/math_autocorrect.C b/src/mathed/math_autocorrect.C index e279cb978b..e5896ea7d4 100644 --- a/src/mathed/math_autocorrect.C +++ b/src/mathed/math_autocorrect.C @@ -67,21 +67,21 @@ bool Correction::read(istream & is) void Correction::write(ostream & os) const { os << "from: '" << from1_ << "' and '" << from2_ - << "' to '" << to_ << "'" << endl; + << "' to '" << to_ << '\'' << endl; } bool Correction::correct(MathAtom & at, char c) const { //lyxerr[Debug::MATHED] - // << "trying to correct ar: " << at << " from: '" << from1_ << "'" << endl; + // << "trying to correct ar: " << at << " from: '" << from1_ << '\'' << endl; if (from2_ != c) return false; if (!at->match(from1_)) return false; lyxerr[Debug::MATHED] << "match found! subst in " << at - << " from: '" << from1_ << "' to '" << to_ << "'" << endl; + << " from: '" << from1_ << "' to '" << to_ << '\'' << endl; at = to_; return true; } @@ -143,15 +143,15 @@ void initAutoCorrect() ifstream is(file.c_str()); while (getline(is, line)) { if (line.size() == 0 || line[0] == '#') { - //lyxerr[Debug::MATHED] << "ignoring line '" << line << "'" << endl; + //lyxerr[Debug::MATHED] << "ignoring line '" << line << '\'' << endl; continue; } istringstream il(STRCONV(line)); - //lyxerr[Debug::MATHED] << "line '" << line << "'" << endl; + //lyxerr[Debug::MATHED] << "line '" << line << '\'' << endl; Correction corr; if (corr.read(il)) { - //lyxerr[Debug::MATHED] << "parsed: '" << corr << "'" << endl; + //lyxerr[Debug::MATHED] << "parsed: '" << corr << '\'' << endl; theCorrections.insert(corr); } } diff --git a/src/mathed/math_biginset.C b/src/mathed/math_biginset.C index e85d6ac03c..7cae97e392 100644 --- a/src/mathed/math_biginset.C +++ b/src/mathed/math_biginset.C @@ -64,5 +64,5 @@ void MathBigInset::write(WriteStream & os) const void MathBigInset::normalize(NormalStream & os) const { - os << "[" << name_ << ' ' << delim_ << ']'; + os << '[' << name_ << ' ' << delim_ << ']'; } diff --git a/src/mathed/math_boxinset.C b/src/mathed/math_boxinset.C index 61a1bf1f2b..af3d117053 100644 --- a/src/mathed/math_boxinset.C +++ b/src/mathed/math_boxinset.C @@ -24,7 +24,7 @@ MathInset * MathBoxInset::clone() const void MathBoxInset::write(WriteStream & os) const { - os << "\\" << name_ << "{" << cell(0) << "}"; + os << '\\' << name_ << '{' << cell(0) << '}'; } diff --git a/src/mathed/math_casesinset.C b/src/mathed/math_casesinset.C index 08fec53a24..8fe06a6a7e 100644 --- a/src/mathed/math_casesinset.C +++ b/src/mathed/math_casesinset.C @@ -52,7 +52,7 @@ void MathCasesInset::normalize(NormalStream & os) const { os << "[cases "; MathGridInset::normalize(os); - os << "]"; + os << ']'; } @@ -60,7 +60,7 @@ void MathCasesInset::maplize(MapleStream & os) const { os << "cases("; MathGridInset::maplize(os); - os << ")"; + os << ')'; } diff --git a/src/mathed/math_charinset.C b/src/mathed/math_charinset.C index 6b6c5f8202..9be9091e80 100644 --- a/src/mathed/math_charinset.C +++ b/src/mathed/math_charinset.C @@ -138,7 +138,7 @@ void MathCharInset::write(WriteStream & os) const void MathCharInset::normalize(NormalStream & os) const { - os << "[char " << char_ << " " << "mathalpha" << "]"; + os << "[char " << char_ << ' ' << "mathalpha]"; } diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index c598d5745a..f76e0618fb 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -136,14 +136,14 @@ bool MathCursor::popRight() #if FILEDEBUG void MathCursor::dump(char const * what) const { - lyxerr << "MC: " << what << "\n"; - lyxerr << " Cursor: " << depth() << "\n"; + lyxerr << "MC: " << what << endl; + lyxerr << " Cursor: " << depth() << endl; for (unsigned i = 0; i < depth(); ++i) - lyxerr << " i: " << i << " " << Cursor_[i] << "\n"; - lyxerr << " Anchor: " << Anchor_.size() << "\n"; + lyxerr << " i: " << i << ' ' << Cursor_[i] << endl; + lyxerr << " Anchor: " << Anchor_.size() << endl; for (unsigned i = 0; i < Anchor_.size(); ++i) - lyxerr << " i: " << i << " " << Anchor_[i] << "\n"; - lyxerr << " sel: " << selection_ << "\n"; + lyxerr << " i: " << i << ' ' << Anchor_[i] << endl; + lyxerr << " sel: " << selection_ << endl; } #else void MathCursor::dump(char const *) const {} @@ -778,18 +778,19 @@ void MathCursor::normalize() { if (idx() >= par()->nargs()) { lyxerr << "this should not really happen - 1: " - << idx() << " " << par()->nargs() << " in: " << par() << "\n"; + << idx() << ' ' << par()->nargs() + << " in: " << par() << endl; dump("error 2"); } idx() = min(idx(), par()->nargs() - 1); if (pos() > size()) { lyxerr << "this should not really happen - 2: " - << pos() << " " << size() << " in idx: " << idx() - << " in atom: '"; + << pos() << ' ' << size() << " in idx: " << idx() + << " in atom: '"; WriteStream wi(lyxerr, false, true); par()->write(wi); - lyxerr << "\n"; + lyxerr << endl; dump("error 4"); } pos() = min(pos(), size()); @@ -1346,7 +1347,7 @@ string MathCursor::grabSelection() const data += "\\\\"; for (col_type col = c1; col <= c2; ++col) { if (col > c1) - data += "&"; + data += '&'; data += asString(i1.par_->cell(i1.par_->index(row, col))); } } diff --git a/src/mathed/math_data.C b/src/mathed/math_data.C index 0d4a65fa30..757b5d0a6f 100644 --- a/src/mathed/math_data.C +++ b/src/mathed/math_data.C @@ -113,7 +113,7 @@ void MathArray::dump() const { NormalStream ns(lyxerr); for (const_iterator it = begin(); it != end(); ++it) - ns << "<" << *it << ">"; + ns << '<' << *it << '>'; } @@ -275,7 +275,7 @@ void MathArray::drawT(TextPainter & pain, int x, int y) const { //if (drawn_ && x == xo_ && y == yo_) // return; - //lyxerr << "x: " << x << " y: " << y << " " << pain.workAreaHeight() << endl; + //lyxerr << "x: " << x << " y: " << y << ' ' << pain.workAreaHeight() << endl; xo_ = x; yo_ = y; drawn_ = true; diff --git a/src/mathed/math_deliminset.C b/src/mathed/math_deliminset.C index 1b4b477049..514ea6ca6d 100644 --- a/src/mathed/math_deliminset.C +++ b/src/mathed/math_deliminset.C @@ -36,7 +36,7 @@ string convertDelimToLatexName(string const & name) return name; if (name == "|") return name; - return "\\" + name + " "; + return '\\' + name + ' '; } } @@ -133,9 +133,9 @@ void MathDelimInset::maplize(MapleStream & os) const { if (isAbs()) { if (cell(0).size() == 1 && cell(0).front()->asMatrixInset()) - os << "linalg[det](" << cell(0) << ")"; + os << "linalg[det](" << cell(0) << ')'; else - os << "abs(" << cell(0) << ")"; + os << "abs(" << cell(0) << ')'; } else os << left_ << cell(0) << right_; @@ -145,9 +145,9 @@ void MathDelimInset::maximize(MaximaStream & os) const { if (isAbs()) { if (cell(0).size() == 1 && cell(0).front()->asMatrixInset()) - os << "determinant(" << cell(0) << ")"; + os << "determinant(" << cell(0) << ')'; else - os << "abs(" << cell(0) << ")"; + os << "abs(" << cell(0) << ')'; } else os << left_ << cell(0) << right_; @@ -177,7 +177,7 @@ void MathDelimInset::mathmlize(MathMLStream & os) const void MathDelimInset::octavize(OctaveStream & os) const { if (isAbs()) - os << "det(" << cell(0) << ")"; + os << "det(" << cell(0) << ')'; else os << left_ << cell(0) << right_; } diff --git a/src/mathed/math_envinset.C b/src/mathed/math_envinset.C index 993e8bea27..5075e98672 100644 --- a/src/mathed/math_envinset.C +++ b/src/mathed/math_envinset.C @@ -43,7 +43,7 @@ void MathEnvInset::write(WriteStream & os) const void MathEnvInset::normalize(NormalStream & os) const { - os << "[env " << name_ << " " << cell(0) << ']'; + os << "[env " << name_ << ' ' << cell(0) << ']'; } diff --git a/src/mathed/math_extern.C b/src/mathed/math_extern.C index 8c887038f8..c16d5cbdd8 100644 --- a/src/mathed/math_extern.C +++ b/src/mathed/math_extern.C @@ -1062,7 +1062,7 @@ namespace { // Probably missing an operator such as * p // lyxerr << "checking expr: '" << expr << "'\n"; - string out = captureOutput("mint -i 1 -S -s -q -q", expr + ";"); + string out = captureOutput("mint -i 1 -S -s -q -q", expr + ';'); if (out.empty()) break; // expression syntax is ok istringstream is(out.c_str()); @@ -1077,7 +1077,7 @@ namespace { pos -= 15; // skip the "on line ..." part if (expr[pos] == '*' || (pos > 0 && expr[pos - 1] == '*')) break; // two '*' in a row are definitely bad - expr.insert(pos, "*"); + expr.insert(pos, 1, '*'); } string full = "latex(" + extra + '(' + expr + "));"; @@ -1138,7 +1138,7 @@ namespace { pos -= 4; // skip the ">>> " part if (expr[pos] == '*') break; // two '*' in a row are definitely bad - expr.insert(pos, "*"); + expr.insert(pos, 1, '*'); } if (out.size() < 6) @@ -1178,15 +1178,15 @@ MathArray pipeThroughExtern(string const & lang, string const & extra, // create normalized expression ostringstream os; NormalStream ns(os); - os << "[" << extra << ' '; + os << '[' << extra << ' '; ns << ar; - os << "]"; + os << ']'; string data = STRCONV(os.str()); // search external script string file = LibFileSearch("mathed", "extern_" + lang); if (file.empty()) { - lyxerr << "converter to '" << lang << "' not found\n"; + lyxerr << "converter to '" << lang << "' not found" << endl; return MathArray(); } diff --git a/src/mathed/math_factory.C b/src/mathed/math_factory.C index cd56903489..1a124d0884 100644 --- a/src/mathed/math_factory.C +++ b/src/mathed/math_factory.C @@ -123,7 +123,7 @@ void initSymbols() // special case of pre-defined macros if (line.size() > 8 && line.substr(0, 5) == "\\def\\") { - //lyxerr << "defining: '" << line << "'" << endl; + //lyxerr << "defining: '" << line << '\'' << endl; istringstream is(STRCONV(line)); MathMacroTable::create(MathAtom(new MathMacroTemplate(is))); continue; @@ -137,7 +137,7 @@ void initSymbols() else is >> tmp.extra; if (!is) { - lyxerr[Debug::MATHED] << "skipping line '" << line << "'" << endl; + lyxerr[Debug::MATHED] << "skipping line '" << line << '\'' << endl; lyxerr[Debug::MATHED] << tmp.name << ' ' << tmp.inset << ' ' << tmp.extra << endl; continue; @@ -183,7 +183,7 @@ void initSymbols() << " inset: " << tmp.inset << " draw: " << int(tmp.draw.empty() ? 0 : tmp.draw[0]) << " extra: " << tmp.extra - << "'" << endl; + << '\'' << endl; } string tmp = "cmm"; string tmp2 = "cmsy"; @@ -216,12 +216,12 @@ latexkeys const * in_word_set(string const & str) MathAtom createMathInset(string const & s) { lyxerr[Debug::MATHED] << "creating inset with name: '" - << s << "'" << endl;; + << s << '\'' << endl;; latexkeys const * l = in_word_set(s); if (l) { string const & inset = l->inset; lyxerr[Debug::MATHED] << " found inset: '" << - inset << "'" << endl; + inset << '\'' << endl; if (inset == "ref") return MathAtom(new RefInset(l->name)); if (inset == "underset") @@ -292,6 +292,6 @@ MathAtom createMathInset(string const & s) if (MathMacroTable::has(s)) return MathAtom(new MathMacro(s)); - //lyxerr[Debug::MATHED] << "creating inset 2 with name: '" << s << "'" << endl; + //lyxerr[Debug::MATHED] << "creating inset 2 with name: '" << s << '\'' << endl; return MathAtom(new MathUnknownInset(s)); } diff --git a/src/mathed/math_fontoldinset.C b/src/mathed/math_fontoldinset.C index 577ac4a3a4..c8f67c69cf 100644 --- a/src/mathed/math_fontoldinset.C +++ b/src/mathed/math_fontoldinset.C @@ -64,7 +64,7 @@ void MathFontOldInset::write(WriteStream & os) const void MathFontOldInset::normalize(NormalStream & os) const { - os << "[font " << key_->name << " " << cell(0) << "]"; + os << "[font " << key_->name << ' ' << cell(0) << ']'; } diff --git a/src/mathed/math_gridinset.C b/src/mathed/math_gridinset.C index 59584395c5..7d4ac27eaf 100644 --- a/src/mathed/math_gridinset.C +++ b/src/mathed/math_gridinset.C @@ -27,7 +27,7 @@ string verboseHLine(int n) for (int i = 0; i < n; ++i) res += "\\hline"; if (n) - res += " "; + res += ' '; return res; } @@ -177,7 +177,7 @@ MathGridInset::col_type MathGridInset::guessColumns(string const & hh) const for (string::const_iterator it = hh.begin(); it != hh.end(); ++it) if (*it == 'c' || *it == 'l' || *it == 'r') ++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 if (col == 0) col = 1; @@ -518,7 +518,7 @@ string MathGridInset::eolString(row_type row, bool fragile) const string eol; if (!rowinfo_[row].crskip_.zero()) - eol += "[" + rowinfo_[row].crskip_.asLatexString() + "]"; + eol += '[' + rowinfo_[row].crskip_.asLatexString() + ']'; // make sure an upcoming '[' does not break anything if (row + 1 < nrows()) { @@ -1012,7 +1012,7 @@ MathInset::result_type MathGridInset::dispatch if (idx > 0) --idx; pos = cell(idx).size(); - + //mathcursor->normalize(); //updateLocal(bv, true); return DISPATCHED_POP; @@ -1058,7 +1058,7 @@ MathInset::result_type MathGridInset::dispatch copyCol(col(idx)); else if (cmd.argument == "swap-column") swapCol(col(idx)); - else + else return UNDISPATCHED; return DISPATCHED_POP; @@ -1093,7 +1093,7 @@ MathInset::result_type MathGridInset::dispatch return DISPATCHED_POP; } - default: + default: return MathNestInset::dispatch(cmd, idx, pos); } return UNDISPATCHED; diff --git a/src/mathed/math_hullinset.C b/src/mathed/math_hullinset.C index b6f743e32a..c4ba16ed68 100644 --- a/src/mathed/math_hullinset.C +++ b/src/mathed/math_hullinset.C @@ -362,18 +362,18 @@ void MathHullInset::header_write(WriteStream & os) const os << "\\begin{" << type_ << star(n) << "}\n"; else if (type_ == "alignat" || type_ == "xalignat") - os << "\\begin{" << type_ << star(n) << "}" - << "{" << static_cast((ncols() + 1)/2) << "}\n"; + os << "\\begin{" << type_ << star(n) << '}' + << '{' << static_cast((ncols() + 1)/2) << "}\n"; else if (type_ == "xxalignat") - os << "\\begin{" << type_ << "}" - << "{" << static_cast((ncols() + 1)/2) << "}\n"; + os << "\\begin{" << type_ << '}' + << '{' << static_cast((ncols() + 1)/2) << "}\n"; else if (type_ == "multline" || type_ == "gather") os << "\\begin{" << type_ << "}\n"; else - os << "\\begin{unknown" << star(n) << "}"; + os << "\\begin{unknown" << star(n) << '}'; } @@ -401,7 +401,7 @@ void MathHullInset::footer_write(WriteStream & os) const os << "\\end{" << type_ << "}\n"; else - os << "\\end{unknown" << star(n) << "}"; + os << "\\end{unknown" << star(n) << '}'; } @@ -455,7 +455,7 @@ string MathHullInset::nicelabel(row_type row) const return string(); if (label_[row].empty()) return string("(#)"); - return "(" + label_[row] + ")"; + return '(' + label_[row] + ')'; } @@ -626,7 +626,7 @@ string MathHullInset::eolString(row_type row, bool fragile) const string res; if (numberedType()) { if (!label_[row].empty() && !nonum_[row]) - res += "\\label{" + label_[row] + "}"; + res += "\\label{" + label_[row] + '}'; if (nonum_[row]) res += "\\nonumber "; } @@ -644,7 +644,7 @@ void MathHullInset::write(WriteStream & os) const void MathHullInset::normalize(NormalStream & os) const { - os << "[formula " << type_ << " "; + os << "[formula " << type_ << ' '; MathGridInset::normalize(os); os << "] "; } diff --git a/src/mathed/math_inferinset.C b/src/mathed/math_inferinset.C index 61d49081f6..f25f8ee6b8 100644 --- a/src/mathed/math_inferinset.C +++ b/src/mathed/math_inferinset.C @@ -9,9 +9,6 @@ #include "textpainter.h" -using std::max; - - MathInferInset::MathInferInset() : MathGridInset(1, 1) {} @@ -37,8 +34,6 @@ void MathInferInset::write(WriteStream & os) const { os << "\\infer"; if (opt_.size()) - os << "[" << opt_ << "]"; + os << '[' << opt_ << ']'; MathGridInset::write(os); } - - diff --git a/src/mathed/math_kerninset.C b/src/mathed/math_kerninset.C index 04335abdeb..03c25b53c6 100644 --- a/src/mathed/math_kerninset.C +++ b/src/mathed/math_kerninset.C @@ -45,11 +45,11 @@ void MathKernInset::draw(MathPainterInfo &, int, int) const void MathKernInset::write(WriteStream & os) const { - os << "\\kern" << wid_.asLatexString() << " "; + os << "\\kern" << wid_.asLatexString() << ' '; } void MathKernInset::normalize(NormalStream & os) const { - os << "[kern " << wid_.asLatexString() << "]"; + os << "[kern " << wid_.asLatexString() << ']'; } diff --git a/src/mathed/math_numberinset.C b/src/mathed/math_numberinset.C index 22eb9a1812..3051703c4a 100644 --- a/src/mathed/math_numberinset.C +++ b/src/mathed/math_numberinset.C @@ -37,7 +37,7 @@ void MathNumberInset::draw(MathPainterInfo & pi, int x, int y) const void MathNumberInset::normalize(NormalStream & os) const { - os << "[number " << str_ << "]"; + os << "[number " << str_ << ']'; } diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index ad506e70ae..ddadf94e19 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -207,9 +207,9 @@ private: ostream & operator<<(ostream & os, Token const & t) { if (t.cs().size()) - os << "\\" << t.cs(); + os << '\\' << t.cs(); else - os << "[" << t.character() << "," << t.cat() << "]"; + os << '[' << t.character() << ',' << t.cat() << ']'; return os; } diff --git a/src/mathed/math_pos.C b/src/mathed/math_pos.C index 497892f7da..82ab4c5a45 100644 --- a/src/mathed/math_pos.C +++ b/src/mathed/math_pos.C @@ -1,6 +1,5 @@ - #ifdef __GNUG__ -#pragma implementation +#pragma implementation #endif #include "config.h" @@ -52,7 +51,7 @@ void MathCursorPos::setPos(MathArray::pos_type pos) std::ostream & operator<<(std::ostream & os, MathCursorPos const & p) { - os << "(par: " << p.par_ << " idx: " << p.idx_ << " pos: " << p.pos_ << ")"; + os << "(par: " << p.par_ << " idx: " << p.idx_ << " pos: " << p.pos_ << ')'; return os; } diff --git a/src/mathed/math_rootinset.C b/src/mathed/math_rootinset.C index 9194bbbd28..8c442d3bf7 100644 --- a/src/mathed/math_rootinset.C +++ b/src/mathed/math_rootinset.C @@ -91,13 +91,13 @@ bool MathRootInset::idxUpDown(idx_type & idx, pos_type & pos, bool up, int) cons void MathRootInset::maplize(MapleStream & os) const { - os << "(" << cell(1) << ")^(1/(" << cell(0) <<"))"; + os << '(' << cell(1) << ")^(1/(" << cell(0) <<"))"; } void MathRootInset::octavize(OctaveStream & os) const { - os << "root(" << cell(1) << ',' << cell(0) <<')'; + os << "root(" << cell(1) << ',' << cell(0) << ')'; } diff --git a/src/mathed/math_scriptinset.C b/src/mathed/math_scriptinset.C index 61bfd9fe01..f531e4e626 100644 --- a/src/mathed/math_scriptinset.C +++ b/src/mathed/math_scriptinset.C @@ -319,7 +319,7 @@ bool MathScriptInset::idxUpDown(idx_type & idx, pos_type & pos, bool up, return false; // otherwise go to last base position idx = 2; - pos = cell(2).size(); + pos = cell(2).size(); } else if (idx == 0) { @@ -327,14 +327,14 @@ bool MathScriptInset::idxUpDown(idx_type & idx, pos_type & pos, bool up, if (!up) return false; idx = 2; - pos = cell(2).size(); + pos = cell(2).size(); } - + else { // in nucleus // don't go up/down unless in last position if (pos != cell(2).size()) - return false; + return false; // don't go up/down if there is no cell. if (!has(up)) return false; @@ -417,18 +417,18 @@ void MathScriptInset::mathematicize(MathematicaStream & os) const bool u = hasUp() && up().size(); if (nuc().size()) { - if (d) + if (d) os << "Subscript[" << nuc(); else os << nuc(); } if (u) - os << "^(" << up() << ")"; + os << "^(" << up() << ')'; if (nuc().size()) if (d) - os << "," << down() << "]"; + os << ',' << down() << ']'; } diff --git a/src/mathed/math_sizeinset.C b/src/mathed/math_sizeinset.C index 63f934e81a..a4cba68316 100644 --- a/src/mathed/math_sizeinset.C +++ b/src/mathed/math_sizeinset.C @@ -48,7 +48,7 @@ void MathSizeInset::write(WriteStream & os) const void MathSizeInset::normalize(NormalStream & os) const { - os << "[" << key_->name << ' ' << cell(0) << ']'; + os << '[' << key_->name << ' ' << cell(0) << ']'; } diff --git a/src/mathed/math_splitinset.C b/src/mathed/math_splitinset.C index e7d9389cc7..9fb25c670b 100644 --- a/src/mathed/math_splitinset.C +++ b/src/mathed/math_splitinset.C @@ -36,7 +36,7 @@ void MathSplitInset::write(WriteStream & ws) const { if (ws.fragile()) ws << "\\protect"; - ws << "\\begin{" << name_ << "}"; + ws << "\\begin{" << name_ << '}'; MathGridInset::write(ws); if (ws.fragile()) ws << "\\protect"; diff --git a/src/mathed/math_stringinset.C b/src/mathed/math_stringinset.C index bf01a676ae..e28556edbc 100644 --- a/src/mathed/math_stringinset.C +++ b/src/mathed/math_stringinset.C @@ -37,7 +37,7 @@ void MathStringInset::draw(MathPainterInfo & pi, int x, int y) const void MathStringInset::normalize(NormalStream & os) const { - os << "[string " << str_ << ' ' << "mathalpha" << "]"; + os << "[string " << str_ << ' ' << "mathalpha" << ']'; } diff --git a/src/mathed/math_substackinset.C b/src/mathed/math_substackinset.C index 89635f8b3e..29850787be 100644 --- a/src/mathed/math_substackinset.C +++ b/src/mathed/math_substackinset.C @@ -43,7 +43,7 @@ void MathSubstackInset::normalize(NormalStream & os) const { os << "[substack "; MathGridInset::normalize(os); - os << "]"; + os << ']'; } @@ -51,5 +51,5 @@ void MathSubstackInset::maplize(MapleStream & os) const { os << "substack("; MathGridInset::maplize(os); - os << ")"; + os << ')'; } diff --git a/src/mathed/math_support.C b/src/mathed/math_support.C index cdaca8d9fc..782fd1eb19 100644 --- a/src/mathed/math_support.C +++ b/src/mathed/math_support.C @@ -1,6 +1,5 @@ - #ifdef __GNUG__ -#pragma implementation +#pragma implementation #endif #include @@ -453,14 +452,14 @@ void mathed_draw_deco(MathPainterInfo & pi, int x, int y, int w, int h, for (int j = 0; j < n; ++j) { double xx = d[i++]; double yy = d[i++]; -// lyxerr << " " << xx << " " << yy << " "; +// lyxerr << ' ' << xx << ' ' << yy << ' '; if (code == 4) sqmt.transform(xx, yy); else mt.transform(xx, yy); xp[j] = int(x + xx + 0.5); yp[j] = int(y + yy + 0.5); - // lyxerr << "P[" << j " " << xx << " " << yy << " " << x << " " << y << "]"; + // lyxerr << "P[" << j ' ' << xx << ' ' << yy << ' ' << x << ' ' << y << ']'; } pi.pain.lines(xp, yp, n, LColor::math); } @@ -524,7 +523,7 @@ struct fontinfo { LyXFont::FONT_FAMILY const inh_family = LyXFont::INHERIT_FAMILY; LyXFont::FONT_SERIES const inh_series = LyXFont::INHERIT_SERIES; -LyXFont::FONT_SHAPE const inh_shape = LyXFont::INHERIT_SHAPE; +LyXFont::FONT_SHAPE const inh_shape = LyXFont::INHERIT_SHAPE; // mathnormal should be the first, otherwise the fallback further down @@ -582,11 +581,11 @@ fontinfo fontinfos[] = { fontinfo * lookupFont(string const & name) { - //lyxerr << "searching font '" << name << "'\n"; + //lyxerr << "searching font '" << name << "'\n"; int const n = sizeof(fontinfos) / sizeof(fontinfo); for (int i = 0; i < n; ++i) if (fontinfos[i].cmd_ == name) { - //lyxerr << "found '" << i << "'\n"; + //lyxerr << "found '" << i << "'\n"; return fontinfos + i; } return 0; diff --git a/src/mathed/math_symbolinset.C b/src/mathed/math_symbolinset.C index 5a2129324f..71fc0ecf16 100644 --- a/src/mathed/math_symbolinset.C +++ b/src/mathed/math_symbolinset.C @@ -1,6 +1,5 @@ - #ifdef __GNUG__ -#pragma implementation +#pragma implementation #endif #include @@ -117,7 +116,7 @@ void MathSymbolInset::validate(LaTeXFeatures & features) const void MathSymbolInset::normalize(NormalStream & os) const { - os << "[symbol " << name() << "]"; + os << "[symbol " << name() << ']'; } diff --git a/src/mathed/math_xyarrowinset.C b/src/mathed/math_xyarrowinset.C index e9d9bcdf5c..f2506827ee 100644 --- a/src/mathed/math_xyarrowinset.C +++ b/src/mathed/math_xyarrowinset.C @@ -35,7 +35,7 @@ MathXYMatrixInset const * MathXYArrowInset::targetMatrix() const MathArray const & MathXYArrowInset::targetCell() const { -#if 0 +#if 0 MathXYMatrixInset const * p = targetMatrix(); int x = 0; int y = 0; @@ -137,9 +137,9 @@ void MathXYArrowInset::write(WriteStream & os) const { os << "\\ar"; if (cell(0).size()) - os << "[" << cell(0) << "]"; + os << '[' << cell(0) << ']'; if (cell(1).size()) - os << (up_ ? "^" : "_") << "{" << cell(1) << "}"; + os << (up_ ? '^' : '_') << '{' << cell(1) << '}'; os << " "; } @@ -148,5 +148,5 @@ void MathXYArrowInset::normalize(NormalStream & os) const { os << "[xyarrow "; MathNestInset::normalize(os); - os << "]"; + os << ']'; } diff --git a/src/mathed/math_xymatrixinset.C b/src/mathed/math_xymatrixinset.C index d9ae049ca2..550621367d 100644 --- a/src/mathed/math_xymatrixinset.C +++ b/src/mathed/math_xymatrixinset.C @@ -53,7 +53,7 @@ void MathXYMatrixInset::normalize(NormalStream & os) const { os << "[xymatrix "; MathGridInset::normalize(os); - os << "]"; + os << ']'; } @@ -61,5 +61,5 @@ void MathXYMatrixInset::maplize(MapleStream & os) const { os << "xymatrix("; MathGridInset::maplize(os); - os << ")"; + os << ')'; } diff --git a/src/mathed/ref_inset.C b/src/mathed/ref_inset.C index f90f4ac53e..6edbae0e8d 100644 --- a/src/mathed/ref_inset.C +++ b/src/mathed/ref_inset.C @@ -56,7 +56,7 @@ RefInset::dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos) return DISPATCHED; } break; - case LFUN_MOUSE_PRESS: + case LFUN_MOUSE_PRESS: case LFUN_MOUSE_MOTION: // eat other mouse commands return DISPATCHED; @@ -97,7 +97,7 @@ void RefInset::validate(LaTeXFeatures & features) const int RefInset::ascii(std::ostream & os, int) const { - os << "[" << asString(cell(0)) << "]"; + os << '[' << asString(cell(0)) << ']'; return 0; } diff --git a/src/mathed/textpainter.C b/src/mathed/textpainter.C index 5f464b5754..cdc013c384 100644 --- a/src/mathed/textpainter.C +++ b/src/mathed/textpainter.C @@ -1,6 +1,5 @@ - #ifdef __GNUG__ -#pragma implementation +#pragma implementation #endif #include "textpainter.h" @@ -26,7 +25,7 @@ char TextPainter::at(int x, int y) const void TextPainter::draw(int x, int y, char const * str) { - //cerr << "drawing string '" << str << "' at " << x << "," << y << "\n"; + //cerr << "drawing string '" << str << "' at " << x << ',' << y << endl; for (int i = 0; *str && x + i < xmax_; ++i, ++str) at(x + i, y) = *str; //show(); @@ -49,7 +48,7 @@ void TextPainter::verticalLine(int x, int y, int n, char c) void TextPainter::draw(int x, int y, char c) { - //cerr << "drawing char '" << c << "' at " << x << "," << y << "\n"; + //cerr << "drawing char '" << c << "' at " << x << ',' << y << endl; at(x, y) = c; //show(); } @@ -60,7 +59,7 @@ void TextPainter::show(std::ostream & os, int offset) const os << '\n'; for (int j = 0; j <= ymax_; ++j) { for (int i = 0; i < offset; ++i) - os << ' '; + os << ' '; for (int i = 0; i < xmax_; ++i) os << at(i, j); os << '\n'; diff --git a/src/paragraph.C b/src/paragraph.C index d6701c8e4b..1ca0c04ef1 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -182,15 +182,15 @@ void Paragraph::write(Buffer const * buf, ostream & os, } // First write the layout - os << "\n\\layout " << layout()->name() << "\n"; + os << "\n\\layout " << layout()->name() << '\n'; // Maybe some vertical spaces. if (params().spaceTop().kind() != VSpace::NONE) os << "\\added_space_top " - << params().spaceTop().asLyXCommand() << " "; + << params().spaceTop().asLyXCommand() << ' '; if (params().spaceBottom().kind() != VSpace::NONE) os << "\\added_space_bottom " - << params().spaceBottom().asLyXCommand() << " "; + << params().spaceBottom().asLyXCommand() << ' '; // Maybe the paragraph has special spacing params().spacing().writeFile(os, true); @@ -222,7 +222,8 @@ void Paragraph::write(Buffer const * buf, ostream & os, // Do we have a manual left indent? if (!params().leftIndent().zero()) - os << "\\leftindent " << params().leftIndent().asString() << " "; + os << "\\leftindent " << params().leftIndent().asString() + << ' '; // Alignment? if (params().align() != LYX_ALIGN_LAYOUT) { @@ -233,7 +234,7 @@ void Paragraph::write(Buffer const * buf, ostream & os, case LYX_ALIGN_CENTER: h = 3; break; default: h = 0; break; } - os << "\\align " << string_align[h] << " "; + os << "\\align " << string_align[h] << ' '; } // bibitem ale970302 @@ -245,7 +246,7 @@ void Paragraph::write(Buffer const * buf, ostream & os, int column = 0; for (pos_type i = 0; i < size(); ++i) { if (!i) { - os << "\n"; + os << '\n'; column = 0; } @@ -293,12 +294,12 @@ void Paragraph::write(Buffer const * buf, ostream & os, os << ".\n"; column = 0; } else - os << "."; + os << '.'; break; default: if ((column > 70 && c == ' ') || column > 79) { - os << "\n"; + os << '\n'; column = 0; } // this check is to amend a bug. LyX sometimes @@ -984,7 +985,7 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf, if (!params().spacing().isDefault() && (!previous() || !previous()->hasSameLayout(this))) { - os << params().spacing().writeEnvirBegin() << "\n"; + os << params().spacing().writeEnvirBegin() << '\n'; texrow.newline(); } @@ -1052,7 +1053,7 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf, language->encoding() != previous_language->encoding()) { os << "\\inputencoding{" << language->encoding()->LatexName() - << "}" << endl; + << "}\n"; texrow.newline(); } @@ -1102,12 +1103,12 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf, if (style->resfont.size() != font.size() && next_ && !is_command) { if (!need_par) - os << "{"; + os << '{'; os << "\\" << font.latexSize() << " \\par}"; } else if (need_par) { os << "\\par}"; } else if (is_command) - os << "}"; + os << '}'; switch (style->latextype) { case LATEX_ITEM_ENVIRONMENT: @@ -1157,7 +1158,7 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf, if (!params().spacing().isDefault() && (!next_ || !next_->hasSameLayout(this))) { - os << params().spacing().writeEnvirEnd() << "\n"; + os << params().spacing().writeEnvirEnd() << '\n'; texrow.newline(); } } @@ -1459,7 +1460,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf, running_font = basefont; if (font.family() == LyXFont::TYPEWRITER_FAMILY) { - os << "~"; + os << '~'; } if (moving_arg) os << "\\protect "; diff --git a/src/paragraph_pimpl.C b/src/paragraph_pimpl.C index 42ec28da89..4b953cf7c7 100644 --- a/src/paragraph_pimpl.C +++ b/src/paragraph_pimpl.C @@ -326,7 +326,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf, style.free_spacing); if (close) - os << "}"; + os << '}'; if (tmp) { for (int j = 0; j < tmp; ++j) { diff --git a/src/sgml.C b/src/sgml.C index 52ada720fc..435d71cc13 100644 --- a/src/sgml.C +++ b/src/sgml.C @@ -89,8 +89,8 @@ int openTag(ostream & os, Paragraph::depth_type depth, { if (!latexname.empty() && latexname != "!-- --") { if (!mixcont) - os << string(" ", depth); - os << "<" << latexname << ">"; + os << string(depth, ' '); + os << '<' << latexname << '>'; } if (!mixcont) @@ -105,8 +105,8 @@ int closeTag(ostream & os, Paragraph::depth_type depth, { if (!latexname.empty() && latexname != "!-- --") { if (!mixcont) - os << endl << string(" ", depth); - os << ""; + os << endl << string(depth, ' '); + os << "'; } if (!mixcont) diff --git a/src/support/filetools.C b/src/support/filetools.C index 745b922eb6..7e58026b45 100644 --- a/src/support/filetools.C +++ b/src/support/filetools.C @@ -122,8 +122,8 @@ string const MakeLatexName(string const & file) string const QuoteName(string const & name) { return (os::shell() == os::UNIX) ? - "\'" + name + "\'": - "\"" + name + "\""; + '\'' + name + '\'': + '"' + name + '"'; } @@ -213,7 +213,7 @@ vector const DirList(string const & dir, string const & ext) // This is a non-error checking C/system implementation string extension(ext); if (!extension.empty() && extension[0] != '.') - extension.insert(0, "."); + extension.insert(0, 1, '.'); vector dirlist; DIR * dirp = ::opendir(dir.c_str()); if (!dirp) { @@ -240,7 +240,7 @@ vector const DirList(string const & dir, string const & ext) */ /* A C++ implementaion will look like this: string extension(ext); - if (extension[0] != '.') extension.insert(0, "."); + if (extension[0] != '.') extension.insert(0, 1, '.'); vector dirlist; directory_iterator dit("dir"); while (dit != directory_iterator()) { @@ -477,7 +477,7 @@ string const CreateTmpDir(string const & tempdir, string const & mask) { lyxerr[Debug::FILES] << "CreateTmpDir: tempdir=`" << tempdir << "'\n" - << "CreateTmpDir: mask=`" << mask << "'" << endl; + << "CreateTmpDir: mask=`" << mask << '\'' << endl; string const tmpfl(lyx::tempName(tempdir, mask)); // lyx::tempName actually creates a file to make sure that it @@ -785,7 +785,7 @@ string const GetFileContents(string const & fname) return STRCONV(ofs.str()); } } - lyxerr << "LyX was not able to read file '" << fname << "'" << endl; + lyxerr << "LyX was not able to read file '" << fname << '\'' << endl; return string(); } @@ -965,7 +965,7 @@ string const ChangeExtension(string const & oldname, string const & extension) string ext; // Make sure the extension starts with a dot if (!extension.empty() && extension[0] != '.') - ext= "." + extension; + ext= '.' + extension; else ext = extension; @@ -1353,9 +1353,9 @@ string const findtexfile(string const & fil, string const & /*format*/) cmd_ret const c = RunCommand(kpsecmd); - lyxerr[Debug::LATEX] << "kpse status = " << c.first << "\n" + lyxerr[Debug::LATEX] << "kpse status = " << c.first << '\n' << "kpse result = `" << rtrim(c.second, "\n") - << "'" << endl; + << '\'' << endl; if (c.first != -1) return os::internal_path(rtrim(c.second, "\n\r")); else diff --git a/src/support/forkedcall.C b/src/support/forkedcall.C index a3e01df1a5..3cd5eafccd 100644 --- a/src/support/forkedcall.C +++ b/src/support/forkedcall.C @@ -115,7 +115,7 @@ void ForkedProcess::emitSignal() // Wait for child process to finish. -int ForkedProcess::runBlocking() +int ForkedProcess::runBlocking() { retval_ = 0; pid_ = generateChild(); @@ -149,7 +149,7 @@ int ForkedProcess::runNonBlocking() void ForkedProcess::kill(int tol) { - lyxerr << "ForkedProcess::kill(" << tol << ")" << std::endl; + lyxerr << "ForkedProcess::kill(" << tol << ')' << endl; if (pid() == 0) { lyxerr << "Can't kill non-existent process!" << endl; return; diff --git a/src/support/os_win32.C b/src/support/os_win32.C index f3f8026c2b..cbe6a7235b 100644 --- a/src/support/os_win32.C +++ b/src/support/os_win32.C @@ -82,7 +82,7 @@ string os::external_path(string const & p) { lyxerr[Debug::LATEX] << " [" << p << "]->>[" - << dos_path << "]" << endl; + << dos_path << ']' << endl; return dos_path; } @@ -98,7 +98,7 @@ string os::internal_path(string const &p) { lyxerr[Debug::DEPEND] << " [" << p << "]->>[" - << posix_path << "]" << endl; + << posix_path << ']' << endl; return posix_path; } diff --git a/src/tabular-old.C b/src/tabular-old.C index 796f47b650..b3906c8c58 100644 --- a/src/tabular-old.C +++ b/src/tabular-old.C @@ -165,8 +165,8 @@ void LyXTabular::ReadOld(Buffer const * buf, istream & is, Init(buf->params, rows_arg, columns_arg); l_getline(is, line); if (!prefixIs(line, " got" << - line << ")" << endl; + lyxerr << "Wrong tabular format (expected got" + << line << ')' << endl; return; } getTokenValue(line, "islongtable", is_long_tabular); @@ -184,8 +184,8 @@ void LyXTabular::ReadOld(Buffer const * buf, istream & is, for (int i = 0; i < rows_; ++i) { l_getline(is, line); if (!prefixIs(line, " got" << - line << ")" << endl; + lyxerr << "Wrong tabular format (expected got" + << line << ')' << endl; return; } getTokenValue(line, "topline", row_info[i].top_line); @@ -194,8 +194,8 @@ void LyXTabular::ReadOld(Buffer const * buf, istream & is, for (int j = 0; j < columns_; ++j) { l_getline(is,line); if (!prefixIs(line," got" << - line << ")" << endl; + lyxerr << "Wrong tabular format (expected got" + << line << ')' << endl; return; } if (!i) { @@ -208,8 +208,8 @@ void LyXTabular::ReadOld(Buffer const * buf, istream & is, } l_getline(is, line); if (!prefixIs(line, " got" << - line << ")" << endl; + lyxerr << "Wrong tabular format (expected got" + << line << ')' << endl; return; } getTokenValue(line, "multicolumn", cell_info[i][j].multicolumn); @@ -229,21 +229,21 @@ void LyXTabular::ReadOld(Buffer const * buf, istream & is, l_getline(is, line); } if (line != "") { - lyxerr << "Wrong tabular format (expected got" << - line << ")" << endl; + lyxerr << "Wrong tabular format (expected got" + << line << ')' << endl; return; } l_getline(is, line); if (line != "") { - lyxerr << "Wrong tabular format (expected got" << - line << ")" << endl; + lyxerr << "Wrong tabular format (expected got" + << line << ')' << endl; return; } } l_getline(is, line); if (line != "") { - lyxerr << "Wrong tabular format (expected got" << - line << ")" << endl; + lyxerr << "Wrong tabular format (expected got" + << line << ')' << endl; return; } } diff --git a/src/tabular.C b/src/tabular.C index 519813af97..ef80cf2c7a 100644 --- a/src/tabular.C +++ b/src/tabular.C @@ -1206,8 +1206,8 @@ void LyXTabular::ReadNew(Buffer const * buf, istream & is, Init(buf->params, rows_arg, columns_arg); l_getline(is, line); if (!prefixIs(line, " got" << - line << ")" << endl; + lyxerr << "Wrong tabular format (expected got" + << line << ')' << endl; return; } getTokenValue(line, "rotate", rotate); @@ -1246,8 +1246,8 @@ void LyXTabular::ReadNew(Buffer const * buf, istream & is, for (int j = 0; j < columns_; ++j) { l_getline(is,line); if (!prefixIs(line," got" << - line << ")" << endl; + lyxerr << "Wrong tabular format (expected got" + << line << ')' << endl; return; } getTokenValue(line, "alignment", column_info[j].alignment); @@ -1261,8 +1261,8 @@ void LyXTabular::ReadNew(Buffer const * buf, istream & is, for (int i = 0; i < rows_; ++i) { l_getline(is, line); if (!prefixIs(line, " got" << - line << ")" << endl; + lyxerr << "Wrong tabular format (expected got" + << line << ')' << endl; return; } getTokenValue(line, "topline", row_info[i].top_line); @@ -1275,8 +1275,8 @@ void LyXTabular::ReadNew(Buffer const * buf, istream & is, for (int j = 0; j < columns_; ++j) { l_getline(is, line); if (!prefixIs(line, " got" << - line << ")" << endl; + lyxerr << "Wrong tabular format (expected got" + << line << ')' << endl; return; } getTokenValue(line, "multicolumn", cell_info[i][j].multicolumn); @@ -1296,15 +1296,15 @@ void LyXTabular::ReadNew(Buffer const * buf, istream & is, l_getline(is, line); } if (!prefixIs(line, "")) { - lyxerr << "Wrong tabular format (expected got" << - line << ")" << endl; + lyxerr << "Wrong tabular format (expected got" + << line << ')' << endl; return; } } l_getline(is, line); if (!prefixIs(line, "")) { - lyxerr << "Wrong tabular format (expected got" << - line << ")" << endl; + lyxerr << "Wrong tabular format (expected got" + << line << ')' << endl; return; } } @@ -1997,16 +1997,18 @@ int LyXTabular::TeXCellPreamble(ostream & os, int cell) const if (!GetPWidth(cell).zero()) { switch (GetVAlignment(cell)) { case LYX_VALIGN_TOP: - os << "p"; + os << 'p'; break; case LYX_VALIGN_CENTER: - os << "m"; + os << 'm'; break; case LYX_VALIGN_BOTTOM: - os << "b"; + os << 'b'; break; } - os << "{" << GetPWidth(cell).asLatexString() << '}'; + os << '{' + << GetPWidth(cell).asLatexString() + << '}'; } else { switch (GetAlignment(cell)) { case LYX_ALIGN_LEFT: @@ -2032,13 +2034,13 @@ int LyXTabular::TeXCellPreamble(ostream & os, int cell) const os << "\\parbox["; switch (GetVAlignment(cell)) { case LYX_VALIGN_TOP: - os << "t"; + os << 't'; break; case LYX_VALIGN_CENTER: - os << "c"; + os << 'c'; break; case LYX_VALIGN_BOTTOM: - os << "b"; + os << 'b'; break; } os << "]{" << GetPWidth(cell).asLatexString() << "}{"; @@ -2046,13 +2048,13 @@ int LyXTabular::TeXCellPreamble(ostream & os, int cell) const os << "\\begin{minipage}["; switch (GetVAlignment(cell)) { case LYX_VALIGN_TOP: - os << "t"; + os << 't'; break; case LYX_VALIGN_CENTER: - os << "m"; + os << 'm'; break; case LYX_VALIGN_BOTTOM: - os << "b"; + os << 'b'; break; } os << "]{" << GetPWidth(cell).asLatexString() << "}\n"; @@ -2068,7 +2070,7 @@ int LyXTabular::TeXCellPostamble(ostream & os, int cell) const // usual cells if (GetUsebox(cell) == BOX_PARBOX) - os << "}"; + os << '}'; else if (GetUsebox(cell) == BOX_MINIPAGE) { os << "%\n\\end{minipage}"; ret += 2; @@ -2204,7 +2206,7 @@ int LyXTabular::TeXRow(ostream & os, int const i, Buffer const * buf, os << "\\R{"; ret += inset->latex(buf, os, fragile, fp); if (rtl) - os << "}"; + os << '}'; ret += TeXCellPostamble(os, cell); if (!IsLastCellInRow(cell)) { // not last cell in row @@ -2255,19 +2257,19 @@ int LyXTabular::latex(Buffer const * buf, os << ">{\\centering}"; break; } - + switch (column_info[i].valignment) { case LYX_VALIGN_TOP: - os << "p"; + os << 'p'; break; case LYX_VALIGN_CENTER: - os << "m"; + os << 'm'; break; case LYX_VALIGN_BOTTOM: - os << "b"; + os << 'b'; break; } - os << "{" + os << '{' << column_info[i].p_width.asLatexString() << '}'; } else { @@ -2276,8 +2278,8 @@ int LyXTabular::latex(Buffer const * buf, os << 'l'; break; case LYX_ALIGN_RIGHT: - os << 'r'; - break; + os << 'r'; + break; default: os << 'c'; break; @@ -2357,14 +2359,14 @@ int LyXTabular::docbookRow(Buffer const * buf, ostream & os, int row) const case LYX_VALIGN_CENTER: os << "middle"; } - os << "\""; + os << '"'; if (IsMultiColumn(cell)) { os << " namest=\"col" << j << "\" "; - os << "nameend=\"col" << j + cells_in_multicolumn(cell) - 1<< "\""; + os << "nameend=\"col" << j + cells_in_multicolumn(cell) - 1<< '"'; } - os << ">"; + os << '>'; ret += GetCellInset(cell)->docbook(buf, os, true); os << "\n"; ++cell; @@ -2591,11 +2593,9 @@ int LyXTabular::asciiPrintCell(Buffer const * buf, ostream & os, break; } - for (unsigned int i = 0; i < len1; ++i) - os << " "; - os << sstr.str(); - for (unsigned int i = 0; i < len2; ++i) - os << " "; + os << string(len1, ' ') + << sstr.str() + << string(len2, ' '); if (RightLine(cell)) os << " |"; else @@ -2735,7 +2735,7 @@ int LyXTabular::GetCellFromInset(Inset const * inset, int maybe_cell) const void LyXTabular::Validate(LaTeXFeatures & features) const { - features.require("NeedTabularnewline"); + features.require("NeedTabularnewline"); if (IsLongTabular()) features.require("longtable"); if (NeedRotating()) diff --git a/src/text.C b/src/text.C index 1c1ddb6367..46259d4d8b 100644 --- a/src/text.C +++ b/src/text.C @@ -2028,7 +2028,7 @@ void LyXText::insertChar(BufferView * bview, char c) // we would not get a rebreak! row->fill(fill(bview, row, workWidth(bview))); } - + if (c == Paragraph::META_INSET || row->fill() < 0) { refresh_y = y; refresh_row = row; @@ -2395,7 +2395,7 @@ LyXText::selectNextWordToSpellcheck(BufferView * bview, float & value) const WordLangTuple word = the_locking_inset->selectNextWordToSpellcheck(bview, value); if (!word.word().empty()) { value += float(cursor.y()); - value /= float(height); + value /= float(height); return word; } // we have to go on checking so move cursor to the next char @@ -3271,7 +3271,7 @@ int LyXText::drawLengthMarker(DrawRowParams & p, string const & prefix, switch (vsp.kind()) { case VSpace::LENGTH: { - str = prefix + " (" + vsp.asLyXCommand() + ")"; + str = prefix + " (" + vsp.asLyXCommand() + ')'; // adding or removing space bool const added = !(vsp.length().len().value() < 0.0); ty1 = added ? (start + arrow_size) : start; diff --git a/src/text2.C b/src/text2.C index fc29b3646d..027e38bf2a 100644 --- a/src/text2.C +++ b/src/text2.C @@ -1332,7 +1332,7 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const // Doesn't work... yet. ostringstream o; - //o << fl.name() << " " << buf->counters().value(fl.name()) << ":"; + //o << fl.name() << ' ' << buf->counters().value(fl.name()) << ":"; o << fl.name() << " #:"; s = STRCONV(o.str()); } else { diff --git a/src/text3.C b/src/text3.C index ea60e323f7..48bc0c0a7e 100644 --- a/src/text3.C +++ b/src/text3.C @@ -47,7 +47,7 @@ extern string current_layout; extern int bibitemMaxWidth(BufferView *, LyXFont const &); // the selection possible is needed, that only motion events are -// used, where the bottom press event was on the drawing area too +// used, where the bottom press event was on the drawing area too bool selection_possible = false; @@ -104,7 +104,7 @@ namespace { Inset /*const*/ * inset = par.getInset(pos); - if (!isEditableInset(inset)) + if (!isEditableInset(inset)) return 0; // get inset dimensions @@ -124,8 +124,9 @@ namespace { ); if (!b.contained(x, y)) { - lyxerr[Debug::GUI] << "Missed inset at x,y " << x << "," << y - << " box " << b << endl; + lyxerr[Debug::GUI] << "Missed inset at x,y " + << x << ',' << y + << " box " << b << endl; return 0; } @@ -371,7 +372,7 @@ void specialChar(LyXText * lt, BufferView * bv, InsetSpecialChar::Kind kind) Inset::RESULT LyXText::dispatch(FuncRequest const & cmd) { lyxerr[Debug::ACTION] << "LyXFunc::dispatch: action[" << cmd.action - <<"] arg[" << cmd.argument << "]" << endl; + <<"] arg[" << cmd.argument << ']' << endl; BufferView * bv = cmd.view(); @@ -561,8 +562,8 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd) case LFUN_WORDSEL: { update(bv, false); - LyXCursor cur1; - LyXCursor cur2; + LyXCursor cur1; + LyXCursor cur2; getWord(cur1, cur2, WHOLE_WORD); setCursor(bv, cur1.par(), cur1.pos()); bv->beforeChange(this); @@ -1048,7 +1049,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd) if (!is) lyxerr << "SETXY: Could not parse coordinates in '" << cmd.argument << std::endl; - else + else setCursorFromCoordinates(bv, x, y); break; } @@ -1290,7 +1291,8 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd) // in some other local environment, but I would like to leave this here // for the moment until I can remove this (Jug 20020418) if (y_before < bv->text->cursor.y()) - lyxerr << y_before << ":" << bv->text->cursor.y() << endl; + lyxerr << y_before << ':' + << bv->text->cursor.y() << endl; #endif // This is to allow jumping over large insets if (cursorrow == bv->text->cursor.row()) { @@ -1421,7 +1423,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd) // do nothing if we used the mouse wheel if (!bv->buffer()) break; - + if (cmd.button() == mouse_button::button4 || cmd.button() == mouse_button::button5) break; @@ -1599,7 +1601,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd) case LFUN_INSET_WRAP: case LFUN_TABULAR_INSERT: case LFUN_INDEX_INSERT: - case LFUN_INDEX_PRINT: + case LFUN_INDEX_PRINT: case LFUN_PARENTINSERT: case LFUN_TOC_INSERT: { diff --git a/src/trans.C b/src/trans.C index afa2e9b7e7..8b0fa7029f 100644 --- a/src/trans.C +++ b/src/trans.C @@ -123,7 +123,7 @@ int Trans::Load(LyXLex & lex) if (lex.next(true)) { if (lyxerr.debugging(Debug::KBMAP)) lyxerr << "key\t`" << lex.text() - << "'" << endl; + << '\'' << endl; } else return -1; @@ -132,7 +132,7 @@ int Trans::Load(LyXLex & lex) if (lex.next(true)) { if (lyxerr.debugging(Debug::KBMAP)) lyxerr << "accent\t`" << lex.text() - << "'" << endl; + << '\'' << endl; } else return -1; @@ -148,7 +148,7 @@ int Trans::Load(LyXLex & lex) if (lex.next(true)) { if (lyxerr.debugging(Debug::KBMAP)) lyxerr << "allowed\t`" << lex.text() - << "'" << endl; + << '\'' << endl; } else return -1; @@ -222,7 +222,7 @@ int Trans::Load(LyXLex & lex) if (lex.next(true)) { key_from = lex.text()[0]; if (lyxerr.debugging(Debug::KBMAP)) - lyxerr << "\t`" << lex.text() << "'" + lyxerr << "\t`" << lex.text() << '\'' << endl; } else return -1; @@ -231,7 +231,7 @@ int Trans::Load(LyXLex & lex) string string_to = lex.text(); keymap_[key_from] = string_to; if (lyxerr.debugging(Debug::KBMAP)) - lyxerr << "\t`" << string_to << "'" + lyxerr << "\t`" << string_to << '\'' << endl; } else return -1; @@ -247,7 +247,7 @@ int Trans::Load(LyXLex & lex) lyxerr << "KXMOD:\t" << lex.text() << endl; if (lex.next(true)) { if (lyxerr.debugging(Debug::KBMAP)) - lyxerr << "\t`" << lex.text() << "'" + lyxerr << "\t`" << lex.text() << '\'' << endl; accent = getkeymod(lex.getString()); } else @@ -255,7 +255,7 @@ int Trans::Load(LyXLex & lex) if (lex.next(true)) { if (lyxerr.debugging(Debug::KBMAP)) - lyxerr << "\t`" << lex.text() << "'" + lyxerr << "\t`" << lex.text() << '\'' << endl; key = lex.text()[0]; } else @@ -263,7 +263,7 @@ int Trans::Load(LyXLex & lex) if (lex.next(true)) { if (lyxerr.debugging(Debug::KBMAP)) - lyxerr << "\t`" << lex.text() << "'" + lyxerr << "\t`" << lex.text() << '\'' << endl; str = lex.text(); } else @@ -342,7 +342,7 @@ tex_accent getkeymod(string const & p) lyxerr << "p = " << p << ", lyx_accent_table[" << i << "].name = `" << lyx_accent_table[i].name - << "'" << endl; + << '\'' << endl; if (lyx_accent_table[i].name && contains(p, lyx_accent_table[i].name)) { diff --git a/src/vc-backend.C b/src/vc-backend.C index e81ed01b2c..8a9fa6bd2a 100644 --- a/src/vc-backend.C +++ b/src/vc-backend.C @@ -88,7 +88,7 @@ void RCS::retrieve(string const & file) { lyxerr[Debug::LYXVC] << "LyXVC::RCS: retrieve.\n\t" << file << endl; VCS::doVCCommand("co -q -r \"" - + file + "\"", + + file + '"', string()); } @@ -105,7 +105,7 @@ void RCS::scanMaster() while (!read_enough && ifs >> token) { lyxerr[Debug::LYXVC] << "LyXVC::scanMaster: current lex text: `" - << token << "'" << endl; + << token << '\'' << endl; if (token.empty()) continue; @@ -163,7 +163,7 @@ void RCS::registrer(string const & msg) cmd += msg; cmd += "\" \""; cmd += OnlyFilename(owner_->fileName()); - cmd += "\""; + cmd += '"'; doVCCommand(cmd, owner_->filePath()); owner_->getUser()->owner()->dispatch(FuncRequest(LFUN_MENURELOAD)); } @@ -172,7 +172,8 @@ void RCS::registrer(string const & msg) void RCS::checkIn(string const & msg) { doVCCommand("ci -q -u -m\"" + msg + "\" \"" - + OnlyFilename(owner_->fileName()) + "\"", owner_->filePath()); + + OnlyFilename(owner_->fileName()) + '"', + owner_->filePath()); owner_->getUser()->owner()->dispatch(FuncRequest(LFUN_MENURELOAD)); } @@ -181,7 +182,8 @@ void RCS::checkOut() { owner_->markClean(); doVCCommand("co -q -l \"" - + OnlyFilename(owner_->fileName()) + "\"", owner_->filePath()); + + OnlyFilename(owner_->fileName()) + '"', + owner_->filePath()); owner_->getUser()->owner()->dispatch(FuncRequest(LFUN_MENURELOAD)); } @@ -189,7 +191,8 @@ void RCS::checkOut() void RCS::revert() { doVCCommand("co -f -u" + version() + " \"" - + OnlyFilename(owner_->fileName()) + "\"", owner_->filePath()); + + OnlyFilename(owner_->fileName()) + '"', + owner_->filePath()); // We ignore changes and just reload! owner_->markClean(); owner_->getUser()->owner()->dispatch(FuncRequest(LFUN_MENURELOAD)); @@ -200,7 +203,7 @@ void RCS::undoLast() { lyxerr[Debug::LYXVC] << "LyXVC: undoLast" << endl; doVCCommand("rcs -o" + version() + " \"" - + OnlyFilename(owner_->fileName()) + "\"", + + OnlyFilename(owner_->fileName()) + '"', owner_->filePath()); } @@ -208,7 +211,8 @@ void RCS::undoLast() void RCS::getLog(string const & tmpf) { doVCCommand("rlog \"" - + OnlyFilename(owner_->fileName()) + "\" > " + tmpf, owner_->filePath()); + + OnlyFilename(owner_->fileName()) + "\" > " + + tmpf, owner_->filePath()); } @@ -227,7 +231,7 @@ string const CVS::find_file(string const & file) string const dir = OnlyPath(file) + "/CVS/Entries"; string const tmpf = "/" + OnlyFilename(file) + "/"; lyxerr[Debug::LYXVC] << "LyXVC: checking in `" << dir - << "' for `" << tmpf << "'" << endl; + << "' for `" << tmpf << '\'' << endl; FileInfo const f(dir); if (f.readable()) { // Ok we are at least in a CVS dir. Parse the CVS/Entries @@ -251,7 +255,7 @@ void CVS::scanMaster() // Ok now we do the real scan... ifstream ifs(master_.c_str()); string tmpf = "/" + OnlyFilename(file_) + "/"; - lyxerr[Debug::LYXVC] << "\tlooking for `" << tmpf << "'" << endl; + lyxerr[Debug::LYXVC] << "\tlooking for `" << tmpf << '\'' << endl; string line; regex reg("/(.*)/(.*)/(.*)/(.*)/(.*)"); while (getline(ifs, line)) { @@ -279,7 +283,7 @@ void CVS::scanMaster() lyxerr[Debug::LYXVC] << "Date in Entries: `" << file_date << "'\nModification date of file: `" - << mod_date << "'" << endl; + << mod_date << '\'' << endl; if (file_date == mod_date) { locker_ = "Unlocked"; vcstatus = UNLOCKED; @@ -298,7 +302,8 @@ void CVS::scanMaster() void CVS::registrer(string const & msg) { doVCCommand("cvs -q add -m \"" + msg + "\" \"" - + OnlyFilename(owner_->fileName()) + "\"", owner_->filePath()); + + OnlyFilename(owner_->fileName()) + '"', + owner_->filePath()); owner_->getUser()->owner()->dispatch(FuncRequest(LFUN_MENURELOAD)); } @@ -306,7 +311,7 @@ void CVS::registrer(string const & msg) void CVS::checkIn(string const & msg) { doVCCommand("cvs -q commit -m \"" + msg + "\" \"" - + OnlyFilename(owner_->fileName()) + "\"", + + OnlyFilename(owner_->fileName()) + '"', owner_->filePath()); owner_->getUser()->owner()->dispatch(FuncRequest(LFUN_MENURELOAD)); } @@ -325,7 +330,7 @@ void CVS::revert() // gets the updated version from the repository. string const fil = OnlyFilename(owner_->fileName()); - doVCCommand("rm -f \"" + fil + "\"; cvs update \"" + fil + "\"", + doVCCommand("rm -f \"" + fil + "\"; cvs update \"" + fil + '"', owner_->filePath()); owner_->markClean(); owner_->getUser()->owner()->dispatch(FuncRequest(LFUN_MENURELOAD));