diff -r e3a32a79a10a -r 4355e72ffd47 src/primitives.h
--- a/src/primitives.h Wed Sep 25 11:02:44 2013 +0300
+++ b/src/primitives.h Wed Oct 23 12:46:10 2013 +0300
@@ -16,77 +16,74 @@
* along with this program. If not, see .
*/
-#ifndef PRIMITIVES_H
-#define PRIMITIVES_H
+#ifndef LDFORGE_PRIMITIVES_H
+#define LDFORGE_PRIMITIVES_H
#include "common.h"
#include "types.h"
#include
#include
+class LDFile;
class Ui_MakePrimUI;
class PrimitiveCategory;
-struct Primitive {
- str name, title;
+struct Primitive
+{ str name, title;
PrimitiveCategory* cat;
};
-class PrimitiveCategory {
- PROPERTY (str, name, setName)
-
-public:
- enum Type {
- Filename,
- Title
- };
-
- struct RegexEntry {
- QRegExp regex;
- Type type;
- };
-
- typedef List::it it;
- typedef List::c_it c_it;
-
- List regexes;
- List prims;
- static List uncat;
+class PrimitiveCategory
+{ PROPERTY (str, name, setName)
+
+ public:
+ enum Type
+ { Filename,
+ Title
+ };
+
+ struct RegexEntry
+ { QRegExp regex;
+ Type type;
+ };
+
+ QList regexes;
+ QList prims;
+ static QList uncat;
};
// =============================================================================
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// =============================================================================
// PrimitiveLister
-//
+//
// Worker object that scans the primitives folder for primitives and
// builds an index of them.
// =============================================================================
-class PrimitiveLister : public QObject {
- Q_OBJECT
-
-public:
- static void start();
-
-public slots:
- void work();
-
-signals:
- void starting (ulong num);
- void workDone();
- void update (ulong i);
-
-private:
- List m_prims;
+class PrimitiveLister : public QObject
+{ Q_OBJECT
+
+ public:
+ static void start();
+
+ public slots:
+ void work();
+
+ signals:
+ void starting (int num);
+ void workDone();
+ void update (int i);
+
+ private:
+ QList m_prims;
};
-extern List g_PrimitiveCategories;
+extern QList g_PrimitiveCategories;
void loadPrimitives();
bool primitiveLoaderBusy();
enum PrimitiveType
-{
- Circle,
+{ Circle,
Cylinder,
Disc,
DiscNeg,
@@ -95,18 +92,25 @@
};
// =============================================================================
-class PrimitivePrompt : public QDialog {
- Q_OBJECT
-
-public:
- explicit PrimitivePrompt (QWidget* parent = null, Qt::WindowFlags f = 0);
- virtual ~PrimitivePrompt();
- Ui_MakePrimUI* ui;
-
-public slots:
- void hiResToggled (bool on);
+class PrimitivePrompt : public QDialog
+{ Q_OBJECT
+
+ public:
+ explicit PrimitivePrompt (QWidget* parent = null, Qt::WindowFlags f = 0);
+ virtual ~PrimitivePrompt();
+ Ui_MakePrimUI* ui;
+
+ public slots:
+ void hiResToggled (bool on);
};
-void generatePrimitive();
+void makeCircle (int segs, int divs, double radius, QList& lines);
+LDFile* generatePrimitive (PrimitiveType type, int segs, int divs, int num);
-#endif // PRIMITIVES_H
\ No newline at end of file
+// Gets a primitive by the given specs. If the primitive cannot be found, it will
+// be automatically generated.
+LDFile* getPrimitive (PrimitiveType type, int segs, int divs, int num);
+
+str radialFileName (PrimitiveType type, int segs, int divs, int num);
+
+#endif // LDFORGE_PRIMITIVES_H