]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiPrefs.h
Complete the removal of the embedding stuff. Maybe. It's hard to be sure we got every...
[lyx.git] / src / frontends / qt4 / GuiPrefs.h
index b5bf6ff381c4dad5466da350823e74b2eed8b21b..afca6d4b421dc596a3e819086f7b9839464b46c2 100644 (file)
@@ -5,6 +5,8 @@
  * Licence details can be found in the file COPYING.
  *
  * \author John Levon
+ * \author Bo Peng
+ * \author Edwin Leuven
  *
  * Full author contact details are available in file CREDITS.
  */
 
 #include "GuiDialog.h"
 
-#include "Color.h"
+#include "ColorCode.h"
 #include "Converter.h"
 #include "Format.h"
+#include "FuncCode.h"
+#include "KeyMap.h"
 #include "LyXRC.h"
 #include "Mover.h"
 
 
 #include "ui_PrefPlaintextUi.h"
 #include "ui_PrefDateUi.h"
-#include "ui_PrefKeyboardUi.h"
+#include "ui_PrefInputUi.h"
 #include "ui_PrefLatexUi.h"
 #include "ui_PrefScreenFontsUi.h"
+#include "ui_PrefCompletionUi.h"
 #include "ui_PrefColorsUi.h"
 #include "ui_PrefDisplayUi.h"
+#include "ui_PrefEditUi.h"
 #include "ui_PrefPathsUi.h"
 #include "ui_PrefShortcutsUi.h"
 #include "ui_PrefSpellcheckerUi.h"
@@ -49,7 +55,6 @@
 
 namespace lyx {
 
-class Color_color;
 class Converters;
 class Formats;
 class Movers;
@@ -62,18 +67,20 @@ class PrefModule : public QWidget
 {
        Q_OBJECT
 public:
-       PrefModule(docstring const & t,
+       PrefModule(QString const & cat, QString const & t,
                        GuiPreferences * form = 0, QWidget * parent = 0)
-               : QWidget(parent), title_(t), form_(form)
+               : QWidget(parent), category_(cat), title_(t), form_(form)
        {}
 
        virtual void apply(LyXRC & rc) const = 0;
        virtual void update(LyXRC const & rc) = 0;
 
-       docstring const & title() const { return title_; }
+       QString const & category() const { return category_; }
+       QString const & title() const { return title_; }
 
 protected:
-       docstring title_;
+       QString category_;
+       QString title_;
        GuiPreferences * form_;
 
 Q_SIGNALS:
@@ -103,11 +110,11 @@ public:
 };
 
 
-class PrefKeyboard : public PrefModule, public Ui::PrefKeyboardUi
+class PrefInput : public PrefModule, public Ui::PrefInputUi
 {
        Q_OBJECT
 public:
-       PrefKeyboard(GuiPreferences * form, QWidget * parent = 0);
+       PrefInput(GuiPreferences * form, QWidget * parent = 0);
 
        virtual void apply(LyXRC & rc) const;
        virtual void update(LyXRC const & rc);
@@ -122,6 +129,17 @@ private:
 };
 
 
+class PrefCompletion : public PrefModule, public Ui::PrefCompletionUi
+{
+       Q_OBJECT
+public:
+       PrefCompletion(GuiPreferences * form, QWidget * parent = 0);
+
+       virtual void apply(LyXRC & rc) const;
+       virtual void update(LyXRC const & rc);
+};
+
+
 class PrefLatex : public PrefModule, public Ui::PrefLatexUi
 {
        Q_OBJECT
@@ -163,7 +181,7 @@ private Q_SLOTS:
        void change_lyxObjects_selection();
 
 private:
-       std::vector<Color_color> lcolors_;
+       std::vector<ColorCode> lcolors_;
        // FIXME the use of mutable here is required due to the
        // fact that initialization is not done in the controller
        // but in the constructor.
@@ -194,6 +212,7 @@ public:
        void update(LyXRC const & rc);
 
 private Q_SLOTS:
+       void select_exampledir();
        void select_templatedir();
        void select_tempdir();
        void select_backupdir();
@@ -314,7 +333,7 @@ public:
        void update(LyXRC const & rc);
 
 private:
-       std::vector<std::string> lang_;
+       QStringList lang_;
 };
 
 
@@ -340,39 +359,83 @@ public:
 
 public Q_SLOTS:
        void select_ui();
-       void on_loadWindowSizeCB_toggled(bool);
+};
+
+
+class PrefEdit : public PrefModule, public Ui::PrefEditUi
+{
+       Q_OBJECT
+public:
+       PrefEdit(GuiPreferences * form, QWidget * parent = 0);
 
+       void apply(LyXRC & rc) const;
+       void update(LyXRC const & rc);
 };
 
 
-class GuiShortcutDialog : public QDialog, public Ui::ShortcutUi
+
+class GuiShortcutDialog : public QDialog, public Ui::shortcutUi
 {
 public:
-       GuiShortcutDialog(QWidget * parent) : QDialog(parent)
-       {
-               Ui::ShortcutUi::setupUi(this);
-               QDialog::setModal(true);
-       }
+       GuiShortcutDialog(QWidget * parent);
 };
 
 
 class PrefShortcuts : public PrefModule, public Ui::PrefShortcuts
 {
        Q_OBJECT
+private:
+       enum item_type {
+               System,         //< loaded from a bind file
+               UserBind,       //< \bind loaded from user.bind
+               UserUnbind,     //< \unbind loaded from user.bind, with corresponding
+                                       //<    entry in system bind file
+               UserExtraUnbind //< \unbind loaded from user.bind, without
+                                               //<    corresponding entry in system bind file.
+       };
 public:
        PrefShortcuts(GuiPreferences * form, QWidget * parent = 0);
 
        void apply(LyXRC & rc) const;
        void update(LyXRC const & rc);
+       void updateShortcutsTW();
+       ///
+       void setItemType(QTreeWidgetItem * item, item_type tag);
+       QTreeWidgetItem * insertShortcutItem(FuncRequest const & lfun, 
+               KeySequence const & shortcut, item_type tag);
 
 public Q_SLOTS:
        void select_bind();
        void on_newPB_pressed();
-       void on_modifyPB_pressed();
        void on_removePB_pressed();
-       void on_searchPB_pressed();
+       void on_searchLE_textEdited();
+       ///
+       void on_shortcutsTW_itemSelectionChanged();
+       void shortcut_okPB_pressed();
+       void shortcut_clearPB_pressed();
+       void on_shortcutsTW_itemDoubleClicked();
+
 private:
+       ///
        GuiShortcutDialog * shortcut_;
+       ///
+       ButtonController shortcut_bc_;
+       /// category items
+       QTreeWidgetItem * editItem_;
+       QTreeWidgetItem * mathItem_;
+       QTreeWidgetItem * bufferItem_;
+       QTreeWidgetItem * layoutItem_;
+       QTreeWidgetItem * systemItem_;
+       // system_bind_ holds bindings from rc.bind_file
+       // user_bind_ holds \bind bindings from user.bind
+       // user_unbind_ holds \unbind bindings from user.bind
+       // When an item is inserted, it is added to user_bind_
+       // When an item from system_bind_ is deleted, it is added to user_unbind_
+       // When an item in user_bind_ or user_unbind_ is deleted, it is 
+       //      deleted (unbind)
+       KeyMap system_bind_;
+       KeyMap user_bind_;
+       KeyMap user_unbind_;
 };
 
 
@@ -391,7 +454,7 @@ class GuiPreferences : public GuiDialog, public Ui::PrefsUi
 {
        Q_OBJECT
 public:
-       GuiPreferences(LyXView & lv);
+       GuiPreferences(GuiView & lv);
 
        void apply(LyXRC & rc) const;
        void updateRc(LyXRC const & rc);
@@ -400,8 +463,6 @@ public Q_SLOTS:
        void change_adaptor();
 
 public:
-       //
-       void closeEvent(QCloseEvent * e);
        ///
        void add(PrefModule * module);
        /// Apply changes
@@ -421,21 +482,19 @@ public:
        bool isBufferDependent() const { return false; }
 
        /// various file pickers
-       docstring const browsebind(docstring const & file) const;
-       docstring const browseUI(docstring const & file) const;
-       docstring const browsekbmap(docstring const & file) const;
-       docstring const browsedict(docstring const & file) const;
+       QString browsebind(QString const & file) const;
+       QString browseUI(QString const & file) const;
+       QString browsekbmap(QString const & file) const;
+       QString browsedict(QString const & file) const;
 
        /// general browse
-       docstring const browse(docstring const & file,
-                                docstring const & title) const;
+       QString browse(QString const & file, QString const & title) const;
 
        /// browse directory
-       docstring const browsedir(docstring const & path,
-                                   docstring const & title) const;
+       QString browsedir(QString const & path, QString const & title) const;
 
        /// set a color
-       void setColor(Color_color col, std::string const & hex);
+       void setColor(ColorCode col, std::string const & hex);
 
        /// update the screen fonts after change
        void updateScreenFonts();