]> git.lyx.org Git - lyx.git/blobdiff - src/buffer.C
Remove the XOpenIM test as lyxlookup.C has been buried.
[lyx.git] / src / buffer.C
index 4f5e71c5b9200679ae6848a881f4315d746666a7..31dd511ea82498cc36963b029ee4c02b06d29b8a 100644 (file)
@@ -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,
@@ -360,8 +360,13 @@ bool Buffer::readLyXformat2(LyXLex & lex, Paragraph * par)
                        s += tostr(unknown_layouts);
                        s += _(" paragraphs");
                }
+#if USE_BOOST_FORMAT
                Alert::alert(_("Textclass Loading Error!"), s,
                           boost::io::str(boost::format(_("When reading %1$s")) % fileName()));
+#else
+               Alert::alert(_("Textclass Loading Error!"), s,
+                            _("When reading ") + fileName());
+#endif
        }
 
        if (unknown_tokens > 0) {
@@ -372,8 +377,13 @@ bool Buffer::readLyXformat2(LyXLex & lex, Paragraph * par)
                        s += tostr(unknown_tokens);
                        s += _(" unknown tokens");
                }
+#if USE_BOOST_FORMAT
                Alert::alert(_("Textclass Loading Error!"), s,
                           boost::io::str(boost::format(_("When reading %1$s")) % fileName()));
+#else
+               Alert::alert(_("Textclass Loading Error!"), s,
+                            _("When reading ") +  fileName());
+#endif
        }
 
        return the_end_read;
@@ -564,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 == "~") {
@@ -608,9 +618,17 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                if (pp.first) {
                        params.textclass = pp.second;
                } else {
+#if USE_BOOST_FORMAT
                        Alert::alert(_("Textclass error"),
                                boost::io::str(boost::format(_("The document uses an unknown textclass \"%1$s\".")) % lex.getString()),
                                _("LyX will not be able to produce output correctly."));
+#else
+                       Alert::alert(
+                               _("Textclass error"),
+                               _("The document uses an unknown textclass ")
+                               + lex.getString(),
+                               _("LyX will not be able to produce output correctly."));
+#endif
                        params.textclass = 0;
                }
                if (!params.getLyXTextClass().load()) {
@@ -619,10 +637,17 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                        // or stop loading the file.
                        // I can substitute but I don't see how I can
                        // stop loading... ideas??  ARRae980418
+#if USE_BOOST_FORMAT
                        Alert::alert(_("Textclass Loading Error!"),
                                   boost::io::str(boost::format(_("Can't load textclass %1$s")) %
                                   params.getLyXTextClass().name()),
                                   _("-- substituting default"));
+#else
+                       Alert::alert(_("Textclass Loading Error!"),
+                                    _("Can't load textclass ")
+                                    + params.getLyXTextClass().name(),
+                                    _("-- substituting default"));
+#endif
                        params.textclass = 0;
                }
        } else if (token == "\\options") {
@@ -926,8 +951,14 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                // This should be insurance for the future: (Asger)
                ++unknown_tokens;
                lex.eatLine();
-               string const s = boost::io::str(boost::format(_("Unknown token: %1$s %2$s\n")) % token
-                       % lex.text());
+#if USE_BOOST_FORMAT
+               boost::format fmt(_("Unknown token: %1$s %2$s\n"));
+               fmt % token % lex.text();
+               string const s = fmt.str();
+#else
+               string const s = _("Unknown token: ") + token
+                       + ' ' + 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.
                InsetError * new_inset = new InsetError(s);
@@ -939,6 +970,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
        return the_end_read;
 }
 
+
 // needed to insert the selection
 void Buffer::insertStringAsLines(Paragraph *& par, pos_type & pos,
                                 LyXFont const & fn,string const & str) const
@@ -1137,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;
@@ -1169,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!"),
@@ -1493,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;
@@ -2108,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;
@@ -2240,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);
                }
@@ -2565,7 +2599,7 @@ void Buffer::simpleLinuxDocOnePar(ostream & os,
                while (!tag_state.empty() && tag_close) {
                        PAR_TAG k =  tag_state.top();
                        tag_state.pop();
-                       os << "</" << tag_name(k) << ">";
+                       os << "</" << tag_name(k) << '>';
                        if (tag_close & k)
                                reset(tag_close,k);
                        else
@@ -2575,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);
@@ -2624,7 +2658,7 @@ void Buffer::simpleLinuxDocOnePar(ostream & os,
        }
 
        while (!tag_state.empty()) {
-               os << "</" << tag_name(tag_state.top()) << ">";
+               os << "</" << tag_name(tag_state.top()) << '>';
                tag_state.pop();
        }
 
@@ -2697,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);
@@ -2813,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<InsetCommand *>(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;
 
@@ -2896,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: