]> git.lyx.org Git - features.git/blobdiff - src/frontends/qt2/QPrefs.C
change "support/std_sstream.h" to <sstream>
[features.git] / src / frontends / qt2 / QPrefs.C
index 3c8c1072e4f59883ac89a9e1d5ace2604d00d3cb..47fbdd6e8d1a1ece66a7ea6a79aea4b9bd62bf18 100644 (file)
 
 #include <config.h>
 
-#include "debug.h"
-#include "support/lstrings.h"
-#include "support/tostr.h"
-#include "support/std_sstream.h"
-#include <iomanip>
-
-#include "ControlPrefs.h"
+#include "QPrefs.h"
 #include "QPrefsDialog.h"
+
+#include "lcolorcache.h"
+#include "Qt2BC.h"
+#include "qt_helpers.h"
+
 #include "ui/QPrefAsciiModule.h"
 #include "ui/QPrefDateModule.h"
 #include "ui/QPrefKeyboardModule.h"
 #include "ui/QPrefPrinterModule.h"
 #include "ui/QPrefUIModule.h"
 #include "ui/QPrefIdentityModule.h"
-#include "lyx_gui.h"
-#include "QPrefs.h"
-#include "Qt2BC.h"
+
+#include "debug.h"
+#include "LColor.h"
 #include "lyxfont.h"
-#include "frnt_lang.h"
-#include "helper_funcs.h"
-#include "qt_helpers.h"
-#include "lcolorcache.h"
 
-#include <boost/tuple/tuple.hpp>
+#include "support/lstrings.h"
+#include "support/tostr.h"
+
+#include "controllers/ControlPrefs.h"
+#include "controllers/frnt_lang.h"
+#include "controllers/helper_funcs.h"
+
+#include "frontends/lyx_gui.h"
 
-#include <qpushbutton.h>
 #include <qcheckbox.h>
-#include <qlineedit.h>
-#include <qspinbox.h>
+#include "qcoloritem.h"
 #include <qcombobox.h>
 #include <qlabel.h>
-#include "qcoloritem.h"
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qspinbox.h>
 
-#include "LColor.h"
+#include <boost/tuple/tuple.hpp>
+
+#include <iomanip>
+#include <sstream>
 
 using lyx::support::compare_no_case;
 using lyx::support::strToDbl;
@@ -64,12 +69,26 @@ using std::ostringstream;
 using std::pair;
 using std::vector;
 
+namespace lyx {
+namespace frontend {
+
+typedef QController<ControlPrefs, QView<QPrefsDialog> > base_class;
+
+QPrefs::QPrefs(Dialog & parent)
+       : base_class(parent, _("LyX: Preferences"))
+{
+}
+
+
+Converters & QPrefs::converters()
+{
+       return controller().converters();
+}
 
-typedef Qt2CB<ControlPrefs, Qt2DB<QPrefsDialog> > base_class;
 
-QPrefs::QPrefs()
-       : base_class(_("LyX: Preferences"))
+Formats & QPrefs::formats()
 {
+       return controller().formats();
 }
 
 
@@ -86,11 +105,13 @@ void QPrefs::build_dialog()
 
        langmod->defaultLanguageCO->clear();
        // store the lang identifiers for later
-       vector<frnt::LanguagePair> const langs = frnt::getLanguageData(false);
+       using lyx::frontend::LanguagePair;
+       vector<LanguagePair> const langs =
+               lyx::frontend::getLanguageData(false);
        lang_ = getSecond(langs);
 
-       vector<frnt::LanguagePair>::const_iterator lit  = langs.begin();
-       vector<frnt::LanguagePair>::const_iterator lend = langs.end();
+       vector<LanguagePair>::const_iterator lit  = langs.begin();
+       vector<LanguagePair>::const_iterator lend = langs.end();
        for (; lit != lend; ++lit) {
                langmod->defaultLanguageCO->insertItem(toqstr(lit->first));
        }
@@ -161,6 +182,7 @@ void QPrefs::apply()
 
        rc.fontenc = fromqstr(latexmod->latexEncodingED->text());
        rc.chktex_command = fromqstr(latexmod->latexChecktexED->text());
+       rc.bibtex_command = fromqstr(latexmod->latexBibtexED->text());
        rc.auto_reset_options = latexmod->latexAutoresetCB->isChecked();
        rc.view_dvi_paper_option = fromqstr(latexmod->latexDviPaperED->text());
        rc.default_papersize =
@@ -168,15 +190,25 @@ void QPrefs::apply()
 
        QPrefDisplayModule * displaymod(dialog_->displayModule);
 
-       rc.preview = displaymod->previewCB->isChecked();
+       switch (displaymod->instantPreviewCO->currentItem()) {
+       case 0:
+               rc.preview = LyXRC::PREVIEW_OFF;
+               break;
+       case 1:
+               rc.preview = LyXRC::PREVIEW_NO_MATH;
+               break;
+       case 2:
+               rc.preview = LyXRC::PREVIEW_ON;
+               break;
+       }
 
        lyx::graphics::DisplayType dtype(lyx::graphics::ColorDisplay);
 
        switch (displaymod->displayGraphicsCO->currentItem()) {
-               case 3: dtype = lyx::graphics::NoDisplay; break;
-               case 2: dtype = lyx::graphics::ColorDisplay; break;
-               case 1: dtype = lyx::graphics::GrayscaleDisplay;        break;
-               case 0: dtype = lyx::graphics::MonochromeDisplay; break;
+       case 3: dtype = lyx::graphics::NoDisplay; break;
+       case 2: dtype = lyx::graphics::ColorDisplay; break;
+       case 1: dtype = lyx::graphics::GrayscaleDisplay;        break;
+       case 0: dtype = lyx::graphics::MonochromeDisplay; break;
        }
        rc.display_graphics = dtype;
 
@@ -286,9 +318,6 @@ void QPrefs::apply()
                controller().updateScreenFonts();
        }
 
-       controller().setFormats(formats_);
-       controller().setConverters(converters_);
-
        QPrefColorsModule * colmod(dialog_->colorsModule);
 
        unsigned int i;
@@ -472,6 +501,7 @@ void QPrefs::update_contents()
 
        latexmod->latexEncodingED->setText(toqstr(rc.fontenc));
        latexmod->latexChecktexED->setText(toqstr(rc.chktex_command));
+       latexmod->latexBibtexED->setText(toqstr(rc.bibtex_command));
        latexmod->latexAutoresetCB->setChecked(rc.auto_reset_options);
        latexmod->latexDviPaperED->setText(toqstr(rc.view_dvi_paper_option));
        latexmod->latexPaperSizeCO->setCurrentItem(rc.default_papersize);
@@ -479,7 +509,17 @@ void QPrefs::update_contents()
 
        QPrefDisplayModule * displaymod(dialog_->displayModule);
 
-       displaymod->previewCB->setChecked(rc.preview);
+       switch (rc.preview) {
+       case LyXRC::PREVIEW_OFF:
+               displaymod->instantPreviewCO->setCurrentItem(0);
+               break;
+       case LyXRC::PREVIEW_NO_MATH :
+               displaymod->instantPreviewCO->setCurrentItem(1);
+               break;
+       case LyXRC::PREVIEW_ON :
+               displaymod->instantPreviewCO->setCurrentItem(2);
+               break;
+       }
 
        int item = 2;
 
@@ -580,11 +620,10 @@ void QPrefs::update_contents()
        fontmod->screenHugeED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_HUGE])));
        fontmod->screenHugerED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_HUGER])));
 
-       formats_ = formats;
-
        dialog_->updateFormats();
 
-       converters_ = converters;
-
        dialog_->updateConverters();
 }
+
+} // namespace frontend
+} // namespace lyx