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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3157 - (hide annotations) (download) (as text)
Mon May 8 17:30:10 2017 UTC (6 years, 11 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 3637 byte(s)
* Fixed potentially unhandled exceptions when app is loading
  its config file.
* WIP: Introduced user configurable list of macros which are
  auto assigned to keyboard accelerators (F1 ... F12) and
  saved along with the app's config file (added under new
  main menu bar section "Macro").
* Bumped version (1.0.0.svn38).

1 schoenebeck 3151 /*
2     Copyright (c) MMXVII Christian Schoenebeck
3    
4     This file is part of "gigedit" and released under the terms of the
5     GNU General Public License version 2.
6     */
7    
8     #ifndef GIGEDIT_MACROEDITOR_H
9     #define GIGEDIT_MACROEDITOR_H
10    
11     #ifdef LIBGIG_HEADER_FILE
12     # include LIBGIG_HEADER_FILE(gig.h)
13     # include LIBGIG_HEADER_FILE(Serialization.h)
14     #else
15     # include <gig.h>
16     # include <Serialization.h>
17     #endif
18    
19     #include <gtkmm.h>
20     #if HAVE_CONFIG_H
21     # include <config.h>
22     #endif
23     #include "compat.h"
24     #include <gtkmm/uimanager.h>
25     #include <gtkmm/actiongroup.h>
26     #include "ManagedWindow.h"
27    
28 schoenebeck 3157 /** @brief Editor for gigedit macros.
29     *
30     * Implements a window which allows to edit the abstract tree of one macro
31     * that may be applied with gigedit.
32     */
33 schoenebeck 3151 class MacroEditor : public ManagedWindow {
34     public:
35     MacroEditor();
36     ~MacroEditor();
37     void setMacro(Serialization::Archive* macro);
38    
39     // implementation for abstract methods of interface class "ManagedWindow"
40     virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->macroEditorWindowX; }
41     virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->macroEditorWindowY; }
42     virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->macroEditorWindowW; }
43     virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->macroEditorWindowH; }
44    
45     protected:
46     Serialization::Archive* m_macroOriginal;
47     Serialization::Archive m_macro;
48    
49     Gtk::VBox m_vbox;
50     Gtk::HBox m_footerHBox;
51     Gtk::HBox m_statusHBox;
52 schoenebeck 3154 Gtk::HButtonBox m_buttonBoxL;
53 schoenebeck 3151 Gtk::HButtonBox m_buttonBox;
54     Gtk::ScrolledWindow m_scrolledWindow;
55    
56     class MacroModel : public Gtk::TreeModel::ColumnRecord {
57     public:
58     MacroModel() {
59     add(m_col_name);
60     add(m_col_type);
61     add(m_col_value);
62     add(m_col_uid);
63     }
64    
65     Gtk::TreeModelColumn<Glib::ustring> m_col_name;
66     Gtk::TreeModelColumn<Glib::ustring> m_col_type;
67     Gtk::TreeModelColumn<Glib::ustring> m_col_value;
68     Gtk::TreeModelColumn<Serialization::UID> m_col_uid;
69     } m_treeModelMacro;
70    
71     class MacroTreeStore : public Gtk::TreeStore {
72     public:
73     static Glib::RefPtr<MacroTreeStore> create(const MacroModel& columns) {
74     return Glib::RefPtr<MacroTreeStore>( new MacroTreeStore(columns) );
75     }
76     protected:
77     MacroTreeStore(const MacroModel& columns) : Gtk::TreeStore(columns) {}
78     };
79    
80     Gtk::TreeView m_treeViewMacro;
81     Glib::RefPtr<MacroTreeStore> m_treeStoreMacro;
82 schoenebeck 3154 bool m_ignoreTreeViewValueChange;
83 schoenebeck 3151
84     Gtk::Label m_statusLabel;
85 schoenebeck 3154 Gtk::Button m_deleteButton;
86     Gtk::Button m_inverseDeleteButton;
87 schoenebeck 3151 Gtk::Button m_applyButton;
88     Gtk::Button m_cancelButton;
89    
90 schoenebeck 3155 bool m_altKeyDown;
91    
92 schoenebeck 3151 bool isModified() const;
93     void onButtonCancel();
94     void onButtonApply();
95     void onWindowHide();
96     bool onWindowDelete(GdkEventAny* e);
97     void updateStatus();
98     void updateStatusBar();
99     void reloadTreeView();
100     void buildTreeView(const Gtk::TreeModel::Row& parentRow, const Serialization::Object& parentObject);
101 schoenebeck 3154 void onTreeViewSelectionChanged();
102     void onMacroTreeViewKeyRelease(GdkEventKey* button);
103     void onMacroTreeViewRowValueChanged(const Gtk::TreeModel::Path& path,
104     const Gtk::TreeModel::iterator& iter);
105     void deleteSelectedRows();
106     void inverseDeleteSelectedRows();
107 schoenebeck 3155 void deleteRows(const std::vector<Gtk::TreeModel::Path>& rows);
108     bool onKeyPressed(GdkEventKey* key);
109     bool onKeyReleased(GdkEventKey* key);
110 schoenebeck 3151 };
111    
112     #endif // GIGEDIT_MACROEDITOR_H

  ViewVC Help
Powered by ViewVC