/[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 3154 - (hide annotations) (download) (as text)
Sat May 6 13:46:14 2017 UTC (6 years, 11 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 3305 byte(s)
* WIP Macro Editor: Implemented deleting of rows.
* WIP Macro Editor: Implemented changing values 
  of rows.
* WIP Macro Editor: show type column in gray color.
* Bumped version (1.0.0.svn36).

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     class MacroEditor : public ManagedWindow {
29     public:
30     MacroEditor();
31     ~MacroEditor();
32     void setMacro(Serialization::Archive* macro);
33    
34     // implementation for abstract methods of interface class "ManagedWindow"
35     virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->macroEditorWindowX; }
36     virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->macroEditorWindowY; }
37     virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->macroEditorWindowW; }
38     virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->macroEditorWindowH; }
39    
40     protected:
41     Serialization::Archive* m_macroOriginal;
42     Serialization::Archive m_macro;
43    
44     Gtk::VBox m_vbox;
45     Gtk::HBox m_footerHBox;
46     Gtk::HBox m_statusHBox;
47 schoenebeck 3154 Gtk::HButtonBox m_buttonBoxL;
48 schoenebeck 3151 Gtk::HButtonBox m_buttonBox;
49     Gtk::ScrolledWindow m_scrolledWindow;
50    
51     class MacroModel : public Gtk::TreeModel::ColumnRecord {
52     public:
53     MacroModel() {
54     add(m_col_name);
55     add(m_col_type);
56     add(m_col_value);
57     add(m_col_uid);
58     }
59    
60     Gtk::TreeModelColumn<Glib::ustring> m_col_name;
61     Gtk::TreeModelColumn<Glib::ustring> m_col_type;
62     Gtk::TreeModelColumn<Glib::ustring> m_col_value;
63     Gtk::TreeModelColumn<Serialization::UID> m_col_uid;
64     } m_treeModelMacro;
65    
66     class MacroTreeStore : public Gtk::TreeStore {
67     public:
68     static Glib::RefPtr<MacroTreeStore> create(const MacroModel& columns) {
69     return Glib::RefPtr<MacroTreeStore>( new MacroTreeStore(columns) );
70     }
71     protected:
72     MacroTreeStore(const MacroModel& columns) : Gtk::TreeStore(columns) {}
73     };
74    
75     Gtk::TreeView m_treeViewMacro;
76     Glib::RefPtr<MacroTreeStore> m_treeStoreMacro;
77 schoenebeck 3154 bool m_ignoreTreeViewValueChange;
78 schoenebeck 3151
79     Gtk::Label m_statusLabel;
80 schoenebeck 3154 Gtk::Button m_deleteButton;
81     Gtk::Button m_inverseDeleteButton;
82 schoenebeck 3151 Gtk::Button m_applyButton;
83     Gtk::Button m_cancelButton;
84    
85     bool isModified() const;
86     void onButtonCancel();
87     void onButtonApply();
88     void onWindowHide();
89     bool onWindowDelete(GdkEventAny* e);
90     void updateStatus();
91     void updateStatusBar();
92     void reloadTreeView();
93     void buildTreeView(const Gtk::TreeModel::Row& parentRow, const Serialization::Object& parentObject);
94 schoenebeck 3154 void onTreeViewSelectionChanged();
95     void onMacroTreeViewKeyRelease(GdkEventKey* button);
96     void onMacroTreeViewRowValueChanged(const Gtk::TreeModel::Path& path,
97     const Gtk::TreeModel::iterator& iter);
98     void deleteSelectedRows();
99     void inverseDeleteSelectedRows();
100 schoenebeck 3151 };
101    
102     #endif // GIGEDIT_MACROEDITOR_H

  ViewVC Help
Powered by ViewVC