]> git.lyx.org Git - lyx.git/blobdiff - src/lyxrc.C
remove unused code
[lyx.git] / src / lyxrc.C
index 5e801533ff0eed2beca7ec175fdbc1503dcd24ff..809f71ee64d007d2a676e2ca3233df6ce5bbcf15 100644 (file)
 #include <fstream>
 #include <iomanip>
 #include <iostream>
+#include <boost/scoped_ptr.hpp>
 
 #include "debug.h"
 
 #include "lyxrc.h"
 #include "kbmap.h"
 #include "LyXAction.h"
-#include "lyx_main.h"
 #include "intl.h"
 #include "support/path.h"
 #include "support/filetools.h"
-#include "lyxtext.h"
 #include "converter.h"
 #include "gettext.h"
+#include "lyxlex.h"
 
 using std::ostream;
 using std::ofstream;
@@ -38,11 +38,13 @@ using std::ios;
 using std::endl;
 using std::vector;
 
-extern LyXAction lyxaction;
+class kb_keymap;
+
 extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
 
 namespace {
 
+// when adding something to this array keep it sorted!
 keyword_item lyxrcTags[] = {
        { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
        { "\\alternate_language", LyXRC::RC_ALT_LANG },
@@ -66,10 +68,8 @@ keyword_item lyxrcTags[] = {
        { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
        { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
        { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
-       { "\\display_shortcuts", LyXRC::RC_DISPLAY_SHORTCUTS },
        { "\\document_path", LyXRC::RC_DOCUMENTPATH },
        { "\\escape_chars", LyXRC::RC_ESC_CHARS },
-       { "\\exit_confirmation", LyXRC::RC_EXIT_CONFIRMATION },
        { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
        { "\\format", LyXRC::RC_FORMAT },
        { "\\input", LyXRC::RC_INPUT },
@@ -88,13 +88,15 @@ keyword_item lyxrcTags[] = {
        { "\\lastfiles", LyXRC::RC_LASTFILES },
        { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
        { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
-       { "\\new_ask_filename", LyXRC::RC_NEW_ASK_FILENAME },
        { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
        { "\\override_x_deadkeys", LyXRC::RC_OVERRIDE_X_DEADKEYS },
        { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
        { "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
        { "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
        { "\\popup_normal_font", LyXRC::RC_POPUP_NORMAL_FONT },
+       { "\\preview", LyXRC::RC_PREVIEW },
+       { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
+       { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
        { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
        { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
        { "\\print_command", LyXRC::RC_PRINT_COMMAND },
@@ -223,9 +225,7 @@ void LyXRC::setDefaults() {
        check_lastfiles = true;
        make_backup = true;
        backupdir_path.erase();
-       exit_confirmation = true;
        display_graphics = "color";
-       display_shortcuts = true;
        // Spellchecker settings:
 #ifdef USE_PSPELL
        use_pspell = true;
@@ -248,15 +248,16 @@ void LyXRC::setDefaults() {
        language_command_begin = "\\selectlanguage{$$lang}";
        language_command_local = "\\foreignlanguage{$$lang}{";
        default_language = "english";
-       //
-       new_ask_filename = false;
+       show_banner = true;
 
        //
        date_insert_format = "%A, %e %B %Y";
-       show_banner = true;
        cursor_follows_scrollbar = false;
        dialogs_iconify_with_main = false;
        label_init_length = 3;
+       preview = false;
+       preview_hashed_labels  = false;
+       preview_scale_factor = 0.9;
 
        /// These variables are not stored on disk (perhaps they
        // should be moved from the LyXRC class).
@@ -346,11 +347,6 @@ int LyXRC::read(string const & filename)
                        }
                        break;
 
-               case RC_EXIT_CONFIRMATION:
-                       if (lexrc.next())
-                               exit_confirmation = lexrc.getBool();
-                       break;
-
                case RC_AUTORESET_OPTIONS:
                        if (lexrc.next())
                                auto_reset_options = lexrc.getBool();
@@ -361,11 +357,6 @@ int LyXRC::read(string const & filename)
                                display_graphics = lexrc.getString();
                        break;
 
-               case RC_DISPLAY_SHORTCUTS:
-                       if (lexrc.next())
-                               display_shortcuts = lexrc.getBool();
-                       break;
-
                case RC_KBMAP:
                        if (lexrc.next())
                                use_kbmap = lexrc.getBool();
@@ -505,7 +496,7 @@ int LyXRC::read(string const & filename)
                case RC_DEFAULT_PAPERSIZE:
                        if (lexrc.next()) {
                                string const size =
-                                       lowercase(lexrc.getString());
+                                       ascii_lowercase(lexrc.getString());
                                if (size == "usletter")
                                        default_papersize =
                                                BufferParams::PAPER_USLETTER;
@@ -734,7 +725,7 @@ int LyXRC::read(string const & filename)
                                break;
                        }
 
-                       if ((action = lyxaction.LookupFunc(cmd))>= 0) {
+                       if ((action = lyxaction.LookupFunc(cmd)) >= 0) {
                                if (lyxerr.debugging(Debug::LYXRC)) {
                                        lyxerr << "RC_BIND: Sequence `"
                                               << seq << "' Command `"
@@ -882,15 +873,7 @@ int LyXRC::read(string const & filename)
                        if (lexrc.next())
                                mark_foreign_language = lexrc.getBool();
                        break;
-               case RC_SHOW_BANNER:
-                       if (lexrc.next())
-                               show_banner = lexrc.getBool();
-                       break;
 
-               case RC_NEW_ASK_FILENAME:
-                       if (lexrc.next())
-                               new_ask_filename = lexrc.getBool();
-                       break;
                case RC_CONVERTER: {
                        string from, to, command, flags;
                        if (lexrc.next())
@@ -948,6 +931,26 @@ int LyXRC::read(string const & filename)
                                label_init_length = lexrc.getInteger();
                        break;
 
+               case RC_SHOW_BANNER:
+                       if (lexrc.next())
+                               show_banner = lexrc.getBool();
+                       break;
+
+               case RC_PREVIEW:
+                       if (lexrc.next())
+                               preview = lexrc.getBool();
+                       break;
+
+               case RC_PREVIEW_HASHED_LABELS:
+                       if (lexrc.next())
+                               preview_hashed_labels = lexrc.getBool();
+                       break;
+
+               case RC_PREVIEW_SCALE_FACTOR:
+                       if (lexrc.next())
+                               preview_scale_factor = lexrc.getFloat();
+                       break;
+
                case RC_LAST: break; // this is just a dummy
                }
        }
@@ -1015,11 +1018,6 @@ void LyXRC::output(ostream & os) const
                   << "# MISC SECTION ######################################\n"
                   << "#\n\n";
 
-       case RC_SHOW_BANNER:
-               if (show_banner != system_lyxrc.show_banner) {
-                       os << "# Set to false to inhibit the startup banner.\n"
-                          << "\\show_banner " << tostr(show_banner) << "\n";
-               }
                // bind files are not done here.
        case RC_UIFILE:
                if (ui_file != system_lyxrc.ui_file) {
@@ -1044,13 +1042,6 @@ void LyXRC::output(ostream & os) const
                        os << "# The time interval between auto-saves in seconds.\n"
                           << "\\autosave " << autosave << "\n";
                }
-       case RC_EXIT_CONFIRMATION:
-               if (exit_confirmation != system_lyxrc.exit_confirmation) {
-                       os << "# Ask for confirmation before exit if there are\n"
-                          << "# unsaved changed documents.\n"
-                          << "\\exit_confirmation " << tostr(exit_confirmation)
-                          << "\n";
-               }
        case RC_DISPLAY_GRAPHICS:
                if (display_graphics != system_lyxrc.display_graphics) {
                        os << "# Display graphics within LyX\n"
@@ -1059,13 +1050,6 @@ void LyXRC::output(ostream & os) const
                           << "\n";
                }
 
-       case RC_DISPLAY_SHORTCUTS:
-               if (display_shortcuts != system_lyxrc.display_shortcuts) {
-                       os << "# Display name of the last command executed,\n"
-                          << "# with a list of short-cuts in the minibuffer.\n"
-                          << "\\display_shortcuts " << tostr(display_shortcuts)
-                          << "\n";
-               }
        case RC_VIEWDVI_PAPEROPTION:
                if (view_dvi_paper_option
                    != system_lyxrc.view_dvi_paper_option) {
@@ -1134,6 +1118,29 @@ void LyXRC::output(ostream & os) const
                           << "\n";
                }
 
+       case RC_SHOW_BANNER:
+               if (show_banner != system_lyxrc.show_banner) {
+                       os << "\\show_banner " << tostr(show_banner) << "\n";
+               }
+
+       case RC_PREVIEW:
+               if (preview != system_lyxrc.preview) {
+                       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";
+               }
+
+       case RC_PREVIEW_SCALE_FACTOR:
+               if (preview_scale_factor != system_lyxrc.preview_scale_factor) {
+                       os << "\\preview_scale_factor "
+                          << preview_scale_factor << "\n";
+               }
+
                os << "\n#\n"
                   << "# SCREEN & FONTS SECTION ############################\n"
                   << "#\n\n";
@@ -1569,11 +1576,6 @@ void LyXRC::output(ostream & os) const
                if (auto_number != system_lyxrc.auto_number) {
                        os << "\\auto_number " << tostr(auto_number) << "\n";
                }
-       case RC_NEW_ASK_FILENAME:
-               if (new_ask_filename != system_lyxrc.new_ask_filename) {
-                       os << "\\new_ask_filename " << tostr(new_ask_filename)
-                          << "\n";
-               }
        case RC_DEFAULT_LANGUAGE:
                if (default_language != system_lyxrc.default_language) {
                        os << "\\default_language " << default_language << "\n";
@@ -1911,18 +1913,10 @@ string const LyXRC::getDescription(LyXRCTags tag)
                str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
                break;
 
-       case RC_EXIT_CONFIRMATION:
-               str = _("Sets whether LyX asks for a second confirmation to exit when you have changed documents. (LyX will still ask to save changed documents.)");
-               break;
-
        case RC_DISPLAY_GRAPHICS:
                str = _("Select how LyX will display any graphics.");
                break;
 
-       case RC_DISPLAY_SHORTCUTS:
-               str = _("LyX continously displays names of last command executed, along with a list of defined short-cuts for it in the minibuffer. Set to false if LyX seems slow.");
-               break;
-
        case RC_MAKE_BACKUP:
                str = _("De-select if you don't want LyX to create backup files.");
                break;
@@ -1993,10 +1987,6 @@ string const LyXRC::getDescription(LyXRCTags tag)
        case RC_FORMAT:
                break;
 
-       case RC_NEW_ASK_FILENAME:
-               str = _("This sets the behaviour if you want to be asked for a filename when creating a new document or wait until you save it and be asked then.");
-               break;
-
        case RC_DEFAULT_LANGUAGE:
                str = _("New documents will be assigned this language.");
                break;
@@ -2005,6 +1995,18 @@ string const LyXRC::getDescription(LyXRCTags tag)
                str = _("Maximum number of words in the initialization string for a new label");
                break;
 
+       case RC_PREVIEW:
+               str = _("Shows a typeset preview of things such as math");
+               break;
+
+       case RC_PREVIEW_HASHED_LABELS:
+               str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
+               break;
+
+       case RC_PREVIEW_SCALE_FACTOR:
+               str = _("Scale the preview size to suit.");
+               break;
+
        default:
                break;
        }