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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3155 - (show annotations) (download) (as text)
Sun May 7 15:32:43 2017 UTC (5 years, 1 month ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 3480 byte(s)
* Macro Editor: implemented reverse selected deletion of rows
* Macro Editor: Fixed "modified" state not being updated after
  clicking on "Apply" button.
* Macro Editor: Show implemented keyboard accelerators as
  symbols on the "Delete" (Ctrl+Del) and "Inverse Delete"
  (Alt+Del) buttons.
* Bumped version (1.0.0.svn37).

1 /*
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_buttonBoxL;
48 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 bool m_ignoreTreeViewValueChange;
78
79 Gtk::Label m_statusLabel;
80 Gtk::Button m_deleteButton;
81 Gtk::Button m_inverseDeleteButton;
82 Gtk::Button m_applyButton;
83 Gtk::Button m_cancelButton;
84
85 bool m_altKeyDown;
86
87 bool isModified() const;
88 void onButtonCancel();
89 void onButtonApply();
90 void onWindowHide();
91 bool onWindowDelete(GdkEventAny* e);
92 void updateStatus();
93 void updateStatusBar();
94 void reloadTreeView();
95 void buildTreeView(const Gtk::TreeModel::Row& parentRow, const Serialization::Object& parentObject);
96 void onTreeViewSelectionChanged();
97 void onMacroTreeViewKeyRelease(GdkEventKey* button);
98 void onMacroTreeViewRowValueChanged(const Gtk::TreeModel::Path& path,
99 const Gtk::TreeModel::iterator& iter);
100 void deleteSelectedRows();
101 void inverseDeleteSelectedRows();
102 void deleteRows(const std::vector<Gtk::TreeModel::Path>& rows);
103 bool onKeyPressed(GdkEventKey* key);
104 bool onKeyReleased(GdkEventKey* key);
105 };
106
107 #endif // GIGEDIT_MACROEDITOR_H

  ViewVC Help
Powered by ViewVC