#include "KeySequence.h"
#include "Language.h"
#include "LyXAction.h"
+#include "LyX.h"
#include "PanelStack.h"
#include "paper.h"
#include "Session.h"
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;
}
}
-
-/////////////////////////////////////////////////////////////////////
-//
-// 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));
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 $$o#src:$$n$$t");
+ dviCB->addItem("synctex view -i $$n:0:$$t -o $$o -x \"evince -p %{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 $$o#src:$$n$$t");
+ pdfCB->addItem("synctex view -i $$n:0:$$t -o $$o -x \"evince -p %{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;
+ }
}
|| lc == Color_magenta
|| lc == Color_yellow
|| lc == Color_inherit
- || lc == Color_ignore) continue;
+ || lc == Color_ignore
+ || lc == Color_greyedouttext
+ || lc == Color_shadedbg) continue;
lcolors_.push_back(lc);
}
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());
spellcheckerCB->addItem(qt_("hunspell"), QString("hunspell"));
#endif
- if (theSpellChecker()) {
+ #if 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(spellcheckContinuouslyCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
- } else {
+ connect(spellcheckNotesCB, SIGNAL(clicked()),
+ this, SIGNAL(changed()));
+ #else
spellcheckerCB->setEnabled(false);
altLanguageED->setEnabled(false);
escapeCharactersED->setEnabled(false);
compoundWordCB->setEnabled(false);
spellcheckContinuouslyCB->setEnabled(false);
- }
+ spellcheckNotesCB->setEnabled(false);
+ #endif
}
rc.spellchecker_esc_chars = fromqstr(escapeCharactersED->text());
rc.spellchecker_accept_compound = compoundWordCB->isChecked();
rc.spellcheck_continuously = spellcheckContinuouslyCB->isChecked();
+ rc.spellcheck_notes = spellcheckNotesCB->isChecked();
}
escapeCharactersED->setText(toqstr(rc.spellchecker_esc_chars));
compoundWordCB->setChecked(rc.spellchecker_accept_compound);
spellcheckContinuouslyCB->setChecked(rc.spellcheck_continuously);
+ spellcheckNotesCB->setChecked(rc.spellcheck_notes);
}
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());
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);
this, SIGNAL(changed()));
connect(uiLanguageCO, SIGNAL(activated(int)),
this, SIGNAL(changed()));
+ connect(defaultDecimalPointLE, SIGNAL(textChanged(QString)),
+ this, SIGNAL(changed()));
uiLanguageCO->clear();
rc.language_command_end = fromqstr(endCommandED->text());
rc.gui_language = fromqstr(
uiLanguageCO->itemData(uiLanguageCO->currentIndex()).toString());
+ rc.default_decimal_point = fromqstr(defaultDecimalPointLE->text());
}
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(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)),
rc.use_lastfilepos = restoreCursorCB->isChecked();
rc.load_session = loadSessionCB->isChecked();
rc.allow_geometry_session = allowGeometrySessionCB->isChecked();
- rc.autosave = autoSaveCB->isChecked()? autoSaveSB->value() * 60 : 0;
+ 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();
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);
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?
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
- && toqstr(makeCmdString(oldBinding)) != save_lfun_)
- {
+ 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;
}
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);
bc().setRestore(restorePB);
// initialize the strftime validator
- bc().addCheckedLineEdit(dateFormat->DateED);
+ bc().addCheckedLineEdit(output->DateED);
}