src/gui.h

changeset 395
5210bcb1d7e0
parent 388
7ff483614aa1
child 402
ec95fc95e5f3
equal deleted inserted replaced
394:298958ce1b54 395:5210bcb1d7e0
30 class ForgeWindow; 30 class ForgeWindow;
31 class LDColor; 31 class LDColor;
32 class QToolButton; 32 class QToolButton;
33 class QDialogButtonBox; 33 class QDialogButtonBox;
34 class GLRenderer; 34 class GLRenderer;
35 class CheckBoxGroup;
36 class QComboBox; 35 class QComboBox;
37 class QProgressBar; 36 class QProgressBar;
38 class Ui_LDForgeUI; 37 class Ui_LDForgeUI;
39 38
40 // Stuff for dialogs 39 // Stuff for dialogs
57 #define CTRL(N) (Qt::CTRL | Qt::Key_##N) 56 #define CTRL(N) (Qt::CTRL | Qt::Key_##N)
58 #define SHIFT(N) (Qt::SHIFT | Qt::Key_##N) 57 #define SHIFT(N) (Qt::SHIFT | Qt::Key_##N)
59 #define CTRL_SHIFT(N) (Qt::CTRL | Qt::SHIFT | Qt::Key_##N) 58 #define CTRL_SHIFT(N) (Qt::CTRL | Qt::SHIFT | Qt::Key_##N)
60 59
61 // ============================================================================= 60 // =============================================================================
62 typedef struct { 61 struct LDQuickColor {
63 LDColor* col; 62 LDColor* col;
64 QToolButton* btn; 63 QToolButton* btn;
65 bool isSeparator; 64 bool isSeparator;
66 } quickColor; 65 };
67 66
68 // ============================================================================= 67 // =============================================================================
69 // ObjectList 68 // ObjectList
70 // 69 //
71 // Object list class for ForgeWindow 70 // Object list class for ForgeWindow
110 int deleteSelection(); 109 int deleteSelection();
111 void deleteByColor (const short int colnum); 110 void deleteByColor (const short int colnum);
112 void save (LDOpenFile* f, bool saveAs); 111 void save (LDOpenFile* f, bool saveAs);
113 GLRenderer* R() { return m_renderer; } 112 GLRenderer* R() { return m_renderer; }
114 vector<LDObject*>& sel() { return m_sel; } 113 vector<LDObject*>& sel() { return m_sel; }
115 void setQuickColorMeta (vector<quickColor>& quickColorMeta) { 114 void setQuickColors (vector<LDQuickColor>& colors) { m_quickColors = colors; }
116 m_colorMeta = quickColorMeta;
117 }
118 void setStatusBarText (str text); 115 void setStatusBarText (str text);
119 void addMessage (str msg); 116 void addMessage (str msg);
120 Ui_LDForgeUI* interface() const; 117 Ui_LDForgeUI* interface() const;
121 void refreshObjectList(); 118 void refreshObjectList();
122
123 void beginAction(QAction* act); 119 void beginAction(QAction* act);
124 void endAction(); 120 void endAction();
125 121
126 #define act(N) QAction* action##N(); 122 #define act(N) QAction* action##N();
127 #include "actions.h" 123 #include "actions.h"
140 private: 136 private:
141 GLRenderer* m_renderer; 137 GLRenderer* m_renderer;
142 QProgressBar* m_primLoaderBar; 138 QProgressBar* m_primLoaderBar;
143 QWidget* m_primLoaderWidget; 139 QWidget* m_primLoaderWidget;
144 vector<LDObject*> m_sel; 140 vector<LDObject*> m_sel;
145 vector<quickColor> m_colorMeta; 141 vector<LDQuickColor> m_quickColors;
146 vector<QToolButton*> m_colorButtons; 142 vector<QToolButton*> m_colorButtons;
147 vector<QAction*> m_recentFiles; 143 vector<QAction*> m_recentFiles;
148 MessageManager* m_msglog; 144 MessageManager* m_msglog;
149 Ui_LDForgeUI* ui; 145 Ui_LDForgeUI* ui;
150 146
167 // Pointer to the instance of ForgeWindow. 163 // Pointer to the instance of ForgeWindow.
168 extern ForgeWindow* g_win; 164 extern ForgeWindow* g_win;
169 165
170 // ----------------------------------------------------------------------------- 166 // -----------------------------------------------------------------------------
171 // Other GUI-related stuff not directly part of ForgeWindow: 167 // Other GUI-related stuff not directly part of ForgeWindow:
172 QPixmap getIcon (str iconName); 168 QPixmap getIcon (str iconName); // Get an icon from the resource dir
173 vector<quickColor> parseQuickColorMeta(); 169 vector<LDQuickColor> quickColorsFromConfig(); // Make a list of quick colors based on config
174 bool confirm (str title, str msg); 170 bool confirm (str title, str msg); // Generic confirm prompt
175 bool confirm (str msg); 171 bool confirm (str msg); // Generic confirm prompt
176 void critical (str msg); 172 void critical (str msg); // Generic error prompt
177 QIcon makeColorIcon (LDColor* colinfo, const ushort size); 173 QIcon makeColorIcon (LDColor* colinfo, const ushort size); // Makes an icon for the given color
178 void makeColorSelector (QComboBox* box); 174 void makeColorSelector (QComboBox* box); // Fills the given combo-box with color information
179 CheckBoxGroup* makeAxesBox();
180 QImage imageFromScreencap (uchar* data, ushort w, ushort h); 175 QImage imageFromScreencap (uchar* data, ushort w, ushort h);
181 176
182 // ============================================================================= 177 // =============================================================================
183 // ----------------------------------------------------------------------------- 178 // -----------------------------------------------------------------------------
184 // Takes in pairs of radio buttons and respective values and returns the value of 179 // Takes in pairs of radio buttons and respective values and returns the value of

mercurial