]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
Handle change-accept and change-reject in multi-cell selection
[lyx.git] / src / BufferParams.cpp
index 40d59f920aca0bfd047d06a615a69c9a4654947e..399faa393344a97d0c7039c6a2222885b5f654d8 100644 (file)
@@ -79,12 +79,20 @@ static char const * const string_quotes_style[] = {
 
 
 static char const * const string_papersize[] = {
+       "default", "custom", "letter", "legal", "executive",
+       "a0", "a1", "a2", "a3", "a4", "a5", "a6",
+       "b0", "b1", "b2", "b3", "b4", "b5", "b6",
+       "c0", "c1", "c2", "c3", "c4", "c5", "c6",
+       "b0j", "b1j", "b2j", "b3j", "b4j", "b5j", "b6j", ""
+};
+
+
+static char const * const string_papersize_geometry[] = {
        "default", "custom", "letterpaper", "legalpaper", "executivepaper",
-       "a0paper", "a1paper", "a2paper", "a3paper", "a4paper", "a5paper",
-       "a6paper", "b0paper", "b1paper", "b2paper", "b3paper", "b4paper",
-       "b5paper", "b6paper", "c0paper", "c1paper", "c2paper", "c3paper",
-       "c4paper", "c5paper", "c6paper", "b0j", "b1j", "b2j", "b3j", "b4j", "b5j",
-       "b6j", ""
+       "a0paper", "a1paper", "a2paper", "a3paper", "a4paper", "a5paper", "a6paper",
+       "b0paper", "b1paper", "b2paper", "b3paper", "b4paper", "b5paper", "b6paper",
+       "c0paper", "c1paper", "c2paper", "c3paper", "c4paper", "c5paper", "c6paper",
+       "b0j", "b1j", "b2j", "b3j", "b4j", "b5j", "b6j", ""
 };
 
 
@@ -357,7 +365,9 @@ BufferParams::Impl::Impl()
 {
        // set initial author
        // FIXME UNICODE
-       authorlist.record(Author(from_utf8(lyxrc.user_name), from_utf8(lyxrc.user_email)));
+       authorlist.record(Author(from_utf8(lyxrc.user_name),
+                                from_utf8(lyxrc.user_email),
+                                from_utf8(lyxrc.user_initials)));
 }
 
 
@@ -400,6 +410,7 @@ BufferParams::BufferParams()
        save_transient_properties = true;
        track_changes = false;
        output_changes = false;
+       change_bars = false;
        use_default_options = true;
        maintain_unincluded_children = false;
        secnumdepth = 3;
@@ -941,6 +952,8 @@ string BufferParams::readToken(Lexer & lex, string const & token,
                lex >> track_changes;
        } else if (token == "\\output_changes") {
                lex >> output_changes;
+       } else if (token == "\\change_bars") {
+               lex >> change_bars;
        } else if (token == "\\branch") {
                lex.eatLine();
                docstring branch = lex.getDocString();
@@ -1458,6 +1471,10 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const
           << (save_transient_properties ? convert<string>(output_changes) : "false")
           << '\n';
 
+       os << "\\change_bars "
+          << (save_transient_properties ? convert<string>(change_bars) : "false")
+          << '\n';
+
        os << "\\html_math_output " << html_math_output << '\n'
           << "\\html_css_as_file " << html_css_as_file << '\n'
           << "\\html_be_strict " << convert<string>(html_be_strict) << '\n';
@@ -1515,6 +1532,8 @@ void BufferParams::validate(LaTeXFeatures & features) const
                default:
                        break;
                }
+               if (change_bars)
+                       features.require("changebar");
        }
 
        // Floats with 'Here definitely' as default setting.
@@ -1617,7 +1636,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
        if (tokenPos(tclass.opt_fontsize(),
                     '|', fontsize) >= 0) {
                // only write if existing in list (and not default)
-               clsoptions << fontsize << "pt,";
+               clsoptions << subst(tclass.fontsizeformat(), "$$s", fontsize) << ",";
        }
 
        // paper sizes not supported by the class itself need the
@@ -1627,8 +1646,8 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
                || find(classpsizes.begin(), classpsizes.end(), string_papersize[papersize]) != classpsizes.end();
 
        if ((!use_geometry || features.isProvided("geometry-light"))
-           && class_supported_papersize)
-               clsoptions << string_papersize[papersize] << ",";
+           && class_supported_papersize && papersize != PAPER_DEFAULT)
+               clsoptions << subst(tclass.pagesizeformat(), "$$s", string_papersize[papersize]) << ",";
 
        // if needed
        if (sides != tclass.sides()) {
@@ -1849,7 +1868,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
                case PAPER_JISB4:
                case PAPER_JISB5:
                case PAPER_JISB6:
-                       ods << "," << from_ascii(string_papersize[papersize]);
+                       ods << "," << from_ascii(string_papersize_geometry[papersize]);
                        break;
                case PAPER_DEFAULT:
                        break;
@@ -2927,12 +2946,12 @@ void BufferParams::readIncludeonly(Lexer & lex)
 }
 
 
-string BufferParams::paperSizeName(PapersizePurpose purpose, string const psize) const
+string BufferParams::paperSizeName(PapersizePurpose purpose, string const psize) const
 {
        PAPER_SIZE ppsize = psize.empty() ? papersize : papersizetranslator().find(psize);
        switch (ppsize) {
        case PAPER_DEFAULT:
-               if (documentClass().pagesize() == "custom")
+               if (documentClass().pagesize() == "default")
                        // could be anything, so don't guess
                        return string();
                return paperSizeName(purpose, documentClass().pagesize());