2002-11-13 02:22:48 +00:00
|
|
|
/**
|
|
|
|
* \file QPrefs.C
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author John Levon
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
2002-11-15 06:32:13 +00:00
|
|
|
#include "support/lstrings.h"
|
2002-11-17 09:42:25 +00:00
|
|
|
#include "Lsstream.h"
|
|
|
|
#include <iomanip>
|
2002-11-27 10:30:28 +00:00
|
|
|
|
2002-11-13 02:22:48 +00:00
|
|
|
#include "ControlPrefs.h"
|
|
|
|
#include "QPrefsDialog.h"
|
2002-11-15 06:32:13 +00:00
|
|
|
#include "ui/QPrefAsciiModule.h"
|
|
|
|
#include "ui/QPrefDateModule.h"
|
|
|
|
#include "ui/QPrefKeyboardModule.h"
|
|
|
|
#include "ui/QPrefLatexModule.h"
|
|
|
|
#include "ui/QPrefScreenFontsModule.h"
|
|
|
|
#include "ui/QPrefColorsModule.h"
|
|
|
|
#include "ui/QPrefDisplayModule.h"
|
|
|
|
#include "ui/QPrefPathsModule.h"
|
|
|
|
#include "ui/QPrefSpellcheckerModule.h"
|
|
|
|
#include "ui/QPrefConvertersModule.h"
|
|
|
|
#include "ui/QPrefFileformatsModule.h"
|
|
|
|
#include "ui/QPrefLanguageModule.h"
|
|
|
|
#include "ui/QPrefPrinterModule.h"
|
|
|
|
#include "ui/QPrefUIModule.h"
|
2002-11-13 02:22:48 +00:00
|
|
|
#include "QPrefs.h"
|
|
|
|
#include "Qt2BC.h"
|
|
|
|
#include "lyxrc.h"
|
2002-11-17 05:37:27 +00:00
|
|
|
#include "frnt_lang.h"
|
|
|
|
#include "helper_funcs.h"
|
2002-11-27 21:49:50 +00:00
|
|
|
#include "qt_helpers.h"
|
2002-11-17 09:42:25 +00:00
|
|
|
#include "debug.h"
|
2002-11-13 02:22:48 +00:00
|
|
|
|
2002-11-27 21:49:50 +00:00
|
|
|
#include <boost/tuple/tuple.hpp>
|
|
|
|
|
2002-11-13 02:22:48 +00:00
|
|
|
#include <qpushbutton.h>
|
2002-11-15 06:32:13 +00:00
|
|
|
#include <qcheckbox.h>
|
|
|
|
#include <qlineedit.h>
|
|
|
|
#include <qspinbox.h>
|
2002-11-27 10:30:28 +00:00
|
|
|
#include <qcombobox.h>
|
2002-11-17 07:11:02 +00:00
|
|
|
#include <qlistbox.h>
|
2002-11-25 03:18:27 +00:00
|
|
|
#include <qlabel.h>
|
2002-11-17 09:42:25 +00:00
|
|
|
#include "qcoloritem.h"
|
2002-11-27 10:30:28 +00:00
|
|
|
|
2002-11-17 08:40:04 +00:00
|
|
|
using std::vector;
|
2002-11-27 21:49:50 +00:00
|
|
|
using std::pair;
|
2002-11-17 09:42:25 +00:00
|
|
|
using std::ostringstream;
|
|
|
|
using std::setfill;
|
|
|
|
using std::setw;
|
|
|
|
using std::endl;
|
2002-11-27 10:30:28 +00:00
|
|
|
|
2002-11-13 02:22:48 +00:00
|
|
|
typedef Qt2CB<ControlPrefs, Qt2DB<QPrefsDialog> > base_class;
|
|
|
|
|
|
|
|
|
|
|
|
QPrefs::QPrefs()
|
|
|
|
: base_class(_("LyX: Preferences"))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QPrefs::build_dialog()
|
|
|
|
{
|
|
|
|
dialog_.reset(new QPrefsDialog(this));
|
|
|
|
|
|
|
|
bc().setOK(dialog_->savePB);
|
|
|
|
bc().setApply(dialog_->applyPB);
|
|
|
|
bc().setCancel(dialog_->closePB);
|
|
|
|
bc().setRestore(dialog_->restorePB);
|
2002-11-27 10:30:28 +00:00
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
QPrefLanguageModule * langmod(dialog_->languageModule);
|
2002-11-27 10:30:28 +00:00
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
langmod->defaultLanguageCO->clear();
|
|
|
|
// store the lang identifiers for later
|
|
|
|
vector<frnt::LanguagePair> const langs = frnt::getLanguageData(false);
|
|
|
|
lang_ = getSecond(langs);
|
|
|
|
|
|
|
|
vector<frnt::LanguagePair>::const_iterator lit = langs.begin();
|
|
|
|
vector<frnt::LanguagePair>::const_iterator lend = langs.end();
|
|
|
|
for (; lit != lend; ++lit) {
|
|
|
|
langmod->defaultLanguageCO->insertItem(lit->first.c_str());
|
|
|
|
}
|
2002-11-13 02:22:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QPrefs::apply()
|
|
|
|
{
|
|
|
|
LyXRC & rc(controller().rc());
|
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
QPrefLanguageModule * langmod(dialog_->languageModule);
|
2002-11-27 10:30:28 +00:00
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
// FIXME: remove rtl_support bool
|
|
|
|
rc.rtl_support = langmod->rtlCB->isChecked();
|
2002-11-27 10:30:28 +00:00
|
|
|
rc.mark_foreign_language = langmod->markForeignCB->isChecked();
|
|
|
|
rc.language_auto_begin = langmod->autoBeginCB->isChecked();
|
|
|
|
rc.language_auto_end = langmod->autoEndCB->isChecked();
|
2002-11-17 05:37:27 +00:00
|
|
|
rc.language_use_babel = langmod->useBabelCB->isChecked();
|
|
|
|
rc.language_global_options = langmod->globalCB->isChecked();
|
|
|
|
rc.language_package = langmod->languagePackageED->text().latin1();
|
|
|
|
rc.language_command_begin = langmod->startCommandED->text().latin1();
|
|
|
|
rc.language_command_end = langmod->endCommandED->text().latin1();
|
2002-11-27 10:30:28 +00:00
|
|
|
rc.default_language = lang_[langmod->defaultLanguageCO->currentItem()];
|
2002-11-17 05:37:27 +00:00
|
|
|
|
2002-11-27 10:30:28 +00:00
|
|
|
QPrefUIModule * uimod(dialog_->uiModule);
|
2002-11-15 06:02:43 +00:00
|
|
|
|
2002-11-17 11:45:18 +00:00
|
|
|
rc.ui_file = uimod->uiFileED->text().latin1();
|
|
|
|
rc.bind_file = uimod->bindFileED->text().latin1();
|
2002-11-27 10:30:28 +00:00
|
|
|
rc.cursor_follows_scrollbar = uimod->cursorFollowsCB->isChecked();
|
2002-11-17 05:37:27 +00:00
|
|
|
rc.wheel_jump = uimod->wheelMouseSB->value();
|
|
|
|
rc.autosave = uimod->autoSaveSB->value() * 60;
|
|
|
|
rc.make_backup = uimod->autoSaveCB->isChecked();
|
|
|
|
rc.num_lastfiles = uimod->lastfilesSB->value();
|
2002-11-27 10:30:28 +00:00
|
|
|
|
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
QPrefKeyboardModule * keymod(dialog_->keyboardModule);
|
2002-11-15 06:02:43 +00:00
|
|
|
|
2002-11-27 10:30:28 +00:00
|
|
|
// FIXME: can derive CB from the two EDs
|
2002-11-17 05:37:27 +00:00
|
|
|
rc.use_kbmap = keymod->keymapCB->isChecked();
|
|
|
|
rc.primary_kbmap = keymod->firstKeymapED->text().latin1();
|
|
|
|
rc.secondary_kbmap = keymod->secondKeymapED->text().latin1();
|
2002-11-27 10:30:28 +00:00
|
|
|
|
2002-11-15 06:02:43 +00:00
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
QPrefAsciiModule * ascmod(dialog_->asciiModule);
|
2002-11-15 06:02:43 +00:00
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
rc.ascii_linelen = ascmod->asciiLinelengthSB->value();
|
|
|
|
rc.ascii_roff_command = ascmod->asciiRoffED->text().latin1();
|
2002-11-15 06:02:43 +00:00
|
|
|
|
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
QPrefDateModule * datemod(dialog_->dateModule);
|
|
|
|
|
|
|
|
rc.date_insert_format = datemod->DateED->text().latin1();
|
2002-11-15 06:02:43 +00:00
|
|
|
|
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
QPrefLatexModule * latexmod(dialog_->latexModule);
|
2002-11-15 06:02:43 +00:00
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
rc.fontenc = latexmod->latexEncodingED->text().latin1();
|
2002-11-27 10:30:28 +00:00
|
|
|
rc.chktex_command = latexmod->latexChecktexED->text().latin1();
|
2002-11-17 05:37:27 +00:00
|
|
|
rc.auto_reset_options = latexmod->latexAutoresetCB->isChecked();
|
|
|
|
rc.view_dvi_paper_option = latexmod->latexDviPaperED->text().latin1();
|
|
|
|
rc.default_papersize =
|
|
|
|
static_cast<BufferParams::PAPER_SIZE>(latexmod->latexPaperSizeCO->currentItem());
|
2002-11-15 06:02:43 +00:00
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
|
|
|
|
QPrefDisplayModule * displaymod(dialog_->displayModule);
|
|
|
|
|
|
|
|
rc.preview = displaymod->previewCB->isChecked();
|
2002-11-27 10:30:28 +00:00
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
grfx::DisplayType dtype(grfx::ColorDisplay);
|
2002-11-27 10:30:28 +00:00
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
switch (displaymod->displayGraphicsCO->currentItem()) {
|
|
|
|
case 3: dtype = grfx::NoDisplay; break;
|
|
|
|
case 2: dtype = grfx::ColorDisplay; break;
|
|
|
|
case 1: dtype = grfx::GrayscaleDisplay; break;
|
|
|
|
case 0: dtype = grfx::MonochromeDisplay; break;
|
2002-11-15 06:02:43 +00:00
|
|
|
}
|
2002-11-17 05:37:27 +00:00
|
|
|
rc.display_graphics = dtype;
|
2002-11-27 10:30:28 +00:00
|
|
|
|
2002-11-15 06:02:43 +00:00
|
|
|
#ifdef WITH_WARNINGS
|
|
|
|
#warning FIXME!! The graphics cache no longer has a changeDisplay method.
|
|
|
|
#endif
|
|
|
|
#if 0
|
|
|
|
if (old_value != rc.display_graphics) {
|
|
|
|
grfx::GCache & gc = grfx::GCache::get();
|
|
|
|
gc.changeDisplay();
|
|
|
|
}
|
|
|
|
#endif
|
2002-11-27 10:30:28 +00:00
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
QPrefPathsModule * pathsmod(dialog_->pathsModule);
|
2002-11-27 10:30:28 +00:00
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
rc.document_path = pathsmod->workingDirED->text().latin1();
|
|
|
|
rc.template_path = pathsmod->templateDirED->text().latin1();
|
|
|
|
rc.backupdir_path = pathsmod->backupDirED->text().latin1();
|
|
|
|
rc.use_tempdir = pathsmod->tempDirCB->isChecked();
|
|
|
|
rc.tempdir_path = pathsmod->tempDirED->text().latin1();
|
|
|
|
// FIXME: should be a checkbox only
|
|
|
|
rc.lyxpipes = pathsmod->lyxserverDirED->text().latin1();
|
2002-11-15 06:02:43 +00:00
|
|
|
|
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
QPrefSpellcheckerModule * spellmod(dialog_->spellcheckerModule);
|
2002-11-15 06:02:43 +00:00
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
if (spellmod->spellCommandCO->currentItem() == 0)
|
|
|
|
rc.isp_command = "ispell";
|
|
|
|
else
|
|
|
|
rc.isp_command = "aspell";
|
2002-11-27 10:30:28 +00:00
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
// FIXME: remove isp_use_alt_lang
|
|
|
|
rc.isp_alt_lang = spellmod->altLanguageED->text().latin1();
|
2002-11-27 10:30:28 +00:00
|
|
|
rc.isp_use_alt_lang = !rc.isp_alt_lang.empty();
|
|
|
|
// FIXME: remove isp_use_esc_chars
|
2002-11-17 05:37:27 +00:00
|
|
|
rc.isp_esc_chars = spellmod->escapeCharactersED->text().latin1();
|
|
|
|
rc.isp_use_esc_chars = !rc.isp_esc_chars.empty();
|
2002-11-27 10:30:28 +00:00
|
|
|
// FIXME: remove isp_use_pers_dict
|
2002-11-17 05:37:27 +00:00
|
|
|
rc.isp_pers_dict = spellmod->persDictionaryED->text().latin1();
|
|
|
|
rc.isp_use_pers_dict = !rc.isp_pers_dict.empty();
|
|
|
|
rc.isp_accept_compound = spellmod->compoundWordCB->isChecked();
|
|
|
|
rc.isp_use_input_encoding = spellmod->inputEncodingCB->isChecked();
|
|
|
|
|
|
|
|
|
|
|
|
QPrefPrinterModule * printmod(dialog_->printerModule);
|
|
|
|
|
|
|
|
rc.print_adapt_output = printmod->printerAdaptCB->isChecked();
|
|
|
|
rc.print_command = printmod->printerCommandED->text().latin1();
|
|
|
|
rc.printer = printmod->printerNameED->text().latin1();
|
|
|
|
|
|
|
|
rc.print_pagerange_flag = printmod->printerPageRangeED->text().latin1();
|
|
|
|
rc.print_copies_flag = printmod->printerCopiesED->text().latin1();
|
|
|
|
rc.print_reverse_flag = printmod->printerReverseED->text().latin1();
|
|
|
|
rc.print_to_printer = printmod->printerToPrinterED->text().latin1();
|
|
|
|
rc.print_file_extension = printmod->printerExtensionED->text().latin1();
|
|
|
|
rc.print_file_extension = printmod->printerSpoolCommandED->text().latin1();
|
|
|
|
rc.print_paper_flag = printmod->printerPaperTypeED->text().latin1();
|
|
|
|
rc.print_evenpage_flag = printmod->printerEvenED->text().latin1();
|
|
|
|
rc.print_oddpage_flag = printmod->printerOddED->text().latin1();
|
|
|
|
rc.print_collcopies_flag = printmod->printerCollatedED->text().latin1();
|
|
|
|
rc.print_landscape_flag = printmod->printerLandscapeED->text().latin1();
|
|
|
|
rc.print_to_file = printmod->printerToFileED->text().latin1();
|
|
|
|
rc.print_extra_options = printmod->printerExtraED->text().latin1();
|
|
|
|
rc.print_spool_printerprefix = printmod->printerSpoolPrefixED->text().latin1();
|
|
|
|
rc.print_paper_dimension_flag = printmod->printerPaperSizeED->text().latin1();
|
|
|
|
|
|
|
|
|
|
|
|
QPrefScreenFontsModule * fontmod(dialog_->screenfontsModule);
|
|
|
|
|
|
|
|
LyXRC const oldrc(rc);
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-27 21:49:50 +00:00
|
|
|
boost::tie(rc.roman_font_name, rc.roman_font_foundry)
|
|
|
|
= parseFontName(fontmod->screenRomanCO->currentText().latin1());
|
2002-12-01 22:59:25 +00:00
|
|
|
boost::tie(rc.sans_font_name, rc.sans_font_foundry) =
|
2002-11-27 21:49:50 +00:00
|
|
|
parseFontName(fontmod->screenSansCO->currentText().latin1());
|
|
|
|
boost::tie(rc.typewriter_font_name, rc.typewriter_font_foundry) =
|
|
|
|
parseFontName(fontmod->screenTypewriterCO->currentText().latin1());
|
2002-11-27 10:30:28 +00:00
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
rc.zoom = fontmod->screenZoomSB->value();
|
|
|
|
rc.dpi = fontmod->screenDpiSB->value();
|
|
|
|
rc.font_sizes[LyXFont::SIZE_TINY] = strToDbl(fontmod->screenTinyED->text().latin1());
|
|
|
|
rc.font_sizes[LyXFont::SIZE_SCRIPT] = strToDbl(fontmod->screenSmallestED->text().latin1());
|
|
|
|
rc.font_sizes[LyXFont::SIZE_FOOTNOTE] = strToDbl(fontmod->screenSmallerED->text().latin1());
|
|
|
|
rc.font_sizes[LyXFont::SIZE_SMALL] = strToDbl(fontmod->screenSmallED->text().latin1());
|
|
|
|
rc.font_sizes[LyXFont::SIZE_NORMAL] = strToDbl(fontmod->screenNormalED->text().latin1());
|
|
|
|
rc.font_sizes[LyXFont::SIZE_LARGE] = strToDbl(fontmod->screenLargeED->text().latin1());
|
|
|
|
rc.font_sizes[LyXFont::SIZE_LARGER] = strToDbl(fontmod->screenLargerED->text().latin1());
|
|
|
|
rc.font_sizes[LyXFont::SIZE_LARGEST] = strToDbl(fontmod->screenLargestED->text().latin1());
|
|
|
|
rc.font_sizes[LyXFont::SIZE_HUGE] = strToDbl(fontmod->screenHugeED->text().latin1());
|
|
|
|
rc.font_sizes[LyXFont::SIZE_HUGER] = strToDbl(fontmod->screenHugerED->text().latin1());
|
|
|
|
|
|
|
|
if (rc.font_sizes != oldrc.font_sizes
|
|
|
|
|| rc.roman_font_name != oldrc.roman_font_name
|
|
|
|
|| rc.sans_font_name != oldrc.sans_font_name
|
|
|
|
|| rc.typewriter_font_name != oldrc.typewriter_font_name
|
|
|
|
|| rc.zoom != oldrc.zoom || rc.dpi != oldrc.dpi) {
|
|
|
|
controller().updateScreenFonts();
|
2002-11-15 06:02:43 +00:00
|
|
|
}
|
2002-11-27 10:30:28 +00:00
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
controller().setConverters(converters_);
|
2002-11-27 10:30:28 +00:00
|
|
|
controller().setFormats(formats_);
|
2002-11-15 06:02:43 +00:00
|
|
|
|
2002-11-17 09:42:25 +00:00
|
|
|
QPrefColorsModule * colmod(dialog_->colorsModule);
|
2002-11-27 10:30:28 +00:00
|
|
|
|
2002-11-17 09:42:25 +00:00
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
for (i = 0; i < colmod->lyxObjectsLB->count(); ++i) {
|
|
|
|
QListBoxItem * ib(colmod->lyxObjectsLB->item(i));
|
|
|
|
QColorItem * ci(static_cast<QColorItem*>(ib));
|
|
|
|
|
|
|
|
ostringstream ostr;
|
2002-11-27 10:30:28 +00:00
|
|
|
|
|
|
|
ostr << '#' << std::setbase(16) << setfill('0')
|
2002-11-17 09:42:25 +00:00
|
|
|
<< setw(2) << ci->color().red()
|
|
|
|
<< setw(2) << ci->color().green()
|
|
|
|
<< setw(2) << ci->color().blue();
|
2002-11-27 10:30:28 +00:00
|
|
|
|
2002-11-17 09:42:25 +00:00
|
|
|
string newhex(STRCONV(ostr.str()));
|
|
|
|
|
|
|
|
LColor::color col(dialog_->colors_[i]);
|
|
|
|
|
|
|
|
// FIXME: dubious, but it's what xforms does
|
|
|
|
if (lcolor.getX11Name(col) != newhex) {
|
|
|
|
controller().setColor(col, newhex);
|
|
|
|
}
|
|
|
|
}
|
2002-11-17 05:37:27 +00:00
|
|
|
}
|
2002-11-15 06:02:43 +00:00
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
|
2002-11-27 10:30:28 +00:00
|
|
|
// FIXME: move to helper_funcs.h
|
2002-11-17 05:37:27 +00:00
|
|
|
namespace {
|
2002-11-27 10:30:28 +00:00
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
template<class A>
|
|
|
|
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);
|
|
|
|
if (it == vec.end())
|
|
|
|
return 0;
|
|
|
|
return std::distance(vec.begin(), it);
|
2002-11-13 02:22:48 +00:00
|
|
|
}
|
|
|
|
|
2002-11-27 21:49:50 +00:00
|
|
|
void setComboxFont(QComboBox * cb,
|
|
|
|
string const & family, string const & foundry)
|
|
|
|
{
|
|
|
|
|
|
|
|
string const name = makeFontName(family, foundry);
|
|
|
|
for (int i = 0; i < cb->count(); ++i) {
|
|
|
|
if (compare_no_case(cb->text(i).latin1(), name) == 0) {
|
|
|
|
cb->setCurrentItem(i);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Try matching without foundary name
|
|
|
|
for (int i = cb->count() - 1; i >= 0; --i) {
|
|
|
|
// We count in reverse in order to prefer the Xft foundry
|
|
|
|
pair<string, string> tmp = parseFontName(cb->text(i).latin1());
|
|
|
|
if (compare_no_case(tmp.first, family) == 0) {
|
|
|
|
cb->setCurrentItem(i);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
}
|
2002-11-13 02:22:48 +00:00
|
|
|
|
|
|
|
void QPrefs::update_contents()
|
|
|
|
{
|
|
|
|
LyXRC const & rc(controller().rc());
|
|
|
|
|
2002-11-15 06:32:13 +00:00
|
|
|
QPrefLanguageModule * langmod(dialog_->languageModule);
|
2002-11-27 10:30:28 +00:00
|
|
|
|
2002-11-15 06:32:13 +00:00
|
|
|
// FIXME: remove rtl_support bool
|
|
|
|
langmod->rtlCB->setChecked(rc.rtl_support);
|
2002-11-27 10:30:28 +00:00
|
|
|
langmod->markForeignCB->setChecked(rc.mark_foreign_language);
|
|
|
|
langmod->autoBeginCB->setChecked(rc.language_auto_begin);
|
|
|
|
langmod->autoEndCB->setChecked(rc.language_auto_end);
|
2002-11-15 06:32:13 +00:00
|
|
|
langmod->useBabelCB->setChecked(rc.language_use_babel);
|
|
|
|
langmod->globalCB->setChecked(rc.language_global_options);
|
|
|
|
langmod->languagePackageED->setText(rc.language_package.c_str());
|
|
|
|
langmod->startCommandED->setText(rc.language_command_begin.c_str());
|
|
|
|
langmod->endCommandED->setText(rc.language_command_end.c_str());
|
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
int const pos = int(findPos(lang_, rc.default_language));
|
|
|
|
langmod->defaultLanguageCO->setCurrentItem(pos);
|
2002-11-15 06:32:13 +00:00
|
|
|
|
2002-11-27 10:30:28 +00:00
|
|
|
QPrefUIModule * uimod(dialog_->uiModule);
|
2002-11-15 06:32:13 +00:00
|
|
|
|
2002-11-17 11:45:18 +00:00
|
|
|
uimod->uiFileED->setText(rc.ui_file.c_str());
|
|
|
|
uimod->bindFileED->setText(rc.bind_file.c_str());
|
2002-11-27 10:30:28 +00:00
|
|
|
uimod->cursorFollowsCB->setChecked(rc.cursor_follows_scrollbar);
|
2002-11-15 06:32:13 +00:00
|
|
|
uimod->wheelMouseSB->setValue(rc.wheel_jump);
|
|
|
|
// convert to minutes
|
2002-11-15 06:39:14 +00:00
|
|
|
int mins(rc.autosave / 60);
|
|
|
|
if (rc.autosave && !mins)
|
2002-11-15 06:32:13 +00:00
|
|
|
mins = 1;
|
|
|
|
uimod->autoSaveSB->setValue(mins);
|
2002-11-17 03:35:02 +00:00
|
|
|
uimod->autoSaveCB->setChecked(rc.make_backup);
|
2002-11-17 05:37:27 +00:00
|
|
|
uimod->lastfilesSB->setValue(rc.num_lastfiles);
|
2002-11-27 10:30:28 +00:00
|
|
|
|
|
|
|
|
2002-11-15 06:32:13 +00:00
|
|
|
QPrefKeyboardModule * keymod(dialog_->keyboardModule);
|
|
|
|
|
2002-11-27 10:30:28 +00:00
|
|
|
// FIXME: can derive CB from the two EDs
|
2002-11-15 06:32:13 +00:00
|
|
|
keymod->keymapCB->setChecked(rc.use_kbmap);
|
2002-11-25 03:18:27 +00:00
|
|
|
// no idea why we need these. Fscking Qt.
|
|
|
|
keymod->firstKeymapED->setEnabled(rc.use_kbmap);
|
|
|
|
keymod->firstKeymapPB->setEnabled(rc.use_kbmap);
|
|
|
|
keymod->firstKeymapLA->setEnabled(rc.use_kbmap);
|
|
|
|
keymod->secondKeymapED->setEnabled(rc.use_kbmap);
|
|
|
|
keymod->secondKeymapPB->setEnabled(rc.use_kbmap);
|
|
|
|
keymod->secondKeymapLA->setEnabled(rc.use_kbmap);
|
2002-11-15 06:32:13 +00:00
|
|
|
keymod->firstKeymapED->setText(rc.primary_kbmap.c_str());
|
|
|
|
keymod->secondKeymapED->setText(rc.secondary_kbmap.c_str());
|
2002-11-27 10:30:28 +00:00
|
|
|
|
2002-11-15 06:32:13 +00:00
|
|
|
|
|
|
|
QPrefAsciiModule * ascmod(dialog_->asciiModule);
|
|
|
|
|
|
|
|
ascmod->asciiLinelengthSB->setValue(rc.ascii_linelen);
|
|
|
|
ascmod->asciiRoffED->setText(rc.ascii_roff_command.c_str());
|
|
|
|
|
|
|
|
|
|
|
|
QPrefDateModule * datemod(dialog_->dateModule);
|
|
|
|
|
|
|
|
datemod->DateED->setText(rc.date_insert_format.c_str());
|
|
|
|
|
|
|
|
|
|
|
|
QPrefLatexModule * latexmod(dialog_->latexModule);
|
|
|
|
|
|
|
|
latexmod->latexEncodingED->setText(rc.fontenc.c_str());
|
2002-11-27 10:30:28 +00:00
|
|
|
latexmod->latexChecktexED->setText(rc.chktex_command.c_str());
|
2002-11-15 06:32:13 +00:00
|
|
|
latexmod->latexAutoresetCB->setChecked(rc.auto_reset_options);
|
|
|
|
latexmod->latexDviPaperED->setText(rc.view_dvi_paper_option.c_str());
|
2002-11-17 05:37:27 +00:00
|
|
|
latexmod->latexPaperSizeCO->setCurrentItem(rc.default_papersize);
|
2002-11-15 06:32:13 +00:00
|
|
|
|
2002-11-17 03:35:02 +00:00
|
|
|
|
|
|
|
QPrefDisplayModule * displaymod(dialog_->displayModule);
|
|
|
|
|
|
|
|
displaymod->previewCB->setChecked(rc.preview);
|
2002-11-27 10:30:28 +00:00
|
|
|
|
2002-11-17 03:35:02 +00:00
|
|
|
int item = 2;
|
2002-11-27 10:30:28 +00:00
|
|
|
|
2002-11-17 03:35:02 +00:00
|
|
|
switch (rc.display_graphics) {
|
|
|
|
case grfx::NoDisplay: item = 3; break;
|
|
|
|
case grfx::ColorDisplay: item = 2; break;
|
|
|
|
case grfx::GrayscaleDisplay: item = 1; break;
|
|
|
|
case grfx::MonochromeDisplay: item = 0; break;
|
|
|
|
}
|
|
|
|
displaymod->displayGraphicsCO->setCurrentItem(item);
|
2002-11-27 10:30:28 +00:00
|
|
|
|
2002-11-17 03:35:02 +00:00
|
|
|
|
|
|
|
QPrefPathsModule * pathsmod(dialog_->pathsModule);
|
2002-11-27 10:30:28 +00:00
|
|
|
|
2002-11-17 03:35:02 +00:00
|
|
|
pathsmod->workingDirED->setText(rc.document_path.c_str());
|
|
|
|
pathsmod->templateDirED->setText(rc.template_path.c_str());
|
|
|
|
pathsmod->backupDirED->setText(rc.backupdir_path.c_str());
|
|
|
|
pathsmod->tempDirCB->setChecked(rc.use_tempdir);
|
|
|
|
pathsmod->tempDirED->setText(rc.tempdir_path.c_str());
|
|
|
|
// FIXME: should be a checkbox only
|
|
|
|
pathsmod->lyxserverDirED->setText(rc.lyxpipes.c_str());
|
|
|
|
|
2002-11-15 06:02:43 +00:00
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
QPrefSpellcheckerModule * spellmod(dialog_->spellcheckerModule);
|
|
|
|
|
|
|
|
item = (rc.isp_command == "ispell") ? 0 : 1;
|
|
|
|
spellmod->spellCommandCO->setCurrentItem(item);
|
|
|
|
// FIXME: remove isp_use_alt_lang
|
|
|
|
spellmod->altLanguageED->setText(rc.isp_alt_lang.c_str());
|
2002-11-27 10:30:28 +00:00
|
|
|
// FIXME: remove isp_use_esc_chars
|
2002-11-17 05:37:27 +00:00
|
|
|
spellmod->escapeCharactersED->setText(rc.isp_esc_chars.c_str());
|
2002-11-27 10:30:28 +00:00
|
|
|
// FIXME: remove isp_use_pers_dict
|
2002-11-17 05:37:27 +00:00
|
|
|
spellmod->persDictionaryED->setText(rc.isp_pers_dict.c_str());
|
|
|
|
spellmod->compoundWordCB->setChecked(rc.isp_accept_compound);
|
|
|
|
spellmod->inputEncodingCB->setChecked(rc.isp_use_input_encoding);
|
|
|
|
|
|
|
|
|
|
|
|
QPrefPrinterModule * printmod(dialog_->printerModule);
|
|
|
|
|
|
|
|
printmod->printerAdaptCB->setChecked(rc.print_adapt_output);
|
|
|
|
printmod->printerCommandED->setText(rc.print_command.c_str());
|
|
|
|
printmod->printerNameED->setText(rc.printer.c_str());
|
|
|
|
|
|
|
|
printmod->printerPageRangeED->setText(rc.print_pagerange_flag.c_str());
|
|
|
|
printmod->printerCopiesED->setText(rc.print_copies_flag.c_str());
|
|
|
|
printmod->printerReverseED->setText(rc.print_reverse_flag.c_str());
|
|
|
|
printmod->printerToPrinterED->setText(rc.print_to_printer.c_str());
|
|
|
|
printmod->printerExtensionED->setText(rc.print_file_extension.c_str());
|
|
|
|
printmod->printerSpoolCommandED->setText(rc.print_file_extension.c_str());
|
|
|
|
printmod->printerPaperTypeED->setText(rc.print_paper_flag.c_str());
|
|
|
|
printmod->printerEvenED->setText(rc.print_evenpage_flag.c_str());
|
|
|
|
printmod->printerOddED->setText(rc.print_oddpage_flag.c_str());
|
|
|
|
printmod->printerCollatedED->setText(rc.print_collcopies_flag.c_str());
|
|
|
|
printmod->printerLandscapeED->setText(rc.print_landscape_flag.c_str());
|
|
|
|
printmod->printerToFileED->setText(rc.print_to_file.c_str());
|
|
|
|
printmod->printerExtraED->setText(rc.print_extra_options.c_str());
|
|
|
|
printmod->printerSpoolPrefixED->setText(rc.print_spool_printerprefix.c_str());
|
|
|
|
printmod->printerPaperSizeED->setText(rc.print_paper_dimension_flag.c_str());
|
|
|
|
|
|
|
|
|
|
|
|
QPrefScreenFontsModule * fontmod(dialog_->screenfontsModule);
|
|
|
|
|
2002-11-27 21:49:50 +00:00
|
|
|
setComboxFont(fontmod->screenRomanCO,
|
|
|
|
rc.roman_font_name, rc.roman_font_foundry);
|
|
|
|
setComboxFont(fontmod->screenSansCO,
|
|
|
|
rc.sans_font_name, rc.sans_font_foundry);
|
|
|
|
setComboxFont(fontmod->screenTypewriterCO,
|
|
|
|
rc.typewriter_font_name, rc.typewriter_font_foundry);
|
|
|
|
|
|
|
|
dialog_->select_roman(fontmod->screenRomanCO->currentText());
|
|
|
|
dialog_->select_sans(fontmod->screenSansCO->currentText());
|
|
|
|
dialog_->select_typewriter(fontmod->screenTypewriterCO->currentText());
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
fontmod->screenZoomSB->setValue(rc.zoom);
|
|
|
|
fontmod->screenDpiSB->setValue(int(rc.dpi));
|
|
|
|
fontmod->screenTinyED->setText(tostr(rc.font_sizes[LyXFont::SIZE_TINY]).c_str());
|
|
|
|
fontmod->screenSmallestED->setText(tostr(rc.font_sizes[LyXFont::SIZE_SCRIPT]).c_str());
|
|
|
|
fontmod->screenSmallerED->setText(tostr(rc.font_sizes[LyXFont::SIZE_FOOTNOTE]).c_str());
|
|
|
|
fontmod->screenSmallED->setText(tostr(rc.font_sizes[LyXFont::SIZE_SMALL]).c_str());
|
|
|
|
fontmod->screenNormalED->setText(tostr(rc.font_sizes[LyXFont::SIZE_NORMAL]).c_str());
|
|
|
|
fontmod->screenLargeED->setText(tostr(rc.font_sizes[LyXFont::SIZE_LARGE]).c_str());
|
|
|
|
fontmod->screenLargerED->setText(tostr(rc.font_sizes[LyXFont::SIZE_LARGER]).c_str());
|
|
|
|
fontmod->screenLargestED->setText(tostr(rc.font_sizes[LyXFont::SIZE_LARGEST]).c_str());
|
|
|
|
fontmod->screenHugeED->setText(tostr(rc.font_sizes[LyXFont::SIZE_HUGE]).c_str());
|
|
|
|
fontmod->screenHugerED->setText(tostr(rc.font_sizes[LyXFont::SIZE_HUGER]).c_str());
|
|
|
|
|
|
|
|
formats_ = formats;
|
2002-11-17 07:11:02 +00:00
|
|
|
|
|
|
|
dialog_->updateFormats();
|
2002-11-27 10:30:28 +00:00
|
|
|
|
2002-11-17 07:11:02 +00:00
|
|
|
converters_ = converters;
|
2002-11-15 06:02:43 +00:00
|
|
|
|
2002-11-17 07:11:02 +00:00
|
|
|
dialog_->updateConverters();
|
2002-11-13 02:22:48 +00:00
|
|
|
}
|