]> git.lyx.org Git - lyx.git/blobdiff - src/LyXRC.cpp
Split pdf format as discussed on the list
[lyx.git] / src / LyXRC.cpp
index d980c22ae58481905b05701c723811096a3a0f7d..e7e7593908e1de9f33f09b4e389cf022f757ccb1 100644 (file)
@@ -55,7 +55,7 @@ namespace os = support::os;
 
 namespace {
 
-static unsigned int const LYXRC_FILEFORMAT = 8; // rgh: add "nice" flag
+static unsigned int const LYXRC_FILEFORMAT = 11; // gb: Split pdf format into pdf and pdf6
 
 // when adding something to this array keep it sorted!
 LexerKeyword lyxrcTags[] = {
@@ -73,6 +73,7 @@ LexerKeyword lyxrcTags[] = {
        { "\\bind_file", LyXRC::RC_BINDFILE },
        { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
        { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
+       { "\\close_buffer_with_last_view", LyXRC::RC_CLOSE_BUFFER_WITH_LAST_VIEW },
        { "\\completion_cursor_text", LyXRC::RC_COMPLETION_CURSOR_TEXT },
        { "\\completion_inline_delay", LyXRC::RC_COMPLETION_INLINE_DELAY },
        { "\\completion_inline_dots", LyXRC::RC_COMPLETION_INLINE_DOTS },
@@ -370,6 +371,7 @@ void LyXRC::setDefaults()
        default_decimal_point = ".";
        default_length_unit = Length::CM;
        cursor_width = 1;
+       close_buffer_with_last_view = "yes";
 }
 
 
@@ -1042,6 +1044,9 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
                case RC_VISUAL_CURSOR:
                        lexrc >> visual_cursor;
                        break;
+               case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
+                       lexrc >> close_buffer_with_last_view;
+                       break;
                case RC_AUTO_NUMBER:
                        lexrc >> auto_number;
                        break;
@@ -1138,19 +1143,15 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
                }
                case RC_VIEWER_ALTERNATIVES:  {
                        string format, command;
-                       if (lexrc.next())
-                               format = lexrc.getString();
-                       if (lexrc.eatLine())
-                               command = lexrc.getString();
+                       lexrc >> format;
+                       lexrc >> command;
                        viewer_alternatives[format].insert(command);
                        break;
                }
                case RC_EDITOR_ALTERNATIVES:  {
                        string format, command;
-                       if (lexrc.next())
-                               format = lexrc.getString();
-                       if (lexrc.eatLine())
-                               command = lexrc.getString();
+                       lexrc >> format;
+                       lexrc >> command;
                        editor_alternatives[format].insert(command);
                        break;
                }
@@ -2528,6 +2529,14 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                }
                if (tag != RC_LAST)
                        break;
+       case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
+               if (ignore_system_lyxrc ||
+                       close_buffer_with_last_view != system_lyxrc.close_buffer_with_last_view) {
+                       os << "# When closing last view, buffer closes (yes), hides (no), or ask the user (ask)\n";
+                       os << "\\close_buffer_with_last_view " << close_buffer_with_last_view << '\n';
+               }
+               if (tag != RC_LAST)
+                       break;
        case RC_LANGUAGE_CUSTOM_PACKAGE:
                if (ignore_system_lyxrc ||
                    language_custom_package != system_lyxrc.language_custom_package) {
@@ -2751,7 +2760,7 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                                    || sysfmt == sysend               // format not found
                                         || sysfmt->second.count(cmd) == 0 // this command not found
                                   )
-                                       os << "\\viewer_alternatives " << fmt << " " << cmd << "\n";
+                                       os << "\\viewer_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
                        }
                }
                if (tag != RC_LAST)
@@ -2776,7 +2785,7 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                                    || sysfmt == sysend               // format not found
                                    || sysfmt->second.count(cmd) == 0 // this command not found
                                   )
-                                       os << "\\editor_alternatives " << fmt << " " << cmd << "\n";
+                                       os << "\\editor_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
                        }
                }
                if (tag != RC_LAST)
@@ -3025,6 +3034,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_FULL_SCREEN_TOOLBARS:
        case LyXRC::RC_FULL_SCREEN_WIDTH:
        case LyXRC::RC_VISUAL_CURSOR:
+       case LyXRC::RC_CLOSE_BUFFER_WITH_LAST_VIEW:
        case LyXRC::RC_VIEWER:
        case LyXRC::RC_VIEWER_ALTERNATIVES:
        case LyXRC::RC_FORWARD_SEARCH_DVI:
@@ -3387,6 +3397,10 @@ string const LyXRC::getDescription(LyXRCTags tag)
                str = _("Select to have visual bidi cursor movement, unselect for logical movement.");
                break;
 
+       case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
+               str = _("Specify whether, closing the last view of an open document, LyX should close the document (yes), hide it (no), or ask the user (ask).");
+               break;
+
        case RC_SCREEN_DPI:
                str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
                break;