349 } |
349 } |
350 |
350 |
351 // ============================================================================= |
351 // ============================================================================= |
352 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
352 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
353 // ============================================================================= |
353 // ============================================================================= |
354 NewPartDialog::NewPartDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f) { |
|
355 lb_brickIcon = new QLabel; |
|
356 lb_brickIcon->setPixmap (getIcon ("brick")); |
|
357 |
|
358 lb_name = new QLabel ("Title:"); |
|
359 le_name = new QLineEdit; |
|
360 le_name->setMinimumWidth (384); |
|
361 |
|
362 lb_author = new QLabel ("Author:"); |
|
363 le_author = new QLineEdit; |
|
364 |
|
365 rb_license = new RadioBox ("License", { |
|
366 "CCAL Redistributable", |
|
367 "Non-redistributable", |
|
368 "None", |
|
369 }, CCAL); |
|
370 |
|
371 rb_BFC = new RadioBox ("BFC Winding", { |
|
372 "CCW", |
|
373 "CW", |
|
374 "None" |
|
375 }, CCW); |
|
376 |
|
377 QHBoxLayout* boxes = new QHBoxLayout; |
|
378 boxes->addWidget (rb_license); |
|
379 boxes->addWidget (rb_BFC); |
|
380 |
|
381 QGridLayout* layout = new QGridLayout; |
|
382 layout->addWidget (lb_brickIcon, 0, 0); |
|
383 layout->addWidget (lb_name, 0, 1); |
|
384 layout->addWidget (le_name, 0, 2); |
|
385 layout->addWidget (lb_author, 1, 1); |
|
386 layout->addWidget (le_author, 1, 2); |
|
387 layout->addLayout (boxes, 2, 1, 1, 2); |
|
388 layout->addWidget (makeButtonBox (*this), 3, 2); |
|
389 |
|
390 setLayout (layout); |
|
391 setWindowTitle ("New Part"); |
|
392 } |
|
393 |
|
394 // ============================================================================= |
|
395 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
|
396 // ============================================================================= |
|
397 void NewPartDialog::StaticDialog () { |
|
398 NewPartDialog dlg (g_win); |
|
399 if (dlg.exec () == false) |
|
400 return; |
|
401 |
|
402 newFile (); |
|
403 |
|
404 short idx; |
|
405 str author = dlg.le_author->text (); |
|
406 |
|
407 idx = dlg.rb_BFC->value (); |
|
408 const LDBFC::Type BFCType = |
|
409 (idx == CCW) ? LDBFC::CertifyCCW : |
|
410 (idx == CW) ? LDBFC::CertifyCW : |
|
411 LDBFC::NoCertify; |
|
412 |
|
413 idx = dlg.rb_license->value (); |
|
414 const str license = |
|
415 (idx == CCAL) ? CALicense : |
|
416 (idx == NonCA) ? NonCALicense : |
|
417 ""; |
|
418 |
|
419 *g_curfile << new LDComment (dlg.le_name->text ()); |
|
420 *g_curfile << new LDComment ("Name: <untitled>.dat"); |
|
421 *g_curfile << new LDComment (fmt ("Author: %1", author)); |
|
422 *g_curfile << new LDComment (fmt ("!LDRAW_ORG Unofficial_Part")); |
|
423 |
|
424 if( license != "" ) |
|
425 *g_curfile << new LDComment ( license ); |
|
426 |
|
427 *g_curfile << new LDEmpty; |
|
428 *g_curfile << new LDBFC (BFCType); |
|
429 *g_curfile << new LDEmpty; |
|
430 |
|
431 g_win->fullRefresh (); |
|
432 } |
|
433 |
|
434 // ============================================================================= |
|
435 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
|
436 // ============================================================================= |
|
437 RotationPointDialog::RotationPointDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f) { |
354 RotationPointDialog::RotationPointDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f) { |
438 rb_rotpoint = new RadioBox ("Rotation Point", { "Object center", "Custom" }, 0, Qt::Vertical, this); |
355 rb_rotpoint = new RadioBox ("Rotation Point", { "Object center", "Custom" }, 0, Qt::Vertical, this); |
439 connect (rb_rotpoint, SIGNAL (valueChanged (int)), this, SLOT (radioBoxChanged ())); |
356 connect (rb_rotpoint, SIGNAL (valueChanged (int)), this, SLOT (radioBoxChanged ())); |
440 |
357 |
441 gb_customPos = new QGroupBox ("Custom point", this); |
358 gb_customPos = new QGroupBox ("Custom point", this); |