#include "GuiKeySymbol.h"
#include "qt_helpers.h"
+#include "Author.h"
#include "BufferList.h"
#include "Color.h"
#include "ColorSet.h"
#include "KeySequence.h"
#include "Language.h"
#include "LyXAction.h"
+#include "LyX.h"
#include "PanelStack.h"
#include "paper.h"
#include "Session.h"
#include "support/filetools.h"
#include "support/foreach.h"
#include "support/gettext.h"
+#include "support/lassert.h"
#include "support/lstrings.h"
#include "support/os.h"
#include "support/Package.h"
/** Launch a file dialog and return the chosen file.
filename: a suggested filename.
title: the title of the dialog.
- pattern: *.ps etc.
+ filters: *.ps etc.
dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
*/
QString browseFile(QString const & filename,
FileDialog::Result result;
if (save)
- result = dlg.save(lastPath, filters, onlyFilename(filename));
+ result = dlg.save(lastPath, filters, onlyFileName(filename));
else
- result = dlg.open(lastPath, filters, onlyFilename(filename));
+ result = dlg.open(lastPath, filters, onlyFileName(filename));
return result.second;
}
// FIXME UNICODE
QString const label1 = qt_("System files|#S#s");
QString const dir1 =
- toqstr(addName(package().system_support().absFilename(), fromqstr(dir)));
+ toqstr(addName(package().system_support().absFileName(), fromqstr(dir)));
QString const label2 = qt_("User files|#U#u");
QString const dir2 =
- toqstr(addName(package().user_support().absFilename(), fromqstr(dir)));
+ toqstr(addName(package().user_support().absFileName(), fromqstr(dir)));
QString const result = browseFile(toqstr(
- libFileSearch(dir, name, ext).absFilename()),
+ libFileSearch(dir, name, ext).absFileName()),
title, filters, false, dir1, dir2, QString(), QString(), dir1);
// remove the extension if it is the default one
noextresult = result;
// remove the directory, if it is the default one
- QString const file = onlyFilename(noextresult);
- if (toqstr(libFileSearch(dir, file, ext).absFilename()) == result)
+ QString const file = onlyFileName(noextresult);
+ if (toqstr(libFileSearch(dir, file, ext).absFileName()) == result)
return file;
else
return noextresult;
dlg.setButton2(label2, dir2);
FileDialog::Result const result =
- dlg.opendir(lastPath, onlyFilename(pathname));
+ dlg.opendir(lastPath, onlyFileName(pathname));
return result.second;
}
} // namespace frontend
-QString browseRelFile(QString const & filename, QString const & refpath,
+QString browseRelToParent(QString const & filename, QString const & relpath,
QString const & title, QStringList const & filters, bool save,
QString const & label1, QString const & dir1,
QString const & label2, QString const & dir2)
{
- QString const fname = makeAbsPath(filename, refpath);
-
+ QString const fname = makeAbsPath(filename, relpath);
QString const outname =
frontend::browseFile(fname, title, filters, save, label1, dir1, label2, dir2);
QString const reloutname =
- toqstr(makeRelPath(qstring_to_ucs4(outname), qstring_to_ucs4(refpath)));
+ toqstr(makeRelPath(qstring_to_ucs4(outname), qstring_to_ucs4(relpath)));
if (reloutname.startsWith("../"))
return outname;
}
+QString browseRelToSub(QString const & filename, QString const & relpath,
+ QString const & title, QStringList const & filters, bool save,
+ QString const & label1, QString const & dir1,
+ QString const & label2, QString const & dir2)
+{
+ QString const fname = makeAbsPath(filename, relpath);
+
+ QString const outname =
+ frontend::browseFile(fname, title, filters, save, label1, dir1, label2, dir2);
+
+ QString const reloutname =
+ toqstr(makeRelPath(qstring_to_ucs4(outname), qstring_to_ucs4(relpath)));
+
+ QString testname = reloutname;
+ testname.remove(QRegExp("^(\\.\\./)+"));
+
+ if (testname.contains("/"))
+ return outname;
+ else
+ return reloutname;
+}
+
+
/////////////////////////////////////////////////////////////////////
//
}
+/////////////////////////////////////////////////////////////////////
+//
+// NoNewLineValidator
+//
+/////////////////////////////////////////////////////////////////////
+
+class NoNewLineValidator : public QValidator
+{
+public:
+ NoNewLineValidator(QWidget *);
+ QValidator::State validate(QString & input, int & pos) const;
+};
+
+
+NoNewLineValidator::NoNewLineValidator(QWidget * parent)
+ : QValidator(parent)
+{
+}
+
+
+QValidator::State NoNewLineValidator::validate(QString & input, int & /*pos*/) const
+{
+ input.remove(QRegExp("[\\n\\r]"));
+ return QValidator::Acceptable;
+}
+
+
/////////////////////////////////////////////////////////////////////
//
// StrftimeValidator
: PrefModule(qt_(catOutput), qt_("General"), form)
{
setupUi(this);
+
DateED->setValidator(new StrftimeValidator(DateED));
+ dviCB->setValidator(new NoNewLineValidator(dviCB));
+ pdfCB->setValidator(new NoNewLineValidator(pdfCB));
+
connect(DateED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
connect(plaintextLinelengthSB, SIGNAL(valueChanged(int)),
this, SIGNAL(changed()));
+ connect(overwriteCO, SIGNAL(activated(int)),
+ this, SIGNAL(changed()));
+ connect(dviCB, SIGNAL(editTextChanged(QString)),
+ this, SIGNAL(changed()));
+ connect(pdfCB, SIGNAL(editTextChanged(QString)),
+ this, SIGNAL(changed()));
+ dviCB->addItem("");
+ dviCB->addItem("xdvi -sourceposition '$$n:\\ $$t' $$o");
+ dviCB->addItem("yap -1 -s \"$$n $$t\" $$o");
+ dviCB->addItem("okular --unique \"file:$$o#src:$$n $$t\"");
+ dviCB->addItem("synctex view -i $$n:0:$$t -o $$o -x \"evince -i %{page+1} $$o\"");
+ pdfCB->addItem("");
+ pdfCB->addItem("CMCDDE SUMATRA control [ForwardSearch(\\\"$$o\\\",\\\"$$t\\\",$$n,0,0,1)]");
+ pdfCB->addItem("synctex view -i $$n:0:$$t -o $$o -x \"xpdf -raise -remote $$t.tmp $$o %{page+1}\"");
+ pdfCB->addItem("okular --unique \"file:$$o#src:$$n $$t\"");
+ pdfCB->addItem("synctex view -i $$n:0:$$t -o $$o -x \"evince -i %{page+1} $$o\"");
+ pdfCB->addItem("/Applications/Skim.app/Contents/SharedSupport/displayline $$n $$o $$t");
}
{
rc.date_insert_format = fromqstr(DateED->text());
rc.plaintext_linelen = plaintextLinelengthSB->value();
+ rc.forward_search_dvi = fromqstr(dviCB->currentText());
+ rc.forward_search_pdf = fromqstr(pdfCB->currentText());
+
+ switch (overwriteCO->currentIndex()) {
+ case 0:
+ rc.export_overwrite = NO_FILES;
+ break;
+ case 1:
+ rc.export_overwrite = MAIN_FILE;
+ break;
+ case 2:
+ rc.export_overwrite = ALL_FILES;
+ break;
+ }
}
{
DateED->setText(toqstr(rc.date_insert_format));
plaintextLinelengthSB->setValue(rc.plaintext_linelen);
+ dviCB->setEditText(toqstr(rc.forward_search_dvi));
+ pdfCB->setEditText(toqstr(rc.forward_search_pdf));
+
+ switch (rc.export_overwrite) {
+ case NO_FILES:
+ overwriteCO->setCurrentIndex(0);
+ break;
+ case MAIN_FILE:
+ overwriteCO->setCurrentIndex(1);
+ break;
+ case ALL_FILES:
+ overwriteCO->setCurrentIndex(2);
+ break;
+ }
}
this, SIGNAL(changed()));
connect(mouseWheelSpeedSB, SIGNAL(valueChanged(double)),
this, SIGNAL(changed()));
+ connect(scrollzoomEnableCB, SIGNAL(clicked()),
+ this, SIGNAL(changed()));
+ connect(scrollzoomValueCO, SIGNAL(activated(int)),
+ this, SIGNAL(changed()));
+ connect(dontswapCB, SIGNAL(toggled(bool)),
+ this, SIGNAL(changed()));
+
+ // reveal checkbox for switching Ctrl and Meta on Mac:
+ bool swapcb = false;
+#ifdef Q_WS_MACX
+#if QT_VERSION > 0x040600
+ swapcb = true;
+#endif
+#endif
+ dontswapCB->setVisible(swapcb);
}
rc.primary_kbmap = internal_path(fromqstr(firstKeymapED->text()));
rc.secondary_kbmap = internal_path(fromqstr(secondKeymapED->text()));
rc.mouse_wheel_speed = mouseWheelSpeedSB->value();
+ if (scrollzoomEnableCB->isChecked()) {
+ switch (scrollzoomValueCO->currentIndex()) {
+ case 0:
+ rc.scroll_wheel_zoom = LyXRC::SCROLL_WHEEL_ZOOM_CTRL;
+ break;
+ case 1:
+ rc.scroll_wheel_zoom = LyXRC::SCROLL_WHEEL_ZOOM_SHIFT;
+ break;
+ case 2:
+ rc.scroll_wheel_zoom = LyXRC::SCROLL_WHEEL_ZOOM_ALT;
+ break;
+ }
+ } else {
+ rc.scroll_wheel_zoom = LyXRC::SCROLL_WHEEL_ZOOM_OFF;
+ }
+ rc.mac_dontswap_ctrl_meta = dontswapCB->isChecked();
}
firstKeymapED->setText(toqstr(external_path(rc.primary_kbmap)));
secondKeymapED->setText(toqstr(external_path(rc.secondary_kbmap)));
mouseWheelSpeedSB->setValue(rc.mouse_wheel_speed);
+ switch (rc.scroll_wheel_zoom) {
+ case LyXRC::SCROLL_WHEEL_ZOOM_OFF:
+ scrollzoomEnableCB->setChecked(false);
+ break;
+ case LyXRC::SCROLL_WHEEL_ZOOM_CTRL:
+ scrollzoomEnableCB->setChecked(true);
+ scrollzoomValueCO->setCurrentIndex(0);
+ break;
+ case LyXRC::SCROLL_WHEEL_ZOOM_SHIFT:
+ scrollzoomEnableCB->setChecked(true);
+ scrollzoomValueCO->setCurrentIndex(1);
+ break;
+ case LyXRC::SCROLL_WHEEL_ZOOM_ALT:
+ scrollzoomEnableCB->setChecked(true);
+ scrollzoomValueCO->setCurrentIndex(2);
+ break;
+ }
+ dontswapCB->setChecked(rc.mac_dontswap_ctrl_meta);
}
}
+void PrefInput::on_scrollzoomEnableCB_toggled(bool enabled)
+{
+ scrollzoomValueCO->setEnabled(enabled);
+}
+
+
/////////////////////////////////////////////////////////////////////
//
// PrefCompletion
: PrefModule(qt_(catOutput), qt_("LaTeX"), form)
{
setupUi(this);
+
+ latexEncodingED->setValidator(new NoNewLineValidator(latexEncodingED));
+ latexDviPaperED->setValidator(new NoNewLineValidator(latexDviPaperED));
+ latexBibtexED->setValidator(new NoNewLineValidator(latexBibtexED));
+ latexJBibtexED->setValidator(new NoNewLineValidator(latexJBibtexED));
+ latexIndexED->setValidator(new NoNewLineValidator(latexIndexED));
+ latexJIndexED->setValidator(new NoNewLineValidator(latexJIndexED));
+ latexNomenclED->setValidator(new NoNewLineValidator(latexNomenclED));
+ latexChecktexED->setValidator(new NoNewLineValidator(latexChecktexED));
+
connect(latexEncodingCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(latexEncodingED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
connect(latexPaperSizeCO, SIGNAL(activated(int)),
this, SIGNAL(changed()));
+ connect(latexNomenclED, SIGNAL(textChanged(QString)),
+ this, SIGNAL(changed()));
#if defined(__CYGWIN__) || defined(_WIN32)
pathCB->setVisible(true);
/////////////////////////////////////////////////////////////////////
PrefScreenFonts::PrefScreenFonts(GuiPreferences * form)
- : PrefModule(qt_(catLookAndFeel), qt_("Screen fonts"), form)
+ : PrefModule(qt_(catLookAndFeel), qt_("Screen Fonts"), form)
{
setupUi(this);
this, SIGNAL(changed()));
connect(screenZoomSB, SIGNAL(valueChanged(int)),
this, SIGNAL(changed()));
- connect(screenDpiSB, SIGNAL(valueChanged(int)),
- this, SIGNAL(changed()));
connect(screenTinyED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
connect(screenSmallestED, SIGNAL(textChanged(QString)),
rc.typewriter_font_name, rc.typewriter_font_foundry);
rc.zoom = screenZoomSB->value();
- rc.dpi = screenDpiSB->value();
rc.font_sizes[FONT_SIZE_TINY] = widgetToDoubleStr(screenTinyED);
rc.font_sizes[FONT_SIZE_SCRIPT] = widgetToDoubleStr(screenSmallestED);
rc.font_sizes[FONT_SIZE_FOOTNOTE] = widgetToDoubleStr(screenSmallerED);
|| 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) {
+ || rc.zoom != oldrc.zoom) {
// The global QPixmapCache is used in GuiPainter to cache text
// painting so we must reset it in case any of the above
// parameter is changed.
selectTypewriter(screenTypewriterCO->currentText());
screenZoomSB->setValue(rc.zoom);
- screenDpiSB->setValue(rc.dpi);
+ updateScreenFontSizes(rc);
+
+ pixmapCacheCB->setChecked(rc.use_pixmap_cache);
+#if defined(Q_WS_X11)
+ pixmapCacheCB->setEnabled(false);
+#endif
+
+}
+
+
+void PrefScreenFonts::updateScreenFontSizes(LyXRC const & rc)
+{
doubleToWidget(screenTinyED, rc.font_sizes[FONT_SIZE_TINY]);
doubleToWidget(screenSmallestED, rc.font_sizes[FONT_SIZE_SCRIPT]);
doubleToWidget(screenSmallerED, rc.font_sizes[FONT_SIZE_FOOTNOTE]);
doubleToWidget(screenLargestED, rc.font_sizes[FONT_SIZE_LARGEST]);
doubleToWidget(screenHugeED, rc.font_sizes[FONT_SIZE_HUGE]);
doubleToWidget(screenHugerED, rc.font_sizes[FONT_SIZE_HUGER]);
-
- pixmapCacheCB->setChecked(rc.use_pixmap_cache);
-#if defined(Q_WS_X11)
- pixmapCacheCB->setEnabled(false);
-#endif
-
}
for (int i = 0; i < Color_ignore; ++i) {
ColorCode lc = static_cast<ColorCode>(i);
if (lc == Color_none
- || lc == Color_black
- || lc == Color_white
- || lc == Color_red
- || lc == Color_green
- || lc == Color_blue
- || lc == Color_cyan
- || lc == Color_magenta
- || lc == Color_yellow
- || lc == Color_inherit
- || lc == Color_ignore
- || lc == Color_greyedouttext
- || lc == Color_shadedbg) continue;
-
+ || lc == Color_black
+ || lc == Color_white
+ || lc == Color_red
+ || lc == Color_green
+ || lc == Color_blue
+ || lc == Color_cyan
+ || lc == Color_magenta
+ || lc == Color_yellow
+ || lc == Color_inherit
+ || lc == Color_ignore)
+ continue;
lcolors_.push_back(lc);
}
sort(lcolors_.begin(), lcolors_.end(), ColorSorter());
this, SLOT(changeLyxObjectsSelection()));
connect(lyxObjectsLW, SIGNAL(itemActivated(QListWidgetItem*)),
this, SLOT(changeColor()));
+ connect(syscolorsCB, SIGNAL(toggled(bool)),
+ this, SIGNAL(changed()));
+ connect(syscolorsCB, SIGNAL(toggled(bool)),
+ this, SLOT(changeSysColor()));
}
-void PrefColors::apply(LyXRC & /*rc*/) const
+void PrefColors::apply(LyXRC & rc) const
{
+ LyXRC oldrc = rc;
+
for (unsigned int i = 0; i < lcolors_.size(); ++i)
if (curcolors_[i] != newcolors_[i])
form_->setColor(lcolors_[i], newcolors_[i]);
+ rc.use_system_colors = syscolorsCB->isChecked();
+
+ if (oldrc.use_system_colors != rc.use_system_colors)
+ guiApp->colorCache().clear();
}
-void PrefColors::update(LyXRC const & /*rc*/)
+void PrefColors::update(LyXRC const & rc)
{
for (unsigned int i = 0; i < lcolors_.size(); ++i) {
- QColor color = QColor(guiApp->colorCache().get(lcolors_[i]));
+ QColor color = QColor(guiApp->colorCache().get(lcolors_[i], false));
QPixmap coloritem(32, 32);
coloritem.fill(color);
lyxObjectsLW->item(i)->setIcon(QIcon(coloritem));
newcolors_[i] = curcolors_[i] = color.name();
}
+ syscolorsCB->setChecked(rc.use_system_colors);
changeLyxObjectsSelection();
}
}
}
+void PrefColors::changeSysColor()
+{
+ for (int row = 0 ; row < lyxObjectsLW->count() ; ++row) {
+ // skip colors that are taken from system palette
+ bool const hide = syscolorsCB->isChecked()
+ && guiApp->colorCache().isSystem(lcolors_[row]);
+
+ lyxObjectsLW->item(row)->setHidden(hide);
+ }
+
+}
+
void PrefColors::changeLyxObjectsSelection()
{
colorChangePB->setDisabled(lyxObjectsLW->currentRow() < 0);
connect(instantPreviewCO, SIGNAL(activated(int)), this, SIGNAL(changed()));
connect(previewSizeSB, SIGNAL(valueChanged(double)), this, SIGNAL(changed()));
connect(paragraphMarkerCB, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
- if (instantPreviewCO->currentIndex() == 0)
- previewSizeSB->setEnabled(false);
- else
- previewSizeSB->setEnabled(true);
}
void PrefDisplay::on_instantPreviewCO_currentIndexChanged(int index)
{
- if (index == 0)
- previewSizeSB->setEnabled(false);
- else
- previewSizeSB->setEnabled(true);
+ previewSizeSB->setEnabled(index != 0);
+}
+
+
+void PrefDisplay::on_displayGraphicsCB_toggled(bool on)
+{
+ instantPreviewCO->setEnabled(on);
+ previewSizeSB->setEnabled(on && instantPreviewCO->currentIndex() > 0);
}
void PrefDisplay::apply(LyXRC & rc) const
{
switch (instantPreviewCO->currentIndex()) {
- 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;
+ 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;
}
rc.display_graphics = displayGraphicsCB->isChecked();
instantPreviewCO->setEnabled(rc.display_graphics);
previewSizeSB->setValue(rc.preview_scale_factor);
paragraphMarkerCB->setChecked(rc.paragraph_markers);
+ previewSizeSB->setEnabled(
+ rc.display_graphics
+ && rc.preview != LyXRC::PREVIEW_OFF);
}
connect(tempDirED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
+#if defined(USE_HUNSPELL)
connect(hunspellDirPB, SIGNAL(clicked()), this, SLOT(selectHunspelldir()));
connect(hunspellDirED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
+#else
+ hunspellDirPB->setEnabled(false);
+ hunspellDirED->setEnabled(false);
+#endif
connect(pathPrefixED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
+
+ connect(texinputsPrefixED, SIGNAL(textChanged(QString)),
+ this, SIGNAL(changed()));
+
+ pathPrefixED->setValidator(new NoNewLineValidator(pathPrefixED));
+ texinputsPrefixED->setValidator(new NoNewLineValidator(texinputsPrefixED));
}
rc.thesaurusdir_path = internal_path(fromqstr(thesaurusDirED->text()));
rc.hunspelldir_path = internal_path(fromqstr(hunspellDirED->text()));
rc.path_prefix = internal_path_list(fromqstr(pathPrefixED->text()));
+ rc.texinputs_prefix = internal_path_list(fromqstr(texinputsPrefixED->text()));
// FIXME: should be a checkbox only
rc.lyxpipes = internal_path(fromqstr(lyxserverDirED->text()));
}
thesaurusDirED->setText(toqstr(external_path(rc.thesaurusdir_path)));
hunspellDirED->setText(toqstr(external_path(rc.hunspelldir_path)));
pathPrefixED->setText(toqstr(external_path_list(rc.path_prefix)));
+ texinputsPrefixED->setText(toqstr(external_path_list(rc.texinputs_prefix)));
// FIXME: should be a checkbox only
lyxserverDirED->setText(toqstr(external_path(rc.lyxpipes)));
}
{
setupUi(this);
+// FIXME: this check should test the target platform (darwin)
+#if defined(USE_MACOSX_PACKAGING)
+ spellcheckerCB->addItem(qt_("Native"), QString("native"));
+#define CONNECT_APPLESPELL
+#else
+#undef CONNECT_APPLESPELL
+#endif
#if defined(USE_ASPELL)
- spellcheckerCB->addItem(qt_("aspell"), QString("aspell"));
+ spellcheckerCB->addItem(qt_("Aspell"), QString("aspell"));
#endif
#if defined(USE_ENCHANT)
- spellcheckerCB->addItem(qt_("enchant"), QString("enchant"));
+ spellcheckerCB->addItem(qt_("Enchant"), QString("enchant"));
#endif
#if defined(USE_HUNSPELL)
- spellcheckerCB->addItem(qt_("hunspell"), QString("hunspell"));
+ spellcheckerCB->addItem(qt_("Hunspell"), QString("hunspell"));
#endif
- #if defined(USE_ASPELL) || defined(USE_ENCHANT) || defined(USE_HUNSPELL)
+ #if defined(CONNECT_APPLESPELL) || defined(USE_ASPELL) || defined(USE_ENCHANT) || defined(USE_HUNSPELL)
connect(spellcheckerCB, SIGNAL(currentIndexChanged(int)),
this, SIGNAL(changed()));
connect(altLanguageED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
connect(spellcheckNotesCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
+
+ altLanguageED->setValidator(new NoNewLineValidator(altLanguageED));
+ escapeCharactersED->setValidator(new NoNewLineValidator(escapeCharactersED));
#else
spellcheckerCB->setEnabled(false);
altLanguageED->setEnabled(false);
void PrefSpellchecker::apply(LyXRC & rc) const
{
- rc.spellchecker = fromqstr(spellcheckerCB->itemData(
- spellcheckerCB->currentIndex()).toString());
+ string const speller = fromqstr(spellcheckerCB->
+ itemData(spellcheckerCB->currentIndex()).toString());
+ if (!speller.empty())
+ rc.spellchecker = speller;
rc.spellchecker_alt_lang = fromqstr(altLanguageED->text());
rc.spellchecker_esc_chars = fromqstr(escapeCharactersED->text());
rc.spellchecker_accept_compound = compoundWordCB->isChecked();
}
-
+void PrefSpellchecker::on_spellcheckerCB_currentIndexChanged(int index)
+{
+ QString spellchecker = spellcheckerCB->itemData(index).toString();
+
+ compoundWordCB->setEnabled(spellchecker == QString("aspell"));
+}
+
+
+
/////////////////////////////////////////////////////////////////////
//
// PrefConverters
connect(maxAgeLE, SIGNAL(textEdited(QString)),
this, SIGNAL(changed()));
+ converterED->setValidator(new NoNewLineValidator(converterED));
+ converterFlagED->setValidator(new NoNewLineValidator(converterFlagED));
maxAgeLE->setValidator(new QDoubleValidator(maxAgeLE));
//converterDefGB->setFocusProxy(convertersLW);
}
void PrefConverters::updateButtons()
{
+ if (form_->formats().size() == 0)
+ return;
Format const & from = form_->formats().get(converterFromCO->currentIndex());
Format const & to = form_->formats().get(converterToCO->currentIndex());
int const sel = form_->converters().getNumber(from.name(), to.name());
/////////////////////////////////////////////////////////////////////
PrefFileformats::PrefFileformats(GuiPreferences * form)
- : PrefModule(qt_(catFiles), qt_("File formats"), form)
+ : PrefModule(qt_(catFiles), qt_("File Formats"), form)
{
setupUi(this);
+
formatED->setValidator(new FormatNameValidator(formatsCB, form_->formats()));
formatsCB->setValidator(new FormatPrettynameValidator(formatsCB, form_->formats()));
+ extensionED->setValidator(new NoNewLineValidator(extensionED));
+ shortcutED->setValidator(new NoNewLineValidator(shortcutED));
+ editorED->setValidator(new NoNewLineValidator(editorED));
+ viewerED->setValidator(new NoNewLineValidator(viewerED));
+ copierED->setValidator(new NoNewLineValidator(copierED));
connect(documentCB, SIGNAL(clicked()),
this, SLOT(setFlags()));
connect(vectorCB, SIGNAL(clicked()),
this, SLOT(setFlags()));
+ connect(exportMenuCB, SIGNAL(clicked()),
+ this, SLOT(setFlags()));
connect(formatsCB->lineEdit(), SIGNAL(editingFinished()),
this, SLOT(updatePrettyname()));
connect(formatsCB->lineEdit(), SIGNAL(textEdited(QString)),
return split(l10n_format, '|');
}
-}; // namespace anon
+} // namespace anon
void PrefFileformats::apply(LyXRC & rc) const
formatsCB->addItem(qt_(cit->prettyname()),
QVariant(form_->formats().getNumber(cit->name())));
if (form_->converters().isReachable("latex", cit->name())
- || form_->converters().isReachable("pdflatex", cit->name()))
+ || form_->converters().isReachable("dviluatex", cit->name())
+ || form_->converters().isReachable("pdflatex", cit->name())
+ || form_->converters().isReachable("luatex", cit->name())
+ || form_->converters().isReachable("xetex", cit->name()))
defaultFormatCB->addItem(qt_(cit->prettyname()),
QVariant(toqstr(cit->name())));
}
void PrefFileformats::on_formatsCB_currentIndexChanged(int i)
{
+ if (form_->formats().size() == 0)
+ return;
int const nr = formatsCB->itemData(i).toInt();
Format const f = form_->formats().get(nr);
toqstr(l10n_shortcut(f.prettyname(), f.shortcut())));
documentCB->setChecked((f.documentFormat()));
vectorCB->setChecked((f.vectorFormat()));
+ exportMenuCB->setChecked((f.inExportMenu()));
+ exportMenuCB->setEnabled((f.documentFormat()));
updateViewers();
updateEditors();
}
flags |= Format::document;
if (vectorCB->isChecked())
flags |= Format::vector;
+ if (exportMenuCB->isChecked())
+ flags |= Format::export_menu;
currentFormat().setFlags(flags);
+ exportMenuCB->setEnabled(documentCB->isChecked());
changed();
}
void PrefFileformats::on_formatED_editingFinished()
{
string const newname = fromqstr(formatED->displayText());
- if (newname == currentFormat().name())
+ string const oldname = currentFormat().name();
+ if (newname == oldname)
return;
+ if (form_->converters().formatIsUsed(oldname)) {
+ Alert::error(_("Format in use"),
+ _("You cannot change a format's short name "
+ "if the format is used by a converter. "
+ "Please remove the converter first."));
+ updateView();
+ return;
+ }
currentFormat().setName(newname);
changed();
this, SIGNAL(changed()));
connect(autoEndCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
- connect(useBabelCB, SIGNAL(clicked()),
- this, SIGNAL(changed()));
- connect(globalCB, SIGNAL(clicked()),
+ connect(languagePackageCO, SIGNAL(activated(int)),
this, SIGNAL(changed()));
connect(languagePackageED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
+ connect(globalCB, SIGNAL(clicked()),
+ this, SIGNAL(changed()));
connect(startCommandED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
connect(endCommandED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
connect(uiLanguageCO, SIGNAL(activated(int)),
this, SIGNAL(changed()));
+ connect(defaultDecimalPointLE, SIGNAL(textChanged(QString)),
+ this, SIGNAL(changed()));
+
+ languagePackageED->setValidator(new NoNewLineValidator(languagePackageED));
+ startCommandED->setValidator(new NoNewLineValidator(startCommandED));
+ endCommandED->setValidator(new NoNewLineValidator(endCommandED));
uiLanguageCO->clear();
QAbstractItemModel * language_model = guiApp->languageModel();
// FIXME: it would be nice if sorting was enabled/disabled via a checkbox.
language_model->sort(0);
+ defaultDecimalPointLE->setInputMask("X; ");
+ defaultDecimalPointLE->setMaxLength(1);
- // FIXME: This is wrong, we need filter this list based on the available
- // translation.
+ set<string> added;
uiLanguageCO->blockSignals(true);
uiLanguageCO->addItem(qt_("Default"), toqstr("auto"));
for (int i = 0; i != language_model->rowCount(); ++i) {
QModelIndex index = language_model->index(i, 0);
+ // Filter the list based on the available translation and add
+ // each language code only once
+ string const name = fromqstr(index.data(Qt::UserRole).toString());
+ Language const * lang = languages.getLanguage(name);
+ // never remove the currently selected language
+ if (lang && name != form->rc().gui_language && name != lyxrc.gui_language)
+ if (!lang->translated() || added.find(lang->code()) != added.end())
+ continue;
+ added.insert(lang->code());
uiLanguageCO->addItem(index.data(Qt::DisplayRole).toString(),
index.data(Qt::UserRole).toString());
}
}
+void PrefLanguage::on_languagePackageCO_currentIndexChanged(int i)
+{
+ languagePackageED->setEnabled(i == 2);
+}
+
+
void PrefLanguage::apply(LyXRC & rc) const
{
// FIXME: remove rtl_support bool
rc.mark_foreign_language = markForeignCB->isChecked();
rc.language_auto_begin = autoBeginCB->isChecked();
rc.language_auto_end = autoEndCB->isChecked();
- rc.language_use_babel = useBabelCB->isChecked();
+ int const p = languagePackageCO->currentIndex();
+ if (p == 0)
+ rc.language_package_selection = LyXRC::LP_AUTO;
+ else if (p == 1)
+ rc.language_package_selection = LyXRC::LP_BABEL;
+ else if (p == 2)
+ rc.language_package_selection = LyXRC::LP_CUSTOM;
+ else if (p == 3)
+ rc.language_package_selection = LyXRC::LP_NONE;
+ rc.language_custom_package = fromqstr(languagePackageED->text());
rc.language_global_options = globalCB->isChecked();
- rc.language_package = fromqstr(languagePackageED->text());
rc.language_command_begin = fromqstr(startCommandED->text());
rc.language_command_end = fromqstr(endCommandED->text());
rc.gui_language = fromqstr(
uiLanguageCO->itemData(uiLanguageCO->currentIndex()).toString());
+ rc.default_decimal_point = fromqstr(defaultDecimalPointLE->text());
}
markForeignCB->setChecked(rc.mark_foreign_language);
autoBeginCB->setChecked(rc.language_auto_begin);
autoEndCB->setChecked(rc.language_auto_end);
- useBabelCB->setChecked(rc.language_use_babel);
+ languagePackageCO->setCurrentIndex(rc.language_package_selection);
+ languagePackageED->setText(toqstr(rc.language_custom_package));
+ languagePackageED->setEnabled(languagePackageCO->currentIndex() == 2);
globalCB->setChecked(rc.language_global_options);
- languagePackageED->setText(toqstr(rc.language_package));
startCommandED->setText(toqstr(rc.language_command_begin));
endCommandED->setText(toqstr(rc.language_command_end));
+ defaultDecimalPointLE->setText(toqstr(rc.default_decimal_point));
int pos = uiLanguageCO->findData(toqstr(rc.gui_language));
uiLanguageCO->blockSignals(true);
this, SIGNAL(changed()));
connect(printerPaperSizeED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
+
+ printerNameED->setValidator(new NoNewLineValidator(printerNameED));
+ printerCommandED->setValidator(new NoNewLineValidator(printerCommandED));
+ printerEvenED->setValidator(new NoNewLineValidator(printerEvenED));
+ printerPageRangeED->setValidator(new NoNewLineValidator(printerPageRangeED));
+ printerCopiesED->setValidator(new NoNewLineValidator(printerCopiesED));
+ printerReverseED->setValidator(new NoNewLineValidator(printerReverseED));
+ printerToFileED->setValidator(new NoNewLineValidator(printerToFileED));
+ printerPaperTypeED->setValidator(new NoNewLineValidator(printerPaperTypeED));
+ printerExtraED->setValidator(new NoNewLineValidator(printerExtraED));
+ printerOddED->setValidator(new NoNewLineValidator(printerOddED));
+ printerCollatedED->setValidator(new NoNewLineValidator(printerCollatedED));
+ printerLandscapeED->setValidator(new NoNewLineValidator(printerLandscapeED));
+ printerToPrinterED->setValidator(new NoNewLineValidator(printerToPrinterED));
+ printerExtensionED->setValidator(new NoNewLineValidator(printerExtensionED));
+ printerPaperSizeED->setValidator(new NoNewLineValidator(printerPaperSizeED));
+ printerSpoolCommandED->setValidator(new NoNewLineValidator(printerSpoolCommandED));
+ printerSpoolPrefixED->setValidator(new NoNewLineValidator(printerSpoolPrefixED));
}
/////////////////////////////////////////////////////////////////////
PrefUserInterface::PrefUserInterface(GuiPreferences * form)
- : PrefModule(qt_(catLookAndFeel), qt_("User interface"), form)
+ : PrefModule(qt_(catLookAndFeel), qt_("User Interface"), form)
{
setupUi(this);
TextLabel1, SLOT(setEnabled(bool)));
connect(openDocumentsInTabsCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
+ connect(singleInstanceCB, SIGNAL(clicked()),
+ this, SIGNAL(changed()));
#if QT_VERSION < 0x040500
singleCloseTabButtonCB->setEnabled(false);
#endif
this, SLOT(selectUi()));
connect(uiFileED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
+ connect(iconSetCO, SIGNAL(activated(int)),
+ this, SIGNAL(changed()));
connect(restoreCursorCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(loadSessionCB, SIGNAL(clicked()),
connect(tooltipCB, SIGNAL(toggled(bool)),
this, SIGNAL(changed()));
lastfilesSB->setMaximum(maxlastfiles);
+
+ iconSetCO->addItem(qt_("Default"), QString());
+ iconSetCO->addItem(qt_("Classic"), "classic");
+ iconSetCO->addItem(qt_("Oxygen"), "oxygen");
}
void PrefUserInterface::apply(LyXRC & rc) const
{
+ rc.icon_set = fromqstr(iconSetCO->itemData(
+ iconSetCO->currentIndex()).toString());
+
rc.ui_file = internal_path(fromqstr(uiFileED->text()));
rc.use_lastfilepos = restoreCursorCB->isChecked();
rc.load_session = loadSessionCB->isChecked();
rc.num_lastfiles = lastfilesSB->value();
rc.use_tooltip = tooltipCB->isChecked();
rc.open_buffers_in_tabs = openDocumentsInTabsCB->isChecked();
+ rc.single_instance = singleInstanceCB->isChecked();
rc.single_close_tab_button = singleCloseTabButtonCB->isChecked();
#if QT_VERSION < 0x040500
rc.single_close_tab_button = true;
void PrefUserInterface::update(LyXRC const & rc)
{
+ int iconset = iconSetCO->findData(toqstr(rc.icon_set));
+ if (iconset < 0)
+ iconset = 0;
+ iconSetCO->setCurrentIndex(iconset);
uiFileED->setText(toqstr(external_path(rc.ui_file)));
restoreCursorCB->setChecked(rc.use_lastfilepos);
loadSessionCB->setChecked(rc.load_session);
lastfilesSB->setValue(rc.num_lastfiles);
tooltipCB->setChecked(rc.use_tooltip);
openDocumentsInTabsCB->setChecked(rc.open_buffers_in_tabs);
+ singleInstanceCB->setChecked(rc.single_instance && !rc.lyxpipes.empty());
+ singleInstanceCB->setEnabled(!rc.lyxpipes.empty());
singleCloseTabButtonCB->setChecked(rc.single_close_tab_button);
}
this, SIGNAL(changed()));
connect(scrollBelowCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
+ connect(macLikeWordMovementCB, SIGNAL(clicked()),
+ this, SIGNAL(changed()));
connect(sortEnvironmentsCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(groupEnvironmentsCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(macroEditStyleCO, SIGNAL(activated(int)),
this, SIGNAL(changed()));
+ connect(cursorWidthSB, SIGNAL(valueChanged(int)),
+ this, SIGNAL(changed()));
connect(fullscreenLimitGB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(fullscreenWidthSB, SIGNAL(valueChanged(int)),
{
rc.cursor_follows_scrollbar = cursorFollowsCB->isChecked();
rc.scroll_below_document = scrollBelowCB->isChecked();
+ rc.mac_like_word_movement = macLikeWordMovementCB->isChecked();
rc.sort_layouts = sortEnvironmentsCB->isChecked();
rc.group_layouts = groupEnvironmentsCB->isChecked();
switch (macroEditStyleCO->currentIndex()) {
case 1: rc.macro_edit_style = LyXRC::MACRO_EDIT_INLINE; break;
case 2: rc.macro_edit_style = LyXRC::MACRO_EDIT_LIST; break;
}
+ rc.cursor_width = cursorWidthSB->value();
rc.full_screen_toolbars = toggleToolbarsCB->isChecked();
rc.full_screen_scrollbar = toggleScrollbarCB->isChecked();
rc.full_screen_tabbar = toggleTabbarCB->isChecked();
{
cursorFollowsCB->setChecked(rc.cursor_follows_scrollbar);
scrollBelowCB->setChecked(rc.scroll_below_document);
+ macLikeWordMovementCB->setChecked(rc.mac_like_word_movement);
sortEnvironmentsCB->setChecked(rc.sort_layouts);
groupEnvironmentsCB->setChecked(rc.group_layouts);
macroEditStyleCO->setCurrentIndex(rc.macro_edit_style);
+ cursorWidthSB->setValue(rc.cursor_width);
toggleScrollbarCB->setChecked(rc.full_screen_scrollbar);
toggleToolbarsCB->setChecked(rc.full_screen_toolbars);
toggleTabbarCB->setChecked(rc.full_screen_tabbar);
{
rc.bind_file = internal_path(fromqstr(bindFileED->text()));
// write user_bind and user_unbind to .lyx/bind/user.bind
- FileName bind_dir(addPath(package().user_support().absFilename(), "bind"));
+ FileName bind_dir(addPath(package().user_support().absFileName(), "bind"));
if (!bind_dir.exists() && !bind_dir.createDirectory(0777)) {
lyxerr << "LyX could not create the user bind directory '"
<< bind_dir << "'. All user-defined key bindings will be lost." << endl;
<< bind_dir << "'. All user-defined key bindings will be lost." << endl;
return;
}
- FileName user_bind_file(bind_dir.absFilename() + "/user.bind");
+ FileName user_bind_file(bind_dir.absFileName() + "/user.bind");
user_unbind_.write(user_bind_file.toFilesystemEncoding(), false, true);
user_bind_.write(user_bind_file.toFilesystemEncoding(), true, false);
// immediately apply the keybindings. Why this is not done before?
shortcutsTW->clear();
editItem_ = new QTreeWidgetItem(shortcutsTW);
- editItem_->setText(0, qt_("Cursor, Mouse and Editing functions"));
+ editItem_->setText(0, qt_("Cursor, Mouse and Editing Functions"));
editItem_->setFlags(editItem_->flags() & ~Qt::ItemIsSelectable);
mathItem_ = new QTreeWidgetItem(shortcutsTW);
this, SIGNAL(changed()));
connect(emailED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
+
+ nameED->setValidator(new NoNewLineValidator(nameED));
+ emailED->setValidator(new NoNewLineValidator(emailED));
}
addModule(new PrefUserInterface(this));
addModule(new PrefEdit(this));
addModule(new PrefShortcuts(this));
- addModule(new PrefScreenFonts(this));
+ PrefScreenFonts * screenfonts = new PrefScreenFonts(this);
+ connect(this, SIGNAL(prefsApplied(LyXRC const &)),
+ screenfonts, SLOT(updateScreenFontSizes(LyXRC const &)));
+ addModule(screenfonts);
addModule(new PrefColors(this));
addModule(new PrefDisplay(this));
addModule(new PrefInput(this));
addModule(converters);
addModule(formats);
- prefsPS->setCurrentPanel(qt_("User interface"));
+ prefsPS->setCurrentPanel(qt_("User Interface"));
// FIXME: hack to work around resizing bug in Qt >= 4.2
// bug verified with Qt 4.2.{0-3} (JSpitzm)
#if QT_VERSION >= 0x040200
apply(rc());
}
+
bool GuiPreferences::initialiseParams(string const &)
{
rc_ = lyxrc;
ostringstream ss;
rc_.write(ss, true);
dispatch(FuncRequest(LFUN_LYXRC_APPLY, ss.str()));
+ // issue prefsApplied signal. This will update the
+ // localized screen font sizes.
+ prefsApplied(rc_);
// FIXME: these need lfuns
// FIXME UNICODE
- theBufferList().setCurrentAuthor(from_utf8(rc_.user_name), from_utf8(rc_.user_email));
+ Author const & author =
+ Author(from_utf8(rc_.user_name), from_utf8(rc_.user_email));
+ theBufferList().recordCurrentAuthor(author);
lyx::formats = formats_;