src/gui_actions.cpp

changeset 377
271d1da66b7e
parent 376
4a89dd47535f
child 379
f5f3faac60cd
equal deleted inserted replaced
376:4a89dd47535f 377:271d1da66b7e
54 if (dlg->exec() == false) 54 if (dlg->exec() == false)
55 return; 55 return;
56 56
57 newFile(); 57 newFile();
58 58
59 const LDBFC::Type BFCType = 59 const LDBFCObject::Type BFCType =
60 ui.rb_bfc_ccw->isChecked() ? LDBFC::CertifyCCW : 60 ui.rb_bfc_ccw->isChecked() ? LDBFCObject::CertifyCCW :
61 ui.rb_bfc_cw->isChecked() ? LDBFC::CertifyCW : 61 ui.rb_bfc_cw->isChecked() ? LDBFCObject::CertifyCW :
62 LDBFC::NoCertify; 62 LDBFCObject::NoCertify;
63 63
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 LDCommentObject (ui.le_title->text());
70 *g_curfile << new LDComment ("Name: <untitled>.dat" ); 70 *g_curfile << new LDCommentObject ("Name: <untitled>.dat" );
71 *g_curfile << new LDComment (fmt ("Author: %1", ui.le_author->text())); 71 *g_curfile << new LDCommentObject (fmt ("Author: %1", ui.le_author->text()));
72 *g_curfile << new LDComment (fmt ("!LDRAW_ORG Unofficial_Part")); 72 *g_curfile << new LDCommentObject (fmt ("!LDRAW_ORG Unofficial_Part"));
73 73
74 if (license != "") 74 if (license != "")
75 *g_curfile << new LDComment (license); 75 *g_curfile << new LDCommentObject (license);
76 76
77 *g_curfile << new LDEmpty; 77 *g_curfile << new LDEmptyObject;
78 *g_curfile << new LDBFC (BFCType); 78 *g_curfile << new LDBFCObject (BFCType);
79 *g_curfile << new LDEmpty; 79 *g_curfile << new LDEmptyObject;
80 80
81 g_win->fullRefresh(); 81 g_win->fullRefresh();
82 } 82 }
83 83
84 // ============================================================================= 84 // =============================================================================
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<LDSubfileObject*> (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<LDSubfileObject*> (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<LDSubfileObject*> (obj)->fileInfo()->name() != refName)
260 continue; 260 continue;
261 261
262 g_win->sel() << obj; 262 g_win->sel() << obj;
263 } 263 }
264 264

mercurial