gui.cpp

changeset 140
2e8c1626aef7
parent 139
5e31a96adaa2
child 142
6e8aee653dab
equal deleted inserted replaced
139:5e31a96adaa2 140:2e8c1626aef7
82 EXTERN_ACTION (roundCoords) 82 EXTERN_ACTION (roundCoords)
83 EXTERN_ACTION (gridCoarse) 83 EXTERN_ACTION (gridCoarse)
84 EXTERN_ACTION (gridMedium) 84 EXTERN_ACTION (gridMedium)
85 EXTERN_ACTION (gridFine) 85 EXTERN_ACTION (gridFine)
86 EXTERN_ACTION (resetView) 86 EXTERN_ACTION (resetView)
87 EXTERN_ACTION (insertFrom)
87 88
88 #ifndef RELEASE 89 #ifndef RELEASE
89 EXTERN_ACTION (addTestQuad) 90 EXTERN_ACTION (addTestQuad)
90 EXTERN_ACTION (addTestRadial) 91 EXTERN_ACTION (addTestRadial)
91 #endif // RELEASE 92 #endif // RELEASE
181 qRecentFilesMenu->setIcon (getIcon ("open-recent")); 182 qRecentFilesMenu->setIcon (getIcon ("open-recent"));
182 updateRecentFilesMenu (); 183 updateRecentFilesMenu ();
183 184
184 // File menu 185 // File menu
185 qFileMenu = menuBar ()->addMenu (tr ("&File")); 186 qFileMenu = menuBar ()->addMenu (tr ("&File"));
186 qFileMenu->addAction (ACTION (newFile)); // New 187 qFileMenu->addAction (ACTION (newFile)); // New
187 qFileMenu->addAction (ACTION (open)); // Open 188 qFileMenu->addAction (ACTION (open)); // Open
188 qFileMenu->addMenu (qRecentFilesMenu); // Open Recent 189 qFileMenu->addMenu (qRecentFilesMenu); // Open Recent
189 qFileMenu->addAction (ACTION (save)); // Save 190 qFileMenu->addAction (ACTION (save)); // Save
190 qFileMenu->addAction (ACTION (saveAs)); // Save As 191 qFileMenu->addAction (ACTION (saveAs)); // Save As
191 qFileMenu->addSeparator (); // ------- 192 qFileMenu->addSeparator (); // -------
192 qFileMenu->addAction (ACTION (settings)); // Settings 193 qFileMenu->addAction (ACTION (insertFrom)); // Insert from File
193 qFileMenu->addSeparator (); // ------- 194 qFileMenu->addSeparator (); // -------
194 qFileMenu->addAction (ACTION (exit)); // Exit 195 qFileMenu->addAction (ACTION (settings)); // Settings
196 qFileMenu->addSeparator (); // -------
197 qFileMenu->addAction (ACTION (exit)); // Exit
195 198
196 // View menu 199 // View menu
197 qViewMenu = menuBar ()->addMenu (tr ("&View")); 200 qViewMenu = menuBar ()->addMenu (tr ("&View"));
198 qViewMenu->addAction (ACTION (resetView)); 201 qViewMenu->addAction (ACTION (resetView));
199 202
203 qInsertMenu->addAction (ACTION (newLine)); // New Line 206 qInsertMenu->addAction (ACTION (newLine)); // New Line
204 qInsertMenu->addAction (ACTION (newTriangle)); // New Triangle 207 qInsertMenu->addAction (ACTION (newTriangle)); // New Triangle
205 qInsertMenu->addAction (ACTION (newQuad)); // New Quad 208 qInsertMenu->addAction (ACTION (newQuad)); // New Quad
206 qInsertMenu->addAction (ACTION (newCondLine)); // New Conditional Line 209 qInsertMenu->addAction (ACTION (newCondLine)); // New Conditional Line
207 qInsertMenu->addAction (ACTION (newComment)); // New Comment 210 qInsertMenu->addAction (ACTION (newComment)); // New Comment
208 qInsertMenu->addAction (ACTION (newVertex)); // New Vertex 211 qInsertMenu->addAction (ACTION (newVertex)); // New Vertex
209 qInsertMenu->addAction (ACTION (newRadial)); // New Radial 212 qInsertMenu->addAction (ACTION (newRadial)); // New Radial
210 213
211 // Edit menu 214 // Edit menu
212 qEditMenu = menuBar ()->addMenu (tr ("&Edit")); 215 qEditMenu = menuBar ()->addMenu (tr ("&Edit"));
213 qEditMenu->addAction (ACTION (undo)); // Undo 216 qEditMenu->addAction (ACTION (undo)); // Undo
214 qEditMenu->addAction (ACTION (redo)); // Redo 217 qEditMenu->addAction (ACTION (redo)); // Redo
215 qEditMenu->addSeparator (); // ----- 218 qEditMenu->addSeparator (); // -----
216 qEditMenu->addAction (ACTION (cut)); // Cut 219 qEditMenu->addAction (ACTION (cut)); // Cut
217 qEditMenu->addAction (ACTION (copy)); // Copy 220 qEditMenu->addAction (ACTION (copy)); // Copy
218 qEditMenu->addAction (ACTION (paste)); // Paste 221 qEditMenu->addAction (ACTION (paste)); // Paste
219 qEditMenu->addAction (ACTION (del)); // Delete 222 qEditMenu->addAction (ACTION (del)); // Delete
220 qEditMenu->addSeparator (); // ----- 223 qEditMenu->addSeparator (); // -----
221 qEditMenu->addAction (ACTION (selectByColor)); // Select by Color 224 qEditMenu->addAction (ACTION (selectByColor)); // Select by Color
222 qEditMenu->addAction (ACTION (selectByType)); // Select by Type 225 qEditMenu->addAction (ACTION (selectByType)); // Select by Type
223 qEditMenu->addSeparator (); // ----- 226 qEditMenu->addSeparator (); // -----
224 qEditMenu->addAction (ACTION (setColor)); // Set Color 227 qEditMenu->addAction (ACTION (setColor)); // Set Color
225 qEditMenu->addAction (ACTION (invert)); // Invert 228 qEditMenu->addAction (ACTION (invert)); // Invert
226 qEditMenu->addAction (ACTION (inlineContents)); // Inline 229 qEditMenu->addAction (ACTION (inlineContents)); // Inline
227 qEditMenu->addAction (ACTION (deepInline)); // Deep Inline 230 qEditMenu->addAction (ACTION (deepInline)); // Deep Inline
228 qEditMenu->addAction (ACTION (splitQuads)); // Split Quads 231 qEditMenu->addAction (ACTION (splitQuads)); // Split Quads
229 qEditMenu->addAction (ACTION (setContents)); // Set Contents 232 qEditMenu->addAction (ACTION (setContents)); // Set Contents
230 qEditMenu->addAction (ACTION (makeBorders)); // Make Borders 233 qEditMenu->addAction (ACTION (makeBorders)); // Make Borders
231 qEditMenu->addAction (ACTION (makeCornerVerts)); // Make Corner Vertices 234 qEditMenu->addAction (ACTION (makeCornerVerts)); // Make Corner Vertices
232 qEditMenu->addAction (ACTION (roundCoords)); // Round Coordinates 235 qEditMenu->addAction (ACTION (roundCoords)); // Round Coordinates
233 236
234 // Move menu 237 // Move menu
235 qMoveMenu = menuBar ()->addMenu (tr ("&Move")); 238 qMoveMenu = menuBar ()->addMenu (tr ("&Move"));
236 qMoveMenu->addAction (ACTION (moveUp)); // Move Up 239 qMoveMenu->addAction (ACTION (moveUp)); // Move Up
237 qMoveMenu->addAction (ACTION (moveDown)); // Move Down 240 qMoveMenu->addAction (ACTION (moveDown)); // Move Down
238 qMoveMenu->addSeparator (); // ----- 241 qMoveMenu->addSeparator (); // -----
239 qMoveMenu->addAction (ACTION (gridCoarse)); // Coarse Grid 242 qMoveMenu->addAction (ACTION (gridCoarse)); // Coarse Grid
240 qMoveMenu->addAction (ACTION (gridMedium)); // Medium Grid 243 qMoveMenu->addAction (ACTION (gridMedium)); // Medium Grid
241 qMoveMenu->addAction (ACTION (gridFine)); // Fine Grid 244 qMoveMenu->addAction (ACTION (gridFine)); // Fine Grid
242 qMoveMenu->addSeparator (); // ----- 245 qMoveMenu->addSeparator (); // -----
243 qMoveMenu->addAction (ACTION (moveXPos)); // Move +X 246 qMoveMenu->addAction (ACTION (moveXPos)); // Move +X
244 qMoveMenu->addAction (ACTION (moveXNeg)); // Move -X 247 qMoveMenu->addAction (ACTION (moveXNeg)); // Move -X
245 qMoveMenu->addAction (ACTION (moveYPos)); // Move +Y 248 qMoveMenu->addAction (ACTION (moveYPos)); // Move +Y
246 qMoveMenu->addAction (ACTION (moveYNeg)); // Move -Y 249 qMoveMenu->addAction (ACTION (moveYNeg)); // Move -Y
247 qMoveMenu->addAction (ACTION (moveZPos)); // Move +Z 250 qMoveMenu->addAction (ACTION (moveZPos)); // Move +Z
248 qMoveMenu->addAction (ACTION (moveZNeg)); // Move -Z 251 qMoveMenu->addAction (ACTION (moveZNeg)); // Move -Z
249 qMoveMenu->addSeparator (); // ----- 252 qMoveMenu->addSeparator (); // -----
250 qMoveMenu->addAction (ACTION (rotateXPos)); // Rotate +X 253 qMoveMenu->addAction (ACTION (rotateXPos)); // Rotate +X
251 qMoveMenu->addAction (ACTION (rotateXNeg)); // Rotate -X 254 qMoveMenu->addAction (ACTION (rotateXNeg)); // Rotate -X
252 qMoveMenu->addAction (ACTION (rotateYPos)); // Rotate +Y 255 qMoveMenu->addAction (ACTION (rotateYPos)); // Rotate +Y
253 qMoveMenu->addAction (ACTION (rotateYNeg)); // Rotate -Y 256 qMoveMenu->addAction (ACTION (rotateYNeg)); // Rotate -Y
254 qMoveMenu->addAction (ACTION (rotateZPos)); // Rotate +Z 257 qMoveMenu->addAction (ACTION (rotateZPos)); // Rotate +Z
255 qMoveMenu->addAction (ACTION (rotateZNeg)); // Rotate -Z 258 qMoveMenu->addAction (ACTION (rotateZNeg)); // Rotate -Z
256 259
257 // Control menu 260 // Control menu
258 qControlMenu = menuBar ()->addMenu (tr ("&Control")); 261 qControlMenu = menuBar ()->addMenu (tr ("&Control"));
259 qControlMenu->addAction (ACTION (showHistory)); // Show History 262 qControlMenu->addAction (ACTION (showHistory)); // Show History
260 263
261 #ifndef RELEASE 264 #ifndef RELEASE
262 // Debug menu 265 // Debug menu
263 qDebugMenu = menuBar ()->addMenu (tr ("&Debug")); 266 qDebugMenu = menuBar ()->addMenu (tr ("&Debug"));
264 qDebugMenu->addAction (ACTION (addTestQuad)); // Add Test Quad 267 qDebugMenu->addAction (ACTION (addTestQuad)); // Add Test Quad
265 qDebugMenu->addAction (ACTION (addTestRadial)); // Add Test Radial 268 qDebugMenu->addAction (ACTION (addTestRadial)); // Add Test Radial
266 #endif // RELEASE 269 #endif // RELEASE
267 270
268 // Help menu 271 // Help menu
269 qHelpMenu = menuBar ()->addMenu (tr ("&Help")); 272 qHelpMenu = menuBar ()->addMenu (tr ("&Help"));
270 qHelpMenu->addAction (ACTION (help)); // Help 273 qHelpMenu->addAction (ACTION (help)); // Help
271 qHelpMenu->addSeparator (); // ----- 274 qHelpMenu->addSeparator (); // -----
272 qHelpMenu->addAction (ACTION (about)); // About 275 qHelpMenu->addAction (ACTION (about)); // About
273 qHelpMenu->addAction (ACTION (aboutQt)); // About Qt 276 qHelpMenu->addAction (ACTION (aboutQt)); // About Qt
274 } 277 }
275 278
276 // ============================================================================= 279 // =============================================================================
277 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 280 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
278 // ============================================================================= 281 // =============================================================================
905 908
906 bool confirm (str title, str msg) { 909 bool confirm (str title, str msg) {
907 return QMessageBox::question (g_ForgeWindow, title, msg, 910 return QMessageBox::question (g_ForgeWindow, title, msg,
908 (QMessageBox::Yes | QMessageBox::No), QMessageBox::No) == QMessageBox::Yes; 911 (QMessageBox::Yes | QMessageBox::No), QMessageBox::No) == QMessageBox::Yes;
909 } 912 }
913
914 // =============================================================================
915 void critical (str msg) {
916 QMessageBox::critical (g_ForgeWindow, APPNAME_DISPLAY ": Critical Error", msg,
917 (QMessageBox::Close), QMessageBox::Close);
918 }

mercurial