src/ldtypes.cpp

Sun, 07 Jul 2013 17:45:48 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Sun, 07 Jul 2013 17:45:48 +0300
changeset 359
bcdfc801658b
parent 357
9c954c222996
child 362
344fe1da32c8
permissions
-rw-r--r--

more restyle/refactor

183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2013 Santeri Piippo
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
4 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
9 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
14 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #include "common.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #include "ldtypes.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21 #include "file.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 #include "misc.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23 #include "gui.h"
192
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
24 #include "history.h"
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 194
diff changeset
25 #include "gldraw.h"
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26
306
fef00a6cbff0 minor improvements to primitive handling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
27 // List of all LDObjects
fef00a6cbff0 minor improvements to primitive handling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
28 vector<LDObject*> g_LDObjects;
fef00a6cbff0 minor improvements to primitive handling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
29
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 // LDObject constructors
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
34 LDObject::LDObject()
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
35 {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 qObjListEntry = null;
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
37 setParent( null );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38 m_hidden = false;
185
6fea53f1ffc2 Speed up picking - no need to rebuild the object list as its contents do not change while picking. Fixed transparent stuff always being opaque (although it still appears messed up for some reason)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 183
diff changeset
39 m_selected = false;
216
c8882ff62d61 Hopefully fixed the problem regarding objects not getting drawn at first
Santeri Piippo <crimsondusk64@gmail.com>
parents: 214
diff changeset
40 m_glinit = false;
306
fef00a6cbff0 minor improvements to primitive handling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
41
fef00a6cbff0 minor improvements to primitive handling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
42 // Determine ID
fef00a6cbff0 minor improvements to primitive handling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
43 int id = 1; // 0 is invalid
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
44
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
45 for( LDObject * obj : g_LDObjects )
306
fef00a6cbff0 minor improvements to primitive handling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
46 if( obj->id() >= id )
fef00a6cbff0 minor improvements to primitive handling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
47 id = obj->id() + 1;
fef00a6cbff0 minor improvements to primitive handling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
48
fef00a6cbff0 minor improvements to primitive handling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
49 setID( id );
307
c731a22899a3 Use unique IDs instead of file indices in picking lists, this is much less prone to error
Santeri Piippo <crimsondusk64@gmail.com>
parents: 306
diff changeset
50
c731a22899a3 Use unique IDs instead of file indices in picking lists, this is much less prone to error
Santeri Piippo <crimsondusk64@gmail.com>
parents: 306
diff changeset
51 g_LDObjects << this;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
52 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
54 LDGibberish::LDGibberish() {}
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
55 LDGibberish::LDGibberish( str contents, str reason ) : contents( contents ), reason( reason ) {}
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
57 // =============================================================================
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
58 str LDComment::raw()
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
59 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
60 return fmt( "0 %1", text );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
61 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
62
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
63 str LDSubfile::raw()
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
64 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
65 str val = fmt( "1 %1 %2 ", color(), position() );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
66 val += transform().stringRep();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
67 val += ' ';
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
68 val += fileInfo()->name();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
69 return val;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
70 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
71
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
72 str LDLine::raw()
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
73 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
74 str val = fmt( "2 %1", color() );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
75
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
76 for( ushort i = 0; i < 2; ++i )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
77 val += fmt( " %1", getVertex( i ) );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
78
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
79 return val;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
80 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
81
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
82 str LDTriangle::raw()
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
83 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
84 str val = fmt( "3 %1", color() );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
85
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
86 for( ushort i = 0; i < 3; ++i )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
87 val += fmt( " %1", getVertex( i ) );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
88
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
89 return val;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
90 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
91
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
92 str LDQuad::raw()
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
93 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
94 str val = fmt( "4 %1", color() );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
95
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
96 for( ushort i = 0; i < 4; ++i )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
97 val += fmt( " %1", getVertex( i ) );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
98
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
99 return val;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
100 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
101
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
102 str LDCondLine::raw()
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
103 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
104 str val = fmt( "5 %1", color() );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
105
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
106 // Add the coordinates
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
107 for( ushort i = 0; i < 4; ++i )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
108 val += fmt( " %1", getVertex( i ) );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
109
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
110 return val;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
111 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
112
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
113 str LDGibberish::raw()
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
114 {
188
4e686b771996 Further removal of hungarian notation
Santeri Piippo <crimsondusk64@gmail.com>
parents: 185
diff changeset
115 return contents;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
116 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
117
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
118 str LDVertex::raw()
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
119 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
120 return fmt( "0 !LDFORGE VERTEX %1 %2", color(), pos );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
121 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
122
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
123 str LDEmpty::raw()
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
124 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
125 return "";
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
126 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
127
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
128 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
130 // =============================================================================
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
131 const char* LDBFC::statements[] =
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
132 {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
133 "CERTIFY CCW",
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
134 "CCW",
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
135 "CERTIFY CW",
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
136 "CW",
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
137 "NOCERTIFY",
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
138 "INVERTNEXT",
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
139 };
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
140
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
141 str LDBFC::raw()
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
142 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
143 return fmt( "0 BFC %1", LDBFC::statements[type] );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
144 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
145
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
146 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
148 // =============================================================================
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
149 vector<LDTriangle*> LDQuad::splitToTriangles()
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
150 {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
151 // Create the two triangles based on this quadrilateral:
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
152 // 0---3 0---3 3
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
153 // | | | / /|
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
154 // | | = | / / |
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
155 // | | |/ / |
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
156 // 1---2 1 1---2
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
157 LDTriangle* tri1 = new LDTriangle( getVertex( 0 ), getVertex( 1 ), getVertex( 3 ) );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
158 LDTriangle* tri2 = new LDTriangle( getVertex( 1 ), getVertex( 2 ), getVertex( 3 ) );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
159
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
160 // The triangles also inherit the quad's color
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
161 tri1->setColor( color() );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
162 tri2->setColor( color() );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
163
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
164 vector<LDTriangle*> triangles;
252
3f9067022d74 Take the aforementioned operator<< into use
Santeri Piippo <crimsondusk64@gmail.com>
parents: 251
diff changeset
165 triangles << tri1;
3f9067022d74 Take the aforementioned operator<< into use
Santeri Piippo <crimsondusk64@gmail.com>
parents: 251
diff changeset
166 triangles << tri2;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
167 return triangles;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
168 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
169
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
170 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
172 // =============================================================================
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
173 void LDObject::replace( LDObject* replacement )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
174 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
175 long idx = getIndex( g_curfile );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
176 assert( idx != -1 );
276
a21e49914264 Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents: 275
diff changeset
177
214
28e0b37156be Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents: 211
diff changeset
178 // Replace the instance of the old object with the new object
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
179 g_curfile->setObject( idx, replacement );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
180
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
181 // Remove the old object
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
182 delete this;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
183 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
184
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
185 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
187 // =============================================================================
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
188 void LDObject::swap( LDObject* other )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
189 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
190 for( LDObject*& obj : *g_curfile )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
191 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
192 if( obj == this )
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
193 obj = other;
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
194 elif( obj == other )
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
195 obj = this;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
196 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
197 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
198
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
199 LDLine::LDLine( vertex v1, vertex v2 )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
200 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
201 setVertex( 0, v1 );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
202 setVertex( 1, v2 );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
203 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
204
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
205 LDObject::~LDObject()
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
206 {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
207 // Remove this object from the selection array if it is there.
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
208 for( ulong i = 0; i < g_win->sel().size(); ++i )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
209 if( g_win->sel()[i] == this )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
210 g_win->sel().erase( i );
194
cfe9ae5f1124 Fixed coordconv3_2 algorithm, plane drawing works on any of the fixed cameras now.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
211
cfe9ae5f1124 Fixed coordconv3_2 algorithm, plane drawing works on any of the fixed cameras now.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
212 // Delete the GL lists
307
c731a22899a3 Use unique IDs instead of file indices in picking lists, this is much less prone to error
Santeri Piippo <crimsondusk64@gmail.com>
parents: 306
diff changeset
213 GL::deleteLists( this );
c731a22899a3 Use unique IDs instead of file indices in picking lists, this is much less prone to error
Santeri Piippo <crimsondusk64@gmail.com>
parents: 306
diff changeset
214
c731a22899a3 Use unique IDs instead of file indices in picking lists, this is much less prone to error
Santeri Piippo <crimsondusk64@gmail.com>
parents: 306
diff changeset
215 // Remove this object from the list of LDObjects
c731a22899a3 Use unique IDs instead of file indices in picking lists, this is much less prone to error
Santeri Piippo <crimsondusk64@gmail.com>
parents: 306
diff changeset
216 ulong pos = g_LDObjects.find( this );
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
217
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
218 if( pos < g_LDObjects.size() )
307
c731a22899a3 Use unique IDs instead of file indices in picking lists, this is much less prone to error
Santeri Piippo <crimsondusk64@gmail.com>
parents: 306
diff changeset
219 g_LDObjects.erase( pos );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
220 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
221
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
222 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
224 // =============================================================================
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
225 static void transformObject( LDObject* obj, matrix transform, vertex pos, short parentcolor )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
226 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
227 switch( obj->getType() )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
228 {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
229 case LDObject::Line:
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
230 case LDObject::CondLine:
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
231 case LDObject::Triangle:
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
232 case LDObject::Quad:
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
233 for( short i = 0; i < obj->vertices(); ++i )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
234 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
235 vertex v = obj->getVertex( i );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
236 v.transform( transform, pos );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
237 obj->setVertex( i, v );
276
a21e49914264 Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents: 275
diff changeset
238 }
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
239 break;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
240
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
241 case LDObject::Subfile:
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
242 {
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
243 LDSubfile* ref = static_cast<LDSubfile*>( obj );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
244 matrix newMatrix = transform * ref->transform();
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
245 vertex newpos = ref->position();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
246
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
247 newpos.transform( transform, pos );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
248 ref->setPosition( newpos );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
249 ref->setTransform( newMatrix );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
250 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
251 break;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
252
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
253 default:
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
254 break;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
255 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
256
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
257 if( obj->color() == maincolor )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
258 obj->setColor( parentcolor );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
259 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
260
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
261 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
263 // =============================================================================
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
264 vector<LDObject*> LDSubfile::inlineContents( bool deep, bool cache )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
265 {
250
6e80f038e8df Make LDOpenFile's members PROPERTIES
Santeri Piippo <crimsondusk64@gmail.com>
parents: 232
diff changeset
266 vector<LDObject*> objs, objcache;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
267
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
268 // If we have this cached, just clone that
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
269 if( deep && fileInfo()->cache().size() )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
270 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
271 for( LDObject * obj : fileInfo()->cache() )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
272 objs << obj->clone();
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
273 }
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
274 else
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
275 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
276 if( !deep )
250
6e80f038e8df Make LDOpenFile's members PROPERTIES
Santeri Piippo <crimsondusk64@gmail.com>
parents: 232
diff changeset
277 cache = false;
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
278
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
279 for( LDObject * obj : *fileInfo() )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
280 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
281 // Skip those without scemantic meaning
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
282 if( !obj->isScemantic() )
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
283 continue;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
284
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
285 // Got another sub-file reference, inline it if we're deep-inlining. If not,
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
286 // just add it into the objects normally. Also, we only cache immediate
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
287 // subfiles and this is not one. Yay, recursion!
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
288 if( deep && obj->getType() == LDObject::Subfile )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
289 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
290 LDSubfile* ref = static_cast<LDSubfile*>( obj );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
291
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
292 vector<LDObject*> otherobjs = ref->inlineContents( true, false );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
293
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
294 for( LDObject * otherobj : otherobjs )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
295 {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
296 // Cache this object, if desired
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
297 if( cache )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
298 objcache << otherobj->clone();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
299
252
3f9067022d74 Take the aforementioned operator<< into use
Santeri Piippo <crimsondusk64@gmail.com>
parents: 251
diff changeset
300 objs << otherobj;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
301 }
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
302 }
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
303 else
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
304 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
305 if( cache )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
306 objcache << obj->clone();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
307
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
308 objs << obj->clone();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
309 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
310 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
311
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
312 if( cache )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
313 fileInfo()->setCache( objcache );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
314 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
315
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
316 // Transform the objects
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
317 for( LDObject * obj : objs )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
318 {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
319 // Set the parent now so we know what inlined this.
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
320 obj->setParent( this );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
321
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
322 transformObject( obj, transform(), position(), color() );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
323 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
324
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
325 return objs;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
326 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
327
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
328 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
329 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
330 // =============================================================================
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
331 long LDObject::getIndex( LDOpenFile* file ) const
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
332 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
333 for( ulong i = 0; i < file->numObjs(); ++i )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
334 if( file->obj( i ) == this )
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
335 return i;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
336
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
337 return -1;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
338 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
339
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
340 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
341 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
342 // =============================================================================
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
343 void LDObject::moveObjects( vector<LDObject*> objs, const bool up )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
344 {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
345 // If we move down, we need to iterate the array in reverse order.
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
346 const long start = up ? 0 : ( objs.size() - 1 );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
347 const long end = up ? objs.size() : -1;
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
348 const long incr = up ? 1 : -1;
217
cad8c046f27a Fixed: moving objects up/down the object list messed up selection
Santeri Piippo <crimsondusk64@gmail.com>
parents: 216
diff changeset
349 vector<LDObject*> objsToCompile;
cad8c046f27a Fixed: moving objects up/down the object list messed up selection
Santeri Piippo <crimsondusk64@gmail.com>
parents: 216
diff changeset
350
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
351 for( long i = start; i != end; i += incr )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
352 {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
353 LDObject* obj = objs[i];
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
354
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
355 const long idx = obj->getIndex( g_curfile ),
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
356 target = idx + ( up ? -1 : 1 );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
357
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
358 if(( up && idx == 0 ) || ( !up && idx == (long) ( g_curfile->objs().size() - 1 )) )
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
359 {
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
360 // One of the objects hit the extrema. If this happens, this should be the first
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
361 // object to be iterated on. Thus, nothing has changed yet and it's safe to just
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
362 // abort the entire operation.
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
363 assert( i == start );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
364 return;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
365 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
366
252
3f9067022d74 Take the aforementioned operator<< into use
Santeri Piippo <crimsondusk64@gmail.com>
parents: 251
diff changeset
367 objsToCompile << obj;
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
368 objsToCompile << g_curfile->obj( target );
217
cad8c046f27a Fixed: moving objects up/down the object list messed up selection
Santeri Piippo <crimsondusk64@gmail.com>
parents: 216
diff changeset
369
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
370 obj->swap( g_curfile->obj( target ) );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
371 }
217
cad8c046f27a Fixed: moving objects up/down the object list messed up selection
Santeri Piippo <crimsondusk64@gmail.com>
parents: 216
diff changeset
372
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
373 objsToCompile.makeUnique();
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
374
217
cad8c046f27a Fixed: moving objects up/down the object list messed up selection
Santeri Piippo <crimsondusk64@gmail.com>
parents: 216
diff changeset
375 // The objects need to be recompiled, otherwise their pick lists are left with
cad8c046f27a Fixed: moving objects up/down the object list messed up selection
Santeri Piippo <crimsondusk64@gmail.com>
parents: 216
diff changeset
376 // the wrong index colors which messes up selection.
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
377 for( LDObject * obj : objsToCompile )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
378 g_win->R()->compileObject( obj );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
379 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
380
357
9c954c222996 Removed the two string arrays containing object types and icon names, moved these as LDObjects' virtual functions
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
381 str LDObject::typeName( LDObject::Type type )
9c954c222996 Removed the two string arrays containing object types and icon names, moved these as LDObjects' virtual functions
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
382 {
9c954c222996 Removed the two string arrays containing object types and icon names, moved these as LDObjects' virtual functions
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
383 LDObject* obj = LDObject::getDefault( type );
9c954c222996 Removed the two string arrays containing object types and icon names, moved these as LDObjects' virtual functions
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
384 str name = obj->typeName();
9c954c222996 Removed the two string arrays containing object types and icon names, moved these as LDObjects' virtual functions
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
385 delete obj;
9c954c222996 Removed the two string arrays containing object types and icon names, moved these as LDObjects' virtual functions
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
386 return name;
9c954c222996 Removed the two string arrays containing object types and icon names, moved these as LDObjects' virtual functions
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
387 }
9c954c222996 Removed the two string arrays containing object types and icon names, moved these as LDObjects' virtual functions
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
388
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
389 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
390 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
391 // =============================================================================
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
392 str LDObject::objectListContents( const vector<LDObject*>& objs )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
393 {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
394 bool firstDetails = true;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
395 str text = "";
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
396
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
397 if( objs.size() == 0 )
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
398 return "nothing"; // :)
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
399
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
400 for( long i = 0; i < LDObject::NumTypes; ++i )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
401 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
402 LDObject::Type objType = ( LDObject::Type ) i;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
403 ulong objCount = 0;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
404
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
405 for( LDObject * obj : objs )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
406 if( obj->getType() == objType )
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
407 objCount++;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
408
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
409 if( objCount == 0 )
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
410 continue;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
411
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
412 if( !firstDetails )
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
413 text += ", ";
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
414
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
415 str noun = fmt( "%1%2", typeName( objType ), plural( objCount ) );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
416
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
417 // Plural of "vertex" is "vertices". Stupid English.
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
418 if( objType == LDObject::Vertex && objCount != 1 )
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
419 noun = "vertices";
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
420
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
421 text += fmt( "%1 %2", objCount, noun );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
422 firstDetails = false;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
423 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
424
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
425 return text;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
426 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
427
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
428 // =============================================================================
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
429 LDObject* LDObject::topLevelParent()
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
430 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
431 if( !parent() )
191
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
432 return this;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
433
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
434 LDObject* it = this;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
435
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
436 while( it->parent() )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
437 it = it->parent();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
438
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
439 return it;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
440 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
441
191
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
442 // =============================================================================
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
443 LDObject* LDObject::next() const
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
444 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
445 long idx = getIndex( g_curfile );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
446 assert( idx != -1 );
191
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
447
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
448 if( idx == ( long ) g_curfile->numObjs() - 1 )
191
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
449 return null;
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
450
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
451 return g_curfile->obj( idx + 1 );
191
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
452 }
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
453
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
454 // =============================================================================
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
455 LDObject* LDObject::prev() const
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
456 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
457 long idx = getIndex( g_curfile );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
458 assert( idx != -1 );
191
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
459
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
460 if( idx == 0 )
191
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
461 return null;
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
462
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
463 return g_curfile->obj( idx - 1 );
191
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
464 }
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
465
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
466 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
467 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
468 // =============================================================================
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
469 void LDObject::move( vertex vect ) { (void) vect; }
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
470 void LDEmpty::move( vertex vect ) { (void) vect; }
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
471 void LDBFC::move( vertex vect ) { (void) vect; }
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
472 void LDComment::move( vertex vect ) { (void) vect; }
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
473 void LDGibberish::move( vertex vect ) { (void) vect; }
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
474
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
475 void LDVertex::move( vertex vect )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
476 {
191
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
477 pos += vect;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
478 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
479
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
480 void LDSubfile::move( vertex vect )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
481 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
482 setPosition( position() + vect );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
483 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
484
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
485 void LDLine::move( vertex vect )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
486 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
487 for( short i = 0; i < 2; ++i )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
488 setVertex( i, getVertex( i ) + vect );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
489 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
490
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
491 void LDTriangle::move( vertex vect )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
492 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
493 for( short i = 0; i < 3; ++i )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
494 setVertex( i, getVertex( i ) + vect );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
495 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
496
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
497 void LDQuad::move( vertex vect )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
498 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
499 for( short i = 0; i < 4; ++i )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
500 setVertex( i, getVertex( i ) + vect );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
501 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
502
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
503 void LDCondLine::move( vertex vect )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
504 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
505 for( short i = 0; i < 4; ++i )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
506 setVertex( i, getVertex( i ) + vect );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
507 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
508
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
509 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
510 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
511 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
512 #define CHECK_FOR_OBJ(N) \
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
513 if( type == LDObject::N ) \
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
514 return new LD##N;
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
515
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
516 LDObject* LDObject::getDefault( const LDObject::Type type )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
517 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
518 CHECK_FOR_OBJ( Comment )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
519 CHECK_FOR_OBJ( BFC )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
520 CHECK_FOR_OBJ( Line )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
521 CHECK_FOR_OBJ( CondLine )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
522 CHECK_FOR_OBJ( Subfile )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
523 CHECK_FOR_OBJ( Triangle )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
524 CHECK_FOR_OBJ( Quad )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
525 CHECK_FOR_OBJ( Empty )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
526 CHECK_FOR_OBJ( BFC )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
527 CHECK_FOR_OBJ( Gibberish )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
528 CHECK_FOR_OBJ( Vertex )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
529 CHECK_FOR_OBJ( Overlay )
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
530 return null;
192
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
531 }
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
532
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
533 // =============================================================================
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
534 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
535 // =============================================================================
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
536 void LDObject::invert() {}
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
537 void LDBFC::invert() {}
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
538 void LDEmpty::invert() {}
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
539 void LDComment::invert() {}
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
540 void LDGibberish::invert() {}
192
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
541
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
542 void LDTriangle::invert()
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
543 {
192
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
544 // Triangle goes 0 -> 1 -> 2, reversed: 0 -> 2 -> 1.
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
545 // Thus, we swap 1 and 2.
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
546 vertex tmp = getVertex( 1 );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
547 setVertex( 1, getVertex( 2 ) );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
548 setVertex( 2, tmp );
192
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
549
265
955c0aabfebf Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
550 return;
192
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
551 }
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
552
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
553 void LDQuad::invert()
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
554 {
192
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
555 // Quad: 0 -> 1 -> 2 -> 3
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
556 // rev: 0 -> 3 -> 2 -> 1
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
557 // Thus, we swap 1 and 3.
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
558 vertex tmp = getVertex( 1 );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
559 setVertex( 1, getVertex( 3 ) );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
560 setVertex( 3, tmp );
192
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
561 }
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
562
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
563 void LDSubfile::invert()
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
564 {
312
97620579d86c Nuked the obsolete radial type now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 311
diff changeset
565 // Subfiles are inverted when they're prefixed with
192
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
566 // a BFC INVERTNEXT statement. Thus we need to toggle this status.
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
567 // For flat primitives it's sufficient that the determinant is
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
568 // flipped but I don't have a method for checking flatness yet.
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
569 // Food for thought...
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
570
312
97620579d86c Nuked the obsolete radial type now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 311
diff changeset
571 ulong idx = getIndex( g_curfile );
192
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
572
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
573 if( idx > 0 )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
574 {
312
97620579d86c Nuked the obsolete radial type now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 311
diff changeset
575 LDBFC* bfc = dynamic_cast<LDBFC*>( prev() );
192
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
576
312
97620579d86c Nuked the obsolete radial type now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 311
diff changeset
577 if( bfc && bfc->type == LDBFC::InvertNext )
97620579d86c Nuked the obsolete radial type now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 311
diff changeset
578 {
97620579d86c Nuked the obsolete radial type now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 311
diff changeset
579 // This is prefixed with an invertnext, thus remove it.
97620579d86c Nuked the obsolete radial type now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 311
diff changeset
580 g_curfile->forgetObject( bfc );
192
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
581 delete bfc;
265
955c0aabfebf Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
582 return;
192
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
583 }
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
584 }
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
585
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
586 // Not inverted, thus prefix it with a new invertnext.
312
97620579d86c Nuked the obsolete radial type now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 311
diff changeset
587 LDBFC* bfc = new LDBFC( LDBFC::InvertNext );
97620579d86c Nuked the obsolete radial type now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 311
diff changeset
588 g_curfile->insertObj( idx, bfc );
192
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
589 }
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
590
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
591 static void invertLine( LDObject* line )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
592 {
192
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
593 // For lines, we swap the vertices. I don't think that a
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
594 // cond-line's control points need to be swapped, do they?
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
595 vertex tmp = line->getVertex( 0 );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
596 line->setVertex( 0, line->getVertex( 1 ) );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
597 line->setVertex( 1, tmp );
192
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
598 }
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
599
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
600 void LDLine::invert()
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
601 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
602 invertLine( this );
192
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
603 }
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
604
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
605 void LDCondLine::invert()
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
606 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
607 invertLine( this );
192
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
608 }
c414924a647c Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 191
diff changeset
609
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
610 void LDVertex::invert() {}
214
28e0b37156be Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents: 211
diff changeset
611
28e0b37156be Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents: 211
diff changeset
612 // =============================================================================
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
613 LDLine* LDCondLine::demote()
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
614 {
214
28e0b37156be Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents: 211
diff changeset
615 LDLine* repl = new LDLine;
276
a21e49914264 Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents: 275
diff changeset
616
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
617 for( int i = 0; i < repl->vertices(); ++i )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
618 repl->setVertex( i, getVertex( i ) );
276
a21e49914264 Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents: 275
diff changeset
619
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
620 repl->setColor( color() );
214
28e0b37156be Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents: 211
diff changeset
621
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
622 replace( repl );
214
28e0b37156be Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents: 211
diff changeset
623 return repl;
275
7b5afec27688 Color changing is now logged into history
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
624 }
7b5afec27688 Color changing is now logged into history
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
625
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
626 LDObject* LDObject::fromID( int id )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
627 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
628 for( LDObject * obj : g_LDObjects )
307
c731a22899a3 Use unique IDs instead of file indices in picking lists, this is much less prone to error
Santeri Piippo <crimsondusk64@gmail.com>
parents: 306
diff changeset
629 if( obj->id() == id )
c731a22899a3 Use unique IDs instead of file indices in picking lists, this is much less prone to error
Santeri Piippo <crimsondusk64@gmail.com>
parents: 306
diff changeset
630 return obj;
c731a22899a3 Use unique IDs instead of file indices in picking lists, this is much less prone to error
Santeri Piippo <crimsondusk64@gmail.com>
parents: 306
diff changeset
631
c731a22899a3 Use unique IDs instead of file indices in picking lists, this is much less prone to error
Santeri Piippo <crimsondusk64@gmail.com>
parents: 306
diff changeset
632 return null;
c731a22899a3 Use unique IDs instead of file indices in picking lists, this is much less prone to error
Santeri Piippo <crimsondusk64@gmail.com>
parents: 306
diff changeset
633 }
c731a22899a3 Use unique IDs instead of file indices in picking lists, this is much less prone to error
Santeri Piippo <crimsondusk64@gmail.com>
parents: 306
diff changeset
634
316
b4fefda58f43 Made overlay data be contained in the part files, still wip
Santeri Piippo <crimsondusk64@gmail.com>
parents: 312
diff changeset
635 // =============================================================================
b4fefda58f43 Made overlay data be contained in the part files, still wip
Santeri Piippo <crimsondusk64@gmail.com>
parents: 312
diff changeset
636 str LDOverlay::raw()
b4fefda58f43 Made overlay data be contained in the part files, still wip
Santeri Piippo <crimsondusk64@gmail.com>
parents: 312
diff changeset
637 {
b4fefda58f43 Made overlay data be contained in the part files, still wip
Santeri Piippo <crimsondusk64@gmail.com>
parents: 312
diff changeset
638 return fmt( "0 !LDFORGE OVERLAY %1 %2 %3 %4 %5 %6",
b4fefda58f43 Made overlay data be contained in the part files, still wip
Santeri Piippo <crimsondusk64@gmail.com>
parents: 312
diff changeset
639 filename(), camera(), x(), y(), width(), height() );
b4fefda58f43 Made overlay data be contained in the part files, still wip
Santeri Piippo <crimsondusk64@gmail.com>
parents: 312
diff changeset
640 }
b4fefda58f43 Made overlay data be contained in the part files, still wip
Santeri Piippo <crimsondusk64@gmail.com>
parents: 312
diff changeset
641
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
642 void LDOverlay::move( vertex vect )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
643 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
644 Q_UNUSED( vect )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
645 }
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
646
316
b4fefda58f43 Made overlay data be contained in the part files, still wip
Santeri Piippo <crimsondusk64@gmail.com>
parents: 312
diff changeset
647 void LDOverlay::invert() {}
307
c731a22899a3 Use unique IDs instead of file indices in picking lists, this is much less prone to error
Santeri Piippo <crimsondusk64@gmail.com>
parents: 306
diff changeset
648
276
a21e49914264 Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents: 275
diff changeset
649 // =============================================================================
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
650 template<class T> void changeProperty( LDObject* obj, T* ptr, const T& val )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
651 {
275
7b5afec27688 Color changing is now logged into history
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
652 long idx;
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
653
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
654 if(( idx = obj->getIndex( g_curfile )) != -1 )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
655 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
656 str before = obj->raw();
276
a21e49914264 Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents: 275
diff changeset
657 *ptr = val;
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
658 str after = obj->raw();
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
659
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
660 g_curfile->addToHistory( new EditHistory( idx, before, after ) );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
661 }
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
662 else
276
a21e49914264 Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents: 275
diff changeset
663 *ptr = val;
a21e49914264 Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents: 275
diff changeset
664 }
a21e49914264 Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents: 275
diff changeset
665
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
666 READ_ACCESSOR( short, LDObject::color )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
667 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
668 return m_color;
276
a21e49914264 Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents: 275
diff changeset
669 }
a21e49914264 Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents: 275
diff changeset
670
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
671 SET_ACCESSOR( short, LDObject::setColor )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
672 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
673 changeProperty( this, &m_color, val );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
674 }
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
675
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
676 const vertex& LDObject::getVertex( int i ) const
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
677 {
276
a21e49914264 Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents: 275
diff changeset
678 return m_coords[i];
a21e49914264 Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents: 275
diff changeset
679 }
a21e49914264 Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents: 275
diff changeset
680
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
681 void LDObject::setVertex( int i, const vertex& vert )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
682 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
683 changeProperty( this, &m_coords[i], vert );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
684 }
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
685
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
686 READ_ACCESSOR( vertex, LDMatrixObject::position )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
687 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
688 return m_position;
276
a21e49914264 Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents: 275
diff changeset
689 }
a21e49914264 Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents: 275
diff changeset
690
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
691 SET_ACCESSOR( vertex, LDMatrixObject::setPosition )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
692 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
693 changeProperty( linkPointer(), &m_position, val );
276
a21e49914264 Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents: 275
diff changeset
694 }
a21e49914264 Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents: 275
diff changeset
695
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
696 READ_ACCESSOR( matrix, LDMatrixObject::transform )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
697 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
698 return m_transform;
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
699 }
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
700
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
701 SET_ACCESSOR( matrix, LDMatrixObject::setTransform )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
702 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
703 changeProperty( linkPointer(), &m_transform, val );
214
28e0b37156be Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents: 211
diff changeset
704 }

mercurial