#include "LyXAction.h"
#include "LyX.h"
#include "PanelStack.h"
-#include "paper.h"
#include "Session.h"
#include "SpellChecker.h"
QString testname = reloutname;
testname.remove(QRegExp("^(\\.\\./)+"));
-
+
if (testname.contains("/"))
return outname;
else
this, SIGNAL(changed()));
connect(pdfCB, SIGNAL(editTextChanged(QString)),
this, SIGNAL(changed()));
+ connect(printerPaperTypeED, SIGNAL(textChanged(QString)),
+ this, SIGNAL(changed()));
+ connect(printerLandscapeED, SIGNAL(textChanged(QString)),
+ this, SIGNAL(changed()));
+ connect(printerPaperSizeED, SIGNAL(textChanged(QString)),
+ this, SIGNAL(changed()));
+
+ printerPaperTypeED->setValidator(new NoNewLineValidator(printerPaperTypeED));
+ printerLandscapeED->setValidator(new NoNewLineValidator(printerLandscapeED));
+ printerPaperSizeED->setValidator(new NoNewLineValidator(printerPaperSizeED));
+
dviCB->addItem("");
dviCB->addItem("xdvi -sourceposition '$$n:\\ $$t' $$o");
dviCB->addItem("yap -1 -s \"$$n $$t\" $$o");
pdfCB->addItem("SumatraPDF -reuse-instance $$o -forward-search $$t $$n");
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 $$f\"");
+ pdfCB->addItem("qpdfview --unique \"$$o#src:$$f:$$n:0\"");
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 PrefOutput::apply(LyXRC & rc) const
+void PrefOutput::applyRC(LyXRC & rc) const
{
rc.date_insert_format = fromqstr(DateED->text());
rc.plaintext_linelen = plaintextLinelengthSB->value();
rc.export_overwrite = ALL_FILES;
break;
}
+
+ rc.print_paper_flag = fromqstr(printerPaperTypeED->text());
+ rc.print_landscape_flag = fromqstr(printerLandscapeED->text());
+ rc.print_paper_dimension_flag = fromqstr(printerPaperSizeED->text());
}
-void PrefOutput::update(LyXRC const & rc)
+void PrefOutput::updateRC(LyXRC const & rc)
{
DateED->setText(toqstr(rc.date_insert_format));
plaintextLinelengthSB->setValue(rc.plaintext_linelen);
overwriteCO->setCurrentIndex(2);
break;
}
+
+ printerPaperTypeED->setText(toqstr(rc.print_paper_flag));
+ printerLandscapeED->setText(toqstr(rc.print_landscape_flag));
+ printerPaperSizeED->setText(toqstr(rc.print_paper_dimension_flag));
}
this, SIGNAL(changed()));
connect(dontswapCB, SIGNAL(toggled(bool)),
this, SIGNAL(changed()));
+ connect(mmPasteCB, SIGNAL(toggled(bool)),
+ this, SIGNAL(changed()));
// reveal checkbox for switching Ctrl and Meta on Mac:
bool swapcb = false;
-#ifdef Q_WS_MACX
+#ifdef Q_OS_MAC
#if QT_VERSION > 0x040600
swapcb = true;
#endif
}
-void PrefInput::apply(LyXRC & rc) const
+void PrefInput::applyRC(LyXRC & rc) const
{
// FIXME: can derive CB from the two EDs
rc.use_kbmap = keymapCB->isChecked();
rc.scroll_wheel_zoom = LyXRC::SCROLL_WHEEL_ZOOM_OFF;
}
rc.mac_dontswap_ctrl_meta = dontswapCB->isChecked();
+ rc.mouse_middlebutton_paste = mmPasteCB->isChecked();
}
-void PrefInput::update(LyXRC const & rc)
+void PrefInput::updateRC(LyXRC const & rc)
{
// FIXME: can derive CB from the two EDs
keymapCB->setChecked(rc.use_kbmap);
break;
}
dontswapCB->setChecked(rc.mac_dontswap_ctrl_meta);
+ mmPasteCB->setChecked(rc.mouse_middlebutton_paste);
}
{
scrollzoomValueCO->setEnabled(enabled);
}
-
-
+
+
/////////////////////////////////////////////////////////////////////
//
// PrefCompletion
}
-void PrefCompletion::apply(LyXRC & rc) const
+void PrefCompletion::applyRC(LyXRC & rc) const
{
rc.completion_inline_delay = inlineDelaySB->value();
rc.completion_inline_math = inlineMathCB->isChecked();
}
-void PrefCompletion::update(LyXRC const & rc)
+void PrefCompletion::updateRC(LyXRC const & rc)
{
inlineDelaySB->setValue(rc.completion_inline_delay);
inlineMathCB->setChecked(rc.completion_inline_math);
popupTextCB->setChecked(rc.completion_popup_text);
cursorTextCB->setChecked(rc.completion_cursor_text);
popupAfterCompleteCB->setChecked(rc.completion_popup_after_complete);
- enableCB();
+ enableCB();
minlengthSB->setValue(rc.completion_minlength);
}
}
-void PrefLatex::apply(LyXRC & rc) const
+void PrefLatex::applyRC(LyXRC & rc) const
{
// If bibtex is not empty, bibopt contains the options, otherwise
// it is a customized bibtex command with options.
}
-void PrefLatex::update(LyXRC const & rc)
+void PrefLatex::updateRC(LyXRC const & rc)
{
latexBibtexCO->clear();
}
-void PrefScreenFonts::apply(LyXRC & rc) const
+void PrefScreenFonts::applyRC(LyXRC & rc) const
{
LyXRC const oldrc = rc;
}
-void PrefScreenFonts::update(LyXRC const & rc)
+void PrefScreenFonts::updateRC(LyXRC const & rc)
{
setComboxFont(screenRomanCO, rc.roman_font_name,
rc.roman_font_foundry);
updateScreenFontSizes(rc);
pixmapCacheCB->setChecked(rc.use_pixmap_cache);
-#if defined(Q_WS_X11)
+#if defined(Q_WS_X11) || defined(QPA_XCB)
pixmapCacheCB->setEnabled(false);
#endif
//
/////////////////////////////////////////////////////////////////////
-namespace {
-
-struct ColorSorter
-{
- bool operator()(ColorCode lhs, ColorCode rhs) const {
- return
- compare_no_case(lcolor.getGUIName(lhs), lcolor.getGUIName(rhs)) < 0;
- }
-};
-
-} // namespace anon
PrefColors::PrefColors(GuiPreferences * form)
: PrefModule(catLookAndFeel, N_("Colors"), form)
if (lc == Color_none
|| lc == Color_black
|| lc == Color_white
- || lc == Color_red
- || lc == Color_green
|| lc == Color_blue
+ || lc == Color_brown
|| lc == Color_cyan
+ || lc == Color_darkgray
+ || lc == Color_gray
+ || lc == Color_green
+ || lc == Color_lightgray
+ || lc == Color_lime
|| lc == Color_magenta
+ || lc == Color_olive
+ || lc == Color_orange
+ || lc == Color_pink
+ || lc == Color_purple
+ || lc == Color_red
+ || lc == Color_teal
+ || lc == Color_violet
|| lc == Color_yellow
|| lc == Color_inherit
|| lc == Color_ignore)
continue;
lcolors_.push_back(lc);
}
- sort(lcolors_.begin(), lcolors_.end(), ColorSorter());
+ qSort(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 PrefColors::apply(LyXRC & rc) const
+void PrefColors::applyRC(LyXRC & rc) const
{
LyXRC oldrc = rc;
}
-void PrefColors::update(LyXRC const & rc)
+void PrefColors::updateRC(LyXRC const & rc)
{
for (unsigned int i = 0; i < lcolors_.size(); ++i) {
QColor color = QColor(guiApp->colorCache().get(lcolors_[i], false));
}
-void PrefDisplay::apply(LyXRC & rc) const
+void PrefDisplay::applyRC(LyXRC & rc) const
{
switch (instantPreviewCO->currentIndex()) {
case 0:
rc.preview = LyXRC::PREVIEW_OFF;
break;
case 1:
- rc.preview = LyXRC::PREVIEW_NO_MATH;
+ if (rc.preview != LyXRC::PREVIEW_NO_MATH) {
+ rc.preview = LyXRC::PREVIEW_NO_MATH;
+ form_->updatePreviews();
+ }
break;
case 2:
- rc.preview = LyXRC::PREVIEW_ON;
+ if (rc.preview != LyXRC::PREVIEW_ON) {
+ rc.preview = LyXRC::PREVIEW_ON;
+ form_->updatePreviews();
+ }
break;
}
}
-void PrefDisplay::update(LyXRC const & rc)
+void PrefDisplay::updateRC(LyXRC const & rc)
{
switch (rc.preview) {
case LyXRC::PREVIEW_OFF:
}
-void PrefPaths::apply(LyXRC & rc) const
+void PrefPaths::applyRC(LyXRC & rc) const
{
rc.document_path = internal_path(fromqstr(workingDirED->text()));
rc.example_path = internal_path(fromqstr(exampleDirED->text()));
}
-void PrefPaths::update(LyXRC const & rc)
+void PrefPaths::updateRC(LyXRC const & rc)
{
workingDirED->setText(toqstr(external_path(rc.document_path)));
exampleDirED->setText(toqstr(external_path(rc.example_path)));
}
-void PrefSpellchecker::apply(LyXRC & rc) const
+void PrefSpellchecker::applyRC(LyXRC & rc) const
{
string const speller = fromqstr(spellcheckerCB->
itemData(spellcheckerCB->currentIndex()).toString());
}
-void PrefSpellchecker::update(LyXRC const & rc)
+void PrefSpellchecker::updateRC(LyXRC const & rc)
{
spellcheckerCB->setCurrentIndex(
spellcheckerCB->findData(toqstr(rc.spellchecker)));
void PrefSpellchecker::on_spellcheckerCB_currentIndexChanged(int index)
{
QString spellchecker = spellcheckerCB->itemData(index).toString();
-
+
compoundWordCB->setEnabled(spellchecker == QString("aspell"));
}
-
-
-
+
+
+
/////////////////////////////////////////////////////////////////////
//
// PrefConverters
}
-void PrefConverters::apply(LyXRC & rc) const
+void PrefConverters::applyRC(LyXRC & rc) const
{
rc.use_converter_cache = cacheCB->isChecked();
rc.converter_cache_maxage = int(widgetToDouble(maxAgeLE) * 86400.0);
}
-void PrefConverters::update(LyXRC const & rc)
+void PrefConverters::updateRC(LyXRC const & rc)
{
cacheCB->setChecked(rc.use_converter_cache);
QString max_age;
Converters::const_iterator cend = form_->converters().end();
for (; ccit != cend; ++ccit) {
QString const name =
- qt_(ccit->From->prettyname()) + " -> " + qt_(ccit->To->prettyname());
- int type = form_->converters().getNumber(ccit->From->name(), ccit->To->name());
+ qt_(ccit->From()->prettyname()) + " -> " + qt_(ccit->To()->prettyname());
+ int type = form_->converters().getNumber(ccit->From()->name(), ccit->To()->name());
new QListWidgetItem(name, convertersLW, type);
}
convertersLW->sortItems(Qt::AscendingOrder);
{
int const cnr = convertersLW->currentItem()->type();
Converter const & c(form_->converters().get(cnr));
- converterFromCO->setCurrentIndex(form_->formats().getNumber(c.from));
- converterToCO->setCurrentIndex(form_->formats().getNumber(c.to));
- converterED->setText(toqstr(c.command));
- converterFlagED->setText(toqstr(c.flags));
+ converterFromCO->setCurrentIndex(form_->formats().getNumber(c.from()));
+ converterToCO->setCurrentIndex(form_->formats().getNumber(c.to()));
+ converterED->setText(toqstr(c.command()));
+ converterFlagED->setText(toqstr(c.flags()));
updateButtons();
}
if (convertersLW->count() > 0) {
int const cnr = convertersLW->currentItem()->type();
Converter const & c = form_->converters().get(cnr);
- old_command = c.command;
- old_flag = c.flags;
+ old_command = c.command();
+ old_flag = c.flags();
}
string const new_command = fromqstr(converterED->text());
namespace {
-string const l10n_shortcut(string const prettyname, string const shortcut)
+string const l10n_shortcut(string const & prettyname, string const & shortcut)
{
if (shortcut.empty())
return string();
} // namespace anon
-void PrefFileformats::apply(LyXRC & rc) const
+void PrefFileformats::applyRC(LyXRC & rc) const
{
QString const default_format = defaultFormatCB->itemData(
defaultFormatCB->currentIndex()).toString();
}
-void PrefFileformats::update(LyXRC const & rc)
+void PrefFileformats::updateRC(LyXRC const & rc)
{
viewer_alternatives = rc.viewer_alternatives;
editor_alternatives = rc.editor_alternatives;
void updateComboBox(LyXRC::Alternatives const & alts,
string const & fmt, QComboBox * combo)
{
- LyXRC::Alternatives::const_iterator it =
+ LyXRC::Alternatives::const_iterator it =
alts.find(fmt);
if (it != alts.end()) {
LyXRC::CommandSet const & cmds = it->second;
- LyXRC::CommandSet::const_iterator sit =
+ LyXRC::CommandSet::const_iterator sit =
cmds.begin();
- LyXRC::CommandSet::const_iterator const sen =
+ LyXRC::CommandSet::const_iterator const sen =
cmds.end();
for (; sit != sen; ++sit) {
QString const qcmd = toqstr(*sit);
{
setupUi(this);
- connect(rtlGB, SIGNAL(clicked()),
- this, SIGNAL(changed()));
connect(visualCursorRB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(logicalCursorRB, SIGNAL(clicked()),
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);
defaultLengthUnitCO->addItem(lyx::qt_(unit_name_gui[Length::CM]), Length::CM);
defaultLengthUnitCO->addItem(lyx::qt_(unit_name_gui[Length::IN]), Length::IN);
- set<string> added;
+ QAbstractItemModel * language_model = guiApp->languageModel();
+ language_model->sort(0);
uiLanguageCO->blockSignals(true);
+ uiLanguageCO->clear();
uiLanguageCO->addItem(qt_("Default"), toqstr("auto"));
for (int i = 0; i != language_model->rowCount(); ++i) {
QModelIndex index = language_model->index(i, 0);
if (!lang)
continue;
// never remove the currently selected language
- if (name != form->rc().gui_language
+ if (name != form->rc().gui_language
&& name != lyxrc.gui_language
&& (!Messages::available(lang->code())
- || added.find(lang->code()) != added.end()))
- continue;
- added.insert(lang->code());
+ || !lang->hasGuiSupport()))
+ continue;
uiLanguageCO->addItem(index.data(Qt::DisplayRole).toString(),
- index.data(Qt::UserRole).toString());
+ index.data(Qt::UserRole).toString());
}
uiLanguageCO->blockSignals(false);
}
}
-void PrefLanguage::apply(LyXRC & rc) const
+void PrefLanguage::applyRC(LyXRC & rc) const
{
- // FIXME: remove rtl_support bool
- rc.rtl_support = rtlGB->isChecked();
- rc.visual_cursor = rtlGB->isChecked() && visualCursorRB->isChecked();
+ rc.visual_cursor = visualCursorRB->isChecked();
rc.mark_foreign_language = markForeignCB->isChecked();
rc.language_auto_begin = autoBeginCB->isChecked();
rc.language_auto_end = autoEndCB->isChecked();
}
-void PrefLanguage::update(LyXRC const & rc)
+void PrefLanguage::updateRC(LyXRC const & rc)
{
- // FIXME: remove rtl_support bool
- rtlGB->setChecked(rc.rtl_support);
if (rc.visual_cursor)
visualCursorRB->setChecked(true);
else
}
-/////////////////////////////////////////////////////////////////////
-//
-// PrefPrinter
-//
-/////////////////////////////////////////////////////////////////////
-
-PrefPrinter::PrefPrinter(GuiPreferences * form)
- : PrefModule(catOutput, N_("Printer"), form)
-{
- setupUi(this);
-
- connect(printerAdaptCB, SIGNAL(clicked()),
- this, SIGNAL(changed()));
- connect(printerCommandED, SIGNAL(textChanged(QString)),
- this, SIGNAL(changed()));
- connect(printerNameED, SIGNAL(textChanged(QString)),
- this, SIGNAL(changed()));
- connect(printerPageRangeED, SIGNAL(textChanged(QString)),
- this, SIGNAL(changed()));
- connect(printerCopiesED, SIGNAL(textChanged(QString)),
- this, SIGNAL(changed()));
- connect(printerReverseED, SIGNAL(textChanged(QString)),
- this, SIGNAL(changed()));
- connect(printerToPrinterED, SIGNAL(textChanged(QString)),
- this, SIGNAL(changed()));
- connect(printerExtensionED, SIGNAL(textChanged(QString)),
- this, SIGNAL(changed()));
- connect(printerSpoolCommandED, SIGNAL(textChanged(QString)),
- this, SIGNAL(changed()));
- connect(printerPaperTypeED, SIGNAL(textChanged(QString)),
- this, SIGNAL(changed()));
- connect(printerEvenED, SIGNAL(textChanged(QString)),
- this, SIGNAL(changed()));
- connect(printerOddED, SIGNAL(textChanged(QString)),
- this, SIGNAL(changed()));
- connect(printerCollatedED, SIGNAL(textChanged(QString)),
- this, SIGNAL(changed()));
- connect(printerLandscapeED, SIGNAL(textChanged(QString)),
- this, SIGNAL(changed()));
- connect(printerToFileED, SIGNAL(textChanged(QString)),
- this, SIGNAL(changed()));
- connect(printerExtraED, SIGNAL(textChanged(QString)),
- this, SIGNAL(changed()));
- connect(printerSpoolPrefixED, SIGNAL(textChanged(QString)),
- 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));
-}
-
-
-void PrefPrinter::apply(LyXRC & rc) const
-{
- rc.print_adapt_output = printerAdaptCB->isChecked();
- rc.print_command = fromqstr(printerCommandED->text());
- rc.printer = fromqstr(printerNameED->text());
-
- rc.print_pagerange_flag = fromqstr(printerPageRangeED->text());
- rc.print_copies_flag = fromqstr(printerCopiesED->text());
- rc.print_reverse_flag = fromqstr(printerReverseED->text());
- rc.print_to_printer = fromqstr(printerToPrinterED->text());
- rc.print_file_extension = fromqstr(printerExtensionED->text());
- rc.print_spool_command = fromqstr(printerSpoolCommandED->text());
- rc.print_paper_flag = fromqstr(printerPaperTypeED->text());
- rc.print_evenpage_flag = fromqstr(printerEvenED->text());
- rc.print_oddpage_flag = fromqstr(printerOddED->text());
- rc.print_collcopies_flag = fromqstr(printerCollatedED->text());
- rc.print_landscape_flag = fromqstr(printerLandscapeED->text());
- rc.print_to_file = internal_path(fromqstr(printerToFileED->text()));
- rc.print_extra_options = fromqstr(printerExtraED->text());
- rc.print_spool_printerprefix = fromqstr(printerSpoolPrefixED->text());
- rc.print_paper_dimension_flag = fromqstr(printerPaperSizeED->text());
-}
-
-
-void PrefPrinter::update(LyXRC const & rc)
-{
- printerAdaptCB->setChecked(rc.print_adapt_output);
- printerCommandED->setText(toqstr(rc.print_command));
- printerNameED->setText(toqstr(rc.printer));
-
- printerPageRangeED->setText(toqstr(rc.print_pagerange_flag));
- printerCopiesED->setText(toqstr(rc.print_copies_flag));
- printerReverseED->setText(toqstr(rc.print_reverse_flag));
- printerToPrinterED->setText(toqstr(rc.print_to_printer));
- printerExtensionED->setText(toqstr(rc.print_file_extension));
- printerSpoolCommandED->setText(toqstr(rc.print_spool_command));
- printerPaperTypeED->setText(toqstr(rc.print_paper_flag));
- printerEvenED->setText(toqstr(rc.print_evenpage_flag));
- printerOddED->setText(toqstr(rc.print_oddpage_flag));
- printerCollatedED->setText(toqstr(rc.print_collcopies_flag));
- printerLandscapeED->setText(toqstr(rc.print_landscape_flag));
- printerToFileED->setText(toqstr(external_path(rc.print_to_file)));
- printerExtraED->setText(toqstr(rc.print_extra_options));
- printerSpoolPrefixED->setText(toqstr(rc.print_spool_printerprefix));
- printerPaperSizeED->setText(toqstr(rc.print_paper_dimension_flag));
-}
-
-
/////////////////////////////////////////////////////////////////////
//
// PrefUserInterface
iconSetCO->addItem(qt_("Classic"), "classic");
iconSetCO->addItem(qt_("Oxygen"), "oxygen");
-#if (!defined Q_WS_X11 || QT_VERSION < 0x040600)
+#if (!(defined Q_WS_X11 || defined(QPA_XCB)) || QT_VERSION < 0x040600)
useSystemThemeIconsCB->hide();
#endif
}
-void PrefUserInterface::apply(LyXRC & rc) const
+void PrefUserInterface::applyRC(LyXRC & rc) const
{
rc.icon_set = fromqstr(iconSetCO->itemData(
iconSetCO->currentIndex()).toString());
}
-void PrefUserInterface::update(LyXRC const & rc)
+void PrefUserInterface::updateRC(LyXRC const & rc)
{
int iconset = iconSetCO->findData(toqstr(rc.icon_set));
if (iconset < 0)
this, SIGNAL(changed()));
connect(saveCompressedCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
+ connect(saveOriginCB, SIGNAL(clicked()),
+ this, SIGNAL(changed()));
}
-void PrefDocHandling::apply(LyXRC & rc) const
+void PrefDocHandling::applyRC(LyXRC & rc) const
{
rc.use_lastfilepos = restoreCursorCB->isChecked();
rc.load_session = loadSessionCB->isChecked();
rc.autosave = autoSaveCB->isChecked() ? autoSaveSB->value() * 60 : 0;
rc.make_backup = backupCB->isChecked();
rc.save_compressed = saveCompressedCB->isChecked();
+ rc.save_origin = saveOriginCB->isChecked();
rc.open_buffers_in_tabs = openDocumentsInTabsCB->isChecked();
rc.single_instance = singleInstanceCB->isChecked();
rc.single_close_tab_button = singleCloseTabButtonCB->isChecked();
}
-void PrefDocHandling::update(LyXRC const & rc)
+void PrefDocHandling::updateRC(LyXRC const & rc)
{
restoreCursorCB->setChecked(rc.use_lastfilepos);
loadSessionCB->setChecked(rc.load_session);
autoSaveSB->setEnabled(autosave);
backupCB->setChecked(rc.make_backup);
saveCompressedCB->setChecked(rc.save_compressed);
+ saveOriginCB->setChecked(rc.save_origin);
openDocumentsInTabsCB->setChecked(rc.open_buffers_in_tabs);
singleInstanceCB->setChecked(rc.single_instance && !rc.lyxpipes.empty());
singleInstanceCB->setEnabled(!rc.lyxpipes.empty());
}
-void PrefEdit::apply(LyXRC & rc) const
+void PrefEdit::applyRC(LyXRC & rc) const
{
rc.cursor_follows_scrollbar = cursorFollowsCB->isChecked();
rc.scroll_below_document = scrollBelowCB->isChecked();
}
-void PrefEdit::update(LyXRC const & rc)
+void PrefEdit::updateRC(LyXRC const & rc)
{
cursorFollowsCB->setChecked(rc.cursor_follows_scrollbar);
scrollBelowCB->setChecked(rc.scroll_below_document);
macroEditStyleCO->setCurrentIndex(rc.macro_edit_style);
cursorWidthSB->setValue(rc.cursor_width);
toggleScrollbarCB->setChecked(rc.full_screen_scrollbar);
- toggleScrollbarCB->setChecked(rc.full_screen_statusbar);
+ toggleStatusbarCB->setChecked(rc.full_screen_statusbar);
toggleToolbarsCB->setChecked(rc.full_screen_toolbars);
toggleTabbarCB->setChecked(rc.full_screen_tabbar);
toggleMenubarCB->setChecked(rc.full_screen_menubar);
PrefShortcuts::PrefShortcuts(GuiPreferences * form)
- : PrefModule(catEditing, N_("Shortcuts"), form)
+ : PrefModule(catEditing, N_("Shortcuts"), form),
+ editItem_(0), mathItem_(0), bufferItem_(0), layoutItem_(0),
+ systemItem_(0)
{
setupUi(this);
}
-void PrefShortcuts::apply(LyXRC & rc) const
+void PrefShortcuts::applyRC(LyXRC & rc) const
{
rc.bind_file = internal_path(fromqstr(bindFileED->text()));
// write user_bind and user_unbind to .lyx/bind/user.bind
}
-void PrefShortcuts::update(LyXRC const & rc)
+void PrefShortcuts::updateRC(LyXRC const & rc)
{
bindFileED->setText(toqstr(external_path(rc.bind_file)));
//
QString const lfun_name = toqstr(from_utf8(action_name)
+ ' ' + lfun.argument());
QString const shortcut = toqstr(seq.print(KeySequence::ForGui));
- KeyMap::ItemType item_tag = tag;
QTreeWidgetItem * newItem = 0;
// for unbind items, try to find an existing item in the system bind list
QList<QTreeWidgetItem*> const items = shortcutsTW->findItems(lfun_name,
Qt::MatchFlags(Qt::MatchExactly | Qt::MatchRecursive), 0);
for (int i = 0; i < items.size(); ++i) {
- if (items[i]->text(1) == shortcut)
+ if (items[i]->text(1) == shortcut) {
newItem = items[i];
break;
}
+ }
// if not found, this unbind item is KeyMap::UserExtraUnbind
// Such an item is not displayed to avoid confusion (what is
// unmatched removed?).
if (!newItem) {
- item_tag = KeyMap::UserExtraUnbind;
return 0;
}
}
newItem->setText(1, shortcut);
// record BindFile representation to recover KeySequence when needed.
newItem->setData(1, Qt::UserRole, toqstr(seq.print(KeySequence::BindFile)));
- setItemType(newItem, item_tag);
+ setItemType(newItem, tag);
return newItem;
}
if (items.isEmpty())
return;
- KeyMap::ItemType tag =
+ KeyMap::ItemType tag =
static_cast<KeyMap::ItemType>(items[0]->data(0, Qt::UserRole).toInt());
if (tag == KeyMap::UserUnbind)
removePB->setText(qt_("Res&tore"));
string shortcut = fromqstr(items[i]->data(1, Qt::UserRole).toString());
string lfun = fromqstr(items[i]->text(0));
FuncRequest func = lyxaction.lookupFunc(lfun);
- KeyMap::ItemType tag =
+ KeyMap::ItemType tag =
static_cast<KeyMap::ItemType>(items[i]->data(0, Qt::UserRole).toInt());
switch (tag) {
// show matched items
for (int i = 0; i < matched.size(); ++i) {
shortcutsTW->setItemHidden(matched[i], false);
- shortcutsTW->setItemExpanded(matched[i]->parent(), true);
+ shortcutsTW->setItemExpanded(matched[i]->parent(), true);
}
}
if (oldBinding == func)
// nothing has changed
return;
-
+
// make sure this key isn't already bound---and, if so, prompt user
FuncCode const unbind = user_unbind_.getBinding(k).action();
docstring const action_string = makeCmdString(oldBinding);
}
-void PrefIdentity::apply(LyXRC & rc) const
+void PrefIdentity::applyRC(LyXRC & rc) const
{
rc.user_name = fromqstr(nameED->text());
rc.user_email = fromqstr(emailED->text());
}
-void PrefIdentity::update(LyXRC const & rc)
+void PrefIdentity::updateRC(LyXRC const & rc)
{
nameED->setText(toqstr(rc.user_name));
emailED->setText(toqstr(rc.user_email));
/////////////////////////////////////////////////////////////////////
GuiPreferences::GuiPreferences(GuiView & lv)
- : GuiDialog(lv, "prefs", qt_("Preferences")), update_screen_font_(false)
+ : GuiDialog(lv, "prefs", qt_("Preferences")), update_screen_font_(false),
+ update_previews_(false)
{
setupUi(this);
addModule(new PrefSpellchecker(this));
//for strftime validator
- PrefOutput * output = new PrefOutput(this);
+ PrefOutput * output = new PrefOutput(this);
addModule(output);
- addModule(new PrefPrinter(this));
addModule(new PrefLatex(this));
PrefConverters * converters = new PrefConverters(this);
}
-void GuiPreferences::apply(LyXRC & rc) const
+void GuiPreferences::applyRC(LyXRC & rc) const
{
size_t end = modules_.size();
for (size_t i = 0; i != end; ++i)
- modules_[i]->apply(rc);
+ modules_[i]->applyRC(rc);
}
-void GuiPreferences::updateRc(LyXRC const & rc)
+void GuiPreferences::updateRC(LyXRC const & rc)
{
size_t const end = modules_.size();
for (size_t i = 0; i != end; ++i)
- modules_[i]->update(rc);
+ modules_[i]->updateRC(rc);
}
void GuiPreferences::applyView()
{
- apply(rc());
+ applyRC(rc());
}
movers_ = theMovers();
colors_.clear();
update_screen_font_ = false;
-
- updateRc(rc_);
- // Make sure that the bc is in the INITIAL state
- if (bc().policy().buttonStatus(ButtonPolicy::RESTORE))
- bc().restore();
+ update_previews_ = false;
+
+ updateRC(rc_);
+ // Make sure that the bc is in the INITIAL state
+ if (bc().policy().buttonStatus(ButtonPolicy::RESTORE))
+ bc().restore();
return true;
}
prefsApplied(rc_);
// FIXME: these need lfuns
// FIXME UNICODE
- Author const & author =
+ Author const & author =
Author(from_utf8(rc_.user_name), from_utf8(rc_.user_email));
theBufferList().recordCurrentAuthor(author);
if (update_screen_font_) {
dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
+ // resets flag in case second apply in same dialog
update_screen_font_ = false;
}
+ if (update_previews_) {
+ // resets flag in case second apply in same dialog
+ theBufferList().updatePreviews();
+ update_previews_ = false;
+ }
+
// The Save button has been pressed
if (isClosing())
dispatch(FuncRequest(LFUN_PREFERENCES_SAVE));
}
+void GuiPreferences::updatePreviews()
+{
+ update_previews_ = true;
+}
+
+
QString GuiPreferences::browsebind(QString const & file) const
{
return browseLibFile("bind", file, "bind", qt_("Choose bind file"),