gui.h

changeset 135
c243df39913e
parent 132
577e8e89d8de
child 136
13db97be14cb
equal deleted inserted replaced
134:7fd0784471df 135:c243df39913e
14 * 14 *
15 * You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18 18
19 #ifndef __GUI_H__ 19 #ifndef GUI_H
20 #define __GUI_H__ 20 #define GUI_H
21 21
22 #include <QMainWindow> 22 #include <QMainWindow>
23 #include <QMenu> 23 #include <QMenu>
24 #include <QToolBar> 24 #include <QToolBar>
25 #include <QAction> 25 #include <QAction>
30 #include "gldraw.h" 30 #include "gldraw.h"
31 #include "config.h" 31 #include "config.h"
32 32
33 // Stuff for dialogs 33 // Stuff for dialogs
34 #define IMPLEMENT_DIALOG_BUTTONS \ 34 #define IMPLEMENT_DIALOG_BUTTONS \
35 qButtons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel); \ 35 bbx_buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel); \
36 connect (qButtons, SIGNAL (accepted ()), this, SLOT (accept ())); \ 36 connect (bbx_buttons, SIGNAL (accepted ()), this, SLOT (accept ())); \
37 connect (qButtons, SIGNAL (rejected ()), this, SLOT (reject ())); \ 37 connect (bbx_buttons, SIGNAL (rejected ()), this, SLOT (reject ())); \
38 38
39 // ============================================================================= 39 // =============================================================================
40 // Metadata for actions 40 // Metadata for actions
41 typedef struct { 41 typedef struct {
42 QAction** const qAct; 42 QAction** const qAct;
48 extern vector<actionmeta> g_ActionMeta; 48 extern vector<actionmeta> g_ActionMeta;
49 49
50 // ============================================================================= 50 // =============================================================================
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
52 // ============================================================================= 52 // =============================================================================
53 #define ACTION(NAME, DISPLAYNAME, ICONNAME, DESCR, DEFSHORTCUT) \ 53 #define MAKE_ACTION(NAME, DISPLAYNAME, ICONNAME, DESCR, DEFSHORTCUT) \
54 QAction* ACTION_NAME (NAME); \ 54 QAction* ACTION (NAME); \
55 cfg (keyseq, key_##NAME, DEFSHORTCUT); \ 55 cfg (keyseq, key_##NAME, DEFSHORTCUT); \
56 static void actionHandler_##NAME (); \ 56 static void actionHandler_##NAME (); \
57 static ActionAdder ActionAdderInstance_##NAME (&ACTION_NAME(NAME), DISPLAYNAME, \ 57 static ActionAdder ActionAdderInstance_##NAME (&ACTION(NAME), DISPLAYNAME, \
58 ICONNAME, DESCR, &key_##NAME, actionHandler_##NAME); \ 58 ICONNAME, DESCR, &key_##NAME, actionHandler_##NAME); \
59 static void actionHandler_##NAME () 59 static void actionHandler_##NAME ()
60 60
61 #define EXTERN_ACTION(NAME) extern QAction* ACTION_NAME (NAME); 61 #define EXTERN_ACTION(NAME) extern QAction* ACTION (NAME);
62 #define ACTION_NAME(N) LDForgeAction_##N 62 #define ACTION(N) LDForgeAction_##N
63 63
64 // Convenience macros for key sequences. 64 // Convenience macros for key sequences.
65 #define KEY(N) (Qt::Key_##N) 65 #define KEY(N) (Qt::Key_##N)
66 #define CTRL(N) (Qt::CTRL | Qt::Key_##N) 66 #define CTRL(N) (Qt::CTRL | Qt::Key_##N)
67 #define SHIFT(N) (Qt::SHIFT | Qt::Key_##N) 67 #define SHIFT(N) (Qt::SHIFT | Qt::Key_##N)
123 std::vector<QPushButton*> qaColorButtons; 123 std::vector<QPushButton*> qaColorButtons;
124 QToolBar* qColorToolBar; 124 QToolBar* qColorToolBar;
125 std::vector<quickColorMetaEntry> quickColorMeta; 125 std::vector<quickColorMetaEntry> quickColorMeta;
126 126
127 // Selected objects 127 // Selected objects
128 std::vector<LDObject*> paSelection; 128 std::vector<LDObject*> sel;
129 129
130 str zMessageLogHTML; 130 str zMessageLogHTML;
131 131
132 ForgeWindow (); 132 ForgeWindow ();
133 void buildObjList (); 133 void buildObjList ();
134 void setTitle (); 134 void setTitle ();
135 void refresh (); 135 void refresh ();
136 std::vector<LDObject*> getSelectedObjects (); 136 std::vector<LDObject*> getSelectedObjects ();
137 std::vector<LDObject*>& selection ();
138 ulong getInsertionPoint (); 137 ulong getInsertionPoint ();
139 void deleteSelection (vector<ulong>* ulapIndices, std::vector<LDObject*>* papObjects); 138 void deleteSelection (vector<ulong>* ulapIndices, std::vector<LDObject*>* papObjects);
140 void updateToolBars (); 139 void updateToolBars ();
141 void updateRecentFilesMenu (); 140 void updateRecentFilesMenu ();
142 void updateSelection (); 141 void updateSelection ();
143 void updateGridToolBar (); 142 void updateGridToolBar ();
144 bool isSelected (LDObject* obj); 143 bool isSelected (LDObject* obj);
145 short getSelectedColor(); 144 short getSelectedColor();
146 LDObjectType_e getSelectedType (); 145 LDObjectType_e uniformSelectedType ();
147 146
148 protected: 147 protected:
149 void closeEvent (QCloseEvent* ev); 148 void closeEvent (QCloseEvent* ev);
150 149
151 private: 150 private:
177 LDOLC_Icon, 176 LDOLC_Icon,
178 LDOLC_Data, 177 LDOLC_Data,
179 NUM_LDOL_Columns 178 NUM_LDOL_Columns
180 }; 179 };
181 180
182 #endif 181 #endif // GUI_H

mercurial