#include "GuiFontLoader.h"
#include "GuiKeySymbol.h"
#include "qt_helpers.h"
+#include "Validator.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;
+}
+
+
/////////////////////////////////////////////////////////////////////
//
}
-
-/////////////////////////////////////////////////////////////////////
-//
-// PrefPlaintext
-//
-/////////////////////////////////////////////////////////////////////
-
-PrefPlaintext::PrefPlaintext(GuiPreferences * form)
- : PrefModule(qt_(catOutput), qt_("Plain text"), form)
-{
- setupUi(this);
- connect(plaintextLinelengthSB, SIGNAL(valueChanged(int)),
- this, SIGNAL(changed()));
-}
-
-
-void PrefPlaintext::apply(LyXRC & rc) const
-{
- rc.plaintext_linelen = plaintextLinelengthSB->value();
-}
-
-
-void PrefPlaintext::update(LyXRC const & rc)
-{
- plaintextLinelengthSB->setValue(rc.plaintext_linelen);
-}
-
-
/////////////////////////////////////////////////////////////////////
//
// StrftimeValidator
/////////////////////////////////////////////////////////////////////
//
-// PrefDate
+// PrefOutput
//
/////////////////////////////////////////////////////////////////////
-PrefDate::PrefDate(GuiPreferences * form)
- : PrefModule(qt_(catOutput), qt_("Date format"), form)
+PrefOutput::PrefOutput(GuiPreferences * form)
+ : 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");
}
-void PrefDate::on_DateED_textChanged(const QString &)
+void PrefOutput::on_DateED_textChanged(const QString &)
{
QString t = DateED->text();
int p = 0;
}
-void PrefDate::apply(LyXRC & rc) const
+void PrefOutput::apply(LyXRC & rc) const
{
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;
+ }
}
-void PrefDate::update(LyXRC const & rc)
+void PrefOutput::update(LyXRC const & rc)
{
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(latexChecktexED, 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);
}
+void PrefLatex::on_latexEncodingCB_stateChanged(int state)
+{
+ latexEncodingED->setEnabled(state == Qt::Checked);
+}
+
+
void PrefLatex::on_latexBibtexCO_activated(int n)
{
QString const bibtex = latexBibtexCO->itemData(n).toString();
latexBibtexOptionsLA->setText(qt_("Co&mmand:"));
return;
}
- for (set<string>::const_iterator it = bibtex_alternatives.begin();
+ for (LyXRC::CommandSet::const_iterator it = bibtex_alternatives.begin();
it != bibtex_alternatives.end(); ++it) {
QString const bib = toqstr(*it);
int ind = bib.indexOf(" ");
latexIndexOptionsLA->setText(qt_("Co&mmand:"));
return;
}
- for (set<string>::const_iterator it = index_alternatives.begin();
+ for (LyXRC::CommandSet::const_iterator it = index_alternatives.begin();
it != index_alternatives.end(); ++it) {
QString const idx = toqstr(*it);
int ind = idx.indexOf(" ");
else
rc.index_command = fromqstr(index) + " " + fromqstr(idxopt);
- rc.fontenc = fromqstr(latexEncodingED->text());
+ if (latexEncodingCB->isChecked())
+ rc.fontenc = fromqstr(latexEncodingED->text());
+ else
+ rc.fontenc = "default";
rc.chktex_command = fromqstr(latexChecktexED->text());
rc.jbibtex_command = fromqstr(latexJBibtexED->text());
rc.jindex_command = fromqstr(latexJIndexED->text());
latexBibtexCO->clear();
latexBibtexCO->addItem(qt_("Custom"), QString());
- for (set<string>::const_iterator it = rc.bibtex_alternatives.begin();
+ for (LyXRC::CommandSet::const_iterator it = rc.bibtex_alternatives.begin();
it != rc.bibtex_alternatives.end(); ++it) {
QString const command = toqstr(*it).left(toqstr(*it).indexOf(" "));
latexBibtexCO->addItem(command, command);
latexIndexCO->clear();
latexIndexCO->addItem(qt_("Custom"), QString());
- for (set<string>::const_iterator it = rc.index_alternatives.begin();
+ for (LyXRC::CommandSet::const_iterator it = rc.index_alternatives.begin();
it != rc.index_alternatives.end(); ++it) {
QString const command = toqstr(*it).left(toqstr(*it).indexOf(" "));
latexIndexCO->addItem(command, command);
latexIndexOptionsLA->setText(qt_("Co&mmand:"));
}
- latexEncodingED->setText(toqstr(rc.fontenc));
+ if (rc.fontenc == "default") {
+ latexEncodingCB->setChecked(false);
+ latexEncodingED->setEnabled(false);
+ } else {
+ latexEncodingCB->setChecked(true);
+ latexEncodingED->setEnabled(true);
+ latexEncodingED->setText(toqstr(rc.fontenc));
+ }
latexChecktexED->setText(toqstr(rc.chktex_command));
latexJBibtexED->setText(toqstr(rc.jbibtex_command));
latexJIndexED->setText(toqstr(rc.jindex_command));
/////////////////////////////////////////////////////////////////////
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) 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());
vector<ColorCode>::const_iterator cit = lcolors_.begin();
vector<ColorCode>::const_iterator const end = lcolors_.end();
for (; cit != end; ++cit) {
- (void) new QListWidgetItem(QIcon(icon),
+ (void) new QListWidgetItem(QIcon(icon),
toqstr(lcolor.getGUIName(*cit)), lyxObjectsLW);
}
curcolors_.resize(lcolors_.size());
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);
setupUi(this);
connect(displayGraphicsCB, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
connect(instantPreviewCO, SIGNAL(activated(int)), this, SIGNAL(changed()));
- connect(paragraphMarkerCB, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
+ connect(previewSizeSB, SIGNAL(valueChanged(double)), this, SIGNAL(changed()));
+ connect(paragraphMarkerCB, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
+}
+
+
+void PrefDisplay::on_instantPreviewCO_currentIndexChanged(int index)
+{
+ 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();
+ rc.preview_scale_factor = previewSizeSB->value();
rc.paragraph_markers = paragraphMarkerCB->isChecked();
// FIXME!! The graphics cache no longer has a changeDisplay method.
displayGraphicsCB->setChecked(rc.display_graphics);
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);
}
: PrefModule(QString(), qt_("Paths"), form)
{
setupUi(this);
- connect(exampleDirPB, SIGNAL(clicked()), this, SLOT(selectExampledir()));
- connect(templateDirPB, SIGNAL(clicked()), this, SLOT(selectTemplatedir()));
- connect(tempDirPB, SIGNAL(clicked()), this, SLOT(selectTempdir()));
- connect(backupDirPB, SIGNAL(clicked()), this, SLOT(selectBackupdir()));
+
connect(workingDirPB, SIGNAL(clicked()), this, SLOT(selectWorkingdir()));
- connect(lyxserverDirPB, SIGNAL(clicked()), this, SLOT(selectLyxPipe()));
- connect(thesaurusDirPB, SIGNAL(clicked()), this, SLOT(selectThesaurusdir()));
- connect(hunspellDirPB, SIGNAL(clicked()), this, SLOT(selectHunspelldir()));
connect(workingDirED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
- connect(exampleDirED, SIGNAL(textChanged(QString)),
- this, SIGNAL(changed()));
+
+ connect(templateDirPB, SIGNAL(clicked()), this, SLOT(selectTemplatedir()));
connect(templateDirED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
- connect(backupDirED, SIGNAL(textChanged(QString)),
+
+ connect(exampleDirPB, SIGNAL(clicked()), this, SLOT(selectExampledir()));
+ connect(exampleDirED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
- connect(tempDirED, SIGNAL(textChanged(QString)),
+
+ connect(backupDirPB, SIGNAL(clicked()), this, SLOT(selectBackupdir()));
+ connect(backupDirED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
+
+ connect(lyxserverDirPB, SIGNAL(clicked()), this, SLOT(selectLyxPipe()));
connect(lyxserverDirED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
+
+ connect(thesaurusDirPB, SIGNAL(clicked()), this, SLOT(selectThesaurusdir()));
connect(thesaurusDirED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
+
+ connect(tempDirPB, SIGNAL(clicked()), this, SLOT(selectTempdir()));
+ 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);
- spellcheckerCB->addItem("aspell");
- spellcheckerCB->addItem("hunspell");
+// 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"));
+#endif
+#if defined(USE_ENCHANT)
+ spellcheckerCB->addItem(qt_("Enchant"), QString("enchant"));
+#endif
+#if defined(USE_HUNSPELL)
+ spellcheckerCB->addItem(qt_("Hunspell"), QString("hunspell"));
+#endif
- connect(spellcheckerCB, SIGNAL(currentIndexChanged(int)),
- this, SIGNAL(changed()));
- connect(altLanguageED, SIGNAL(textChanged(QString)),
- this, SIGNAL(changed()));
- connect(escapeCharactersED, SIGNAL(textChanged(QString)),
- this, SIGNAL(changed()));
- connect(compoundWordCB, SIGNAL(clicked()),
- this, SIGNAL(changed()));
- connect(spellcheckContinuouslyCB, SIGNAL(clicked()),
- this, SIGNAL(changed()));
+ #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(escapeCharactersED, SIGNAL(textChanged(QString)),
+ this, SIGNAL(changed()));
+ connect(compoundWordCB, SIGNAL(clicked()),
+ this, SIGNAL(changed()));
+ connect(spellcheckContinuouslyCB, SIGNAL(clicked()),
+ 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);
+ escapeCharactersED->setEnabled(false);
+ compoundWordCB->setEnabled(false);
+ spellcheckContinuouslyCB->setEnabled(false);
+ spellcheckNotesCB->setEnabled(false);
+ #endif
}
void PrefSpellchecker::apply(LyXRC & rc) const
{
- rc.spellchecker = fromqstr(spellcheckerCB->currentText());
+ 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();
rc.spellcheck_continuously = spellcheckContinuouslyCB->isChecked();
+ rc.spellcheck_notes = spellcheckNotesCB->isChecked();
}
void PrefSpellchecker::update(LyXRC const & rc)
{
- spellcheckerCB->setCurrentIndex(spellcheckerCB->findText(
- toqstr(rc.spellchecker)));
+ spellcheckerCB->setCurrentIndex(
+ spellcheckerCB->findData(toqstr(rc.spellchecker)));
altLanguageED->setText(toqstr(rc.spellchecker_alt_lang));
escapeCharactersED->setText(toqstr(rc.spellchecker_esc_chars));
compoundWordCB->setChecked(rc.spellchecker_accept_compound);
spellcheckContinuouslyCB->setChecked(rc.spellcheck_continuously);
+ spellcheckNotesCB->setChecked(rc.spellcheck_notes);
}
-
+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()));
+ extensionsED->setValidator(new NoNewLineValidator(extensionsED));
+ 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)),
this, SIGNAL(changed()));
connect(defaultFormatCB, SIGNAL(activated(QString)),
this, SIGNAL(changed()));
+ connect(viewerCO, SIGNAL(activated(int)),
+ this, SIGNAL(changed()));
+ connect(editorCO, SIGNAL(activated(int)),
+ this, SIGNAL(changed()));
}
return split(l10n_format, '|');
}
-}; // namespace anon
+} // namespace anon
void PrefFileformats::apply(LyXRC & rc) const
void PrefFileformats::update(LyXRC const & rc)
{
+ viewer_alternatives = rc.viewer_alternatives;
+ editor_alternatives = rc.editor_alternatives;
bool const init = defaultFormatCB->currentText().isEmpty();
updateView();
if (init) {
- int const pos = defaultFormatCB->findData(toqstr(
- rc.default_view_format));
+ int const pos =
+ defaultFormatCB->findData(toqstr(rc.default_view_format));
defaultFormatCB->setCurrentIndex(pos);
}
}
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);
formatED->setText(toqstr(f.name()));
copierED->setText(toqstr(form_->movers().command(f.name())));
- extensionED->setText(toqstr(f.extension()));
+ extensionsED->setText(toqstr(f.extensions()));
shortcutED->setText(
toqstr(l10n_shortcut(f.prettyname(), f.shortcut())));
- viewerED->setText(toqstr(f.viewer()));
- editorED->setText(toqstr(f.editor()));
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_extensionED_textEdited(const QString & s)
+void PrefFileformats::on_extensionsED_textEdited(const QString & s)
{
- currentFormat().setExtension(fromqstr(s));
+ currentFormat().setExtensions(fromqstr(s));
changed();
}
+
void PrefFileformats::on_viewerED_textEdited(const QString & s)
{
currentFormat().setViewer(fromqstr(s));
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();
}
+namespace {
+ void updateComboBox(LyXRC::Alternatives const & alts,
+ string const & fmt, QComboBox * combo)
+ {
+ LyXRC::Alternatives::const_iterator it =
+ alts.find(fmt);
+ if (it != alts.end()) {
+ LyXRC::CommandSet const & cmds = it->second;
+ LyXRC::CommandSet::const_iterator sit =
+ cmds.begin();
+ LyXRC::CommandSet::const_iterator const sen =
+ cmds.end();
+ for (; sit != sen; ++sit) {
+ QString const qcmd = toqstr(*sit);
+ combo->addItem(qcmd, qcmd);
+ }
+ }
+ }
+}
+
+
+void PrefFileformats::updateViewers()
+{
+ Format const f = currentFormat();
+ viewerCO->blockSignals(true);
+ viewerCO->clear();
+ viewerCO->addItem(qt_("None"), QString());
+ updateComboBox(viewer_alternatives, f.name(), viewerCO);
+ viewerCO->addItem(qt_("Custom"), QString("custom viewer"));
+ viewerCO->blockSignals(false);
+
+ int pos = viewerCO->findData(toqstr(f.viewer()));
+ if (pos != -1) {
+ viewerED->clear();
+ viewerED->setEnabled(false);
+ viewerCO->setCurrentIndex(pos);
+ } else {
+ viewerED->setEnabled(true);
+ viewerED->setText(toqstr(f.viewer()));
+ viewerCO->setCurrentIndex(viewerCO->findData(toqstr("custom viewer")));
+ }
+}
+
+
+void PrefFileformats::updateEditors()
+{
+ Format const f = currentFormat();
+ editorCO->blockSignals(true);
+ editorCO->clear();
+ editorCO->addItem(qt_("None"), QString());
+ updateComboBox(editor_alternatives, f.name(), editorCO);
+ editorCO->addItem(qt_("Custom"), QString("custom editor"));
+ editorCO->blockSignals(false);
+
+ int pos = editorCO->findData(toqstr(f.editor()));
+ if (pos != -1) {
+ editorED->clear();
+ editorED->setEnabled(false);
+ editorCO->setCurrentIndex(pos);
+ } else {
+ editorED->setEnabled(true);
+ editorED->setText(toqstr(f.editor()));
+ editorCO->setCurrentIndex(editorCO->findData(toqstr("custom editor")));
+ }
+}
+
+
+void PrefFileformats::on_viewerCO_currentIndexChanged(int i)
+{
+ bool const custom = viewerCO->itemData(i).toString() == "custom viewer";
+ viewerED->setEnabled(custom);
+ if (!custom)
+ currentFormat().setViewer(fromqstr(viewerCO->itemData(i).toString()));
+}
+
+
+void PrefFileformats::on_editorCO_currentIndexChanged(int i)
+{
+ bool const custom = editorCO->itemData(i).toString() == "custom editor";
+ editorED->setEnabled(custom);
+ if (!custom)
+ currentFormat().setEditor(fromqstr(editorCO->itemData(i).toString()));
+}
+
+
Format & PrefFileformats::currentFormat()
{
int const i = formatsCB->currentIndex();
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
+ connect(singleCloseTabButtonCB, SIGNAL(clicked()),
+ this, SIGNAL(changed()));
connect(uiFilePB, SIGNAL(clicked()),
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()),
this, SIGNAL(changed()));
connect(autoSaveCB, SIGNAL(clicked()),
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)),
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.allow_geometry_session = allowGeometrySessionCB->isChecked();
- rc.autosave = autoSaveSB->value() * 60;
- rc.make_backup = autoSaveCB->isChecked();
+ 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();
+ rc.single_instance = singleInstanceCB->isChecked();
+ rc.single_close_tab_button = singleCloseTabButtonCB->isChecked();
+#if QT_VERSION < 0x040500
+ rc.single_close_tab_button = true;
+#endif
}
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);
allowGeometrySessionCB->setChecked(rc.allow_geometry_session);
// convert to minutes
- int mins(rc.autosave / 60);
- if (rc.autosave && !mins)
- mins = 1;
+ bool autosave = rc.autosave > 0;
+ int mins = rc.autosave / 60;
+ if (!mins)
+ mins = 5;
autoSaveSB->setValue(mins);
- autoSaveCB->setChecked(rc.make_backup);
+ 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);
+ 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);
this, SLOT(selectBind()));
connect(bindFileED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
- connect(removePB, SIGNAL(clicked()),
- this, SIGNAL(changed()));
shortcut_ = new GuiShortcutDialog(this);
shortcut_bc_.setPolicy(ButtonPolicy::OkCancelPolicy);
{
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);
QTreeWidgetItem * PrefShortcuts::insertShortcutItem(FuncRequest const & lfun,
KeySequence const & seq, KeyMap::ItemType tag)
{
- FuncCode action = lfun.action;
+ FuncCode const action = lfun.action();
string const action_name = lyxaction.getActionName(action);
QString const lfun_name = toqstr(from_utf8(action_name)
+ ' ' + lfun.argument());
QTreeWidgetItem * item = shortcutsTW->currentItem();
if (item->flags() & Qt::ItemIsSelectable) {
shortcut_->lfunLE->setText(item->text(0));
- save_lfun_ = item->text(0);
+ save_lfun_ = item->text(0).trimmed();
shortcut_->shortcutWG->setText(item->text(1));
KeySequence seq;
seq.parse(fromqstr(item->data(1, Qt::UserRole).toString()));
void PrefShortcuts::on_removePB_pressed()
{
+ changed();
removeShortcut();
}
docstring makeCmdString(FuncRequest const & f)
{
- docstring actionStr = from_ascii(lyxaction.getActionName(f.action));
+ docstring actionStr = from_ascii(lyxaction.getActionName(f.action()));
if (!f.argument().empty())
actionStr += " " + f.argument();
return actionStr;
QString const new_lfun = shortcut_->lfunLE->text();
FuncRequest func = lyxaction.lookupFunc(fromqstr(new_lfun));
- if (func.action == LFUN_UNKNOWN_ACTION) {
+ if (func.action() == LFUN_UNKNOWN_ACTION) {
Alert::error(_("Failed to create shortcut"),
_("Unknown or invalid LyX function"));
return;
// check to see if there's been any change
FuncRequest oldBinding = system_bind_.getBinding(k);
- if (oldBinding.action == LFUN_UNKNOWN_ACTION)
+ if (oldBinding.action() == LFUN_UNKNOWN_ACTION)
oldBinding = user_bind_.getBinding(k);
- if (oldBinding == func) {
- docstring const actionStr = makeCmdString(func);
- Alert::error(_("Failed to create shortcut"),
- bformat(_("Shortcut `%1$s' is already bound to:\n%2$s"),
- k.print(KeySequence::ForGui), actionStr));
+ if (oldBinding == func)
+ // nothing has changed
return;
- }
// make sure this key isn't already bound---and, if so, not unbound
- FuncCode const unbind = user_unbind_.getBinding(k).action;
- if (oldBinding.action != LFUN_UNKNOWN_ACTION && unbind == LFUN_UNKNOWN_ACTION)
- {
+ FuncCode const unbind = user_unbind_.getBinding(k).action();
+ docstring const action_string = makeCmdString(oldBinding);
+ if (oldBinding.action() > LFUN_NOACTION && unbind == LFUN_UNKNOWN_ACTION
+ && save_lfun_ != toqstr(action_string)) {
// FIXME Perhaps we should offer to over-write the old shortcut?
// If so, we'll need to remove it from our list, etc.
- docstring const actionStr = makeCmdString(oldBinding);
Alert::error(_("Failed to create shortcut"),
bformat(_("Shortcut `%1$s' is already bound to:\n%2$s\n"
"You need to remove that binding before creating a new one."),
- k.print(KeySequence::ForGui), actionStr));
+ k.print(KeySequence::ForGui), action_string));
return;
}
- if (!save_lfun_.isEmpty() && new_lfun == save_lfun_)
+ if (!save_lfun_.isEmpty())
// real modification of the lfun's shortcut,
// so remove the previous one
removeShortcut();
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(new PrefLanguage(this));
addModule(new PrefSpellchecker(this));
+ //for strftime validator
+ PrefOutput * output = new PrefOutput(this);
+ addModule(output);
addModule(new PrefPrinter(this));
- PrefDate * dateFormat = new PrefDate(this);
- addModule(dateFormat);
- addModule(new PrefPlaintext(this));
addModule(new PrefLatex(this));
PrefConverters * converters = new PrefConverters(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
bc().setRestore(restorePB);
// initialize the strftime validator
- bc().addCheckedLineEdit(dateFormat->DateED);
+ bc().addCheckedLineEdit(output->DateED);
}
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_;