src/common.h

Fri, 02 Aug 2013 16:33:30 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Fri, 02 Aug 2013 16:33:30 +0300
changeset 421
7d26db0be944
parent 402
ec95fc95e5f3
child 433
b49930dcbe84
permissions
-rw-r--r--

style cleanup - it should be all unified now

183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2013 Santeri Piippo
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 // This file is included one way or another in every source file of LDForge.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21 // Stuff defined and included here is universally included.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23 #ifndef COMMON_H
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24 #define COMMON_H
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26 #include <stdio.h>
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27 #include <stdlib.h>
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
28 #include <assert.h>
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 #include <stdint.h>
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 #include <stdarg.h>
249
6b2cc2d82ba6 Use QMutex for the thread locking, remove filename from the progress dialog since it's not known anyway
Santeri Piippo <crimsondusk64@gmail.com>
parents: 248
diff changeset
31 #include <QString>
6b2cc2d82ba6 Use QMutex for the thread locking, remove filename from the progress dialog since it's not known anyway
Santeri Piippo <crimsondusk64@gmail.com>
parents: 248
diff changeset
32 #include <QMutex>
6b2cc2d82ba6 Use QMutex for the thread locking, remove filename from the progress dialog since it's not known anyway
Santeri Piippo <crimsondusk64@gmail.com>
parents: 248
diff changeset
33
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 #include "config.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 #define APPNAME "LDForge"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37 #define VERSION_MAJOR 0
374
6c30af56af11 Tag 0.2 alpha
Santeri Piippo <crimsondusk64@gmail.com>
parents: 351
diff changeset
38 #define VERSION_MINOR 2
375
54c90b15d35c Bump version to 0.2.999-intern now that 0.2-alpha is out.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 374
diff changeset
39 #define VERSION_PATCH 999
54c90b15d35c Bump version to 0.2.999-intern now that 0.2-alpha is out.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 374
diff changeset
40 #define BUILD_ID BUILD_INTERNAL
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41
321
48e429bfd58c Apply tr() for possible future translations
Santeri Piippo <crimsondusk64@gmail.com>
parents: 316
diff changeset
42 #define BUILD_INTERNAL 0
48e429bfd58c Apply tr() for possible future translations
Santeri Piippo <crimsondusk64@gmail.com>
parents: 316
diff changeset
43 #define BUILD_ALPHA 1
48e429bfd58c Apply tr() for possible future translations
Santeri Piippo <crimsondusk64@gmail.com>
parents: 316
diff changeset
44 #define BUILD_BETA 2
48e429bfd58c Apply tr() for possible future translations
Santeri Piippo <crimsondusk64@gmail.com>
parents: 316
diff changeset
45 #define BUILD_RC 3
48e429bfd58c Apply tr() for possible future translations
Santeri Piippo <crimsondusk64@gmail.com>
parents: 316
diff changeset
46 #define BUILD_RELEASE 4
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
48 // =============================================
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
49 #if (BUILD_ID != BUILD_INTERNAL)
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
50 #define RELEASE
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
51 #endif // BUILD_ID
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
52
189
ac2d3e8dd110 Rewrote the string class with a simpler version. The old one was more than probably leaking water like a boat with an elephant on board...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 183
diff changeset
53 #ifndef RELEASE
ac2d3e8dd110 Rewrote the string class with a simpler version. The old one was more than probably leaking water like a boat with an elephant on board...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 183
diff changeset
54 # define devf(...) doDevf (__func__, __VA_ARGS__);
ac2d3e8dd110 Rewrote the string class with a simpler version. The old one was more than probably leaking water like a boat with an elephant on board...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 183
diff changeset
55 #else
ac2d3e8dd110 Rewrote the string class with a simpler version. The old one was more than probably leaking water like a boat with an elephant on board...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 183
diff changeset
56 # define devf(...)
ac2d3e8dd110 Rewrote the string class with a simpler version. The old one was more than probably leaking water like a boat with an elephant on board...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 183
diff changeset
57 #endif // RELEASE
ac2d3e8dd110 Rewrote the string class with a simpler version. The old one was more than probably leaking water like a boat with an elephant on board...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 183
diff changeset
58
316
b4fefda58f43 Made overlay data be contained in the part files, still wip
Santeri Piippo <crimsondusk64@gmail.com>
parents: 311
diff changeset
59 #define elif else if
286
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
60
189
ac2d3e8dd110 Rewrote the string class with a simpler version. The old one was more than probably leaking water like a boat with an elephant on board...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 183
diff changeset
61 void doDevf (const char* func, const char* fmtstr, ...);
ac2d3e8dd110 Rewrote the string class with a simpler version. The old one was more than probably leaking water like a boat with an elephant on board...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 183
diff changeset
62
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
63 // Version string identifier
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 402
diff changeset
64 const char* versionString();
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 402
diff changeset
65 const char* versionMoniker();
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 402
diff changeset
66 const char* fullVersionString();
381
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
67
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
68 // Null pointer
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
69 static const std::nullptr_t null = nullptr;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
70
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
71 #ifdef __GNUC__
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
72 # define FORMAT_PRINTF(M,N) __attribute__ ((format (printf, M, N)))
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
73 # define ATTR(N) __attribute__ ((N))
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
74 #else
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
75 # define FORMAT_PRINTF(M,N)
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
76 # define ATTR(N)
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
77 #endif // __GNUC__
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
78
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
79 #ifdef WIN32
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
80 #define DIRSLASH "\\"
227
e13cd69b16dd Update the part's Name: field when saving
Santeri Piippo <crimsondusk64@gmail.com>
parents: 224
diff changeset
81 #define DIRSLASH_CHAR '\\'
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
82 #else // WIN32
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
83 #define DIRSLASH "/"
227
e13cd69b16dd Update the part's Name: field when saving
Santeri Piippo <crimsondusk64@gmail.com>
parents: 224
diff changeset
84 #define DIRSLASH_CHAR '/'
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
85 #endif // WIN32
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
86
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
87 #ifdef RELEASE
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
88 #define NDEBUG // remove asserts
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
89 #endif // RELEASE
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
90
266
12e7302f14e9 Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents: 250
diff changeset
91 #define PROP_NAME(GET) m_##GET
12e7302f14e9 Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents: 250
diff changeset
92
12e7302f14e9 Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents: 250
diff changeset
93 #define READ_ACCESSOR(T, GET) \
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 402
diff changeset
94 T const& GET() const
266
12e7302f14e9 Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents: 250
diff changeset
95
274
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
96 #define SET_ACCESSOR(T, SET) \
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
97 void SET (T val)
266
12e7302f14e9 Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents: 250
diff changeset
98
223
4f95d7f2e9ef Added PROPERTY macro for easier exposed member variable management
Santeri Piippo <crimsondusk64@gmail.com>
parents: 211
diff changeset
99 // Read-only, private property with a get accessor
274
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
100 #define DECLARE_READ_PROPERTY(T, GET, SET) \
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
101 private: \
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
102 T PROP_NAME (GET); \
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
103 SET_ACCESSOR (T, SET); \
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
104 public: \
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
105 READ_ACCESSOR (T, GET);
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
106
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
107 // Read/write private property with get and set accessors
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
108 #define DECLARE_PROPERTY(T, GET, SET) \
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
109 private: \
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
110 T PROP_NAME (GET); \
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
111 public: \
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
112 READ_ACCESSOR (T, GET); \
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
113 SET_ACCESSOR (T, SET);
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
114
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
115 #define DEFINE_PROPERTY(T, CLASS, GET, SET) \
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
116 READ_ACCESSOR (T, CLASS::GET) { return PROP_NAME (GET); } \
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
117 SET_ACCESSOR (T, CLASS::SET) { PROP_NAME (GET) = val; }
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
118
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
119 // Shortcuts
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
120 #define PROPERTY(T, GET, SET) \
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
121 private: \
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
122 T PROP_NAME (GET); \
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
123 public: \
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
124 READ_ACCESSOR (T, GET) { return PROP_NAME (GET); } \
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
125 SET_ACCESSOR (T, SET) { PROP_NAME (GET) = val; }
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
126
266
12e7302f14e9 Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents: 250
diff changeset
127 #define READ_PROPERTY(T, GET, SET) \
223
4f95d7f2e9ef Added PROPERTY macro for easier exposed member variable management
Santeri Piippo <crimsondusk64@gmail.com>
parents: 211
diff changeset
128 private: \
266
12e7302f14e9 Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents: 250
diff changeset
129 T PROP_NAME (GET); \
274
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
130 SET_ACCESSOR (T, SET) { PROP_NAME (GET) = val; } \
266
12e7302f14e9 Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents: 250
diff changeset
131 public: \
274
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
132 READ_ACCESSOR (T, GET) { return PROP_NAME (GET); }
248
4431371f3ffe Added a progress dialog for file loading to respond to desktops while loading files. With large files the no-response policy could be a bad thing. My first real use case of multi-threading...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 246
diff changeset
133
327
9ea604af1319 Largely reworked the color selector. Still not perfect but is better
Santeri Piippo <crimsondusk64@gmail.com>
parents: 322
diff changeset
134 // Property whose set accessor is a public slot
9ea604af1319 Largely reworked the color selector. Still not perfect but is better
Santeri Piippo <crimsondusk64@gmail.com>
parents: 322
diff changeset
135 // TODO: make this replace PROPERTY
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 402
diff changeset
136 #define SLOT_PROPERTY (T, GET, SET) \
327
9ea604af1319 Largely reworked the color selector. Still not perfect but is better
Santeri Piippo <crimsondusk64@gmail.com>
parents: 322
diff changeset
137 private: \
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 402
diff changeset
138 T PROP_NAME (GET); \
327
9ea604af1319 Largely reworked the color selector. Still not perfect but is better
Santeri Piippo <crimsondusk64@gmail.com>
parents: 322
diff changeset
139 public: \
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 402
diff changeset
140 READ_ACCESSOR (T, GET) { return PROP_NAME (GET); } \
327
9ea604af1319 Largely reworked the color selector. Still not perfect but is better
Santeri Piippo <crimsondusk64@gmail.com>
parents: 322
diff changeset
141 public slots: \
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 402
diff changeset
142 SET_ACCESSOR (T, SET) { PROP_NAME (GET) = val; }
327
9ea604af1319 Largely reworked the color selector. Still not perfect but is better
Santeri Piippo <crimsondusk64@gmail.com>
parents: 322
diff changeset
143
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
144 #ifdef null
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
145 #undef null
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
146 #endif // null
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
147
237
ec77f6e9a19f Added fatal error message box for the.. fatal stuff. Windows isn't really good at conveying error messages, converted actions into a C-style array because I've had a ton of problems with the vector approach (it gets zeroed when it shouldn't be..)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 232
diff changeset
148 #ifdef __GNUC__
ec77f6e9a19f Added fatal error message box for the.. fatal stuff. Windows isn't really good at conveying error messages, converted actions into a C-style array because I've had a ton of problems with the vector approach (it gets zeroed when it shouldn't be..)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 232
diff changeset
149 #define FUNCNAME __PRETTY_FUNCTION__
ec77f6e9a19f Added fatal error message box for the.. fatal stuff. Windows isn't really good at conveying error messages, converted actions into a C-style array because I've had a ton of problems with the vector approach (it gets zeroed when it shouldn't be..)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 232
diff changeset
150 #else
ec77f6e9a19f Added fatal error message box for the.. fatal stuff. Windows isn't really good at conveying error messages, converted actions into a C-style array because I've had a ton of problems with the vector approach (it gets zeroed when it shouldn't be..)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 232
diff changeset
151 #define FUNCNAME __func__
ec77f6e9a19f Added fatal error message box for the.. fatal stuff. Windows isn't really good at conveying error messages, converted actions into a C-style array because I've had a ton of problems with the vector approach (it gets zeroed when it shouldn't be..)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 232
diff changeset
152 #endif // __GNUC__
ec77f6e9a19f Added fatal error message box for the.. fatal stuff. Windows isn't really good at conveying error messages, converted actions into a C-style array because I've had a ton of problems with the vector approach (it gets zeroed when it shouldn't be..)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 232
diff changeset
153
ec77f6e9a19f Added fatal error message box for the.. fatal stuff. Windows isn't really good at conveying error messages, converted actions into a C-style array because I've had a ton of problems with the vector approach (it gets zeroed when it shouldn't be..)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 232
diff changeset
154 // Replace assert with a version that shows a GUI dialog if possible
ec77f6e9a19f Added fatal error message box for the.. fatal stuff. Windows isn't really good at conveying error messages, converted actions into a C-style array because I've had a ton of problems with the vector approach (it gets zeroed when it shouldn't be..)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 232
diff changeset
155 #ifdef assert
ec77f6e9a19f Added fatal error message box for the.. fatal stuff. Windows isn't really good at conveying error messages, converted actions into a C-style array because I've had a ton of problems with the vector approach (it gets zeroed when it shouldn't be..)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 232
diff changeset
156 #undef assert
ec77f6e9a19f Added fatal error message box for the.. fatal stuff. Windows isn't really good at conveying error messages, converted actions into a C-style array because I've had a ton of problems with the vector approach (it gets zeroed when it shouldn't be..)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 232
diff changeset
157 #endif // assert
ec77f6e9a19f Added fatal error message box for the.. fatal stuff. Windows isn't really good at conveying error messages, converted actions into a C-style array because I've had a ton of problems with the vector approach (it gets zeroed when it shouldn't be..)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 232
diff changeset
158
381
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
159 class QString;
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
160 typedef QString str;
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
161
237
ec77f6e9a19f Added fatal error message box for the.. fatal stuff. Windows isn't really good at conveying error messages, converted actions into a C-style array because I've had a ton of problems with the vector approach (it gets zeroed when it shouldn't be..)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 232
diff changeset
162 void assertionFailure (const char* file, const ulong line, const char* funcname, const char* expr);
ec77f6e9a19f Added fatal error message box for the.. fatal stuff. Windows isn't really good at conveying error messages, converted actions into a C-style array because I've had a ton of problems with the vector approach (it gets zeroed when it shouldn't be..)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 232
diff changeset
163 void fatalError (const char* file, const ulong line, const char* funcname, str errmsg);
248
4431371f3ffe Added a progress dialog for file loading to respond to desktops while loading files. With large files the no-response policy could be a bad thing. My first real use case of multi-threading...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 246
diff changeset
164
237
ec77f6e9a19f Added fatal error message box for the.. fatal stuff. Windows isn't really good at conveying error messages, converted actions into a C-style array because I've had a ton of problems with the vector approach (it gets zeroed when it shouldn't be..)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 232
diff changeset
165 #define assert(N) \
ec77f6e9a19f Added fatal error message box for the.. fatal stuff. Windows isn't really good at conveying error messages, converted actions into a C-style array because I've had a ton of problems with the vector approach (it gets zeroed when it shouldn't be..)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 232
diff changeset
166 (N) ? ((void)(0)) : assertionFailure(__FILE__, __LINE__, FUNCNAME, #N)
ec77f6e9a19f Added fatal error message box for the.. fatal stuff. Windows isn't really good at conveying error messages, converted actions into a C-style array because I've had a ton of problems with the vector approach (it gets zeroed when it shouldn't be..)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 232
diff changeset
167
ec77f6e9a19f Added fatal error message box for the.. fatal stuff. Windows isn't really good at conveying error messages, converted actions into a C-style array because I've had a ton of problems with the vector approach (it gets zeroed when it shouldn't be..)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 232
diff changeset
168 #define fatal(MSG) \
ec77f6e9a19f Added fatal error message box for the.. fatal stuff. Windows isn't really good at conveying error messages, converted actions into a C-style array because I've had a ton of problems with the vector approach (it gets zeroed when it shouldn't be..)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 232
diff changeset
169 fatalError (__FILE__, __LINE__, FUNCNAME, MSG)
ec77f6e9a19f Added fatal error message box for the.. fatal stuff. Windows isn't really good at conveying error messages, converted actions into a C-style array because I've had a ton of problems with the vector approach (it gets zeroed when it shouldn't be..)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 232
diff changeset
170
272
2074672a6554 Cleansed the string class, moved implementations from header to code file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 267
diff changeset
171 // -----------------------------------------------------------------------------
211
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
172 #ifdef IN_IDE_PARSER // KDevelop workarounds:
272
2074672a6554 Cleansed the string class, moved implementations from header to code file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 267
diff changeset
173 # error IN_IDE_PARSER is defined (this code is only for KDevelop workarounds)
248
4431371f3ffe Added a progress dialog for file loading to respond to desktops while loading files. With large files the no-response policy could be a bad thing. My first real use case of multi-threading...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 246
diff changeset
174
272
2074672a6554 Cleansed the string class, moved implementations from header to code file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 267
diff changeset
175 # ifndef va_start
2074672a6554 Cleansed the string class, moved implementations from header to code file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 267
diff changeset
176 # define va_start(va, arg)
2074672a6554 Cleansed the string class, moved implementations from header to code file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 267
diff changeset
177 # endif // va_start
211
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
178
272
2074672a6554 Cleansed the string class, moved implementations from header to code file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 267
diff changeset
179 # ifndef va_end
2074672a6554 Cleansed the string class, moved implementations from header to code file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 267
diff changeset
180 # define va_end(va)
2074672a6554 Cleansed the string class, moved implementations from header to code file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 267
diff changeset
181 # endif // va_end
248
4431371f3ffe Added a progress dialog for file loading to respond to desktops while loading files. With large files the no-response policy could be a bad thing. My first real use case of multi-threading...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 246
diff changeset
182
381
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
183 static const char* __func__ = ""; // Current function name
248
4431371f3ffe Added a progress dialog for file loading to respond to desktops while loading files. With large files the no-response policy could be a bad thing. My first real use case of multi-threading...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 246
diff changeset
184 typedef void FILE; // :|
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
185 #endif // IN_IDE_PARSER
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
186
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
187 #endif // COMMON_H

mercurial