#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/QPrefLatexModule.h"
#include "ui/QPrefScreenFontsModule.h"
#include "ui/QPrefColorsModule.h"
+#if defined(__CYGWIN__) || defined(__CYGWIN32__)
+#include "ui/QPrefCygwinPathModule.h"
+#endif
#include "ui/QPrefDisplayModule.h"
#include "ui/QPrefPathsModule.h"
#include "ui/QPrefSpellcheckerModule.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 "lastfiles.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 "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;
+using std::distance;
using std::endl;
using std::setfill;
using std::setw;
-
+using std::string;
using std::ostringstream;
using std::pair;
using std::vector;
+namespace lyx {
+namespace frontend {
-typedef Qt2CB<ControlPrefs, Qt2DB<QPrefsDialog> > base_class;
+typedef QController<ControlPrefs, QView<QPrefsDialog> > base_class;
-QPrefs::QPrefs()
- : base_class(_("LyX: Preferences"))
+QPrefs::QPrefs(Dialog & parent)
+ : base_class(parent, _("LyX: Preferences"))
{
}
+Converters & QPrefs::converters()
+{
+ return controller().converters();
+}
+
+
+Formats & QPrefs::formats()
+{
+ return controller().formats();
+}
+
+
+Movers & QPrefs::movers()
+{
+ return controller().movers();
+}
+
+
void QPrefs::build_dialog()
{
dialog_.reset(new QPrefsDialog(this));
bcview().setCancel(dialog_->closePB);
bcview().setRestore(dialog_->restorePB);
+ dialog_->uiModule->lastfilesSB->setMaxValue(maxlastfiles);
+
QPrefLanguageModule * langmod(dialog_->languageModule);
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));
}
rc.date_insert_format = fromqstr(datemod->DateED->text());
+#if defined(__CYGWIN__) || defined(__CYGWIN32__)
+ QPrefCygwinPathModule * cygwinmod(dialog_->cygwinpathModule);
+ rc.cygwin_path_fix = cygwinmod->pathCB->isChecked();
+#endif
QPrefLatexModule * latexmod(dialog_->latexModule);
rc.fontenc = fromqstr(latexmod->latexEncodingED->text());
rc.chktex_command = fromqstr(latexmod->latexChecktexED->text());
+ rc.bibtex_command = fromqstr(latexmod->latexBibtexED->text());
+ rc.index_command = fromqstr(latexmod->latexIndexED->text());
rc.auto_reset_options = latexmod->latexAutoresetCB->isChecked();
rc.view_dvi_paper_option = fromqstr(latexmod->latexDviPaperED->text());
rc.default_papersize =
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;
rc.document_path = fromqstr(pathsmod->workingDirED->text());
rc.template_path = fromqstr(pathsmod->templateDirED->text());
rc.backupdir_path = fromqstr(pathsmod->backupDirED->text());
- rc.use_tempdir = pathsmod->tempDirCB->isChecked();
rc.tempdir_path = fromqstr(pathsmod->tempDirED->text());
+ rc.path_prefix = fromqstr(pathsmod->pathPrefixED->text());
// FIXME: should be a checkbox only
rc.lyxpipes = fromqstr(pathsmod->lyxserverDirED->text());
rc.zoom = fontmod->screenZoomSB->value();
rc.dpi = fontmod->screenDpiSB->value();
- rc.font_sizes[LyXFont::SIZE_TINY] = strToDbl(fromqstr(fontmod->screenTinyED->text()));
- rc.font_sizes[LyXFont::SIZE_SCRIPT] = strToDbl(fromqstr(fontmod->screenSmallestED->text()));
- rc.font_sizes[LyXFont::SIZE_FOOTNOTE] = strToDbl(fromqstr(fontmod->screenSmallerED->text()));
- rc.font_sizes[LyXFont::SIZE_SMALL] = strToDbl(fromqstr(fontmod->screenSmallED->text()));
- rc.font_sizes[LyXFont::SIZE_NORMAL] = strToDbl(fromqstr(fontmod->screenNormalED->text()));
- rc.font_sizes[LyXFont::SIZE_LARGE] = strToDbl(fromqstr(fontmod->screenLargeED->text()));
- rc.font_sizes[LyXFont::SIZE_LARGER] = strToDbl(fromqstr(fontmod->screenLargerED->text()));
- rc.font_sizes[LyXFont::SIZE_LARGEST] = strToDbl(fromqstr(fontmod->screenLargestED->text()));
- rc.font_sizes[LyXFont::SIZE_HUGE] = strToDbl(fromqstr(fontmod->screenHugeED->text()));
- rc.font_sizes[LyXFont::SIZE_HUGER] = strToDbl(fromqstr(fontmod->screenHugerED->text()));
+ rc.font_sizes[LyXFont::SIZE_TINY] = fromqstr(fontmod->screenTinyED->text());
+ rc.font_sizes[LyXFont::SIZE_SCRIPT] = fromqstr(fontmod->screenSmallestED->text());
+ rc.font_sizes[LyXFont::SIZE_FOOTNOTE] = fromqstr(fontmod->screenSmallerED->text());
+ rc.font_sizes[LyXFont::SIZE_SMALL] = fromqstr(fontmod->screenSmallED->text());
+ rc.font_sizes[LyXFont::SIZE_NORMAL] = fromqstr(fontmod->screenNormalED->text());
+ rc.font_sizes[LyXFont::SIZE_LARGE] = fromqstr(fontmod->screenLargeED->text());
+ rc.font_sizes[LyXFont::SIZE_LARGER] = fromqstr(fontmod->screenLargerED->text());
+ rc.font_sizes[LyXFont::SIZE_LARGEST] = fromqstr(fontmod->screenLargestED->text());
+ rc.font_sizes[LyXFont::SIZE_HUGE] = fromqstr(fontmod->screenHugeED->text());
+ rc.font_sizes[LyXFont::SIZE_HUGER] = fromqstr(fontmod->screenHugerED->text());
if (rc.font_sizes != oldrc.font_sizes
|| rc.roman_font_name != oldrc.roman_font_name
controller().updateScreenFonts();
}
- controller().setFormats(formats_);
- controller().setConverters(converters_);
-
QPrefColorsModule * colmod(dialog_->colorsModule);
unsigned int i;
typename std::vector<A>::size_type
findPos(std::vector<A> const & vec, A const & val)
{
- typename std::vector<A>::const_iterator it =
- std::find(vec.begin(), vec.end(), val);
+ typedef typename std::vector<A>::const_iterator Cit;
+
+ Cit it = std::find(vec.begin(), vec.end(), val);
if (it == vec.end())
return 0;
- return std::distance(vec.begin(), it);
+ return distance(vec.begin(), it);
}
void setComboxFont(QComboBox * cb, string const & family, string const & foundry)
for (int i = 0; i < cb->count(); ++i) {
lyxerr << "Looking at " << fromqstr(cb->text(i)) << endl;
- if (compare_no_case(cb->text(i).latin1(), info.family().latin1()) == 0) {
+ if (compare_no_case(fromqstr(cb->text(i)), fromqstr(info.family())) == 0) {
cb->setCurrentItem(i);
return;
}
datemod->DateED->setText(toqstr(rc.date_insert_format));
+#if defined(__CYGWIN__) || defined(__CYGWIN32__)
+ QPrefCygwinPathModule * cygwinmod(dialog_->cygwinpathModule);
+ cygwinmod->pathCB->setChecked(rc.cygwin_path_fix);
+#endif
QPrefLatexModule * latexmod(dialog_->latexModule);
latexmod->latexEncodingED->setText(toqstr(rc.fontenc));
latexmod->latexChecktexED->setText(toqstr(rc.chktex_command));
+ latexmod->latexBibtexED->setText(toqstr(rc.bibtex_command));
+ latexmod->latexIndexED->setText(toqstr(rc.index_command));
latexmod->latexAutoresetCB->setChecked(rc.auto_reset_options);
latexmod->latexDviPaperED->setText(toqstr(rc.view_dvi_paper_option));
latexmod->latexPaperSizeCO->setCurrentItem(rc.default_papersize);
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;
pathsmod->workingDirED->setText(toqstr(rc.document_path));
pathsmod->templateDirED->setText(toqstr(rc.template_path));
pathsmod->backupDirED->setText(toqstr(rc.backupdir_path));
- pathsmod->tempDirCB->setChecked(rc.use_tempdir);
pathsmod->tempDirED->setText(toqstr(rc.tempdir_path));
+ pathsmod->pathPrefixED->setText(toqstr(rc.path_prefix));
// FIXME: should be a checkbox only
pathsmod->lyxserverDirED->setText(toqstr(rc.lyxpipes));
-
QPrefSpellcheckerModule * spellmod(dialog_->spellcheckerModule);
spellmod->spellCommandCO->setCurrentItem(0);
dialog_->select_typewriter(fontmod->screenTypewriterCO->currentText());
fontmod->screenZoomSB->setValue(rc.zoom);
- fontmod->screenDpiSB->setValue(int(rc.dpi));
- fontmod->screenTinyED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_TINY])));
- fontmod->screenSmallestED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_SCRIPT])));
- fontmod->screenSmallerED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_FOOTNOTE])));
- fontmod->screenSmallED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_SMALL])));
- fontmod->screenNormalED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_NORMAL])));
- fontmod->screenLargeED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_LARGE])));
- fontmod->screenLargerED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_LARGER])));
- fontmod->screenLargestED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_LARGEST])));
- fontmod->screenHugeED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_HUGE])));
- fontmod->screenHugerED->setText(toqstr(tostr(rc.font_sizes[LyXFont::SIZE_HUGER])));
-
- formats_ = formats;
+ fontmod->screenDpiSB->setValue(rc.dpi);
+ fontmod->screenTinyED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_TINY]));
+ fontmod->screenSmallestED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_SCRIPT]));
+ fontmod->screenSmallerED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_FOOTNOTE]));
+ fontmod->screenSmallED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_SMALL]));
+ fontmod->screenNormalED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_NORMAL]));
+ fontmod->screenLargeED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_LARGE]));
+ fontmod->screenLargerED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_LARGER]));
+ fontmod->screenLargestED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_LARGEST]));
+ fontmod->screenHugeED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_HUGE]));
+ fontmod->screenHugerED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_HUGER]));
dialog_->updateFormats();
-
- converters_ = converters;
-
dialog_->updateConverters();
+ dialog_->updateCopiers();
}
+
+} // namespace frontend
+} // namespace lyx