src/miscallenous.cpp

changeset 1012
413ecd6b9801
parent 1005
a88cf5a32246
child 1013
fa025ba493d8
child 1215
77a0270352a3
equal deleted inserted replaced
1011:4fdd74a04790 1012:413ecd6b9801
98 ConfigOption (int RotationPointType = 0) 98 ConfigOption (int RotationPointType = 0)
99 ConfigOption (Vertex CustomRotationPoint = Origin) 99 ConfigOption (Vertex CustomRotationPoint = Origin)
100 100
101 float gridCoordinateSnap() 101 float gridCoordinateSnap()
102 { 102 {
103 ConfigurationValueBag* config = g_win->configBag(); 103 switch (Config->grid())
104 104 {
105 switch (config->grid()) 105 case Grid::Coarse: return Config->gridCoarseCoordinateSnap();
106 { 106 case Grid::Medium: return Config->gridMediumCoordinateSnap();
107 case Grid::Coarse: return config->gridCoarseCoordinateSnap(); 107 case Grid::Fine: return Config->gridFineCoordinateSnap();
108 case Grid::Medium: return config->gridMediumCoordinateSnap();
109 case Grid::Fine: return config->gridFineCoordinateSnap();
110 } 108 }
111 109
112 return 1.0f; 110 return 1.0f;
113 } 111 }
114 112
115 float gridAngleSnap() 113 float gridAngleSnap()
116 { 114 {
117 ConfigurationValueBag* config = g_win->configBag(); 115 switch (Config->grid())
118 116 {
119 switch (config->grid()) 117 case Grid::Coarse: return Config->gridCoarseAngleSnap();
120 { 118 case Grid::Medium: return Config->gridMediumAngleSnap();
121 case Grid::Coarse: return config->gridCoarseAngleSnap(); 119 case Grid::Fine: return Config->gridFineAngleSnap();
122 case Grid::Medium: return config->gridMediumAngleSnap();
123 case Grid::Fine: return config->gridFineAngleSnap();
124 } 120 }
125 121
126 return 45.0f; 122 return 45.0f;
127 } 123 }
128 124
129 float gridBezierCurveSegments() 125 float gridBezierCurveSegments()
130 { 126 {
131 ConfigurationValueBag* config = g_win->configBag(); 127 switch (Config->grid())
132
133 switch (config->grid())
134 { 128 {
135 default: 129 default:
136 case Grid::Coarse: return config->gridCoarseBezierCurveSegments(); 130 case Grid::Coarse: return Config->gridCoarseBezierCurveSegments();
137 case Grid::Medium: return config->gridMediumBezierCurveSegments(); 131 case Grid::Medium: return Config->gridMediumBezierCurveSegments();
138 case Grid::Fine: return config->gridFineBezierCurveSegments(); 132 case Grid::Fine: return Config->gridFineBezierCurveSegments();
139 } 133 }
140 } 134 }
141 135
142 // ============================================================================= 136 // =============================================================================
143 // 137 //
188 182
189 // ============================================================================= 183 // =============================================================================
190 // 184 //
191 Vertex GetRotationPoint (const LDObjectList& objs) 185 Vertex GetRotationPoint (const LDObjectList& objs)
192 { 186 {
193 switch (RotationPoint (g_win->configBag()->rotationPointType())) 187 switch (RotationPoint (Config->rotationPointType()))
194 { 188 {
195 case RotationPoint::ObjectOrigin: 189 case RotationPoint::ObjectOrigin:
196 { 190 {
197 LDBoundingBox box; 191 LDBoundingBox box;
198 192
210 204
211 case RotationPoint::WorldOrigin: 205 case RotationPoint::WorldOrigin:
212 return Origin; 206 return Origin;
213 207
214 case RotationPoint::CustomPoint: 208 case RotationPoint::CustomPoint:
215 return g_win->configBag()->customRotationPoint(); 209 return Config->customRotationPoint();
216 210
217 case RotationPoint::NumValues: 211 case RotationPoint::NumValues:
218 break; 212 break;
219 } 213 }
220 214
227 { 221 {
228 QDialog* dlg = new QDialog; 222 QDialog* dlg = new QDialog;
229 Ui::RotPointUI ui; 223 Ui::RotPointUI ui;
230 ui.setupUi (dlg); 224 ui.setupUi (dlg);
231 225
232 switch (RotationPoint (g_win->configBag()->rotationPointType())) 226 switch (RotationPoint (Config->rotationPointType()))
233 { 227 {
234 case RotationPoint::ObjectOrigin: 228 case RotationPoint::ObjectOrigin:
235 ui.objectPoint->setChecked (true); 229 ui.objectPoint->setChecked (true);
236 break; 230 break;
237 231
245 239
246 case RotationPoint::NumValues: 240 case RotationPoint::NumValues:
247 break; 241 break;
248 } 242 }
249 243
250 Vertex custompoint = g_win->configBag()->customRotationPoint(); 244 Vertex custompoint = Config->customRotationPoint();
251 ui.customX->setValue (custompoint.x()); 245 ui.customX->setValue (custompoint.x());
252 ui.customY->setValue (custompoint.y()); 246 ui.customY->setValue (custompoint.y());
253 ui.customZ->setValue (custompoint.z()); 247 ui.customZ->setValue (custompoint.z());
254 248
255 if (not dlg->exec()) 249 if (not dlg->exec())
256 return; 250 return;
257 251
258 g_win->configBag()->setRotationPointType (int ( 252 Config->setRotationPointType (int (
259 (ui.objectPoint->isChecked()) ? RotationPoint::ObjectOrigin : 253 (ui.objectPoint->isChecked()) ? RotationPoint::ObjectOrigin :
260 (ui.worldPoint->isChecked()) ? RotationPoint::WorldOrigin : 254 (ui.worldPoint->isChecked()) ? RotationPoint::WorldOrigin :
261 RotationPoint::CustomPoint)); 255 RotationPoint::CustomPoint));
262 256
263 custompoint.setX (ui.customX->value()); 257 custompoint.setX (ui.customX->value());
264 custompoint.setY (ui.customY->value()); 258 custompoint.setY (ui.customY->value());
265 custompoint.setZ (ui.customZ->value()); 259 custompoint.setZ (ui.customZ->value());
266 g_win->configBag()->setCustomRotationPoint (custompoint); 260 Config->setCustomRotationPoint (custompoint);
267 } 261 }
268 262
269 // ============================================================================= 263 // =============================================================================
270 // 264 //
271 QString Join (QList<StringFormatArg> vals, QString delim) 265 QString Join (QList<StringFormatArg> vals, QString delim)

mercurial