# HG changeset patch # User Santeri Piippo # Date 1372718563 -10800 # Node ID cb0c23f35e2b900e47f2a49ef7ed52640655f6c8 # Parent fd3711a5457a3b49ca601df8905f57f086b76f47 UI-ified the new part prompt diff -r fd3711a5457a -r cb0c23f35e2b changelog.txt --- a/changelog.txt Tue Jul 02 00:31:40 2013 +0300 +++ b/changelog.txt Tue Jul 02 01:42:43 2013 +0300 @@ -5,7 +5,6 @@ - Completely rewrote history (undo/redo) code, making it a LOT stabler in the process. - Added ability to snap to pre-existing vertices while drawing. - Replaced the radial type with a single action to generate primitives. -- When drawing, drawn vertices now display coordinate labels. - Replaced parts list in subfile item list with a primitive listing. Listing is generated either if it's not cached (prims.cfg in configuration directory) or on user demand. Primitives can be categorised with the use of a regex-based configuration file, with a valid default which should cater to most users. @@ -13,6 +12,7 @@ - Parts are now zoomed to fit properly, making the initial view of the part clearer. - Replace coords: allow replacing all coords regardless of original value, plus relative moving (offset) - Objects can now be edited by double-clicking on them. +- When drawing, drawn vertices now display coordinate labels. - Changed default keys for Y-axis moving from PgUp/PgDown to Home and End ala MLCAD. - [Linux] External programs can now be launched with Wine. - Improved external program fault handling: don't try to replace/append the output in case of failure, catch non-zero exit codes. diff -r fd3711a5457a -r cb0c23f35e2b src/dialogs.cpp --- a/src/dialogs.cpp Tue Jul 02 00:31:40 2013 +0300 +++ b/src/dialogs.cpp Tue Jul 02 01:42:43 2013 +0300 @@ -351,89 +351,6 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -NewPartDialog::NewPartDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f) { - lb_brickIcon = new QLabel; - lb_brickIcon->setPixmap (getIcon ("brick")); - - lb_name = new QLabel ("Title:"); - le_name = new QLineEdit; - le_name->setMinimumWidth (384); - - lb_author = new QLabel ("Author:"); - le_author = new QLineEdit; - - rb_license = new RadioBox ("License", { - "CCAL Redistributable", - "Non-redistributable", - "None", - }, CCAL); - - rb_BFC = new RadioBox ("BFC Winding", { - "CCW", - "CW", - "None" - }, CCW); - - QHBoxLayout* boxes = new QHBoxLayout; - boxes->addWidget (rb_license); - boxes->addWidget (rb_BFC); - - QGridLayout* layout = new QGridLayout; - layout->addWidget (lb_brickIcon, 0, 0); - layout->addWidget (lb_name, 0, 1); - layout->addWidget (le_name, 0, 2); - layout->addWidget (lb_author, 1, 1); - layout->addWidget (le_author, 1, 2); - layout->addLayout (boxes, 2, 1, 1, 2); - layout->addWidget (makeButtonBox (*this), 3, 2); - - setLayout (layout); - setWindowTitle ("New Part"); -} - -// ============================================================================= -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -// ============================================================================= -void NewPartDialog::StaticDialog () { - NewPartDialog dlg (g_win); - if (dlg.exec () == false) - return; - - newFile (); - - short idx; - str author = dlg.le_author->text (); - - idx = dlg.rb_BFC->value (); - const LDBFC::Type BFCType = - (idx == CCW) ? LDBFC::CertifyCCW : - (idx == CW) ? LDBFC::CertifyCW : - LDBFC::NoCertify; - - idx = dlg.rb_license->value (); - const str license = - (idx == CCAL) ? CALicense : - (idx == NonCA) ? NonCALicense : - ""; - - *g_curfile << new LDComment (dlg.le_name->text ()); - *g_curfile << new LDComment ("Name: .dat"); - *g_curfile << new LDComment (fmt ("Author: %1", author)); - *g_curfile << new LDComment (fmt ("!LDRAW_ORG Unofficial_Part")); - - if( license != "" ) - *g_curfile << new LDComment ( license ); - - *g_curfile << new LDEmpty; - *g_curfile << new LDBFC (BFCType); - *g_curfile << new LDEmpty; - - g_win->fullRefresh (); -} - -// ============================================================================= -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -// ============================================================================= RotationPointDialog::RotationPointDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f) { rb_rotpoint = new RadioBox ("Rotation Point", { "Object center", "Custom" }, 0, Qt::Vertical, this); connect (rb_rotpoint, SIGNAL (valueChanged (int)), this, SLOT (radioBoxChanged ())); diff -r fd3711a5457a -r cb0c23f35e2b src/dialogs.h --- a/src/dialogs.h Tue Jul 02 00:31:40 2013 +0300 +++ b/src/dialogs.h Tue Jul 02 01:42:43 2013 +0300 @@ -131,20 +131,6 @@ }; // ============================================================================= -class NewPartDialog : public QDialog { -public: - enum { CCAL, NonCA, NoLicense }; - enum { CCW, CW, NoWinding }; - - explicit NewPartDialog (QWidget* parent = null, Qt::WindowFlags f = 0); - static void StaticDialog (); - - QLabel* lb_brickIcon, *lb_name, *lb_author, *lb_license, *lb_BFC; - QLineEdit* le_name, *le_author; - RadioBox* rb_license, *rb_BFC; -}; - -// ============================================================================= class RotationPointDialog : public QDialog { Q_OBJECT diff -r fd3711a5457a -r cb0c23f35e2b src/gui_actions.cpp --- a/src/gui_actions.cpp Tue Jul 02 00:31:40 2013 +0300 +++ b/src/gui_actions.cpp Tue Jul 02 01:42:43 2013 +0300 @@ -34,6 +34,7 @@ #include "gldraw.h" #include "dialogs.h" #include "primitives.h" +#include "ui_newpart.h" extern_cfg (bool, gl_wireframe); @@ -44,7 +45,38 @@ if (safeToCloseAll () == false) return; - NewPartDialog::StaticDialog (); + QDialog* dlg = new QDialog( g_win ); + Ui::NewPartUI ui; + ui.setupUi( dlg ); + + if (dlg->exec () == false) + return; + + newFile (); + + const LDBFC::Type BFCType = + ui.rb_bfc_ccw->isChecked() ? LDBFC::CertifyCCW : + ui.rb_bfc_cw->isChecked() ? LDBFC::CertifyCW : + LDBFC::NoCertify; + + const str license = + ui.rb_license_ca->isChecked() ? CALicense : + ui.rb_license_nonca->isChecked() ? NonCALicense : + ""; + + *g_curfile << new LDComment( ui.le_title->text() ); + *g_curfile << new LDComment( "Name: .dat" ); + *g_curfile << new LDComment( fmt( "Author: %1", ui.le_author->text() )); + *g_curfile << new LDComment( fmt( "!LDRAW_ORG Unofficial_Part" )); + + if( license != "" ) + *g_curfile << new LDComment( license ); + + *g_curfile << new LDEmpty; + *g_curfile << new LDBFC( BFCType ); + *g_curfile << new LDEmpty; + + g_win->fullRefresh(); } // ============================================================================= diff -r fd3711a5457a -r cb0c23f35e2b src/ui/makeprim.ui --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ui/makeprim.ui Tue Jul 02 01:42:43 2013 +0300 @@ -0,0 +1,309 @@ + + + MakePrimUI + + + + 0 + 0 + 336 + 147 + + + + Generate a Primitive + + + + + + + + + + + 0 + 0 + + + + Type + + + + + + Circle + + + true + + + false + + + + + + + Cylinder + + + + + + + Disc + + + + + + + Disc Negative + + + + + + + Ring + + + + + + + Cone + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Hi-res + + + + + + + + + Segments: + + + + + + + Ring number: + + + + + + + 1 + + + 16 + + + 16 + + + + + + + false + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + MakePrimUI + accept() + + + 254 + 140 + + + 157 + 146 + + + + + buttonBox + rejected() + MakePrimUI + reject() + + + 322 + 140 + + + 286 + 146 + + + + + rb_circle + clicked(bool) + sb_ringnum + setDisabled(bool) + + + 45 + 41 + + + 305 + 86 + + + + + rb_cylinder + clicked(bool) + sb_ringnum + setDisabled(bool) + + + 109 + 42 + + + 287 + 86 + + + + + rb_disc + clicked(bool) + sb_ringnum + setDisabled(bool) + + + 49 + 66 + + + 287 + 87 + + + + + rb_ndisc + clicked(bool) + sb_ringnum + setDisabled(bool) + + + 121 + 58 + + + 288 + 83 + + + + + rb_ring + clicked(bool) + sb_ringnum + setEnabled(bool) + + + 45 + 90 + + + 301 + 86 + + + + + rb_cone + clicked(bool) + sb_ringnum + setEnabled(bool) + + + 111 + 89 + + + 302 + 85 + + + + + + enableRingNumber() + + diff -r fd3711a5457a -r cb0c23f35e2b src/ui/newpart.ui --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ui/newpart.ui Tue Jul 02 01:42:43 2013 +0300 @@ -0,0 +1,191 @@ + + + NewPartUI + + + + 0 + 0 + 491 + 203 + + + + New Part + + + + + + + + + + + + + :/icons/brick.png + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + Title: + + + + + + + Author: + + + + + + + + + + + + + + + + + + + License + + + + + + CCAL Redistributable + + + true + + + + + + + Non-redistributable + + + + + + + None + + + + + + + + + + BFC winding + + + + + + CCW + + + true + + + + + + + CW + + + + + + + None + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + + buttonBox + accepted() + NewPartUI + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + NewPartUI + reject() + + + 316 + 260 + + + 286 + 274 + + + + +