/[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 3184 - (hide annotations) (download) (as text)
Wed May 17 12:28:39 2017 UTC (6 years, 10 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 5427 byte(s)
* Added bunch of help text and tooltips for the new
  "Macro Setup" and "Macro Editor" windows.
* wrapLabel: Fixed wrong dimensions when using
  padding.
* Bumped version (1.0.0.svn46).

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 schoenebeck 3184 #include "wrapLabel.hh"
27 schoenebeck 3157 #include "ManagedWindow.h"
28    
29     /** @brief Setup all gigedit macros.
30     *
31     * Shows a list with all gigedit macros configured by the user. It allows to
32     * add and remove macros, and to reorder the list of macros for altering the
33     * keyboard accelerators (F1 - F12) associated with the individual macros.
34     */
35     class MacrosSetup : public ManagedWindow {
36     public:
37     MacrosSetup();
38     ~MacrosSetup();
39 schoenebeck 3160 void setMacros(const std::vector<Serialization::Archive>& macros,
40     Serialization::Archive* pClipboardContent,
41     gig::DimensionRegion* pSelectedDimRgn);
42 schoenebeck 3157
43     sigc::signal<void, const std::vector<Serialization::Archive>& >& signal_macros_changed();
44    
45     // implementation for abstract methods of interface class "ManagedWindow"
46     virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->macrosSetupWindowX; }
47     virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->macrosSetupWindowY; }
48     virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->macrosSetupWindowW; }
49     virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->macrosSetupWindowH; }
50    
51     protected:
52 schoenebeck 3160 bool m_modified;
53 schoenebeck 3157 std::vector<Serialization::Archive> m_macros;
54 schoenebeck 3160 Serialization::Archive* m_clipboardContent;
55     gig::DimensionRegion* m_selectedDimRgn;
56 schoenebeck 3157
57     sigc::signal<void, const std::vector<Serialization::Archive>& > m_macros_changed;
58    
59     Gtk::VBox m_vbox;
60 schoenebeck 3160 Gtk::HBox m_addHBox;
61 schoenebeck 3162 Gtk::HBox m_mainHBox;
62     Gtk::VBox m_rvbox;
63     Gtk::HButtonBox m_detailsButtonBox;
64 schoenebeck 3157 Gtk::HBox m_footerHBox;
65     Gtk::HBox m_statusHBox;
66     Gtk::HButtonBox m_buttonBoxL;
67     Gtk::HButtonBox m_buttonBox;
68     Gtk::ScrolledWindow m_scrolledWindow;
69 schoenebeck 3184 #if GTKMM_MAJOR_VERSION < 3
70     view::WrapLabel m_labelIntro;
71     #else
72     Gtk::Label m_labelIntro;
73     #endif
74 schoenebeck 3157
75     class MacroListModel : public Gtk::TreeModel::ColumnRecord {
76     public:
77     MacroListModel() {
78     add(m_col_key);
79     add(m_col_name);
80     add(m_col_comment);
81     add(m_col_created);
82     add(m_col_modified);
83     add(m_col_index);
84     }
85    
86     Gtk::TreeModelColumn<Glib::ustring> m_col_key;
87     Gtk::TreeModelColumn<Glib::ustring> m_col_name;
88     Gtk::TreeModelColumn<Glib::ustring> m_col_comment;
89     Gtk::TreeModelColumn<Glib::ustring> m_col_created;
90     Gtk::TreeModelColumn<Glib::ustring> m_col_modified;
91     Gtk::TreeModelColumn<int> m_col_index;
92     } m_treeModelMacros;
93    
94     class MacroListTreeStore : public Gtk::TreeStore {
95     public:
96     static Glib::RefPtr<MacroListTreeStore> create(const MacroListModel& columns) {
97     return Glib::RefPtr<MacroListTreeStore>( new MacroListTreeStore(columns) );
98     }
99     protected:
100     MacroListTreeStore(const MacroListModel& columns) : Gtk::TreeStore(columns) {}
101     };
102    
103     Gtk::TreeView m_treeViewMacros;
104     Glib::RefPtr<MacroListTreeStore> m_treeStoreMacros;
105     bool m_ignoreTreeViewValueChange;
106 schoenebeck 3162 bool m_ignoreCommentTextViewChange;
107     bool m_modifiedBeforeMacroEditor;
108 schoenebeck 3157
109 schoenebeck 3160 Gtk::Button m_addFromClipboardButton;
110     Gtk::Button m_addFromSelectionButton;
111 schoenebeck 3162 Gtk::Button m_buttonUp;
112     Gtk::Button m_buttonDown;
113     Gtk::Button m_buttonEdit;
114 schoenebeck 3176 Gtk::Button m_buttonDuplicate;
115 schoenebeck 3157 Gtk::Label m_statusLabel;
116     Gtk::Button m_deleteButton;
117     Gtk::Button m_inverseDeleteButton;
118     Gtk::Button m_applyButton;
119     Gtk::Button m_cancelButton;
120 schoenebeck 3162 Gtk::Label m_labelComment;
121     Gtk::ScrolledWindow m_scrolledWindowComment;
122     Gtk::TextView m_textViewComment;
123 schoenebeck 3157
124     bool m_altKeyDown;
125 schoenebeck 3160 bool m_primaryKeyDown; // on Mac: Cmd key, on all other OSs: Ctrl key
126 schoenebeck 3157
127 schoenebeck 3162 int getSelectedMacroIndex() const;
128     Serialization::Archive* getSelectedMacro();
129 schoenebeck 3157 bool isModified() const;
130 schoenebeck 3160 void onButtonAddFromClipboard();
131     void onButtonAddFromSelection();
132 schoenebeck 3162 void onButtonUp();
133     void onButtonDown();
134     void moveByDir(int d);
135     void onButtonEdit();
136 schoenebeck 3176 void onButtonDuplicate();
137 schoenebeck 3162 void onCommentTextViewChanged();
138 schoenebeck 3157 void onButtonCancel();
139     void onButtonApply();
140     void onWindowHide();
141     bool onWindowDelete(GdkEventAny* e);
142     void updateStatus();
143     void updateStatusBar();
144     void reloadTreeView();
145     void onTreeViewSelectionChanged();
146     void onMacroTreeViewKeyRelease(GdkEventKey* button);
147     void onMacroTreeViewRowValueChanged(const Gtk::TreeModel::Path& path,
148     const Gtk::TreeModel::iterator& iter);
149 schoenebeck 3162 void onMacroEditorAppliedChanges();
150 schoenebeck 3157 void deleteSelectedRows();
151     void inverseDeleteSelectedRows();
152     void deleteRows(const std::vector<Gtk::TreeModel::Path>& rows);
153 schoenebeck 3176 void duplicateRows(const std::vector<Gtk::TreeModel::Path>& rows);
154 schoenebeck 3157 bool onKeyPressed(GdkEventKey* key);
155     bool onKeyReleased(GdkEventKey* key);
156     };
157    
158     #endif // GIGEDIT_MACROSSETUP_H

  ViewVC Help
Powered by ViewVC