zz_addObjectDialog.cpp

changeset 157
635da3135bd4
parent 154
cc53e5cbad54
child 158
499286fcbf37
equal deleted inserted replaced
156:d35b7e440585 157:635da3135bd4
78 case OBJ_Vertex: 78 case OBJ_Vertex:
79 coordCount = 3; 79 coordCount = 3;
80 break; 80 break;
81 81
82 case OBJ_BFC: 82 case OBJ_BFC:
83 bb_bfcType = new ButtonBox<QRadioButton> ("Statement", {}, 0, Qt::Horizontal); 83 rb_bfcType = new RadioBox ("Statement", {}, 0, Qt::Horizontal);
84 84
85 for (int i = 0; i < LDBFC::NumStatements; ++i) { 85 for (int i = 0; i < LDBFC::NumStatements; ++i) {
86 if (i % (LDBFC::NumStatements / 2) == 0) 86 if (i % (LDBFC::NumStatements / 2) == 0)
87 bb_bfcType->rowBreak (); 87 rb_bfcType->rowBreak ();
88 88
89 bb_bfcType->addButton (new QRadioButton (LDBFC::saStatements[i])); 89 rb_bfcType->addButton (new QRadioButton (LDBFC::saStatements[i]));
90 } 90 }
91 91
92 if (obj) 92 if (obj)
93 bb_bfcType->setValue ((int) static_cast<LDBFC*> (obj)->eStatement); 93 rb_bfcType->setValue ((int) static_cast<LDBFC*> (obj)->eStatement);
94 break; 94 break;
95 95
96 case OBJ_Subfile: 96 case OBJ_Subfile:
97 coordCount = 3; 97 coordCount = 3;
98 98
151 lb_radType = new QLabel ("Type:"); 151 lb_radType = new QLabel ("Type:");
152 lb_radResolution = new QLabel ("Resolution:"); 152 lb_radResolution = new QLabel ("Resolution:");
153 lb_radSegments = new QLabel ("Segments:"); 153 lb_radSegments = new QLabel ("Segments:");
154 lb_radRingNum = new QLabel ("Ring number:"); 154 lb_radRingNum = new QLabel ("Ring number:");
155 155
156 bb_radType = new ButtonBox<QRadioButton> ("Type", {}, 0, Qt::Vertical); 156 rb_radType = new RadioBox ("Type", {}, 0, Qt::Vertical);
157 157
158 for (int i = 0; i < LDRadial::NumTypes; ++i) { 158 for (int i = 0; i < LDRadial::NumTypes; ++i) {
159 if (i % (LDRadial::NumTypes / 2) == 0) 159 if (i % (LDRadial::NumTypes / 2) == 0)
160 bb_radType->rowBreak (); 160 rb_radType->rowBreak ();
161 161
162 bb_radType->addButton (new QRadioButton (LDRadial::radialTypeName ((LDRadial::Type) i))); 162 rb_radType->addButton (new QRadioButton (LDRadial::radialTypeName ((LDRadial::Type) i)));
163 } 163 }
164 164
165 connect (bb_radType->buttonGroup, SIGNAL (buttonPressed (int)), this, SLOT (slot_radialTypeChanged (int))); 165 connect (rb_radType, SIGNAL (sig_buttonPressed (int)), this, SLOT (slot_radialTypeChanged (int)));
166 166
167 cb_radHiRes = new QCheckBox ("Hi-Res"); 167 cb_radHiRes = new QCheckBox ("Hi-Res");
168 168
169 sb_radSegments = new QSpinBox; 169 sb_radSegments = new QSpinBox;
170 sb_radSegments->setMinimum (1); 170 sb_radSegments->setMinimum (1);
173 sb_radRingNum->setEnabled (false); 173 sb_radRingNum->setEnabled (false);
174 174
175 if (obj) { 175 if (obj) {
176 LDRadial* rad = static_cast<LDRadial*> (obj); 176 LDRadial* rad = static_cast<LDRadial*> (obj);
177 177
178 bb_radType->setValue (rad->eRadialType); 178 rb_radType->setValue (rad->eRadialType);
179 sb_radSegments->setValue (rad->dSegments); 179 sb_radSegments->setValue (rad->dSegments);
180 cb_radHiRes->setChecked ((rad->dDivisions == 48) ? Qt::Checked : Qt::Unchecked); 180 cb_radHiRes->setChecked ((rad->dDivisions == 48) ? Qt::Checked : Qt::Unchecked);
181 sb_radRingNum->setValue (rad->dRingNum); 181 sb_radRingNum->setValue (rad->dRingNum);
182 } 182 }
183 break; 183 break;
226 case OBJ_Comment: 226 case OBJ_Comment:
227 layout->addWidget (le_comment, 0, 1); 227 layout->addWidget (le_comment, 0, 1);
228 break; 228 break;
229 229
230 case OBJ_BFC: 230 case OBJ_BFC:
231 layout->addWidget (bb_bfcType, 0, 1); 231 layout->addWidget (rb_bfcType, 0, 1);
232 break; 232 break;
233 233
234 case OBJ_Radial: 234 case OBJ_Radial:
235 layout->addWidget (bb_radType, 1, 1, 3, 1); 235 layout->addWidget (rb_radType, 1, 1, 3, 1);
236 layout->addWidget (cb_radHiRes, 1, 2); 236 layout->addWidget (cb_radHiRes, 1, 2);
237 layout->addWidget (lb_radSegments, 2, 2); 237 layout->addWidget (lb_radSegments, 2, 2);
238 layout->addWidget (sb_radSegments, 2, 3); 238 layout->addWidget (sb_radSegments, 2, 3);
239 layout->addWidget (lb_radRingNum, 3, 2); 239 layout->addWidget (lb_radRingNum, 3, 2);
240 layout->addWidget (sb_radRingNum, 3, 3); 240 layout->addWidget (sb_radRingNum, 3, 3);
395 break; 395 break;
396 396
397 case OBJ_BFC: 397 case OBJ_BFC:
398 { 398 {
399 LDBFC* bfc = initObj<LDBFC> (obj); 399 LDBFC* bfc = initObj<LDBFC> (obj);
400 bfc->eStatement = (LDBFC::Type) dlg.bb_bfcType->value (); 400 bfc->eStatement = (LDBFC::Type) dlg.rb_bfcType->value ();
401 } 401 }
402 break; 402 break;
403 403
404 case OBJ_Vertex: 404 case OBJ_Vertex:
405 { 405 {
419 for (const Axis ax : g_Axes) 419 for (const Axis ax : g_Axes)
420 pRad->vPosition[ax] = dlg.dsb_coords[ax]->value (); 420 pRad->vPosition[ax] = dlg.dsb_coords[ax]->value ();
421 421
422 pRad->dDivisions = (dlg.cb_radHiRes->checkState () != Qt::Checked) ? 16 : 48; 422 pRad->dDivisions = (dlg.cb_radHiRes->checkState () != Qt::Checked) ? 16 : 48;
423 pRad->dSegments = min<short> (dlg.sb_radSegments->value (), pRad->dDivisions); 423 pRad->dSegments = min<short> (dlg.sb_radSegments->value (), pRad->dDivisions);
424 pRad->eRadialType = (LDRadial::Type) dlg.bb_radType->value (); 424 pRad->eRadialType = (LDRadial::Type) dlg.rb_radType->value ();
425 pRad->dRingNum = dlg.sb_radRingNum->value (); 425 pRad->dRingNum = dlg.sb_radRingNum->value ();
426 pRad->mMatrix = g_mIdentity; 426 pRad->mMatrix = g_mIdentity;
427 } 427 }
428 break; 428 break;
429 429
450 } 450 }
451 451
452 if (newObject) { 452 if (newObject) {
453 ulong idx = g_ForgeWindow->getInsertionPoint (); 453 ulong idx = g_ForgeWindow->getInsertionPoint ();
454 g_CurrentFile->insertObj (idx, obj); 454 g_CurrentFile->insertObj (idx, obj);
455 History::addEntry (new AddHistory ({idx}, {obj->clone ()})); 455 History::addEntry (new AddHistory ({(ulong) idx}, {obj->clone ()}));
456 } else { 456 } else {
457 History::addEntry (new EditHistory ({obj->getIndex (g_CurrentFile)}, {backup}, {obj->clone ()})); 457 History::addEntry (new EditHistory ({(ulong) obj->getIndex (g_CurrentFile)}, {backup}, {obj->clone ()}));
458 } 458 }
459 459
460 g_ForgeWindow->refresh (); 460 g_ForgeWindow->refresh ();
461 } 461 }

mercurial