Thu, 06 Nov 2014 13:51:09 +0200
- argh
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
844
11587d419d2f
- changed copyright lines to use my legal name instead of my nickname
Teemu Piippo <crimsondusk64@gmail.com>
parents:
843
diff
changeset
|
3 | * Copyright (C) 2013, 2014 Teemu Piippo |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | * |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | * |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | * |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | */ |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
19 | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | #include "main.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | #include "ldObject.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | #include "ldDocument.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | #include "miscallenous.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | #include "mainWindow.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | #include "editHistory.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | #include "glRenderer.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | #include "colors.h" |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
28 | #include "glCompiler.h" |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | |
852
cbd89b33f70d
- down with all these unnecessary semicolons!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
850
diff
changeset
|
30 | CFGENTRY (String, DefaultName, "") |
cbd89b33f70d
- down with all these unnecessary semicolons!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
850
diff
changeset
|
31 | CFGENTRY (String, DefaultUser, "") |
cbd89b33f70d
- down with all these unnecessary semicolons!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
850
diff
changeset
|
32 | CFGENTRY (Bool, UseCALicense, true) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | // List of all LDObjects |
784
f82ab4d3c7b4
- made LDDocument use shared pointers, this eliminates a lot of document-related crashes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
783
diff
changeset
|
35 | QMap<long, LDObjectWeakPtr> g_allObjects; |
771
0f04e34bec54
- use a faster ID choosing setup, this should work so long as nobody goes to create 17 million objects
Santeri Piippo <crimsondusk64@gmail.com>
parents:
770
diff
changeset
|
36 | static int32 g_idcursor = 1; // 0 shalt be null |
0f04e34bec54
- use a faster ID choosing setup, this should work so long as nobody goes to create 17 million objects
Santeri Piippo <crimsondusk64@gmail.com>
parents:
770
diff
changeset
|
37 | static constexpr int32 g_maxID = (1 << 24); |
769
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
38 | |
770
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
39 | #define LDOBJ_DEFAULT_CTOR(T,BASE) \ |
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
40 | T :: T (LDObjectPtr* selfptr) : \ |
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
41 | BASE (selfptr) {} |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
42 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
43 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
44 | // LDObject constructors |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
45 | // |
770
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
46 | LDObject::LDObject (LDObjectPtr* selfptr) : |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
47 | m_isHidden (false), |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
48 | m_isSelected (false), |
769
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
49 | m_isDestructed (false), |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
50 | qObjListEntry (null) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
51 | { |
770
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
52 | *selfptr = LDObjectPtr (this, [](LDObject* obj){ obj->finalDelete(); }); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
53 | memset (m_coords, 0, sizeof m_coords); |
770
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
54 | m_self = selfptr->toWeakRef(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
55 | chooseID(); |
769
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
56 | g_allObjects[id()] = self(); |
751
49d4eb8edcd8
- don't let random colors be too dark (or fully white either for dark backgrounds which use white lines)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
741
diff
changeset
|
57 | setRandomColor (QColor::fromHsv (rand() % 360, rand() % 256, rand() % 96 + 128)); |
770
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
58 | } |
769
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
59 | |
770
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
60 | LDSubfile::LDSubfile (LDObjectPtr* selfptr) : |
843
9ac9060877cc
- moved LDMatrixObject to be an abstract class deriving from LDObject. LDSubfile only inherits from LDMatrixObject.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
840
diff
changeset
|
61 | LDMatrixObject (selfptr) {} |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
62 | |
770
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
63 | LDOBJ_DEFAULT_CTOR (LDEmpty, LDObject) |
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
64 | LDOBJ_DEFAULT_CTOR (LDError, LDObject) |
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
65 | LDOBJ_DEFAULT_CTOR (LDLine, LDObject) |
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
66 | LDOBJ_DEFAULT_CTOR (LDTriangle, LDObject) |
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
67 | LDOBJ_DEFAULT_CTOR (LDCondLine, LDLine) |
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
68 | LDOBJ_DEFAULT_CTOR (LDQuad, LDObject) |
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
69 | LDOBJ_DEFAULT_CTOR (LDVertex, LDObject) |
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
70 | LDOBJ_DEFAULT_CTOR (LDOverlay, LDObject) |
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
71 | LDOBJ_DEFAULT_CTOR (LDBFC, LDObject) |
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
72 | LDOBJ_DEFAULT_CTOR (LDComment, LDObject) |
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
73 | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
74 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
75 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
76 | void LDObject::chooseID() |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
77 | { |
771
0f04e34bec54
- use a faster ID choosing setup, this should work so long as nobody goes to create 17 million objects
Santeri Piippo <crimsondusk64@gmail.com>
parents:
770
diff
changeset
|
78 | // If this is the first pass we can just use a global ID counter for each |
773
6eb3c88982ac
- bfc red/green view and random colors are now mutually exclusive, enabling one disables the other.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
771
diff
changeset
|
79 | // unique object. Let's hope that nobody goes to create 17 million objects |
6eb3c88982ac
- bfc red/green view and random colors are now mutually exclusive, enabling one disables the other.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
771
diff
changeset
|
80 | // anytime soon. |
771
0f04e34bec54
- use a faster ID choosing setup, this should work so long as nobody goes to create 17 million objects
Santeri Piippo <crimsondusk64@gmail.com>
parents:
770
diff
changeset
|
81 | if (g_idcursor < g_maxID) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
82 | { |
771
0f04e34bec54
- use a faster ID choosing setup, this should work so long as nobody goes to create 17 million objects
Santeri Piippo <crimsondusk64@gmail.com>
parents:
770
diff
changeset
|
83 | setID (g_idcursor++); |
0f04e34bec54
- use a faster ID choosing setup, this should work so long as nobody goes to create 17 million objects
Santeri Piippo <crimsondusk64@gmail.com>
parents:
770
diff
changeset
|
84 | return; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
85 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
86 | |
771
0f04e34bec54
- use a faster ID choosing setup, this should work so long as nobody goes to create 17 million objects
Santeri Piippo <crimsondusk64@gmail.com>
parents:
770
diff
changeset
|
87 | // In case someone does, we cannot really continue execution. We must abort, |
0f04e34bec54
- use a faster ID choosing setup, this should work so long as nobody goes to create 17 million objects
Santeri Piippo <crimsondusk64@gmail.com>
parents:
770
diff
changeset
|
88 | // give the user a chance to save their documents though. |
882
2f3cc8e045d5
- fixed compilation on windows
Teemu Piippo <crimsondusk64@gmail.com>
parents:
881
diff
changeset
|
89 | Critical ("Created too many objects. Execution cannot continue. You have a " |
771
0f04e34bec54
- use a faster ID choosing setup, this should work so long as nobody goes to create 17 million objects
Santeri Piippo <crimsondusk64@gmail.com>
parents:
770
diff
changeset
|
90 | "chance to save any changes to documents, then restart."); |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
91 | (void) IsSafeToCloseAll(); |
857
e62983881460
- fixed crash-on-exit (simply by not running full destruction processing during program termination)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
854
diff
changeset
|
92 | Exit(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
93 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
94 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
95 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
96 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
97 | void LDObject::setVertexCoord (int i, Axis ax, double value) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
98 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
99 | Vertex v = vertex (i); |
733
cc39df788660
- reimplemented the Vertex class as a derivative of QVector3D
Santeri Piippo <crimsondusk64@gmail.com>
parents:
725
diff
changeset
|
100 | v.setCoordinate (ax, value); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
101 | setVertex (i, v); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
102 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
103 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
104 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
105 | // |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
106 | QString LDComment::asText() const |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
107 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
108 | return format ("0 %1", text()); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
109 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
110 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
111 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
112 | // |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
113 | QString LDSubfile::asText() const |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
114 | { |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
115 | QString val = format ("1 %1 %2 ", color(), position()); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
116 | val += transform().toString(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
117 | val += ' '; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
118 | val += fileInfo()->name(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
119 | return val; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
120 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
121 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
122 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
123 | // |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
124 | QString LDLine::asText() const |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
125 | { |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
126 | QString val = format ("2 %1", color()); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
127 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
128 | for (int i = 0; i < 2; ++i) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
129 | val += format (" %1", vertex (i)); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
130 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
131 | return val; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
132 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
133 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
134 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
135 | // |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
136 | QString LDTriangle::asText() const |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
137 | { |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
138 | QString val = format ("3 %1", color()); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
139 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
140 | for (int i = 0; i < 3; ++i) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
141 | val += format (" %1", vertex (i)); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
142 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
143 | return val; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
144 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
145 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
146 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
147 | // |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
148 | QString LDQuad::asText() const |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
149 | { |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
150 | QString val = format ("4 %1", color()); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
151 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
152 | for (int i = 0; i < 4; ++i) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
153 | val += format (" %1", vertex (i)); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
154 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
155 | return val; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
156 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
157 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
158 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
159 | // |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
160 | QString LDCondLine::asText() const |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
161 | { |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
162 | QString val = format ("5 %1", color()); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
163 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
164 | // Add the coordinates |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
165 | for (int i = 0; i < 4; ++i) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
166 | val += format (" %1", vertex (i)); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
167 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
168 | return val; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
169 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
170 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
171 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
172 | // |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
173 | QString LDError::asText() const |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
174 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
175 | return contents(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
176 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
177 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
178 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
179 | // |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
180 | QString LDVertex::asText() const |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
181 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
182 | return format ("0 !LDFORGE VERTEX %1 %2", color(), pos); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
183 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
184 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
185 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
186 | // |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
187 | QString LDEmpty::asText() const |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
188 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
189 | return ""; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
190 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
191 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
192 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
193 | // |
847 | 194 | const char* LDBFC::StatementStrings[] = |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
195 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
196 | "CERTIFY CCW", |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
197 | "CCW", |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
198 | "CERTIFY CW", |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
199 | "CW", |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
200 | "NOCERTIFY", |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
201 | "INVERTNEXT", |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
202 | "CLIP", |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
203 | "CLIP CCW", |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
204 | "CLIP CW", |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
205 | "NOCLIP", |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
206 | }; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
207 | |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
208 | QString LDBFC::asText() const |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
209 | { |
847 | 210 | return format ("0 BFC %1", StatementStrings[int (m_statement)]); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
211 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
212 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
213 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
214 | // |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
215 | QList<LDTrianglePtr> LDQuad::splitToTriangles() |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
216 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
217 | // Create the two triangles based on this quadrilateral: |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
218 | // 0---3 0---3 3 |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
219 | // | | | / /| |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
220 | // | | ==> | / / | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
221 | // | | |/ / | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
222 | // 1---2 1 1---2 |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
223 | LDTrianglePtr tri1 (LDSpawn<LDTriangle> (vertex (0), vertex (1), vertex (3))); |
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
224 | LDTrianglePtr tri2 (LDSpawn<LDTriangle> (vertex (1), vertex (2), vertex (3))); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
225 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
226 | // The triangles also inherit the quad's color |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
227 | tri1->setColor (color()); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
228 | tri2->setColor (color()); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
229 | |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
230 | return {tri1, tri2}; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
231 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
232 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
233 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
234 | // |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
235 | void LDObject::replace (LDObjectPtr other) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
236 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
237 | long idx = lineNumber(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
238 | assert (idx != -1); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
239 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
240 | // Replace the instance of the old object with the new object |
784
f82ab4d3c7b4
- made LDDocument use shared pointers, this eliminates a lot of document-related crashes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
783
diff
changeset
|
241 | document().toStrongRef()->setObject (idx, other); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
242 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
243 | // Remove the old object |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
244 | destroy(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
245 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
246 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
247 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
248 | // |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
249 | void LDObject::swap (LDObjectPtr other) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
250 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
251 | assert (document() == other->document()); |
784
f82ab4d3c7b4
- made LDDocument use shared pointers, this eliminates a lot of document-related crashes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
783
diff
changeset
|
252 | document().toStrongRef()->swapObjects (self(), other); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
253 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
254 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
255 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
256 | // |
770
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
257 | LDLine::LDLine (LDObjectPtr* selfptr, Vertex v1, Vertex v2) : |
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
258 | LDObject (selfptr) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
259 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
260 | setVertex (0, v1); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
261 | setVertex (1, v2); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
262 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
263 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
264 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
265 | // |
805
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
266 | LDTriangle::LDTriangle (LDObjectPtr* selfptr, const Vertex& v1, const Vertex& v2, const Vertex& v3) : |
770
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
267 | LDObject (selfptr) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
268 | { |
805
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
269 | setVertex (0, v1); |
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
270 | setVertex (1, v2); |
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
271 | setVertex (2, v3); |
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
272 | } |
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
273 | |
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
274 | // ============================================================================= |
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
275 | // |
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
276 | LDQuad::LDQuad (LDObjectPtr* selfptr, const Vertex& v1, const Vertex& v2, |
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
277 | const Vertex& v3, const Vertex& v4) : |
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
278 | LDObject (selfptr) |
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
279 | { |
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
280 | setVertex (0, v1); |
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
281 | setVertex (1, v2); |
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
282 | setVertex (2, v3); |
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
283 | setVertex (3, v4); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
284 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
285 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
286 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
287 | // |
770
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
288 | LDCondLine::LDCondLine (LDObjectPtr* selfptr, const Vertex& v0, const Vertex& v1, |
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
289 | const Vertex& v2, const Vertex& v3) : |
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
769
diff
changeset
|
290 | LDLine (selfptr) |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
291 | { |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
292 | setVertex (0, v0); |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
293 | setVertex (1, v1); |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
294 | setVertex (2, v2); |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
295 | setVertex (3, v3); |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
296 | } |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
297 | |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
298 | // ============================================================================= |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
299 | // |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
300 | LDObject::~LDObject() {} |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
301 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
302 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
303 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
304 | void LDObject::destroy() |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
305 | { |
857
e62983881460
- fixed crash-on-exit (simply by not running full destruction processing during program termination)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
854
diff
changeset
|
306 | // Don't bother during program termination |
e62983881460
- fixed crash-on-exit (simply by not running full destruction processing during program termination)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
854
diff
changeset
|
307 | if (IsExiting() or isDestructed()) |
e62983881460
- fixed crash-on-exit (simply by not running full destruction processing during program termination)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
854
diff
changeset
|
308 | return; |
e62983881460
- fixed crash-on-exit (simply by not running full destruction processing during program termination)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
854
diff
changeset
|
309 | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
310 | // If this object was selected, unselect it now |
881
82a9c3549db1
- a more elegant fix to the problem addressed in the previous commit
Teemu Piippo <crimsondusk64@gmail.com>
parents:
880
diff
changeset
|
311 | if (isSelected() and document() != null) |
767
44f0d5322628
- slight refactor in ldobject methods
Santeri Piippo <crimsondusk64@gmail.com>
parents:
764
diff
changeset
|
312 | deselect(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
313 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
314 | // If this object was associated to a file, remove it off it now |
784
f82ab4d3c7b4
- made LDDocument use shared pointers, this eliminates a lot of document-related crashes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
783
diff
changeset
|
315 | if (document() != null) |
f82ab4d3c7b4
- made LDDocument use shared pointers, this eliminates a lot of document-related crashes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
783
diff
changeset
|
316 | document().toStrongRef()->forgetObject (self()); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
317 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
318 | // Delete the GL lists |
857
e62983881460
- fixed crash-on-exit (simply by not running full destruction processing during program termination)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
854
diff
changeset
|
319 | if (g_win != null) |
e62983881460
- fixed crash-on-exit (simply by not running full destruction processing during program termination)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
854
diff
changeset
|
320 | g_win->R()->forgetObject (self()); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
321 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
322 | // Remove this object from the list of LDObjects |
769
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
323 | g_allObjects.erase (g_allObjects.find (id())); |
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
324 | setDestructed (true); |
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
325 | } |
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
326 | |
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
327 | // |
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
328 | // Deletes the object. Only the shared pointer is to call this! |
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
329 | // |
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
330 | void LDObject::finalDelete() |
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
331 | { |
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
332 | if (not isDestructed()) |
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
333 | destroy(); |
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
334 | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
335 | delete this; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
336 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
337 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
338 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
339 | // |
880
5dcd2e741d1c
- fixed documentless objects being selected on document close
Teemu Piippo <crimsondusk64@gmail.com>
parents:
867
diff
changeset
|
340 | void LDObject::setDocument (const LDDocumentWeakPtr& a) |
5dcd2e741d1c
- fixed documentless objects being selected on document close
Teemu Piippo <crimsondusk64@gmail.com>
parents:
867
diff
changeset
|
341 | { |
5dcd2e741d1c
- fixed documentless objects being selected on document close
Teemu Piippo <crimsondusk64@gmail.com>
parents:
867
diff
changeset
|
342 | m_document = a; |
5dcd2e741d1c
- fixed documentless objects being selected on document close
Teemu Piippo <crimsondusk64@gmail.com>
parents:
867
diff
changeset
|
343 | |
5dcd2e741d1c
- fixed documentless objects being selected on document close
Teemu Piippo <crimsondusk64@gmail.com>
parents:
867
diff
changeset
|
344 | if (a == null) |
5dcd2e741d1c
- fixed documentless objects being selected on document close
Teemu Piippo <crimsondusk64@gmail.com>
parents:
867
diff
changeset
|
345 | setSelected (false); |
5dcd2e741d1c
- fixed documentless objects being selected on document close
Teemu Piippo <crimsondusk64@gmail.com>
parents:
867
diff
changeset
|
346 | } |
5dcd2e741d1c
- fixed documentless objects being selected on document close
Teemu Piippo <crimsondusk64@gmail.com>
parents:
867
diff
changeset
|
347 | |
5dcd2e741d1c
- fixed documentless objects being selected on document close
Teemu Piippo <crimsondusk64@gmail.com>
parents:
867
diff
changeset
|
348 | // ============================================================================= |
5dcd2e741d1c
- fixed documentless objects being selected on document close
Teemu Piippo <crimsondusk64@gmail.com>
parents:
867
diff
changeset
|
349 | // |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
350 | static void TransformObject (LDObjectPtr obj, Matrix transform, Vertex pos, LDColor parentcolor) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
351 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
352 | switch (obj->type()) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
353 | { |
786
71d786ce0dcc
- LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
784
diff
changeset
|
354 | case OBJ_Line: |
71d786ce0dcc
- LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
784
diff
changeset
|
355 | case OBJ_CondLine: |
71d786ce0dcc
- LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
784
diff
changeset
|
356 | case OBJ_Triangle: |
71d786ce0dcc
- LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
784
diff
changeset
|
357 | case OBJ_Quad: |
767
44f0d5322628
- slight refactor in ldobject methods
Santeri Piippo <crimsondusk64@gmail.com>
parents:
764
diff
changeset
|
358 | for (int i = 0; i < obj->numVertices(); ++i) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
359 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
360 | Vertex v = obj->vertex (i); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
361 | v.transform (transform, pos); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
362 | obj->setVertex (i, v); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
363 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
364 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
365 | break; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
366 | |
786
71d786ce0dcc
- LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
784
diff
changeset
|
367 | case OBJ_Subfile: |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
368 | { |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
369 | LDSubfilePtr ref = qSharedPointerCast<LDSubfile> (obj); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
370 | Matrix newMatrix = transform * ref->transform(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
371 | Vertex newpos = ref->position(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
372 | newpos.transform (transform, pos); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
373 | ref->setPosition (newpos); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
374 | ref->setTransform (newMatrix); |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
375 | break; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
376 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
377 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
378 | default: |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
379 | break; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
380 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
381 | |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
382 | if (obj->color() == MainColor()) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
383 | obj->setColor (parentcolor); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
384 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
385 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
386 | // ============================================================================= |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
387 | // ----------------------------------------------------------------------------- |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
388 | LDObjectList LDSubfile::inlineContents (bool deep, bool render) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
389 | { |
910 | 390 | fileInfo()->sweepBFC(); |
391 | bool isInverted = ((blockWinding() == Winding::CW) | |
392 | or (transform().getDeterminant() < 0)); | |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
393 | LDObjectList objs = fileInfo()->inlineContents (deep, render); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
394 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
395 | // Transform the objects |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
396 | for (LDObjectPtr obj : objs) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
397 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
398 | // Set the parent now so we know what inlined the object. |
769
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
399 | obj->setParent (self()); |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
400 | TransformObject (obj, transform(), position(), color()); |
910 | 401 | |
402 | // Adjust winding | |
403 | if (blockWinding() == Winding::None) | |
404 | obj->setBlockWinding (Winding::None); | |
405 | elif (isInverted) | |
406 | obj->setBlockWinding (Winding (int (obj->blockWinding()) ^ 1)); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
407 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
408 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
409 | return objs; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
410 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
411 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
412 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
413 | // |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
414 | LDPolygon* LDObject::getPolygon() |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
415 | { |
786
71d786ce0dcc
- LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
784
diff
changeset
|
416 | LDObjectType ot = type(); |
847 | 417 | int num = (ot == OBJ_Line) ? 2 |
418 | : (ot == OBJ_Triangle) ? 3 | |
419 | : (ot == OBJ_Quad) ? 4 | |
420 | : (ot == OBJ_CondLine) ? 5 | |
421 | : 0; | |
422 | ||
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
423 | if (num == 0) |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
424 | return null; |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
425 | |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
426 | LDPolygon* data = new LDPolygon; |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
427 | data->id = id(); |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
428 | data->num = num; |
806
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
805
diff
changeset
|
429 | data->color = color().index(); |
891
00d76b281021
- re-committed bfc work (this makes 903ec1e46298 a suitable common ancestor for experimental branch features)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
890
diff
changeset
|
430 | data->winding = blockWinding(); |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
431 | |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
432 | for (int i = 0; i < data->numVertices(); ++i) |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
433 | data->vertices[i] = vertex (i); |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
434 | |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
435 | return data; |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
436 | } |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
437 | |
910 | 438 | /* |
439 | 0 BFC CERTIFY CCW | |
440 | 1 16 0 0 0 1 0 0 0 1 0 0 0 1 stud2a.dat | |
441 | */ | |
442 | ||
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
443 | // ============================================================================= |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
444 | // |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
445 | QList<LDPolygon> LDSubfile::inlinePolygons() |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
446 | { |
910 | 447 | fileInfo()->sweepBFC(); |
448 | bool isInverted = ((blockWinding() == Winding::CW) | |
449 | or (transform().getDeterminant() < 0)); | |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
450 | QList<LDPolygon> data = fileInfo()->inlinePolygons(); |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
451 | |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
452 | for (LDPolygon& entry : data) |
847 | 453 | { |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
454 | for (int i = 0; i < entry.numVertices(); ++i) |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
455 | entry.vertices[i].transform (transform(), position()); |
891
00d76b281021
- re-committed bfc work (this makes 903ec1e46298 a suitable common ancestor for experimental branch features)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
890
diff
changeset
|
456 | |
910 | 457 | // Adjust winding |
458 | if (entry.winding == Winding::None) | |
907
cf150959ccc4
- bfc stuff (at least it works now...)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
906
diff
changeset
|
459 | entry.winding = Winding::None; |
910 | 460 | //obj->setBlockWinding (Winding::None); |
907
cf150959ccc4
- bfc stuff (at least it works now...)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
906
diff
changeset
|
461 | elif (isInverted) |
891
00d76b281021
- re-committed bfc work (this makes 903ec1e46298 a suitable common ancestor for experimental branch features)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
890
diff
changeset
|
462 | invertWinding (entry.winding); |
910 | 463 | //obj->setBlockWinding (Winding (int (obj->blockWinding()) ^ 1)); |
847 | 464 | } |
910 | 465 | |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
466 | return data; |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
467 | } |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
468 | |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
469 | // ============================================================================= |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
470 | // ----------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
471 | long LDObject::lineNumber() const |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
472 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
473 | assert (document() != null); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
474 | |
784
f82ab4d3c7b4
- made LDDocument use shared pointers, this eliminates a lot of document-related crashes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
783
diff
changeset
|
475 | for (int i = 0; i < document().toStrongRef()->getObjectCount(); ++i) |
847 | 476 | { |
784
f82ab4d3c7b4
- made LDDocument use shared pointers, this eliminates a lot of document-related crashes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
783
diff
changeset
|
477 | if (document().toStrongRef()->getObject (i) == this) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
478 | return i; |
847 | 479 | } |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
480 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
481 | return -1; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
482 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
483 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
484 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
485 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
486 | void LDObject::moveObjects (LDObjectList objs, const bool up) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
487 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
488 | if (objs.isEmpty()) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
489 | return; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
490 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
491 | // If we move down, we need to iterate the array in reverse order. |
847 | 492 | long const start = up ? 0 : (objs.size() - 1); |
493 | long const end = up ? objs.size() : -1; | |
494 | long const incr = up ? 1 : -1; | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
495 | LDObjectList objsToCompile; |
784
f82ab4d3c7b4
- made LDDocument use shared pointers, this eliminates a lot of document-related crashes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
783
diff
changeset
|
496 | LDDocumentPtr file = objs[0]->document(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
497 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
498 | for (long i = start; i != end; i += incr) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
499 | { |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
500 | LDObjectPtr obj = objs[i]; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
501 | |
847 | 502 | long const idx = obj->lineNumber(); |
503 | long const target = idx + (up ? -1 : 1); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
504 | |
840
d077dd19bf9a
- changed `&&` and `||` operators to their named variants `and` and `or`
Teemu Piippo <crimsondusk64@gmail.com>
parents:
835
diff
changeset
|
505 | if ((up and idx == 0) or (not up and idx == (long) file->objects().size() - 1l)) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
506 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
507 | // One of the objects hit the extrema. If this happens, this should be the first |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
508 | // object to be iterated on. Thus, nothing has changed yet and it's safe to just |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
509 | // abort the entire operation. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
510 | assert (i == start); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
511 | return; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
512 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
513 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
514 | objsToCompile << obj; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
515 | objsToCompile << file->getObject (target); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
516 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
517 | obj->swap (file->getObject (target)); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
518 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
519 | |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
520 | RemoveDuplicates (objsToCompile); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
521 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
522 | // The objects need to be recompiled, otherwise their pick lists are left with |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
523 | // the wrong index colors which messes up selection. |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
524 | for (LDObjectPtr obj : objsToCompile) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
525 | g_win->R()->compileObject (obj); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
526 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
527 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
528 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
529 | // |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
530 | QString LDObject::typeName (LDObjectType type) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
531 | { |
769
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
532 | return LDObject::getDefault (type)->typeName(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
533 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
534 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
535 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
536 | // |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
537 | QString LDObject::describeObjects (const LDObjectList& objs) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
538 | { |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
539 | QString text; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
540 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
541 | if (objs.isEmpty()) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
542 | return "nothing"; // :) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
543 | |
786
71d786ce0dcc
- LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
784
diff
changeset
|
544 | for (LDObjectType objType = OBJ_FirstType; objType < OBJ_NumTypes; ++objType) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
545 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
546 | int count = 0; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
547 | |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
548 | for (LDObjectPtr obj : objs) |
847 | 549 | { |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
550 | if (obj->type() == objType) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
551 | count++; |
847 | 552 | } |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
553 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
554 | if (count == 0) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
555 | continue; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
556 | |
762
d259256e1394
- added a macro for adding operator++ and operator-- to enums, less cast hell this way
Santeri Piippo <crimsondusk64@gmail.com>
parents:
757
diff
changeset
|
557 | if (not text.isEmpty()) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
558 | text += ", "; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
559 | |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
560 | QString noun = format ("%1%2", typeName (objType), Plural (count)); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
561 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
562 | // Plural of "vertex" is "vertices", correct that |
840
d077dd19bf9a
- changed `&&` and `||` operators to their named variants `and` and `or`
Teemu Piippo <crimsondusk64@gmail.com>
parents:
835
diff
changeset
|
563 | if (objType == OBJ_Vertex and count != 1) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
564 | noun = "vertices"; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
565 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
566 | text += format ("%1 %2", count, noun); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
567 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
568 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
569 | return text; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
570 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
571 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
572 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
573 | // |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
574 | LDObjectPtr LDObject::topLevelParent() |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
575 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
576 | if (parent() == null) |
769
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
577 | return self(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
578 | |
769
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
579 | LDObjectWeakPtr it (self()); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
580 | |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
581 | while (it.toStrongRef()->parent() != null) |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
582 | it = it.toStrongRef()->parent(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
583 | |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
584 | return it.toStrongRef(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
585 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
586 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
587 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
588 | // |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
589 | LDObjectPtr LDObject::next() const |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
590 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
591 | long idx = lineNumber(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
592 | assert (idx != -1); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
593 | |
784
f82ab4d3c7b4
- made LDDocument use shared pointers, this eliminates a lot of document-related crashes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
783
diff
changeset
|
594 | if (idx == (long) document().toStrongRef()->getObjectCount() - 1) |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
595 | return LDObjectPtr(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
596 | |
784
f82ab4d3c7b4
- made LDDocument use shared pointers, this eliminates a lot of document-related crashes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
783
diff
changeset
|
597 | return document().toStrongRef()->getObject (idx + 1); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
598 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
599 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
600 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
601 | // |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
602 | LDObjectPtr LDObject::previous() const |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
603 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
604 | long idx = lineNumber(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
605 | assert (idx != -1); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
606 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
607 | if (idx == 0) |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
608 | return LDObjectPtr(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
609 | |
784
f82ab4d3c7b4
- made LDDocument use shared pointers, this eliminates a lot of document-related crashes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
783
diff
changeset
|
610 | return document().toStrongRef()->getObject (idx - 1); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
611 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
612 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
613 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
614 | // |
776
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
615 | bool LDObject::previousIsInvertnext (LDBFCPtr& ptr) |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
616 | { |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
617 | LDObjectPtr prev (previous()); |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
618 | |
847 | 619 | if (prev != null and prev->type() == OBJ_BFC and |
620 | prev.staticCast<LDBFC>()->statement() == BFCStatement::InvertNext) | |
776
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
621 | { |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
622 | ptr = prev.staticCast<LDBFC>(); |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
623 | return true; |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
624 | } |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
625 | |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
626 | return false; |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
627 | } |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
628 | |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
629 | // ============================================================================= |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
630 | // |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
631 | void LDObject::move (Vertex vect) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
632 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
633 | if (hasMatrix()) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
634 | { |
769
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
635 | LDMatrixObjectPtr mo = self().toStrongRef().dynamicCast<LDMatrixObject>(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
636 | mo->setPosition (mo->position() + vect); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
637 | } |
786
71d786ce0dcc
- LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
784
diff
changeset
|
638 | elif (type() == OBJ_Vertex) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
639 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
640 | // ugh |
769
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
641 | self().toStrongRef().staticCast<LDVertex>()->pos += vect; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
642 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
643 | else |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
644 | { |
767
44f0d5322628
- slight refactor in ldobject methods
Santeri Piippo <crimsondusk64@gmail.com>
parents:
764
diff
changeset
|
645 | for (int i = 0; i < numVertices(); ++i) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
646 | setVertex (i, vertex (i) + vect); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
647 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
648 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
649 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
650 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
651 | // |
786
71d786ce0dcc
- LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
784
diff
changeset
|
652 | LDObjectPtr LDObject::getDefault (const LDObjectType type) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
653 | { |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
654 | switch (type) |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
655 | { |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
656 | case OBJ_Comment: return LDSpawn<LDComment>(); |
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
657 | case OBJ_BFC: return LDSpawn<LDBFC>(); |
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
658 | case OBJ_Line: return LDSpawn<LDLine>(); |
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
659 | case OBJ_CondLine: return LDSpawn<LDCondLine>(); |
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
660 | case OBJ_Subfile: return LDSpawn<LDSubfile>(); |
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
661 | case OBJ_Triangle: return LDSpawn<LDTriangle>(); |
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
662 | case OBJ_Quad: return LDSpawn<LDQuad>(); |
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
663 | case OBJ_Empty: return LDSpawn<LDEmpty>(); |
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
664 | case OBJ_Error: return LDSpawn<LDError>(); |
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
665 | case OBJ_Vertex: return LDSpawn<LDVertex>(); |
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
666 | case OBJ_Overlay: return LDSpawn<LDOverlay>(); |
786
71d786ce0dcc
- LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
784
diff
changeset
|
667 | case OBJ_NumTypes: assert (false); |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
668 | } |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
669 | return LDObjectPtr(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
670 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
671 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
672 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
673 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
674 | void LDObject::invert() {} |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
675 | void LDBFC::invert() {} |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
676 | void LDEmpty::invert() {} |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
677 | void LDComment::invert() {} |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
678 | void LDError::invert() {} |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
679 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
680 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
681 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
682 | void LDTriangle::invert() |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
683 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
684 | // Triangle goes 0 -> 1 -> 2, reversed: 0 -> 2 -> 1. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
685 | // Thus, we swap 1 and 2. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
686 | Vertex tmp = vertex (1); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
687 | setVertex (1, vertex (2)); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
688 | setVertex (2, tmp); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
689 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
690 | return; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
691 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
692 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
693 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
694 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
695 | void LDQuad::invert() |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
696 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
697 | // Quad: 0 -> 1 -> 2 -> 3 |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
698 | // rev: 0 -> 3 -> 2 -> 1 |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
699 | // Thus, we swap 1 and 3. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
700 | Vertex tmp = vertex (1); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
701 | setVertex (1, vertex (3)); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
702 | setVertex (3, tmp); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
703 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
704 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
705 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
706 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
707 | void LDSubfile::invert() |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
708 | { |
784
f82ab4d3c7b4
- made LDDocument use shared pointers, this eliminates a lot of document-related crashes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
783
diff
changeset
|
709 | if (document() == null) |
f82ab4d3c7b4
- made LDDocument use shared pointers, this eliminates a lot of document-related crashes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
783
diff
changeset
|
710 | return; |
f82ab4d3c7b4
- made LDDocument use shared pointers, this eliminates a lot of document-related crashes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
783
diff
changeset
|
711 | |
783
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
712 | // Check whether subfile is flat |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
713 | int axisSet = (1 << X) | (1 << Y) | (1 << Z); |
846
e4ad109f33c6
- use the untransformed subfile when testing whether a subfile is flat, otherwise it won't be considered flat if the subfile is rotated. or worse...
Teemu Piippo <crimsondusk64@gmail.com>
parents:
844
diff
changeset
|
714 | LDObjectList objs = fileInfo()->inlineContents (true, false); |
783
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
715 | |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
716 | for (LDObjectPtr obj : objs) |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
717 | { |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
718 | for (int i = 0; i < obj->numVertices(); ++i) |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
719 | { |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
720 | Vertex const& vrt = obj->vertex (i); |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
721 | |
840
d077dd19bf9a
- changed `&&` and `||` operators to their named variants `and` and `or`
Teemu Piippo <crimsondusk64@gmail.com>
parents:
835
diff
changeset
|
722 | if (axisSet & (1 << X) and vrt.x() != 0.0) |
783
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
723 | axisSet &= ~(1 << X); |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
724 | |
840
d077dd19bf9a
- changed `&&` and `||` operators to their named variants `and` and `or`
Teemu Piippo <crimsondusk64@gmail.com>
parents:
835
diff
changeset
|
725 | if (axisSet & (1 << Y) and vrt.y() != 0.0) |
783
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
726 | axisSet &= ~(1 << Y); |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
727 | |
840
d077dd19bf9a
- changed `&&` and `||` operators to their named variants `and` and `or`
Teemu Piippo <crimsondusk64@gmail.com>
parents:
835
diff
changeset
|
728 | if (axisSet & (1 << Z) and vrt.z() != 0.0) |
783
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
729 | axisSet &= ~(1 << Z); |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
730 | } |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
731 | |
783
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
732 | if (axisSet == 0) |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
733 | break; |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
734 | } |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
735 | |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
736 | if (axisSet != 0) |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
737 | { |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
738 | // Subfile has all vertices zero on one specific plane, so it is flat. |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
739 | // Let's flip it. |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
740 | Matrix matrixModifier = IdentityMatrix; |
783
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
741 | |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
742 | if (axisSet & (1 << X)) |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
743 | matrixModifier[0] = -1; |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
744 | |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
745 | if (axisSet & (1 << Y)) |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
746 | matrixModifier[4] = -1; |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
747 | |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
748 | if (axisSet & (1 << Z)) |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
749 | matrixModifier[8] = -1; |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
750 | |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
751 | setTransform (transform() * matrixModifier); |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
752 | return; |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
753 | } |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
754 | |
1db20d88650f
- subfile inverting now detects flatness and acts accordingly instead of naively applying invertnext to everything
Santeri Piippo <crimsondusk64@gmail.com>
parents:
776
diff
changeset
|
755 | // Subfile is not flat. Resort to invertnext. |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
756 | int idx = lineNumber(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
757 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
758 | if (idx > 0) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
759 | { |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
760 | LDBFCPtr bfc = previous().dynamicCast<LDBFC>(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
761 | |
847 | 762 | if (not bfc.isNull() and bfc->statement() == BFCStatement::InvertNext) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
763 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
764 | // This is prefixed with an invertnext, thus remove it. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
765 | bfc->destroy(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
766 | return; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
767 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
768 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
769 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
770 | // Not inverted, thus prefix it with a new invertnext. |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
771 | document().toStrongRef()->insertObj (idx, LDSpawn<LDBFC> (BFCStatement::InvertNext)); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
772 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
773 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
774 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
775 | // |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
776 | void LDLine::invert() |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
777 | { |
775
4661d6e83630
- don't crash when inverting conditional lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
773
diff
changeset
|
778 | // For lines, we swap the vertices. |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
779 | Vertex tmp = vertex (0); |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
780 | setVertex (0, vertex (1)); |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
781 | setVertex (1, tmp); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
782 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
783 | |
775
4661d6e83630
- don't crash when inverting conditional lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
773
diff
changeset
|
784 | // ============================================================================= |
4661d6e83630
- don't crash when inverting conditional lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
773
diff
changeset
|
785 | // |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
786 | void LDCondLine::invert() |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
787 | { |
775
4661d6e83630
- don't crash when inverting conditional lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
773
diff
changeset
|
788 | // I don't think that a conditional line's control points need to be |
4661d6e83630
- don't crash when inverting conditional lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
773
diff
changeset
|
789 | // swapped, do they? |
4661d6e83630
- don't crash when inverting conditional lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
773
diff
changeset
|
790 | Vertex tmp = vertex (0); |
4661d6e83630
- don't crash when inverting conditional lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
773
diff
changeset
|
791 | setVertex (0, vertex (1)); |
4661d6e83630
- don't crash when inverting conditional lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
773
diff
changeset
|
792 | setVertex (1, tmp); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
793 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
794 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
795 | void LDVertex::invert() {} |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
796 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
797 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
798 | // |
805
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
799 | LDLinePtr LDCondLine::toEdgeLine() |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
800 | { |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
801 | LDLinePtr replacement (LDSpawn<LDLine>()); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
802 | |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
803 | for (int i = 0; i < replacement->numVertices(); ++i) |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
804 | replacement->setVertex (i, vertex (i)); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
805 | |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
806 | replacement->setColor (color()); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
807 | |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
808 | replace (replacement); |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
809 | return replacement; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
810 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
811 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
812 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
813 | // |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
814 | LDObjectPtr LDObject::fromID (int id) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
815 | { |
769
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
816 | auto it = g_allObjects.find (id); |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
817 | |
769
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
818 | if (it != g_allObjects.end()) |
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
819 | return *it; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
820 | |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
821 | return LDObjectPtr(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
822 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
823 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
824 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
825 | // |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
826 | QString LDOverlay::asText() const |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
827 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
828 | return format ("0 !LDFORGE OVERLAY %1 %2 %3 %4 %5 %6", |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
829 | fileName(), camera(), x(), y(), width(), height()); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
830 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
831 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
832 | void LDOverlay::invert() {} |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
833 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
834 | // ============================================================================= |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
835 | // |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
836 | // Hook the set accessors of certain properties to this changeProperty function. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
837 | // It takes care of history management so we can capture low-level changes, this |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
838 | // makes history stuff work out of the box. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
839 | // |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
840 | template<typename T> |
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
841 | static void changeProperty (LDObjectPtr obj, T* ptr, const T& val) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
842 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
843 | long idx; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
844 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
845 | if (*ptr == val) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
846 | return; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
847 | |
840
d077dd19bf9a
- changed `&&` and `||` operators to their named variants `and` and `or`
Teemu Piippo <crimsondusk64@gmail.com>
parents:
835
diff
changeset
|
848 | if (obj->document() != null and (idx = obj->lineNumber()) != -1) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
849 | { |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
850 | QString before = obj->asText(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
851 | *ptr = val; |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
787
diff
changeset
|
852 | QString after = obj->asText(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
853 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
854 | if (before != after) |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
855 | { |
784
f82ab4d3c7b4
- made LDDocument use shared pointers, this eliminates a lot of document-related crashes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
783
diff
changeset
|
856 | obj->document().toStrongRef()->addToHistory (new EditHistory (idx, before, after)); |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
857 | g_win->R()->compileObject (obj); |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
858 | CurrentDocument()->redoVertices(); |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
859 | } |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
860 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
861 | else |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
862 | *ptr = val; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
863 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
864 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
865 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
866 | // |
795
195fa1fff9c3
- changed all color usage to use LDColor classes instead of color indices. Added support for direct colors.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
867 | void LDObject::setColor (LDColor const& val) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
868 | { |
769
8bb3bed44570
- improved shared pointer behavior, still not there yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
768
diff
changeset
|
869 | changeProperty (self(), &m_color, val); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
870 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
871 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
872 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
873 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
874 | const Vertex& LDObject::vertex (int i) const |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
875 | { |
805
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
876 | return m_coords[i]; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
877 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
878 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
879 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
880 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
881 | void LDObject::setVertex (int i, const Vertex& vert) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
882 | { |
805
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
883 | changeProperty (self(), &m_coords[i], vert); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
884 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
885 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
886 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
887 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
888 | void LDMatrixObject::setPosition (const Vertex& a) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
889 | { |
843
9ac9060877cc
- moved LDMatrixObject to be an abstract class deriving from LDObject. LDSubfile only inherits from LDMatrixObject.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
840
diff
changeset
|
890 | changeProperty (self(), &m_position, a); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
891 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
892 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
893 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
894 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
895 | void LDMatrixObject::setTransform (const Matrix& val) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
896 | { |
843
9ac9060877cc
- moved LDMatrixObject to be an abstract class deriving from LDObject. LDSubfile only inherits from LDMatrixObject.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
840
diff
changeset
|
897 | changeProperty (self(), &m_transform, val); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
898 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
899 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
900 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
901 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
902 | void LDObject::select() |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
903 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
904 | assert (document() != null); |
784
f82ab4d3c7b4
- made LDDocument use shared pointers, this eliminates a lot of document-related crashes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
783
diff
changeset
|
905 | document().toStrongRef()->addToSelection (self()); |
776
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
906 | |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
907 | // If this object is inverted with INVERTNEXT, pick the INVERTNEXT as well. |
892
49afb6b98253
- rewritten updateSelection() core loop, a new algorithm there makes selection updating a ton lot faster than before
Teemu Piippo <crimsondusk64@gmail.com>
parents:
890
diff
changeset
|
908 | /* |
776
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
909 | LDBFCPtr invertnext; |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
910 | |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
911 | if (previousIsInvertnext (invertnext)) |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
912 | invertnext->select(); |
892
49afb6b98253
- rewritten updateSelection() core loop, a new algorithm there makes selection updating a ton lot faster than before
Teemu Piippo <crimsondusk64@gmail.com>
parents:
890
diff
changeset
|
913 | */ |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
914 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
915 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
916 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
917 | // |
767
44f0d5322628
- slight refactor in ldobject methods
Santeri Piippo <crimsondusk64@gmail.com>
parents:
764
diff
changeset
|
918 | void LDObject::deselect() |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
919 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
920 | assert (document() != null); |
784
f82ab4d3c7b4
- made LDDocument use shared pointers, this eliminates a lot of document-related crashes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
783
diff
changeset
|
921 | document().toStrongRef()->removeFromSelection (self()); |
776
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
922 | |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
923 | // If this object is inverted with INVERTNEXT, deselect the INVERTNEXT as well. |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
924 | LDBFCPtr invertnext; |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
925 | |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
926 | if (previousIsInvertnext (invertnext)) |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
775
diff
changeset
|
927 | invertnext->deselect(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
928 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
929 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
930 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
931 | // |
848 | 932 | QString PreferredLicenseText() |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
933 | { |
848 | 934 | return (cfg::UseCALicense ? CALicenseText : ""); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
935 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
936 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
937 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
938 | // |
768
29e6c5552388
- initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
767
diff
changeset
|
939 | LDObjectPtr LDObject::createCopy() const |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
940 | { |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
857
diff
changeset
|
941 | LDObjectPtr copy = ParseLine (asText()); |
907
cf150959ccc4
- bfc stuff (at least it works now...)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
906
diff
changeset
|
942 | copy->setBlockWinding (blockWinding()); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
943 | return copy; |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
944 | } |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
945 | |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
946 | // ============================================================================= |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
947 | // |
784
f82ab4d3c7b4
- made LDDocument use shared pointers, this eliminates a lot of document-related crashes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
783
diff
changeset
|
948 | void LDSubfile::setFileInfo (const LDDocumentPtr& a) |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
949 | { |
854
403affd33c6e
- fixed: changing the document of a subfile wasn't recorded into history properly
Teemu Piippo <crimsondusk64@gmail.com>
parents:
852
diff
changeset
|
950 | changeProperty (self(), &m_fileInfo, a); |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
951 | |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
952 | // If it's an immediate subfile reference (i.e. this subfile belongs in an |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
953 | // explicit file), we need to pre-compile the GL polygons for the document |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
954 | // if they don't exist already. |
840
d077dd19bf9a
- changed `&&` and `||` operators to their named variants `and` and `or`
Teemu Piippo <crimsondusk64@gmail.com>
parents:
835
diff
changeset
|
955 | if (a != null and |
d077dd19bf9a
- changed `&&` and `||` operators to their named variants `and` and `or`
Teemu Piippo <crimsondusk64@gmail.com>
parents:
835
diff
changeset
|
956 | a->isImplicit() == false and |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
957 | a->polygonData().isEmpty()) |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
958 | { |
719
f2cc5964f52d
- sped up known vertex information gathering by an order of magnitude
Santeri Piippo <crimsondusk64@gmail.com>
parents:
717
diff
changeset
|
959 | a->initializeCachedData(); |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
960 | } |
835
268413885cb1
- reimplemented vertex tracking using a method similar to what the GL compiler uses
Teemu Piippo <crimsondusk64@gmail.com>
parents:
806
diff
changeset
|
961 | }; |
725
37b71daf4cb5
- added ability to draw with random colors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
724
diff
changeset
|
962 | |
835
268413885cb1
- reimplemented vertex tracking using a method similar to what the GL compiler uses
Teemu Piippo <crimsondusk64@gmail.com>
parents:
806
diff
changeset
|
963 | void LDObject::getVertices (QVector<Vertex>& verts) const |
268413885cb1
- reimplemented vertex tracking using a method similar to what the GL compiler uses
Teemu Piippo <crimsondusk64@gmail.com>
parents:
806
diff
changeset
|
964 | { |
268413885cb1
- reimplemented vertex tracking using a method similar to what the GL compiler uses
Teemu Piippo <crimsondusk64@gmail.com>
parents:
806
diff
changeset
|
965 | for (int i = 0; i < numVertices(); ++i) |
268413885cb1
- reimplemented vertex tracking using a method similar to what the GL compiler uses
Teemu Piippo <crimsondusk64@gmail.com>
parents:
806
diff
changeset
|
966 | verts << vertex (i); |
268413885cb1
- reimplemented vertex tracking using a method similar to what the GL compiler uses
Teemu Piippo <crimsondusk64@gmail.com>
parents:
806
diff
changeset
|
967 | } |
268413885cb1
- reimplemented vertex tracking using a method similar to what the GL compiler uses
Teemu Piippo <crimsondusk64@gmail.com>
parents:
806
diff
changeset
|
968 | |
268413885cb1
- reimplemented vertex tracking using a method similar to what the GL compiler uses
Teemu Piippo <crimsondusk64@gmail.com>
parents:
806
diff
changeset
|
969 | void LDSubfile::getVertices (QVector<Vertex>& verts) const |
268413885cb1
- reimplemented vertex tracking using a method similar to what the GL compiler uses
Teemu Piippo <crimsondusk64@gmail.com>
parents:
806
diff
changeset
|
970 | { |
268413885cb1
- reimplemented vertex tracking using a method similar to what the GL compiler uses
Teemu Piippo <crimsondusk64@gmail.com>
parents:
806
diff
changeset
|
971 | verts << fileInfo()->inlineVertices(); |
268413885cb1
- reimplemented vertex tracking using a method similar to what the GL compiler uses
Teemu Piippo <crimsondusk64@gmail.com>
parents:
806
diff
changeset
|
972 | } |
268413885cb1
- reimplemented vertex tracking using a method similar to what the GL compiler uses
Teemu Piippo <crimsondusk64@gmail.com>
parents:
806
diff
changeset
|
973 | |
268413885cb1
- reimplemented vertex tracking using a method similar to what the GL compiler uses
Teemu Piippo <crimsondusk64@gmail.com>
parents:
806
diff
changeset
|
974 | void LDVertex::getVertices (QVector<Vertex>& verts) const |
268413885cb1
- reimplemented vertex tracking using a method similar to what the GL compiler uses
Teemu Piippo <crimsondusk64@gmail.com>
parents:
806
diff
changeset
|
975 | { |
268413885cb1
- reimplemented vertex tracking using a method similar to what the GL compiler uses
Teemu Piippo <crimsondusk64@gmail.com>
parents:
806
diff
changeset
|
976 | verts.append (pos); |
268413885cb1
- reimplemented vertex tracking using a method similar to what the GL compiler uses
Teemu Piippo <crimsondusk64@gmail.com>
parents:
806
diff
changeset
|
977 | } |
907
cf150959ccc4
- bfc stuff (at least it works now...)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
906
diff
changeset
|
978 | |
cf150959ccc4
- bfc stuff (at least it works now...)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
906
diff
changeset
|
979 | void LDObject::setBlockWinding (Winding const& a) |
cf150959ccc4
- bfc stuff (at least it works now...)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
906
diff
changeset
|
980 | { |
cf150959ccc4
- bfc stuff (at least it works now...)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
906
diff
changeset
|
981 | if (m_blockWinding != a) |
cf150959ccc4
- bfc stuff (at least it works now...)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
906
diff
changeset
|
982 | g_win->R()->compileObject (self()); |
cf150959ccc4
- bfc stuff (at least it works now...)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
906
diff
changeset
|
983 | |
cf150959ccc4
- bfc stuff (at least it works now...)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
906
diff
changeset
|
984 | m_blockWinding = a; |
cf150959ccc4
- bfc stuff (at least it works now...)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
906
diff
changeset
|
985 | } |
cf150959ccc4
- bfc stuff (at least it works now...)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
906
diff
changeset
|
986 |