64 const str license = |
64 const str license = |
65 ui.rb_license_ca->isChecked() ? CALicense : |
65 ui.rb_license_ca->isChecked() ? CALicense : |
66 ui.rb_license_nonca->isChecked() ? NonCALicense : |
66 ui.rb_license_nonca->isChecked() ? NonCALicense : |
67 ""; |
67 ""; |
68 |
68 |
69 *g_curfile << new LDComment( ui.le_title->text() ); |
69 *g_curfile << new LDComment (ui.le_title->text()); |
70 *g_curfile << new LDComment( "Name: <untitled>.dat" ); |
70 *g_curfile << new LDComment ("Name: <untitled>.dat" ); |
71 *g_curfile << new LDComment( fmt( "Author: %1", ui.le_author->text() )); |
71 *g_curfile << new LDComment (fmt ("Author: %1", ui.le_author->text())); |
72 *g_curfile << new LDComment( fmt( "!LDRAW_ORG Unofficial_Part" )); |
72 *g_curfile << new LDComment (fmt ("!LDRAW_ORG Unofficial_Part")); |
73 |
73 |
74 if( license != "" ) |
74 if (license != "") |
75 *g_curfile << new LDComment( license ); |
75 *g_curfile << new LDComment (license); |
76 |
76 |
77 *g_curfile << new LDEmpty; |
77 *g_curfile << new LDEmpty; |
78 *g_curfile << new LDBFC( BFCType ); |
78 *g_curfile << new LDBFC (BFCType); |
79 *g_curfile << new LDEmpty; |
79 *g_curfile << new LDEmpty; |
80 |
80 |
81 g_win->fullRefresh(); |
81 g_win->fullRefresh(); |
82 } |
82 } |
83 |
83 |
84 // ============================================================================= |
84 // ============================================================================= |
85 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
85 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
86 // ============================================================================= |
86 // ============================================================================= |
87 MAKE_ACTION (open, "&Open", "file-open", "Load a part model from a file.", CTRL (O)) { |
87 MAKE_ACTION (open, "&Open", "file-open", "Load a part model from a file.", CTRL (O)) { |
88 if (safeToCloseAll () == false) |
88 if (safeToCloseAll() == false) |
89 return; |
89 return; |
90 |
90 |
91 str name = QFileDialog::getOpenFileName (g_win, "Open File", "", "LDraw files (*.dat *.ldr)"); |
91 str name = QFileDialog::getOpenFileName (g_win, "Open File", "", "LDraw files (*.dat *.ldr)"); |
92 |
92 |
93 if (name.length () == 0) |
93 if (name.length() == 0) |
94 return; |
94 return; |
95 |
95 |
96 closeAll (); |
96 closeAll(); |
97 openMainFile (name); |
97 openMainFile (name); |
98 } |
98 } |
99 |
99 |
100 // ============================================================================= |
100 // ============================================================================= |
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
102 // ============================================================================= |
102 // ============================================================================= |
103 MAKE_ACTION( save, "&Save", "file-save", "Save the part model.", CTRL( S )) |
103 MAKE_ACTION (save, "&Save", "file-save", "Save the part model.", CTRL (S)) |
104 { |
104 { |
105 g_win->save( g_curfile, false ); |
105 g_win->save (g_curfile, false); |
106 } |
106 } |
107 |
107 |
108 // ============================================================================= |
108 // ============================================================================= |
109 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
109 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
110 // ============================================================================= |
110 // ============================================================================= |
111 MAKE_ACTION( saveAs, "Save &As", "file-save-as", "Save the part model to a specific file.", CTRL_SHIFT( S )) |
111 MAKE_ACTION (saveAs, "Save &As", "file-save-as", "Save the part model to a specific file.", CTRL_SHIFT (S)) |
112 { |
112 { |
113 g_win->save( g_curfile, true ); |
113 g_win->save (g_curfile, true); |
114 } |
114 } |
115 |
115 |
116 // ============================================================================= |
116 // ============================================================================= |
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
118 // ============================================================================= |
118 // ============================================================================= |
119 MAKE_ACTION (settings, "Settin&gs", "settings", "Edit the settings of " APPNAME ".", (0)) { |
119 MAKE_ACTION (settings, "Settin&gs", "settings", "Edit the settings of " APPNAME ".", (0)) { |
120 ConfigDialog::staticDialog (); |
120 ConfigDialog::staticDialog(); |
121 } |
121 } |
122 |
122 |
123 MAKE_ACTION (setLDrawPath, "Set LDraw Path", "settings", "Change the LDraw directory path.", (0)) { |
123 MAKE_ACTION (setLDrawPath, "Set LDraw Path", "settings", "Change the LDraw directory path.", (0)) { |
124 LDrawPathDialog dlg (true); |
124 LDrawPathDialog dlg (true); |
125 dlg.exec (); |
125 dlg.exec(); |
126 } |
126 } |
127 |
127 |
128 // ============================================================================= |
128 // ============================================================================= |
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
130 // ============================================================================= |
130 // ============================================================================= |
189 // ============================================================================= |
189 // ============================================================================= |
190 MAKE_ACTION (about, "About " APPNAME, "ldforge", |
190 MAKE_ACTION (about, "About " APPNAME, "ldforge", |
191 "Shows information about " APPNAME ".", (0)) |
191 "Shows information about " APPNAME ".", (0)) |
192 { |
192 { |
193 AboutDialog dlg; |
193 AboutDialog dlg; |
194 dlg.exec (); |
194 dlg.exec(); |
195 } |
195 } |
196 |
196 |
197 MAKE_ACTION (aboutQt, "About Qt", "qt", "Shows information about Qt.", (0)) { |
197 MAKE_ACTION (aboutQt, "About Qt", "qt", "Shows information about Qt.", (0)) { |
198 QMessageBox::aboutQt (g_win); |
198 QMessageBox::aboutQt (g_win); |
199 } |
199 } |
200 |
200 |
201 // ============================================================================= |
201 // ============================================================================= |
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
203 // ============================================================================= |
203 // ============================================================================= |
204 MAKE_ACTION (selectAll, "Select All", "select-all", "Selects all objects.", CTRL (A)) { |
204 MAKE_ACTION (selectAll, "Select All", "select-all", "Selects all objects.", CTRL (A)) { |
205 g_win->sel ().clear (); |
205 g_win->sel().clear(); |
206 |
206 |
207 for (LDObject* obj : g_curfile->objs ()) |
207 for (LDObject* obj : g_curfile->objs()) |
208 g_win->sel () << obj; |
208 g_win->sel() << obj; |
209 |
209 |
210 g_win->updateSelection (); |
210 g_win->updateSelection(); |
211 } |
211 } |
212 |
212 |
213 // ============================================================================= |
213 // ============================================================================= |
214 MAKE_ACTION (selectByColor, "Select by Color", "select-color", |
214 MAKE_ACTION (selectByColor, "Select by Color", "select-color", |
215 "Select all objects by the given color.", CTRL_SHIFT (A)) |
215 "Select all objects by the given color.", CTRL_SHIFT (A)) |
216 { |
216 { |
217 short colnum = g_win->getSelectedColor (); |
217 short colnum = g_win->getSelectedColor(); |
218 |
218 |
219 if (colnum == -1) |
219 if (colnum == -1) |
220 return; // no consensus on color |
220 return; // no consensus on color |
221 |
221 |
222 g_win->sel ().clear (); |
222 g_win->sel().clear(); |
223 for (LDObject* obj : g_curfile->objs ()) |
223 for (LDObject* obj : g_curfile->objs()) |
224 if (obj->color () == colnum) |
224 if (obj->color() == colnum) |
225 g_win->sel () << obj; |
225 g_win->sel() << obj; |
226 |
226 |
227 g_win->updateSelection (); |
227 g_win->updateSelection(); |
228 } |
228 } |
229 |
229 |
230 // ============================================================================= |
230 // ============================================================================= |
231 MAKE_ACTION (selectByType, "Select by Type", "select-type", |
231 MAKE_ACTION (selectByType, "Select by Type", "select-type", |
232 "Select all objects by the given type.", (0)) |
232 "Select all objects by the given type.", (0)) |
233 { |
233 { |
234 if (g_win->sel ().size () == 0) |
234 if (g_win->sel().size() == 0) |
235 return; |
235 return; |
236 |
236 |
237 LDObject::Type type = g_win->uniformSelectedType (); |
237 LDObject::Type type = g_win->uniformSelectedType(); |
238 |
238 |
239 if (type == LDObject::Unidentified) |
239 if (type == LDObject::Unidentified) |
240 return; |
240 return; |
241 |
241 |
242 // If we're selecting subfile references, the reference filename must also |
242 // If we're selecting subfile references, the reference filename must also |
243 // be uniform. |
243 // be uniform. |
244 str refName; |
244 str refName; |
245 |
245 |
246 if (type == LDObject::Subfile) { |
246 if (type == LDObject::Subfile) { |
247 refName = static_cast<LDSubfile*> (g_win->sel ()[0])->fileInfo ()->name (); |
247 refName = static_cast<LDSubfile*> (g_win->sel()[0])->fileInfo()->name(); |
248 |
248 |
249 for (LDObject* obj : g_win->sel ()) |
249 for (LDObject* obj : g_win->sel()) |
250 if (static_cast<LDSubfile*> (obj)->fileInfo ()->name () != refName) |
250 if (static_cast<LDSubfile*> (obj)->fileInfo()->name() != refName) |
251 return; |
251 return; |
252 } |
252 } |
253 |
253 |
254 g_win->sel ().clear (); |
254 g_win->sel().clear(); |
255 for (LDObject* obj : g_curfile->objs ()) { |
255 for (LDObject* obj : g_curfile->objs()) { |
256 if (obj->getType() != type) |
256 if (obj->getType() != type) |
257 continue; |
257 continue; |
258 |
258 |
259 if (type == LDObject::Subfile && static_cast<LDSubfile*> (obj)->fileInfo ()->name () != refName) |
259 if (type == LDObject::Subfile && static_cast<LDSubfile*> (obj)->fileInfo()->name() != refName) |
260 continue; |
260 continue; |
261 |
261 |
262 g_win->sel () << obj; |
262 g_win->sel() << obj; |
263 } |
263 } |
264 |
264 |
265 g_win->updateSelection (); |
265 g_win->updateSelection(); |
266 } |
266 } |
267 |
267 |
268 // ============================================================================= |
268 // ============================================================================= |
269 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
269 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
270 // ============================================================================= |
270 // ============================================================================= |
271 MAKE_ACTION (gridCoarse, "Coarse Grid", "grid-coarse", "Set the grid to Coarse", (0)) { |
271 MAKE_ACTION (gridCoarse, "Coarse Grid", "grid-coarse", "Set the grid to Coarse", (0)) { |
272 grid = Grid::Coarse; |
272 grid = Grid::Coarse; |
273 g_win->updateGridToolBar (); |
273 g_win->updateGridToolBar(); |
274 } |
274 } |
275 |
275 |
276 MAKE_ACTION (gridMedium, "Medium Grid", "grid-medium", "Set the grid to Medium", (0)) { |
276 MAKE_ACTION (gridMedium, "Medium Grid", "grid-medium", "Set the grid to Medium", (0)) { |
277 grid = Grid::Medium; |
277 grid = Grid::Medium; |
278 g_win->updateGridToolBar (); |
278 g_win->updateGridToolBar(); |
279 } |
279 } |
280 |
280 |
281 MAKE_ACTION (gridFine, "Fine Grid", "grid-fine", "Set the grid to Fine", (0)) { |
281 MAKE_ACTION (gridFine, "Fine Grid", "grid-fine", "Set the grid to Fine", (0)) { |
282 grid = Grid::Fine; |
282 grid = Grid::Fine; |
283 g_win->updateGridToolBar (); |
283 g_win->updateGridToolBar(); |
284 } |
284 } |
285 |
285 |
286 // ============================================================================= |
286 // ============================================================================= |
287 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
287 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
288 // ============================================================================= |
288 // ============================================================================= |
289 MAKE_ACTION (resetView, "Reset View", "reset-view", "Reset view angles, pan and zoom", CTRL (0)) { |
289 MAKE_ACTION (resetView, "Reset View", "reset-view", "Reset view angles, pan and zoom", CTRL (0)) { |
290 g_win->R ()->resetAngles (); |
290 g_win->R()->resetAngles(); |
291 g_win->R ()->update (); |
291 g_win->R()->update(); |
292 } |
292 } |
293 |
293 |
294 // ============================================================================= |
294 // ============================================================================= |
295 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
295 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
296 // ============================================================================= |
296 // ============================================================================= |
297 MAKE_ACTION (insertFrom, "Insert from File", "file-import", "Insert LDraw data from a file.", (0)) { |
297 MAKE_ACTION (insertFrom, "Insert from File", "file-import", "Insert LDraw data from a file.", (0)) { |
298 str fname = QFileDialog::getOpenFileName (); |
298 str fname = QFileDialog::getOpenFileName(); |
299 ulong idx = g_win->getInsertionPoint (); |
299 ulong idx = g_win->getInsertionPoint(); |
300 |
300 |
301 if (!fname.length ()) |
301 if (!fname.length()) |
302 return; |
302 return; |
303 |
303 |
304 File f (fname, File::Read); |
304 File f (fname, File::Read); |
305 if (!f) { |
305 if (!f) { |
306 critical (fmt ("Couldn't open %1 (%2)", fname, strerror (errno))); |
306 critical (fmt ("Couldn't open %1 (%2)", fname, strerror (errno))); |
307 return; |
307 return; |
308 } |
308 } |
309 |
309 |
310 vector<LDObject*> objs = loadFileContents (&f, null); |
310 vector<LDObject*> objs = loadFileContents (&f, null); |
311 |
311 |
312 g_win->sel ().clear (); |
312 g_win->sel().clear(); |
313 |
313 |
314 for (LDObject* obj : objs) { |
314 for (LDObject* obj : objs) { |
315 g_curfile->insertObj (idx, obj); |
315 g_curfile->insertObj (idx, obj); |
316 g_win->sel () << obj; |
316 g_win->sel() << obj; |
317 |
317 |
318 idx++; |
318 idx++; |
319 } |
319 } |
320 |
320 |
321 g_win->fullRefresh (); |
321 g_win->fullRefresh(); |
322 g_win->scrollToSelection (); |
322 g_win->scrollToSelection(); |
323 } |
323 } |
324 |
324 |
325 // ============================================================================= |
325 // ============================================================================= |
326 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
326 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
327 // ============================================================================= |
327 // ============================================================================= |
328 MAKE_ACTION (exportTo, "Export To File", "file-export", "Export current selection to file", (0)) { |
328 MAKE_ACTION (exportTo, "Export To File", "file-export", "Export current selection to file", (0)) { |
329 if (g_win->sel ().size () == 0) |
329 if (g_win->sel().size() == 0) |
330 return; |
330 return; |
331 |
331 |
332 str fname = QFileDialog::getSaveFileName (); |
332 str fname = QFileDialog::getSaveFileName(); |
333 if (fname.length () == 0) |
333 if (fname.length() == 0) |
334 return; |
334 return; |
335 |
335 |
336 QFile file (fname); |
336 QFile file (fname); |
337 if (!file.open (QIODevice::WriteOnly | QIODevice::Text)) { |
337 if (!file.open (QIODevice::WriteOnly | QIODevice::Text)) { |
338 critical (fmt ("Unable to open %1 for writing (%2)", fname, strerror (errno))); |
338 critical (fmt ("Unable to open %1 for writing (%2)", fname, strerror (errno))); |
339 return; |
339 return; |
340 } |
340 } |
341 |
341 |
342 for (LDObject* obj : g_win->sel ()) { |
342 for (LDObject* obj : g_win->sel()) { |
343 str contents = obj->raw (); |
343 str contents = obj->raw(); |
344 QByteArray data = contents.toUtf8 (); |
344 QByteArray data = contents.toUtf8(); |
345 file.write (data, data.size ()); |
345 file.write (data, data.size()); |
346 file.write ("\r\n", 2); |
346 file.write ("\r\n", 2); |
347 } |
347 } |
348 } |
348 } |
349 |
349 |
350 // ============================================================================= |
350 // ============================================================================= |
351 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
351 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
352 // ============================================================================= |
352 // ============================================================================= |
353 MAKE_ACTION (insertRaw, "Insert Raw", "insert-raw", "Type in LDraw code to insert.", (0)) { |
353 MAKE_ACTION (insertRaw, "Insert Raw", "insert-raw", "Type in LDraw code to insert.", (0)) { |
354 ulong idx = g_win->getInsertionPoint (); |
354 ulong idx = g_win->getInsertionPoint(); |
355 |
355 |
356 QDialog* const dlg = new QDialog; |
356 QDialog* const dlg = new QDialog; |
357 QVBoxLayout* const layout = new QVBoxLayout; |
357 QVBoxLayout* const layout = new QVBoxLayout; |
358 QTextEdit* const te_edit = new QTextEdit; |
358 QTextEdit* const te_edit = new QTextEdit; |
359 QDialogButtonBox* const bbx_buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel); |
359 QDialogButtonBox* const bbx_buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel); |
360 |
360 |
361 layout->addWidget (te_edit); |
361 layout->addWidget (te_edit); |
362 layout->addWidget (bbx_buttons); |
362 layout->addWidget (bbx_buttons); |
363 dlg->setLayout (layout); |
363 dlg->setLayout (layout); |
364 dlg->setWindowTitle (APPNAME ": Insert Raw"); |
364 dlg->setWindowTitle (APPNAME ": Insert Raw"); |
365 dlg->connect (bbx_buttons, SIGNAL (accepted ()), dlg, SLOT (accept ())); |
365 dlg->connect (bbx_buttons, SIGNAL (accepted()), dlg, SLOT (accept())); |
366 dlg->connect (bbx_buttons, SIGNAL (rejected ()), dlg, SLOT (reject ())); |
366 dlg->connect (bbx_buttons, SIGNAL (rejected()), dlg, SLOT (reject())); |
367 |
367 |
368 if (dlg->exec () == false) |
368 if (dlg->exec() == false) |
369 return; |
369 return; |
370 |
370 |
371 g_win->sel ().clear (); |
371 g_win->sel().clear(); |
372 |
372 |
373 for (str line : str (te_edit->toPlainText ()).split ("\n")) { |
373 for (str line : str (te_edit->toPlainText()).split ("\n")) { |
374 LDObject* obj = parseLine (line); |
374 LDObject* obj = parseLine (line); |
375 |
375 |
376 g_curfile->insertObj (idx, obj); |
376 g_curfile->insertObj (idx, obj); |
377 g_win->sel () << obj; |
377 g_win->sel() << obj; |
378 idx++; |
378 idx++; |
379 } |
379 } |
380 |
380 |
381 g_win->fullRefresh (); |
381 g_win->fullRefresh(); |
382 g_win->scrollToSelection (); |
382 g_win->scrollToSelection(); |
383 } |
383 } |
384 |
384 |
385 // ========================================================================================================================================= |
385 // ========================================================================================================================================= |
386 MAKE_ACTION (screencap, "Screencap Part", "screencap", "Save a picture of the model", (0)) { |
386 MAKE_ACTION (screencap, "Screencap Part", "screencap", "Save a picture of the model", (0)) { |
387 setlocale (LC_ALL, "C"); |
387 setlocale (LC_ALL, "C"); |
388 |
388 |
389 ushort w, h; |
389 ushort w, h; |
390 uchar* imgdata = g_win->R ()->screencap (w, h); |
390 uchar* imgdata = g_win->R()->screencap (w, h); |
391 QImage img = imageFromScreencap (imgdata, w, h); |
391 QImage img = imageFromScreencap (imgdata, w, h); |
392 |
392 |
393 str root = basename (g_curfile->name ()); |
393 str root = basename (g_curfile->name()); |
394 if (root.right (4) == ".dat") |
394 if (root.right (4) == ".dat") |
395 root.chop (4); |
395 root.chop (4); |
396 |
396 |
397 str defaultname = (root.length () > 0) ? fmt ("%1.png", root) : ""; |
397 str defaultname = (root.length() > 0) ? fmt ("%1.png", root) : ""; |
398 str fname = QFileDialog::getSaveFileName (g_win, "Save Screencap", defaultname, |
398 str fname = QFileDialog::getSaveFileName (g_win, "Save Screencap", defaultname, |
399 "PNG images (*.png);;JPG images (*.jpg);;BMP images (*.bmp);;All Files (*.*)"); |
399 "PNG images (*.png);;JPG images (*.jpg);;BMP images (*.bmp);;All Files (*.*)"); |
400 |
400 |
401 if (fname.length () > 0 && !img.save (fname)) |
401 if (fname.length() > 0 && !img.save (fname)) |
402 critical (fmt ("Couldn't open %1 for writing to save screencap: %2", fname, strerror (errno))); |
402 critical (fmt ("Couldn't open %1 for writing to save screencap: %2", fname, strerror (errno))); |
403 |
403 |
404 delete[] imgdata; |
404 delete[] imgdata; |
405 } |
405 } |
406 |
406 |
407 // ========================================================================================================================================= |
407 // ========================================================================================================================================= |
408 extern_cfg (bool, gl_axes); |
408 extern_cfg (bool, gl_axes); |
409 MAKE_ACTION (axes, "Draw Axes", "axes", "Toggles drawing of axes", (0)) { |
409 MAKE_ACTION (axes, "Draw Axes", "axes", "Toggles drawing of axes", (0)) { |
410 gl_axes = !gl_axes; |
410 gl_axes = !gl_axes; |
411 ACTION (axes)->setChecked (gl_axes); |
411 ACTION (axes)->setChecked (gl_axes); |
412 g_win->R ()->update (); |
412 g_win->R()->update(); |
413 } |
413 } |
414 |
414 |
415 // ========================================================================================================================================= |
415 // ========================================================================================================================================= |
416 MAKE_ACTION (visibility, "Toggle Visibility", "visibility", "Toggles visibility/hiding on objects.", (0)) { |
416 MAKE_ACTION (visibility, "Toggle Visibility", "visibility", "Toggles visibility/hiding on objects.", (0)) { |
417 for (LDObject* obj : g_win->sel ()) |
417 for (LDObject* obj : g_win->sel()) |
418 obj->setHidden (!obj->hidden ()); |
418 obj->setHidden (!obj->hidden()); |
419 |
419 |
420 g_win->fullRefresh (); |
420 g_win->fullRefresh(); |
421 } |
421 } |
422 |
422 |
423 MAKE_ACTION (wireframe, "Wireframe", "wireframe", "Toggle wireframe view", (0)) { |
423 MAKE_ACTION (wireframe, "Wireframe", "wireframe", "Toggle wireframe view", (0)) { |
424 gl_wireframe = !gl_wireframe; |
424 gl_wireframe = !gl_wireframe; |
425 g_win->R ()->refresh (); |
425 g_win->R()->refresh(); |
426 } |
426 } |
427 |
427 |
428 MAKE_ACTION( setOverlay, "Set Overlay Image", "overlay", "Set an overlay image", 0 ) |
428 MAKE_ACTION (setOverlay, "Set Overlay Image", "overlay", "Set an overlay image", 0) |
429 { |
429 { |
430 OverlayDialog dlg; |
430 OverlayDialog dlg; |
431 |
431 |
432 if (!dlg.exec ()) |
432 if (!dlg.exec()) |
433 return; |
433 return; |
434 |
434 |
435 g_win->R ()->setupOverlay( (GL::Camera) dlg.camera(), dlg.fpath(), dlg.ofsx(), |
435 g_win->R()->setupOverlay ((GL::Camera) dlg.camera(), dlg.fpath(), dlg.ofsx(), |
436 dlg.ofsy(), dlg.lwidth(), dlg.lheight() ); |
436 dlg.ofsy(), dlg.lwidth(), dlg.lheight() ); |
437 } |
437 } |
438 |
438 |
439 MAKE_ACTION (clearOverlay, "Clear Overlay Image", "overlay-clear", "Clear the overlay image.", (0)) { |
439 MAKE_ACTION (clearOverlay, "Clear Overlay Image", "overlay-clear", "Clear the overlay image.", (0)) { |
440 g_win->R ()->clearOverlay (); |
440 g_win->R()->clearOverlay(); |
441 } |
441 } |
442 |
442 |
443 MAKE_ACTION (modeSelect, "Select Mode", "mode-select", "Select objects from the camera view.", CTRL (1)) { |
443 MAKE_ACTION (modeSelect, "Select Mode", "mode-select", "Select objects from the camera view.", CTRL (1)) { |
444 g_win->R ()->setEditMode (Select); |
444 g_win->R()->setEditMode (Select); |
445 } |
445 } |
446 |
446 |
447 MAKE_ACTION (modeDraw, "Draw Mode", "mode-draw", "Draw objects into the camera view.", CTRL (2)) { |
447 MAKE_ACTION (modeDraw, "Draw Mode", "mode-draw", "Draw objects into the camera view.", CTRL (2)) { |
448 g_win->R ()->setEditMode (Draw); |
448 g_win->R()->setEditMode (Draw); |
449 } |
449 } |
450 |
450 |
451 MAKE_ACTION (setDrawDepth, "Set Depth Value", "depth-value", "Set the depth coordinate of the current camera.", (0)) { |
451 MAKE_ACTION (setDrawDepth, "Set Depth Value", "depth-value", "Set the depth coordinate of the current camera.", (0)) { |
452 if (g_win->R ()->camera () == GL::Free) |
452 if (g_win->R()->camera() == GL::Free) |
453 return; |
453 return; |
454 |
454 |
455 bool ok; |
455 bool ok; |
456 double depth = QInputDialog::getDouble (g_win, "Set Draw Depth", |
456 double depth = QInputDialog::getDouble (g_win, "Set Draw Depth", |
457 fmt ("Depth value for %1 Camera:", g_win->R ()->cameraName ()), |
457 fmt ("Depth value for %1 Camera:", g_win->R()->cameraName()), |
458 g_win->R ()->depthValue (), -10000.0f, 10000.0f, 3, &ok); |
458 g_win->R()->depthValue(), -10000.0f, 10000.0f, 3, &ok); |
459 |
459 |
460 if (ok) |
460 if (ok) |
461 g_win->R ()->setDepthValue (depth); |
461 g_win->R()->setDepthValue (depth); |
462 } |
462 } |
463 |
463 |
464 #ifndef RELEASE |
464 #ifndef RELEASE |
465 // This is a test to draw a dummy axle. Meant to be used as a primitive gallery, |
465 // This is a test to draw a dummy axle. Meant to be used as a primitive gallery, |
466 // but I can't figure how to generate these pictures properly. Multi-threading |
466 // but I can't figure how to generate these pictures properly. Multi-threading |