src/gui_actions.cpp

changeset 193
ce8e25ccbaf6
parent 192
c414924a647c
child 195
7a776f6b0d2a
equal deleted inserted replaced
192:c414924a647c 193:ce8e25ccbaf6
26 #include "addObjectDialog.h" 26 #include "addObjectDialog.h"
27 #include "aboutDialog.h" 27 #include "aboutDialog.h"
28 #include "misc.h" 28 #include "misc.h"
29 #include "ldrawPathDialog.h" 29 #include "ldrawPathDialog.h"
30 30
31 extern_cfg (bool, gl_wireframe);
32
31 // ============================================================================= 33 // =============================================================================
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
33 // ============================================================================= 35 // =============================================================================
34 MAKE_ACTION (newFile, "&New", "brick", "Create a new part model.", CTRL (N)) { 36 MAKE_ACTION (newFile, "&New", "brick", "Create a new part model.", CTRL (N)) {
35 NewPartDialog::StaticDialog (); 37 NewPartDialog::StaticDialog ();
357 g_win->fullRefresh (); 359 g_win->fullRefresh ();
358 g_win->scrollToSelection (); 360 g_win->scrollToSelection ();
359 } 361 }
360 } 362 }
361 363
362 // ============================================================================= 364 // =========================================================================================================================================
363 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
364 // =============================================================================
365 MAKE_ACTION (screencap, "Screencap Part", "screencap", "Save a picture of the model", (0)) { 365 MAKE_ACTION (screencap, "Screencap Part", "screencap", "Save a picture of the model", (0)) {
366 setlocale (LC_ALL, "C"); 366 setlocale (LC_ALL, "C");
367 367
368 ushort w, h; 368 ushort w, h;
369 uchar* imagedata = g_win->R ()->screencap (w, h); 369 uchar* imagedata = g_win->R ()->screencap (w, h);
383 critical (fmt ("Couldn't open %s for writing to save screencap: %s", fname.chars(), strerror (errno))); 383 critical (fmt ("Couldn't open %s for writing to save screencap: %s", fname.chars(), strerror (errno)));
384 384
385 delete[] imagedata; 385 delete[] imagedata;
386 } 386 }
387 387
388 // ============================================================================= 388 // =========================================================================================================================================
389 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
390 // =============================================================================
391 extern_cfg (bool, gl_axes); 389 extern_cfg (bool, gl_axes);
392 MAKE_ACTION (axes, "Draw Axes", "axes", "Toggles drawing of axes", (0)) { 390 MAKE_ACTION (axes, "Draw Axes", "axes", "Toggles drawing of axes", (0)) {
393 gl_axes = !gl_axes; 391 gl_axes = !gl_axes;
394 ACTION (axes)->setChecked (gl_axes); 392 ACTION (axes)->setChecked (gl_axes);
395 g_win->R ()->update (); 393 g_win->R ()->update ();
396 } 394 }
397 395
398 // ============================================================================= 396 // =========================================================================================================================================
399 MAKE_ACTION (beginDraw, "Begin Drawing", "draw", "Begin drawing geometry", KEY (Insert)) { 397 MAKE_ACTION (beginDraw, "Begin Drawing", "draw", "Begin drawing geometry", KEY (Insert)) {
400 g_win->R ()->beginPlaneDraw (); 398 g_win->R ()->beginPlaneDraw ();
401 } 399 }
402 400
403 MAKE_ACTION (cancelDraw, "Cancel Drawing", "draw-cancel", "Cancel drawing geometry", KEY (Escape)) { 401 MAKE_ACTION (cancelDraw, "Cancel Drawing", "draw-cancel", "Cancel drawing geometry", KEY (Escape)) {
406 404
407 MAKE_ACTION (doneDraw, "Done Drawing", "draw-done", "Done drawing geometry", KEY (Enter)) { 405 MAKE_ACTION (doneDraw, "Done Drawing", "draw-done", "Done drawing geometry", KEY (Enter)) {
408 g_win->R ()->endPlaneDraw (true); 406 g_win->R ()->endPlaneDraw (true);
409 } 407 }
410 408
411 // ============================================================================= 409 // =========================================================================================================================================
412 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
413 // =============================================================================
414 MAKE_ACTION (visibility, "Toggle Visibility", "visibility", "Toggles visibility/hiding on objects.", (0)) { 410 MAKE_ACTION (visibility, "Toggle Visibility", "visibility", "Toggles visibility/hiding on objects.", (0)) {
415 for (LDObject* obj : g_win->sel ()) 411 for (LDObject* obj : g_win->sel ())
416 obj->setHidden (!obj->hidden ()); 412 obj->setHidden (!obj->hidden ());
417 413
418 g_win->fullRefresh (); 414 g_win->fullRefresh ();
419 } 415 }
416
417 // =========================================================================================================================================
418 MAKE_ACTION (wireframe, "Toggle Wireframe", "wireframe", "Toggle wireframe view", (0)) {
419 gl_wireframe = !gl_wireframe;
420 g_win->R ()->refresh ();
421 }

mercurial