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 |
|
|
Gtk::HButtonBox m_buttonBox; |
48 |
|
|
Gtk::ScrolledWindow m_scrolledWindow; |
49 |
|
|
|
50 |
|
|
class MacroModel : public Gtk::TreeModel::ColumnRecord { |
51 |
|
|
public: |
52 |
|
|
MacroModel() { |
53 |
|
|
add(m_col_name); |
54 |
|
|
add(m_col_type); |
55 |
|
|
add(m_col_value); |
56 |
|
|
add(m_col_uid); |
57 |
|
|
} |
58 |
|
|
|
59 |
|
|
Gtk::TreeModelColumn<Glib::ustring> m_col_name; |
60 |
|
|
Gtk::TreeModelColumn<Glib::ustring> m_col_type; |
61 |
|
|
Gtk::TreeModelColumn<Glib::ustring> m_col_value; |
62 |
|
|
Gtk::TreeModelColumn<Serialization::UID> m_col_uid; |
63 |
|
|
} m_treeModelMacro; |
64 |
|
|
|
65 |
|
|
class MacroTreeStore : public Gtk::TreeStore { |
66 |
|
|
public: |
67 |
|
|
static Glib::RefPtr<MacroTreeStore> create(const MacroModel& columns) { |
68 |
|
|
return Glib::RefPtr<MacroTreeStore>( new MacroTreeStore(columns) ); |
69 |
|
|
} |
70 |
|
|
protected: |
71 |
|
|
MacroTreeStore(const MacroModel& columns) : Gtk::TreeStore(columns) {} |
72 |
|
|
}; |
73 |
|
|
|
74 |
|
|
Gtk::TreeView m_treeViewMacro; |
75 |
|
|
Glib::RefPtr<MacroTreeStore> m_treeStoreMacro; |
76 |
|
|
|
77 |
|
|
Gtk::Label m_statusLabel; |
78 |
|
|
Gtk::Button m_applyButton; |
79 |
|
|
Gtk::Button m_cancelButton; |
80 |
|
|
|
81 |
|
|
bool isModified() const; |
82 |
|
|
void onButtonCancel(); |
83 |
|
|
void onButtonApply(); |
84 |
|
|
void onWindowHide(); |
85 |
|
|
bool onWindowDelete(GdkEventAny* e); |
86 |
|
|
void updateStatus(); |
87 |
|
|
void updateStatusBar(); |
88 |
|
|
void reloadTreeView(); |
89 |
|
|
void buildTreeView(const Gtk::TreeModel::Row& parentRow, const Serialization::Object& parentObject); |
90 |
|
|
}; |
91 |
|
|
|
92 |
|
|
#endif // GIGEDIT_MACROEDITOR_H |