4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
11 * Full author contact details are available in file CREDITS.
17 #include "GuiDialog.h"
19 #include "Converter.h"
25 #include "ui_PrefsUi.h"
27 #include "ui_PrefOutputUi.h"
28 #include "ui_PrefInputUi.h"
29 #include "ui_PrefLatexUi.h"
30 #include "ui_PrefScreenFontsUi.h"
31 #include "ui_PrefCompletionUi.h"
32 #include "ui_PrefColorsUi.h"
33 #include "ui_PrefDisplayUi.h"
34 #include "ui_PrefDocHandlingUi.h"
35 #include "ui_PrefEditUi.h"
36 #include "ui_PrefPathsUi.h"
37 #include "ui_PrefShortcutsUi.h"
38 #include "ui_PrefSpellcheckerUi.h"
39 #include "ui_PrefConvertersUi.h"
40 #include "ui_PrefFileformatsUi.h"
41 #include "ui_PrefLanguageUi.h"
42 #include "ui_PrefUi.h"
43 #include "ui_PrefIdentityUi.h"
44 #include "ui_ShortcutUi.h"
60 class GuiPreferences : public GuiDialog, public Ui::PrefsUi
64 GuiPreferences(GuiView & lv);
66 void applyRC(LyXRC & rc) const;
67 void updateRC(LyXRC const & rc);
70 void change_adaptor();
73 void prefsApplied(LyXRC const & rc);
79 std::vector<PrefModule *> modules_;
82 bool initialiseParams(std::string const &);
86 void dispatchParams();
88 bool isBufferDependent() const { return false; }
90 /// various file pickers
91 QString browsebind(QString const & file) const;
92 QString browseUI(QString const & file) const;
93 QString browsekbmap(QString const & file) const;
96 QString browse(QString const & file, QString const & title) const;
99 void setColor(ColorCode col, QString const & hex);
101 /// update the screen fonts after change
102 void updateScreenFonts();
104 LyXRC & rc() { return rc_; }
105 Converters & converters() { return converters_; }
106 Formats & formats() { return formats_; }
107 Movers & movers() { return movers_; }
111 void addModule(PrefModule * module);
115 /// temporary converters
116 Converters converters_;
117 /// temporary formats
122 /// A list of colors to be dispatched
123 std::vector<std::string> colors_;
125 bool update_screen_font_;
129 class PrefModule : public QWidget
133 PrefModule(QString const & cat, QString const & t,
134 GuiPreferences * form)
135 : QWidget(form), category_(cat), title_(t), form_(form)
138 virtual void applyRC(LyXRC & rc) const = 0;
139 virtual void updateRC(LyXRC const & rc) = 0;
141 QString const & category() const { return category_; }
142 QString const & title() const { return title_; }
147 GuiPreferences * form_;
154 class PrefOutput : public PrefModule, public Ui::PrefOutputUi
158 PrefOutput(GuiPreferences * form);
160 virtual void applyRC(LyXRC & rc) const;
161 virtual void updateRC(LyXRC const & rc);
164 void on_DateED_textChanged(const QString &);
168 class PrefInput : public PrefModule, public Ui::PrefInputUi
172 PrefInput(GuiPreferences * form);
174 virtual void applyRC(LyXRC & rc) const;
175 virtual void updateRC(LyXRC const & rc);
178 void on_firstKeymapPB_clicked(bool);
179 void on_secondKeymapPB_clicked(bool);
180 void on_keymapCB_toggled(bool);
181 void on_scrollzoomEnableCB_toggled(bool);
184 QString testKeymap(QString const & keymap);
188 class PrefCompletion : public PrefModule, public Ui::PrefCompletionUi
192 PrefCompletion(GuiPreferences * form);
194 virtual void applyRC(LyXRC & rc) const;
195 virtual void updateRC(LyXRC const & rc);
196 virtual void enableCB();
198 void on_popupTextCB_clicked();
199 void on_inlineTextCB_clicked();
203 class PrefLatex : public PrefModule, public Ui::PrefLatexUi
207 PrefLatex(GuiPreferences * form);
209 virtual void applyRC(LyXRC & rc) const;
210 virtual void updateRC(LyXRC const & rc);
213 void on_latexEncodingCB_stateChanged(int state);
214 void on_latexBibtexCO_activated(int n);
215 void on_latexIndexCO_activated(int n);
219 std::set<std::string> bibtex_alternatives;
221 std::set<std::string> index_alternatives;
225 class PrefScreenFonts : public PrefModule, public Ui::PrefScreenFontsUi
229 PrefScreenFonts(GuiPreferences * form);
231 virtual void applyRC(LyXRC & rc) const;
232 virtual void updateRC(LyXRC const & rc);
235 void selectRoman(const QString&);
236 void selectSans(const QString&);
237 void selectTypewriter(const QString&);
240 void updateScreenFontSizes(LyXRC const & rc);
244 class PrefColors : public PrefModule, public Ui::PrefColorsUi
248 PrefColors(GuiPreferences * form);
250 void applyRC(LyXRC & rc) const;
251 void updateRC(LyXRC const & rc);
255 void changeSysColor();
256 void changeLyxObjectsSelection();
259 std::vector<ColorCode> lcolors_;
260 std::vector<QString> curcolors_;
261 std::vector<QString> newcolors_;
265 class PrefDisplay : public PrefModule, public Ui::PrefDisplayUi
269 PrefDisplay(GuiPreferences * form);
271 void applyRC(LyXRC & rc) const;
272 void updateRC(LyXRC const & rc);
275 void on_instantPreviewCO_currentIndexChanged(int);
279 class PrefPaths : public PrefModule, public Ui::PrefPathsUi
283 PrefPaths(GuiPreferences * form);
285 void applyRC(LyXRC & rc) const;
286 void updateRC(LyXRC const & rc);
289 void selectExampledir();
290 void selectTemplatedir();
291 void selectTempdir();
292 void selectBackupdir();
293 void selectWorkingdir();
294 void selectThesaurusdir();
295 void selectHunspelldir();
296 void selectLyxPipe();
301 class PrefSpellchecker : public PrefModule, public Ui::PrefSpellcheckerUi
305 PrefSpellchecker(GuiPreferences * form);
307 void applyRC(LyXRC & rc) const;
308 void updateRC(LyXRC const & rc);
311 void on_spellcheckerCB_currentIndexChanged(int);
315 class PrefConverters : public PrefModule, public Ui::PrefConvertersUi
319 PrefConverters(GuiPreferences * form);
321 void applyRC(LyXRC & rc) const;
322 void updateRC(LyXRC const & rc);
328 void updateConverter();
329 void switchConverter();
330 void removeConverter();
331 void changeConverter();
332 void on_cacheCB_stateChanged(int state);
335 void updateButtons();
339 class PrefFileformats : public PrefModule, public Ui::PrefFileformatsUi
343 PrefFileformats(GuiPreferences * form);
345 void applyRC(LyXRC & rc) const;
346 void updateRC(LyXRC const & rc);
350 void formatsChanged();
353 void on_copierED_textEdited(const QString & s);
354 void on_extensionsED_textEdited(const QString &);
355 void on_viewerED_textEdited(const QString &);
356 void on_editorED_textEdited(const QString &);
357 void on_mimeED_textEdited(const QString &);
358 void on_shortcutED_textEdited(const QString &);
359 void on_formatED_editingFinished();
360 void on_formatED_textChanged(const QString &);
361 void on_formatsCB_currentIndexChanged(int);
362 void on_formatsCB_editTextChanged(const QString &);
363 void on_formatNewPB_clicked();
364 void on_formatRemovePB_clicked();
365 void on_viewerCO_currentIndexChanged(int i);
366 void on_editorCO_currentIndexChanged(int i);
368 void updatePrettyname();
371 Format & currentFormat();
373 void updateViewers();
375 void updateEditors();
377 LyXRC::Alternatives viewer_alternatives;
379 LyXRC::Alternatives editor_alternatives;
383 class PrefLanguage : public PrefModule, public Ui::PrefLanguageUi
387 PrefLanguage(GuiPreferences * form);
389 void applyRC(LyXRC & rc) const;
390 void updateRC(LyXRC const & rc);
393 void on_uiLanguageCO_currentIndexChanged(int);
394 void on_languagePackageCO_currentIndexChanged(int);
398 class PrefUserInterface : public PrefModule, public Ui::PrefUi
402 PrefUserInterface(GuiPreferences * form);
404 void applyRC(LyXRC & rc) const;
405 void updateRC(LyXRC const & rc);
412 class PrefDocHandling : public PrefModule, public Ui::PrefDocHandlingUi
416 PrefDocHandling(GuiPreferences * form);
418 void applyRC(LyXRC & rc) const;
419 void updateRC(LyXRC const & rc);
422 void on_clearSessionPB_clicked();
427 class PrefEdit : public PrefModule, public Ui::PrefEditUi
431 PrefEdit(GuiPreferences * form);
433 void applyRC(LyXRC & rc) const;
434 void updateRC(LyXRC const & rc);
439 class GuiShortcutDialog : public QDialog, public Ui::shortcutUi
442 GuiShortcutDialog(QWidget * parent);
446 class PrefShortcuts : public PrefModule, public Ui::PrefShortcuts
450 PrefShortcuts(GuiPreferences * form);
452 void applyRC(LyXRC & rc) const;
453 void updateRC(LyXRC const & rc);
454 void updateShortcutsTW();
455 void modifyShortcut();
456 void removeShortcut();
458 void setItemType(QTreeWidgetItem * item, KeyMap::ItemType tag);
459 QTreeWidgetItem * insertShortcutItem(FuncRequest const & lfun,
460 KeySequence const & shortcut, KeyMap::ItemType tag);
464 void on_modifyPB_pressed();
465 void on_newPB_pressed();
466 void on_removePB_pressed();
467 void on_searchLE_textEdited();
469 void on_shortcutsTW_itemSelectionChanged();
470 void on_shortcutsTW_itemDoubleClicked();
472 void shortcutOkPressed();
473 void shortcutCancelPressed();
474 void shortcutClearPressed();
475 void shortcutRemovePressed();
479 GuiShortcutDialog * shortcut_;
481 ButtonController shortcut_bc_;
483 QTreeWidgetItem * editItem_;
484 QTreeWidgetItem * mathItem_;
485 QTreeWidgetItem * bufferItem_;
486 QTreeWidgetItem * layoutItem_;
487 QTreeWidgetItem * systemItem_;
488 // system_bind_ holds bindings from rc.bind_file
489 // user_bind_ holds \bind bindings from user.bind
490 // user_unbind_ holds \unbind bindings from user.bind
491 // When an item is inserted, it is added to user_bind_
492 // When an item from system_bind_ is deleted, it is added to user_unbind_
493 // When an item in user_bind_ or user_unbind_ is deleted, it is
503 class PrefIdentity : public PrefModule, public Ui::PrefIdentityUi
507 PrefIdentity(GuiPreferences * form);
509 void applyRC(LyXRC & rc) const;
510 void updateRC(LyXRC const & rc);
514 } // namespace frontend