]> git.lyx.org Git - lyx.git/blobdiff - src/buffer.C
Scons: update_po target, part one: language_l10n.pot
[lyx.git] / src / buffer.C
index 155b8b6047309c4e9cc2afa890a1dad524614e8d..c70bd7444d4e803ad009eab286c2d39c96391e0a 100644 (file)
@@ -141,7 +141,7 @@ using std::string;
 
 namespace {
 
-int const LYX_FORMAT = 256;
+int const LYX_FORMAT = 263;
 
 } // namespace anon
 
@@ -428,6 +428,10 @@ int Buffer::readHeader(LyXLex & lex)
        params().headheight.erase();
        params().headsep.erase();
        params().footskip.erase();
+       for (int i = 0; i < 4; ++i) {
+               params().user_defined_bullet(i) = ITEMIZE_DEFAULTS[i];
+               params().temp_bullet(i) = ITEMIZE_DEFAULTS[i];
+       }
 
        ErrorList & errorList = errorLists_["Parse"];
 
@@ -576,7 +580,7 @@ bool Buffer::readString(std::string const & s)
        std::istringstream is(s);
        lex.setStream(is);
        FileName const name(tempName());
-       switch (readFile(lex, name)) {
+       switch (readFile(lex, name, true)) {
        case failure:
                return false;
        case wrongversion: {
@@ -584,7 +588,7 @@ bool Buffer::readString(std::string const & s)
                std::ofstream os(name.toFilesystemEncoding().c_str());
                os << s;
                os.close();
-               return readFile(name) == success;
+               return readFile(name);
        }
        case success:
                break;
@@ -685,7 +689,7 @@ Buffer::ReadStatus Buffer::readFile(LyXLex & lex, FileName const & filename,
                FileName const tmpfile(tempName());
                if (tmpfile.empty()) {
                        Alert::error(_("Conversion failed"),
-                                    bformat(_("%1$s is from an earlier"
+                                    bformat(_("%1$s is from a different"
                                              " version of LyX, but a temporary"
                                              " file for converting it could"
                                                            " not be created."),
@@ -695,7 +699,7 @@ Buffer::ReadStatus Buffer::readFile(LyXLex & lex, FileName const & filename,
                FileName const lyx2lyx = libFileSearch("lyx2lyx", "lyx2lyx");
                if (lyx2lyx.empty()) {
                        Alert::error(_("Conversion script not found"),
-                                    bformat(_("%1$s is from an earlier"
+                                    bformat(_("%1$s is from a different"
                                               " version of LyX, but the"
                                               " conversion script lyx2lyx"
                                                            " could not be found."),
@@ -717,7 +721,7 @@ Buffer::ReadStatus Buffer::readFile(LyXLex & lex, FileName const & filename,
                cmd_ret const ret = runCommand(command_str);
                if (ret.first != 0) {
                        Alert::error(_("Conversion script failed"),
-                                    bformat(_("%1$s is from an earlier version"
+                                    bformat(_("%1$s is from a different version"
                                              " of LyX, but the lyx2lyx script"
                                                            " failed to convert it."),
                                              from_utf8(filename.absFilename())));
@@ -1018,6 +1022,7 @@ void Buffer::writeLaTeXSource(odocstream & os,
                lyxerr[Debug::LATEX] << "LaTeXFile for inclusion made."
                                     << endl;
        }
+       runparams_in.encoding = runparams.encoding;
 
        // Just to be sure. (Asger)
        texrow().newline();
@@ -1145,15 +1150,15 @@ int Buffer::runChktex()
        busy(true);
 
        // get LaTeX-Filename
-       string const name = getLatexName(false);
        string const path = temppath();
+        string const name = addName(path, getLatexName());
        string const org_path = filePath();
 
        support::Path p(path); // path to LaTeX file
        message(_("Running chktex..."));
 
        // Generate the LaTeX file if neccessary
-       OutputParams runparams;
+       OutputParams runparams(&params().encoding());
        runparams.flavor = OutputParams::LATEX;
        runparams.nice = false;
        makeLaTeXFile(FileName(name), org_path, runparams);
@@ -1166,8 +1171,11 @@ int Buffer::runChktex()
                Alert::error(_("chktex failure"),
                             _("Could not run chktex successfully."));
        } else if (res > 0) {
+               ErrorList & errorList = errorLists_["ChkTeX"];
+               // Clear out old errors
+               errorList.clear();
                // Fill-in the error list with the TeX errors
-               bufferErrors(*this, terr, errorLists_["ChkTex"]);
+               bufferErrors(*this, terr, errorList);
        }
 
        busy(false);
@@ -1472,18 +1480,6 @@ docstring const Buffer::B_(string const & l10n) const
 }
 
 
-docstring const Buffer::translateLabel(docstring const & label) const
-{
-       if (support::isAscii(label))
-               // Probably standard layout, try to translate
-               return B_(to_ascii(label));
-       else
-               // This must be a user defined layout. We cannot translate
-               // this, since gettext accepts only ascii keys.
-               return label;
-}
-
-
 bool Buffer::isClean() const
 {
        return pimpl_->lyx_clean;
@@ -1681,10 +1677,10 @@ void Buffer::changeRefsIfUnique(docstring const & from, docstring const & to,
 void Buffer::getSourceCode(odocstream & os, pit_type par_begin,
        pit_type par_end, bool full_source)
 {
-       OutputParams runparams;
+       OutputParams runparams(&params().encoding());
        runparams.nice = true;
        runparams.flavor = OutputParams::LATEX;
-       runparams.linelen = lyxrc.ascii_linelen;
+       runparams.linelen = lyxrc.plaintext_linelen;
        // No side effect of file copying and image conversion
        runparams.dryrun = true;