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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3160 - (hide annotations) (download) (as text)
Mon May 8 21:31:45 2017 UTC (6 years, 11 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 4527 byte(s)
* Macro Setup (WIP): Implemented adding new macro from
  clipboard or from currently selected DimensionRegion.
* Bumped version (1.0.0.svn40).

1 schoenebeck 3157 /*
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_MACROSSETUP_H
9     #define GIGEDIT_MACROSSETUP_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     /** @brief Setup all gigedit macros.
29     *
30     * Shows a list with all gigedit macros configured by the user. It allows to
31     * add and remove macros, and to reorder the list of macros for altering the
32     * keyboard accelerators (F1 - F12) associated with the individual macros.
33     */
34     class MacrosSetup : public ManagedWindow {
35     public:
36     MacrosSetup();
37     ~MacrosSetup();
38 schoenebeck 3160 void setMacros(const std::vector<Serialization::Archive>& macros,
39     Serialization::Archive* pClipboardContent,
40     gig::DimensionRegion* pSelectedDimRgn);
41 schoenebeck 3157
42     sigc::signal<void, const std::vector<Serialization::Archive>& >& signal_macros_changed();
43    
44     // implementation for abstract methods of interface class "ManagedWindow"
45     virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->macrosSetupWindowX; }
46     virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->macrosSetupWindowY; }
47     virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->macrosSetupWindowW; }
48     virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->macrosSetupWindowH; }
49    
50     protected:
51 schoenebeck 3160 bool m_modified;
52 schoenebeck 3157 std::vector<Serialization::Archive> m_macros;
53 schoenebeck 3160 Serialization::Archive* m_clipboardContent;
54     gig::DimensionRegion* m_selectedDimRgn;
55 schoenebeck 3157
56     sigc::signal<void, const std::vector<Serialization::Archive>& > m_macros_changed;
57    
58     Gtk::VBox m_vbox;
59 schoenebeck 3160 Gtk::HBox m_addHBox;
60 schoenebeck 3157 Gtk::HBox m_footerHBox;
61     Gtk::HBox m_statusHBox;
62     Gtk::HButtonBox m_buttonBoxL;
63     Gtk::HButtonBox m_buttonBox;
64     Gtk::ScrolledWindow m_scrolledWindow;
65    
66     class MacroListModel : public Gtk::TreeModel::ColumnRecord {
67     public:
68     MacroListModel() {
69     add(m_col_key);
70     add(m_col_name);
71     add(m_col_comment);
72     add(m_col_created);
73     add(m_col_modified);
74     add(m_col_index);
75     }
76    
77     Gtk::TreeModelColumn<Glib::ustring> m_col_key;
78     Gtk::TreeModelColumn<Glib::ustring> m_col_name;
79     Gtk::TreeModelColumn<Glib::ustring> m_col_comment;
80     Gtk::TreeModelColumn<Glib::ustring> m_col_created;
81     Gtk::TreeModelColumn<Glib::ustring> m_col_modified;
82     Gtk::TreeModelColumn<int> m_col_index;
83     } m_treeModelMacros;
84    
85     class MacroListTreeStore : public Gtk::TreeStore {
86     public:
87     static Glib::RefPtr<MacroListTreeStore> create(const MacroListModel& columns) {
88     return Glib::RefPtr<MacroListTreeStore>( new MacroListTreeStore(columns) );
89     }
90     protected:
91     MacroListTreeStore(const MacroListModel& columns) : Gtk::TreeStore(columns) {}
92     };
93    
94     Gtk::TreeView m_treeViewMacros;
95     Glib::RefPtr<MacroListTreeStore> m_treeStoreMacros;
96     bool m_ignoreTreeViewValueChange;
97    
98 schoenebeck 3160 Gtk::Button m_addFromClipboardButton;
99     Gtk::Button m_addFromSelectionButton;
100 schoenebeck 3157 Gtk::Label m_statusLabel;
101     Gtk::Button m_deleteButton;
102     Gtk::Button m_inverseDeleteButton;
103     Gtk::Button m_applyButton;
104     Gtk::Button m_cancelButton;
105    
106     bool m_altKeyDown;
107 schoenebeck 3160 bool m_primaryKeyDown; // on Mac: Cmd key, on all other OSs: Ctrl key
108 schoenebeck 3157
109     bool isModified() const;
110 schoenebeck 3160 void onButtonAddFromClipboard();
111     void onButtonAddFromSelection();
112 schoenebeck 3157 void onButtonCancel();
113     void onButtonApply();
114     void onWindowHide();
115     bool onWindowDelete(GdkEventAny* e);
116     void updateStatus();
117     void updateStatusBar();
118     void reloadTreeView();
119     void onTreeViewSelectionChanged();
120     void onMacroTreeViewKeyRelease(GdkEventKey* button);
121     void onMacroTreeViewRowValueChanged(const Gtk::TreeModel::Path& path,
122     const Gtk::TreeModel::iterator& iter);
123     void deleteSelectedRows();
124     void inverseDeleteSelectedRows();
125     void deleteRows(const std::vector<Gtk::TreeModel::Path>& rows);
126     bool onKeyPressed(GdkEventKey* key);
127     bool onKeyReleased(GdkEventKey* key);
128     };
129    
130     #endif // GIGEDIT_MACROSSETUP_H

  ViewVC Help
Powered by ViewVC