src/gui_actions.cpp

changeset 315
cb0c23f35e2b
parent 310
c62edce5668c
child 317
e41ab239ed28
equal deleted inserted replaced
314:fd3711a5457a 315:cb0c23f35e2b
32 #include "aboutDialog.h" 32 #include "aboutDialog.h"
33 #include "misc.h" 33 #include "misc.h"
34 #include "gldraw.h" 34 #include "gldraw.h"
35 #include "dialogs.h" 35 #include "dialogs.h"
36 #include "primitives.h" 36 #include "primitives.h"
37 #include "ui_newpart.h"
37 38
38 extern_cfg (bool, gl_wireframe); 39 extern_cfg (bool, gl_wireframe);
39 40
40 // ============================================================================= 41 // =============================================================================
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
42 // ============================================================================= 43 // =============================================================================
43 MAKE_ACTION (newFile, "&New", "brick", "Create a new part model.", CTRL (N)) { 44 MAKE_ACTION (newFile, "&New", "brick", "Create a new part model.", CTRL (N)) {
44 if (safeToCloseAll () == false) 45 if (safeToCloseAll () == false)
45 return; 46 return;
46 47
47 NewPartDialog::StaticDialog (); 48 QDialog* dlg = new QDialog( g_win );
49 Ui::NewPartUI ui;
50 ui.setupUi( dlg );
51
52 if (dlg->exec () == false)
53 return;
54
55 newFile ();
56
57 const LDBFC::Type BFCType =
58 ui.rb_bfc_ccw->isChecked() ? LDBFC::CertifyCCW :
59 ui.rb_bfc_cw->isChecked() ? LDBFC::CertifyCW :
60 LDBFC::NoCertify;
61
62 const str license =
63 ui.rb_license_ca->isChecked() ? CALicense :
64 ui.rb_license_nonca->isChecked() ? NonCALicense :
65 "";
66
67 *g_curfile << new LDComment( ui.le_title->text() );
68 *g_curfile << new LDComment( "Name: <untitled>.dat" );
69 *g_curfile << new LDComment( fmt( "Author: %1", ui.le_author->text() ));
70 *g_curfile << new LDComment( fmt( "!LDRAW_ORG Unofficial_Part" ));
71
72 if( license != "" )
73 *g_curfile << new LDComment( license );
74
75 *g_curfile << new LDEmpty;
76 *g_curfile << new LDBFC( BFCType );
77 *g_curfile << new LDEmpty;
78
79 g_win->fullRefresh();
48 } 80 }
49 81
50 // ============================================================================= 82 // =============================================================================
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 83 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
52 // ============================================================================= 84 // =============================================================================

mercurial