/[svn]/gigedit/trunk/src/gigedit/MacroEditor.h
ViewVC logotype

Diff of /gigedit/trunk/src/gigedit/MacroEditor.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3151 by schoenebeck, Fri May 5 18:44:59 2017 UTC revision 3184 by schoenebeck, Wed May 17 12:28:39 2017 UTC
# Line 23  Line 23 
23  #include "compat.h"  #include "compat.h"
24  #include <gtkmm/uimanager.h>  #include <gtkmm/uimanager.h>
25  #include <gtkmm/actiongroup.h>  #include <gtkmm/actiongroup.h>
26    #include "wrapLabel.hh"
27  #include "ManagedWindow.h"  #include "ManagedWindow.h"
28    
29    /** @brief Editor for gigedit macros.
30     *
31     * Implements a window which allows to edit the abstract tree of one macro
32     * that may be applied with gigedit.
33     */
34  class MacroEditor : public ManagedWindow {  class MacroEditor : public ManagedWindow {
35  public:  public:
36      MacroEditor();      MacroEditor();
37     ~MacroEditor();     ~MacroEditor();
38      void setMacro(Serialization::Archive* macro);      void setMacro(Serialization::Archive* macro, bool isClipboard);
39    
40        sigc::signal<void>& signal_changes_applied();
41    
42      // implementation for abstract methods of interface class "ManagedWindow"      // implementation for abstract methods of interface class "ManagedWindow"
43      virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->macroEditorWindowX; }      virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->macroEditorWindowX; }
# Line 41  protected: Line 49  protected:
49      Serialization::Archive* m_macroOriginal;      Serialization::Archive* m_macroOriginal;
50      Serialization::Archive  m_macro;      Serialization::Archive  m_macro;
51    
52        sigc::signal<void> m_changes_applied;
53    
54      Gtk::VBox m_vbox;      Gtk::VBox m_vbox;
55      Gtk::HBox m_footerHBox;      Gtk::HBox m_footerHBox;
56      Gtk::HBox m_statusHBox;      Gtk::HBox m_statusHBox;
57        Gtk::HButtonBox m_buttonBoxL;
58      Gtk::HButtonBox m_buttonBox;      Gtk::HButtonBox m_buttonBox;
59      Gtk::ScrolledWindow m_scrolledWindow;      Gtk::ScrolledWindow m_scrolledWindow;
60    #if GTKMM_MAJOR_VERSION < 3
61        view::WrapLabel m_labelIntro;
62    #else
63        Gtk::Label m_labelIntro;
64    #endif
65    
66        class ComboOptionsModel : public Gtk::TreeModel::ColumnRecord {
67        public:
68            ComboOptionsModel() {
69                add(m_col_choice);
70            }
71    
72            Gtk::TreeModelColumn<Glib::ustring> m_col_choice;
73        } m_comboOptionsModel;
74    
75      class MacroModel : public Gtk::TreeModel::ColumnRecord {      class MacroModel : public Gtk::TreeModel::ColumnRecord {
76      public:      public:
# Line 54  protected: Line 79  protected:
79              add(m_col_type);              add(m_col_type);
80              add(m_col_value);              add(m_col_value);
81              add(m_col_uid);              add(m_col_uid);
82                add(m_col_allowTextEntry);
83                add(m_col_editable);
84                add(m_col_options);
85          }          }
86    
87          Gtk::TreeModelColumn<Glib::ustring> m_col_name;          Gtk::TreeModelColumn<Glib::ustring> m_col_name;
88          Gtk::TreeModelColumn<Glib::ustring> m_col_type;          Gtk::TreeModelColumn<Glib::ustring> m_col_type;
89          Gtk::TreeModelColumn<Glib::ustring> m_col_value;          Gtk::TreeModelColumn<Glib::ustring> m_col_value;
90          Gtk::TreeModelColumn<Serialization::UID> m_col_uid;          Gtk::TreeModelColumn<Serialization::UID> m_col_uid;
91            Gtk::TreeModelColumn<bool> m_col_allowTextEntry;
92            Gtk::TreeModelColumn<bool> m_col_editable;
93            Gtk::TreeModelColumn<Glib::RefPtr<Gtk::ListStore> > m_col_options;
94      } m_treeModelMacro;      } m_treeModelMacro;
95    
96      class MacroTreeStore : public Gtk::TreeStore {      class MacroTreeStore : public Gtk::TreeStore {
# Line 73  protected: Line 104  protected:
104    
105      Gtk::TreeView m_treeViewMacro;      Gtk::TreeView m_treeViewMacro;
106      Glib::RefPtr<MacroTreeStore> m_treeStoreMacro;      Glib::RefPtr<MacroTreeStore> m_treeStoreMacro;
107        Gtk::CellRendererCombo m_valueCellRenderer;
108        Glib::RefPtr<Gtk::ListStore> m_comboBoxModel;
109        bool m_ignoreTreeViewValueChange;
110    
111      Gtk::Label m_statusLabel;      Gtk::Label m_statusLabel;
112        Gtk::Button m_deleteButton;
113        Gtk::Button m_inverseDeleteButton;
114      Gtk::Button m_applyButton;      Gtk::Button m_applyButton;
115      Gtk::Button m_cancelButton;      Gtk::Button m_cancelButton;
116    
117        bool m_altKeyDown;
118        bool m_primaryKeyDown; // on Mac: Cmd key, on all other OSs: Ctrl key
119    
120      bool isModified() const;      bool isModified() const;
121      void onButtonCancel();      void onButtonCancel();
122      void onButtonApply();      void onButtonApply();
# Line 87  protected: Line 126  protected:
126      void updateStatusBar();      void updateStatusBar();
127      void reloadTreeView();      void reloadTreeView();
128      void buildTreeView(const Gtk::TreeModel::Row& parentRow, const Serialization::Object& parentObject);      void buildTreeView(const Gtk::TreeModel::Row& parentRow, const Serialization::Object& parentObject);
129        void onTreeViewSelectionChanged();
130        void onMacroTreeViewKeyRelease(GdkEventKey* button);
131        void onMacroTreeViewRowValueChanged(const Gtk::TreeModel::Path& path,
132                                            const Gtk::TreeModel::iterator& iter);
133        void onMacroTreeViewRowValueChangedImpl(const Gtk::TreeModel::Path& path,
134                                                const Gtk::TreeModel::iterator& iter,
135                                                const Glib::ustring& value);
136        void onValueCellEdited(const Glib::ustring& sPath, const Glib::ustring& text);
137        void deleteSelectedRows();
138        void inverseDeleteSelectedRows();
139        void deleteRows(const std::vector<Gtk::TreeModel::Path>& rows);
140        bool onKeyPressed(GdkEventKey* key);
141        bool onKeyReleased(GdkEventKey* key);
142        Glib::RefPtr<Gtk::ListStore> createComboOptions(const char** options);
143  };  };
144    
145  #endif // GIGEDIT_MACROEDITOR_H  #endif // GIGEDIT_MACROEDITOR_H

Legend:
Removed from v.3151  
changed lines
  Added in v.3184

  ViewVC Help
Powered by ViewVC