From 1e4ccc2d22c15e047423423d677f817871233f39 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Fri, 26 Mar 2010 14:02:56 +0000 Subject: [PATCH] Fix bug #6617: Allowing "compressed documents" be the default. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33870 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferParams.cpp | 2 +- src/LyXRC.cpp | 13 +++++++++++++ src/LyXRC.h | 3 +++ src/frontends/qt4/GuiPrefs.cpp | 6 +++++- src/frontends/qt4/ui/PrefUi.ui | 17 ++++++++++++----- 5 files changed, 34 insertions(+), 7 deletions(-) diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 1a543f7cb6..04d035481f 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -369,7 +369,7 @@ BufferParams::BufferParams() suppress_date = false; // white is equal to no background color backgroundcolor = lyx::rgbFromHexName("#ffffff"); - compressed = false; + compressed = lyxrc.save_compressed; for (int iter = 0; iter < 4; ++iter) { user_defined_bullet(iter) = ITEMIZE_DEFAULTS[iter]; temp_bullet(iter) = ITEMIZE_DEFAULTS[iter]; diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index 2f58f3b48a..3b363fd3f7 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -155,6 +155,7 @@ LexerKeyword lyxrcTags[] = { { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER }, { "\\printer", LyXRC::RC_PRINTER }, { "\\rtl", LyXRC::RC_RTL_SUPPORT }, + { "\\save_compressed", LyXRC::RC_SAVE_COMPRESSED }, { "\\screen_dpi", LyXRC::RC_SCREEN_DPI }, { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN }, { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY }, @@ -274,6 +275,7 @@ void LyXRC::setDefaults() use_lastfilepos = true; load_session = false; make_backup = true; + save_compressed = false; backupdir_path.erase(); display_graphics = true; // Spellchecker settings: @@ -921,6 +923,9 @@ int LyXRC::read(Lexer & lexrc) case RC_MAKE_BACKUP: lexrc >> make_backup; break; + case RC_SAVE_COMPRESSED: + lexrc >> save_compressed; + break; case RC_BACKUPDIR_PATH: if (lexrc.next()) { backupdir_path = os::internal_path(lexrc.getString()); @@ -2218,6 +2223,13 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c } if (tag != RC_LAST) break; + case RC_SAVE_COMPRESSED: + if (ignore_system_lyxrc || + save_compressed != system_lyxrc.save_compressed) { + os << "\\save_compressed " << convert(save_compressed) << '\n'; + } + if (tag != RC_LAST) + break; case RC_BACKUPDIR_PATH: if (ignore_system_lyxrc || backupdir_path != system_lyxrc.backupdir_path) { @@ -2736,6 +2748,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_PRINT_ADAPTOUTPUT: case LyXRC::RC_PRINT_COMMAND: case LyXRC::RC_RTL_SUPPORT: + case LyXRC::RC_SAVE_COMPRESSED: case LyXRC::RC_SCREEN_DPI: case LyXRC::RC_SCREEN_FONT_ROMAN: case LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY: diff --git a/src/LyXRC.h b/src/LyXRC.h index 45e203af7e..c68e83cd29 100644 --- a/src/LyXRC.h +++ b/src/LyXRC.h @@ -140,6 +140,7 @@ public: RC_PRINT_ADAPTOUTPUT, RC_PRINT_COMMAND, RC_RTL_SUPPORT, + RC_SAVE_COMPRESSED, RC_SCREEN_DPI, RC_SCREEN_FONT_ROMAN, RC_SCREEN_FONT_ROMAN_FOUNDRY, @@ -302,6 +303,8 @@ public: bool use_lastfilepos; /// load files from last session automatically bool load_session; + /// do we save new documents as compressed by default + bool save_compressed; /// shall a backup file be created bool make_backup; /// A directory for storing backup files diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 10d9cc0850..7d785eb594 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -2248,6 +2248,8 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form) this, SIGNAL(changed())); connect(backupCB, SIGNAL(clicked()), this, SIGNAL(changed())); + connect(saveCompressedCB, SIGNAL(clicked()), + this, SIGNAL(changed())); connect(lastfilesSB, SIGNAL(valueChanged(int)), this, SIGNAL(changed())); connect(tooltipCB, SIGNAL(toggled(bool)), @@ -2262,8 +2264,9 @@ void PrefUserInterface::apply(LyXRC & rc) const rc.use_lastfilepos = restoreCursorCB->isChecked(); rc.load_session = loadSessionCB->isChecked(); rc.allow_geometry_session = allowGeometrySessionCB->isChecked(); - rc.autosave = autoSaveCB->isChecked()? autoSaveSB->value() * 60 : 0; + rc.autosave = autoSaveCB->isChecked() ? autoSaveSB->value() * 60 : 0; rc.make_backup = backupCB->isChecked(); + rc.save_compressed = saveCompressedCB->isChecked(); rc.num_lastfiles = lastfilesSB->value(); rc.use_tooltip = tooltipCB->isChecked(); rc.open_buffers_in_tabs = openDocumentsInTabsCB->isChecked(); @@ -2289,6 +2292,7 @@ void PrefUserInterface::update(LyXRC const & rc) autoSaveCB->setChecked(autosave); autoSaveSB->setEnabled(autosave); backupCB->setChecked(rc.make_backup); + saveCompressedCB->setChecked(rc.save_compressed); lastfilesSB->setValue(rc.num_lastfiles); tooltipCB->setChecked(rc.use_tooltip); openDocumentsInTabsCB->setChecked(rc.open_buffers_in_tabs); diff --git a/src/frontends/qt4/ui/PrefUi.ui b/src/frontends/qt4/ui/PrefUi.ui index c06d76c822..a3a04d0bea 100644 --- a/src/frontends/qt4/ui/PrefUi.ui +++ b/src/frontends/qt4/ui/PrefUi.ui @@ -91,7 +91,7 @@ true - + @@ -196,6 +196,13 @@ + + + &Save documents compressed by default + + + + &Maximum last files: @@ -205,14 +212,14 @@ - + 9 - + Qt::Horizontal @@ -225,14 +232,14 @@ - + &Open documents in tabs - + Whether to place close button on each tab or only one in the top left.