Merged new part and LDraw path dialogs into dialogs.cpp

Tue, 14 May 2013 04:03:52 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Tue, 14 May 2013 04:03:52 +0300
changeset 200
5583af82087e
parent 199
10dd5909a50e
child 201
4d620d819f4f

Merged new part and LDraw path dialogs into dialogs.cpp

src/aboutDialog.cpp file | annotate | diff | comparison | revisions
src/aboutDialog.h file | annotate | diff | comparison | revisions
src/dialogs.cpp file | annotate | diff | comparison | revisions
src/dialogs.h file | annotate | diff | comparison | revisions
src/file.cpp file | annotate | diff | comparison | revisions
src/gldraw.cpp file | annotate | diff | comparison | revisions
src/gui_actions.cpp file | annotate | diff | comparison | revisions
src/ldrawPathDialog.cpp file | annotate | diff | comparison | revisions
src/ldrawPathDialog.h file | annotate | diff | comparison | revisions
src/newPartDialog.cpp file | annotate | diff | comparison | revisions
src/newPartDialog.h file | annotate | diff | comparison | revisions
--- a/src/aboutDialog.cpp	Tue May 14 03:49:15 2013 +0300
+++ b/src/aboutDialog.cpp	Tue May 14 04:03:52 2013 +0300
@@ -16,13 +16,13 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <qlabel.h>
-#include <qboxlayout.h>
-#include <qdialogbuttonbox.h>
-#include <qdesktopservices.h>
-#include <qpushbutton.h>
+#include <QLabel>
+#include <QBoxLayout>
+#include <QDialogButtonBox>
+#include <QDesktopServices>
+#include <QPushButton>
 #include <QTextEdit>
-#include <qurl.h>
+#include <QUrl>
 #include "common.h"
 #include "aboutDialog.h"
 
--- a/src/aboutDialog.h	Tue May 14 03:49:15 2013 +0300
+++ b/src/aboutDialog.h	Tue May 14 04:03:52 2013 +0300
@@ -19,14 +19,14 @@
 #ifndef ZZ_ABOUTDIALOG_H
 #define ZZ_ABOUTDIALOG_H
 
-#include <qdialog.h>
+#include <QDialog>
 #include "gui.h"
 
 class AboutDialog : public QDialog {
 	Q_OBJECT
 	
 public:
-	AboutDialog (QWidget* parent = nullptr, Qt::WindowFlags f = 0);
+	AboutDialog (QWidget* parent = null, Qt::WindowFlags f = 0);
 	QPushButton* pb_mailAuthor;
 	
 private slots:
--- a/src/dialogs.cpp	Tue May 14 03:49:15 2013 +0300
+++ b/src/dialogs.cpp	Tue May 14 04:03:52 2013 +0300
@@ -30,8 +30,11 @@
 #include "gldraw.h"
 #include "docs.h"
 #include "checkboxgroup.h"
+#include "file.h"
 #include "dialogs.h"
 
+extern_cfg (str, io_ldpath);
+
 // =============================================================================
 OverlayDialog::OverlayDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f) {
 	rb_camera = new RadioBox ("Camera", {}, 0, Qt::Horizontal, this);
@@ -231,4 +234,189 @@
 
 str SetContentsDialog::text () const {
 	return le_contents->text ();
+}
+
+// ========================================================================================================================================
+LDrawPathDialog::LDrawPathDialog (const bool validDefault, QWidget* parent, Qt::WindowFlags f)
+	: QDialog (parent, f), m_validDefault (validDefault)
+{
+	QLabel* lb_description = null;
+	lb_resolution = new QLabel ("---");
+	
+	if (validDefault == false)
+		lb_description = new QLabel ("Please input your LDraw directory");
+	
+	QLabel* lb_path = new QLabel ("LDraw path:");
+	le_path = new QLineEdit;
+	btn_findPath = new QPushButton;
+	btn_findPath->setIcon (getIcon ("folder"));
+	
+	btn_tryConfigure = new QPushButton ("Configure");
+	btn_tryConfigure->setIcon (getIcon ("settings"));
+	
+	btn_cancel = new QPushButton;
+	
+	if (validDefault == false) {
+		btn_cancel->setText ("Exit");
+		btn_cancel->setIcon (getIcon ("exit"));
+	} else {
+		btn_cancel->setText ("Cancel");
+		btn_cancel->setIcon (getIcon ("cancel"));
+	}
+	
+	dbb_buttons = new QDialogButtonBox (QDialogButtonBox::Ok);
+	dbb_buttons->addButton (btn_tryConfigure, QDialogButtonBox::ActionRole);
+	dbb_buttons->addButton (btn_cancel, QDialogButtonBox::RejectRole);
+	okButton ()->setEnabled (false);
+	
+	QHBoxLayout* inputLayout = new QHBoxLayout;
+	inputLayout->addWidget (lb_path);
+	inputLayout->addWidget (le_path);
+	inputLayout->addWidget (btn_findPath);
+	
+	QVBoxLayout* mainLayout = new QVBoxLayout;
+	
+	if (validDefault == false)
+		mainLayout->addWidget (lb_description);
+	
+	mainLayout->addLayout (inputLayout);
+	mainLayout->addWidget (lb_resolution);
+	mainLayout->addWidget (dbb_buttons);
+	setLayout (mainLayout);
+	
+	connect (le_path, SIGNAL (textEdited ()), this, SLOT (slot_tryConfigure ()));
+	connect (btn_findPath, SIGNAL (clicked ()), this, SLOT (slot_findPath ()));
+	connect (btn_tryConfigure, SIGNAL (clicked ()), this, SLOT (slot_tryConfigure ()));
+	connect (dbb_buttons, SIGNAL (accepted ()), this, SLOT (accept ()));
+	connect (dbb_buttons, SIGNAL (rejected ()), this, (validDefault) ? SLOT (reject ()) : SLOT (slot_exit ()));
+	
+	setPath (io_ldpath);
+	if (validDefault)
+		slot_tryConfigure ();
+}
+
+// ========================================================================================================================================
+QPushButton* LDrawPathDialog::okButton () {
+	return dbb_buttons->button (QDialogButtonBox::Ok);
+}
+
+// ========================================================================================================================================
+void LDrawPathDialog::setPath (str path) {
+	le_path->setText (path);
+}
+
+// ========================================================================================================================================
+str LDrawPathDialog::path () const {
+	return le_path->text ();
+}
+
+// ========================================================================================================================================
+void LDrawPathDialog::slot_findPath () {
+	str newpath = QFileDialog::getExistingDirectory (this, "Find LDraw Path");
+	
+	if (~newpath > 0 && newpath != path ()) {
+		setPath (newpath);
+		slot_tryConfigure ();
+	}
+}
+
+
+// ========================================================================================================================================
+void LDrawPathDialog::slot_exit () {
+	exit (1);
+}
+
+// ========================================================================================================================================
+void LDrawPathDialog::slot_tryConfigure () {
+	if (LDPaths::tryConfigure (path ()) == false) {
+		lb_resolution->setText (fmt ("<span style=\"color:red; font-weight: bold;\">%s</span>", LDPaths::getError().chars ()));
+		okButton ()->setEnabled (false);
+		return;
+	}
+	
+	lb_resolution->setText ("<span style=\"color: #7A0; font-weight: bold;\">OK!</span>");
+	okButton ()->setEnabled (true);
+}
+
+// =============================================================================
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+// =============================================================================
+NewPartDialog::NewPartDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f) {
+	lb_brickIcon = new QLabel;
+	lb_brickIcon->setPixmap (getIcon ("brick"));
+	
+	lb_name = new QLabel ("Name:");
+	le_name = new QLineEdit;
+	le_name->setMinimumWidth (320);
+	
+	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 ()) {
+		newFile ();
+		
+		short idx;
+		str author = dlg.le_author->text ();
+		vector<LDObject*>& objs = g_curfile->m_objs;
+		
+		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 char* license =
+			(idx == CCAL) ? "Redistributable under CCAL version 2.0 : see CAreadme.txt" :
+			(idx == NonCA) ? "Not redistributable : see NonCAreadme.txt" :
+			null;
+		
+		objs.push_back (new LDComment (dlg.le_name->text ()));
+		objs.push_back (new LDComment ("Name: <untitled>.dat"));
+		objs.push_back (new LDComment (fmt ("Author: %s", author.chars())));
+		objs.push_back (new LDComment (fmt ("!LDRAW_ORG Unofficial_Part")));
+		
+		if (license != null)
+			objs.push_back (new LDComment (fmt ("!LICENSE %s", license)));
+		
+		objs.push_back (new LDEmpty);
+		objs.push_back (new LDBFC (BFCType));
+		objs.push_back (new LDEmpty);
+		
+		g_win->fullRefresh ();
+	}
 }
\ No newline at end of file
--- a/src/dialogs.h	Tue May 14 03:49:15 2013 +0300
+++ b/src/dialogs.h	Tue May 14 04:03:52 2013 +0300
@@ -74,4 +74,42 @@
 	QLineEdit* le_contents;
 };
 
+class LDrawPathDialog : public QDialog {
+	Q_OBJECT
+	
+public:
+	explicit LDrawPathDialog (const bool validDefault, QWidget* parent = null, Qt::WindowFlags f = 0);
+	str path () const;
+	void setPath (str path);
+	
+private:
+	Q_DISABLE_COPY (LDrawPathDialog)
+	
+	QLabel* lb_resolution;
+	QLineEdit* le_path;
+	QPushButton* btn_findPath, *btn_tryConfigure, *btn_cancel;
+	QDialogButtonBox* dbb_buttons;
+	const bool m_validDefault;
+	
+	QPushButton* okButton ();
+	
+private slots:
+	void slot_findPath ();
+	void slot_tryConfigure ();
+	void slot_exit ();
+};
+
+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;
+};
+
 #endif // DIALOGS_H
\ No newline at end of file
--- a/src/file.cpp	Tue May 14 03:49:15 2013 +0300
+++ b/src/file.cpp	Tue May 14 04:03:52 2013 +0300
@@ -25,7 +25,7 @@
 #include "bbox.h"
 #include "gui.h"
 #include "history.h"
-#include "ldrawPathDialog.h"
+#include "dialogs.h"
 #include "gldraw.h"
 
 cfg (str, io_ldpath, "");
--- a/src/gldraw.cpp	Tue May 14 03:49:15 2013 +0300
+++ b/src/gldraw.cpp	Tue May 14 04:03:52 2013 +0300
@@ -17,7 +17,9 @@
  */
 
 #include <QGLWidget>
-#include <qevent.h>
+#include <QWheelEvent>
+#include <QMouseEvent>
+#include <QContextMenuEvent>
 #include <GL/glu.h>
 
 #include "common.h"
--- a/src/gui_actions.cpp	Tue May 14 03:49:15 2013 +0300
+++ b/src/gui_actions.cpp	Tue May 14 04:03:52 2013 +0300
@@ -24,13 +24,12 @@
 #include "gui.h"
 #include "file.h"
 #include "history.h"
-#include "newPartDialog.h"
 #include "configDialog.h"
 #include "addObjectDialog.h"
 #include "aboutDialog.h"
 #include "misc.h"
-#include "ldrawPathDialog.h"
 #include "gldraw.h"
+#include "dialogs.h"
 
 extern_cfg (bool, gl_wireframe);
 
@@ -45,12 +44,10 @@
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
 MAKE_ACTION (open, "&Open", "file-open", "Load a part model from a file.", CTRL (O)) {
-	str zName;
-	zName += QFileDialog::getOpenFileName (g_win, "Open File",
-		"", "LDraw files (*.dat *.ldr)");
+	str name = QFileDialog::getOpenFileName (g_win, "Open File", "", "LDraw files (*.dat *.ldr)");
 	
-	if (~zName)
-		openMainFile (zName);
+	if (~name)
+		openMainFile (name);
 }
 
 // =============================================================================
--- a/src/ldrawPathDialog.cpp	Tue May 14 03:49:15 2013 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-/*
- *  LDForge: LDraw parts authoring CAD
- *  Copyright (C) 2013 Santeri Piippo
- *  
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *  
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *  
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <QLineEdit>
-#include <QPushButton>
-#include <QDialogButtonBox>
-#include <QFileDialog>
-#include <QBoxLayout>
-#include <QLabel>
-#include "ldrawPathDialog.h"
-#include "gui.h"
-#include "file.h"
-
-extern_cfg (str, io_ldpath);
-
-// ========================================================================================================================================
-LDrawPathDialog::LDrawPathDialog (const bool validDefault, QWidget* parent, Qt::WindowFlags f)
-	: QDialog (parent, f), m_validDefault (validDefault)
-{
-	QLabel* lb_description = null;
-	lb_resolution = new QLabel ("---");
-	
-	if (validDefault == false)
-		lb_description = new QLabel ("Please input your LDraw directory");
-	
-	QLabel* lb_path = new QLabel ("LDraw path:");
-	le_path = new QLineEdit;
-	btn_findPath = new QPushButton;
-	btn_findPath->setIcon (getIcon ("folder"));
-	
-	btn_tryConfigure = new QPushButton ("Configure");
-	btn_tryConfigure->setIcon (getIcon ("settings"));
-	
-	btn_cancel = new QPushButton;
-	
-	if (validDefault == false) {
-		btn_cancel->setText ("Exit");
-		btn_cancel->setIcon (getIcon ("exit"));
-	} else {
-		btn_cancel->setText ("Cancel");
-		btn_cancel->setIcon (getIcon ("cancel"));
-	}
-	
-	dbb_buttons = new QDialogButtonBox (QDialogButtonBox::Ok);
-	dbb_buttons->addButton (btn_tryConfigure, QDialogButtonBox::ActionRole);
-	dbb_buttons->addButton (btn_cancel, QDialogButtonBox::RejectRole);
-	okButton ()->setEnabled (false);
-	
-	QHBoxLayout* inputLayout = new QHBoxLayout;
-	inputLayout->addWidget (lb_path);
-	inputLayout->addWidget (le_path);
-	inputLayout->addWidget (btn_findPath);
-	
-	QVBoxLayout* mainLayout = new QVBoxLayout;
-	
-	if (validDefault == false)
-		mainLayout->addWidget (lb_description);
-	
-	mainLayout->addLayout (inputLayout);
-	mainLayout->addWidget (lb_resolution);
-	mainLayout->addWidget (dbb_buttons);
-	setLayout (mainLayout);
-	
-	connect (le_path, SIGNAL (textEdited ()), this, SLOT (slot_tryConfigure ()));
-	connect (btn_findPath, SIGNAL (clicked ()), this, SLOT (slot_findPath ()));
-	connect (btn_tryConfigure, SIGNAL (clicked ()), this, SLOT (slot_tryConfigure ()));
-	connect (dbb_buttons, SIGNAL (accepted ()), this, SLOT (accept ()));
-	connect (dbb_buttons, SIGNAL (rejected ()), this, (validDefault) ? SLOT (reject ()) : SLOT (slot_exit ()));
-	
-	setPath (io_ldpath);
-	if (validDefault)
-		slot_tryConfigure ();
-}
-
-// ========================================================================================================================================
-QPushButton* LDrawPathDialog::okButton () {
-	return dbb_buttons->button (QDialogButtonBox::Ok);
-}
-
-// ========================================================================================================================================
-void LDrawPathDialog::setPath (str path) {
-	le_path->setText (path);
-}
-
-// ========================================================================================================================================
-str LDrawPathDialog::path () const {
-	return le_path->text ();
-}
-
-// ========================================================================================================================================
-void LDrawPathDialog::slot_findPath () {
-	str newpath = QFileDialog::getExistingDirectory (this, "Find LDraw Path");
-	
-	if (~newpath > 0 && newpath != path ()) {
-		setPath (newpath);
-		slot_tryConfigure ();
-	}
-}
-
-
-// ========================================================================================================================================
-void LDrawPathDialog::slot_exit () {
-	exit (1);
-}
-
-// ========================================================================================================================================
-void LDrawPathDialog::slot_tryConfigure () {
-	if (LDPaths::tryConfigure (path ()) == false) {
-		lb_resolution->setText (fmt ("<span style=\"color:red; font-weight: bold;\">%s</span>", LDPaths::getError().chars ()));
-		okButton ()->setEnabled (false);
-		return;
-	}
-	
-	lb_resolution->setText ("<span style=\"color: #7A0; font-weight: bold;\">OK!</span>");
-	okButton ()->setEnabled (true);
-}
\ No newline at end of file
--- a/src/ldrawPathDialog.h	Tue May 14 03:49:15 2013 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- *  LDForge: LDraw parts authoring CAD
- *  Copyright (C) 2013 Santeri Piippo
- *  
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *  
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *  
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef LDRAWPATHDIALOG_H
-#define LDRAWPATHDIALOG_H
-
-#include <QDialog>
-#include "common.h"
-
-class QLabel;
-class QLineEdit;
-class QDialogButtonBox;
-
-class LDrawPathDialog : public QDialog {
-	Q_OBJECT
-	
-public:
-	explicit LDrawPathDialog (const bool validDefault, QWidget* parent = null, Qt::WindowFlags f = 0);
-	str path () const;
-	void setPath (str path);
-	void (*callback ()) () const { return m_callback; }
-	void setCallback (void (*callback) ()) { m_callback = callback; }
-	
-private:
-	Q_DISABLE_COPY (LDrawPathDialog)
-	
-	QLabel* lb_resolution;
-	QLineEdit* le_path;
-	QPushButton* btn_findPath, *btn_tryConfigure, *btn_cancel;
-	QDialogButtonBox* dbb_buttons;
-	void (*m_callback) ();
-	const bool m_validDefault;
-	
-	QPushButton* okButton ();
-	
-private slots:
-	void slot_findPath ();
-	void slot_tryConfigure ();
-	void slot_exit ();
-};
-
-#endif // LDRAWPATHDIALOG_H
--- a/src/newPartDialog.cpp	Tue May 14 03:49:15 2013 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-/*
- *  LDForge: LDraw parts authoring CAD
- *  Copyright (C) 2013 Santeri Piippo
- *  
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *  
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *  
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <QGridLayout>
-#include <QLabel>
-#include <QLineEdit>
-#include <QDialogButtonBox>
-
-#include "newPartDialog.h"
-#include "file.h"
-#include "gui.h"
-#include "radiobox.h"
-
-// -------------------------------------
-enum {
-	LICENSE_CCAL,
-	LICENSE_NonCA,
-	LICENSE_None
-};
-
-// -------------------------------------
-enum {
-	BFCBOX_CCW,
-	BFCBOX_CW,
-	BFCBOX_None,
-};
-
-// =============================================================================
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-// =============================================================================
-NewPartDialog::NewPartDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f) {
-	lb_brickIcon = new QLabel;
-	lb_brickIcon->setPixmap (getIcon ("brick"));
-	
-	lb_name = new QLabel ("Name:");
-	le_name = new QLineEdit;
-	le_name->setMinimumWidth (320);
-	
-	lb_author = new QLabel ("Author:");
-	le_author = new QLineEdit;
-	
-	rb_license = new RadioBox ("License", {
-		"CCAL Redistributable",
-		"Non-redistributable",
-		"Don't append a license",
-	}, LICENSE_CCAL);
-	
-	rb_BFC = new RadioBox ("BFC Winding", {
-		"CCW",
-		"CW",
-		"No winding"
-	}, BFCBOX_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);
-	setWindowIcon (getIcon ("brick"));
-	setWindowTitle (APPNAME ": New Part");
-}
-
-// =============================================================================
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-// =============================================================================
-void NewPartDialog::StaticDialog () {
-	NewPartDialog dlg (g_win);
-	if (dlg.exec ()) {
-		newFile ();
-		
-		short idx;
-		str author = dlg.le_author->text ();
-		vector<LDObject*>& objs = g_curfile->m_objs;
-		
-		idx = dlg.rb_BFC->value ();
-		const LDBFC::Type eBFCType =
-			(idx == BFCBOX_CCW) ? LDBFC::CertifyCCW :
-			(idx == BFCBOX_CW) ? LDBFC::CertifyCW :
-			LDBFC::NoCertify;
-		
-		idx = dlg.rb_license->value ();
-		const char* sLicense =
-			(idx == LICENSE_CCAL) ? "Redistributable under CCAL version 2.0 : see CAreadme.txt" :
-			(idx == LICENSE_NonCA) ? "Not redistributable : see NonCAreadme.txt" :
-			null;
-		
-		objs.push_back (new LDComment (dlg.le_name->text ()));
-		objs.push_back (new LDComment ("Name: <untitled>.dat"));
-		objs.push_back (new LDComment (fmt ("Author: %s", author.chars())));
-		objs.push_back (new LDComment (fmt ("!LDRAW_ORG Unofficial_Part")));
-		
-		if (sLicense != null)
-			objs.push_back (new LDComment (fmt ("!LICENSE %s", sLicense)));
-		
-		objs.push_back (new LDEmpty);
-		objs.push_back (new LDBFC (eBFCType));
-		objs.push_back (new LDEmpty);
-		
-		g_win->fullRefresh ();
-	}
-}
\ No newline at end of file
--- a/src/newPartDialog.h	Tue May 14 03:49:15 2013 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- *  LDForge: LDraw parts authoring CAD
- *  Copyright (C) 2013 Santeri Piippo
- *  
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *  
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *  
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NEWPARTDIALOG_H
-#define NEWPARTDIALOG_H
-
-#include <QDialog>
-#include "common.h"
-
-class QLabel;
-class QLineEdit;
-class RadioBox;
-
-class NewPartDialog : public QDialog {
-public:
-	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;
-};
-
-#endif // NEWPARTDIALOG_H
\ No newline at end of file

mercurial