@@ -153,24 +153,6 @@ namespace RTEGUI {
153
153
dynamic_cast <GUILabel *>(m_EditorControlManager->GetControl (" FrameTimer" ))->SetText (" Frame Time: " + std::to_string (frameTime) + " ms" );
154
154
}
155
155
156
- // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
157
-
158
- void EditorManager::StoreCurrentSelectionCopyInfo () const {
159
- GUIControl *selectedControl = s_SelectionInfo.GetControl ();
160
- if (selectedControl) {
161
- s_SelectionCopyInfo = {
162
- selectedControl->GetName (),
163
- selectedControl->GetID (),
164
- selectedControl->GetPanel ()->GetRelXPos (),
165
- selectedControl->GetPanel ()->GetRelYPos (),
166
- selectedControl->GetPanel ()->GetWidth (),
167
- selectedControl->GetPanel ()->GetHeight (),
168
- selectedControl->GetParent (),
169
- selectedControl->GetProperties ()
170
- };
171
- }
172
- }
173
-
174
156
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
175
157
176
158
bool EditorManager::AddNewControl (GUIEvent &editorEvent) {
@@ -298,6 +280,7 @@ namespace RTEGUI {
298
280
s_SelectionInfo.SetControl (control);
299
281
}
300
282
UpdateCollectionBoxChildrenList (dynamic_cast <GUICollectionBox *>(control));
283
+ UpdateControlProperties (s_SelectionInfo.GetControl ());
301
284
}
302
285
} else {
303
286
// Deselection if clicked on no list item
@@ -318,6 +301,7 @@ namespace RTEGUI {
318
301
if (control) {
319
302
s_SelectionInfo.ReleaseAnyGrabs ();
320
303
s_SelectionInfo.SetControl (control);
304
+ UpdateControlProperties (s_SelectionInfo.GetControl ());
321
305
}
322
306
} else {
323
307
// Deselection if clicked on no list item
@@ -388,6 +372,9 @@ namespace RTEGUI {
388
372
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
389
373
390
374
void EditorManager::UpdateCollectionBoxChildrenList (GUICollectionBox *collectionBox) const {
375
+ if (!collectionBox) {
376
+ return ;
377
+ }
391
378
m_ControlsInCollectionBoxList->ClearList ();
392
379
393
380
// Go through all the top-level (directly under root) controls and add only the CollectionBoxes to the list here
@@ -470,6 +457,24 @@ namespace RTEGUI {
470
457
RemoveFocus ();
471
458
}
472
459
460
+ // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
461
+
462
+ void EditorManager::StoreCurrentSelectionCopyInfo () const {
463
+ GUIControl *selectedControl = s_SelectionInfo.GetControl ();
464
+ if (selectedControl) {
465
+ s_SelectionCopyInfo = {
466
+ selectedControl->GetName (),
467
+ selectedControl->GetID (),
468
+ selectedControl->GetPanel ()->GetRelXPos (),
469
+ selectedControl->GetPanel ()->GetRelYPos (),
470
+ selectedControl->GetPanel ()->GetWidth (),
471
+ selectedControl->GetPanel ()->GetHeight (),
472
+ selectedControl->GetParent (),
473
+ selectedControl->GetProperties ()
474
+ };
475
+ }
476
+ }
477
+
473
478
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
474
479
475
480
void EditorManager::UpdateSnapGridSize (GUIEvent &editorEvent) const {
@@ -494,17 +499,13 @@ namespace RTEGUI {
494
499
bool EditorManager::UpdateControlProperties (GUIControl *control, bool manualEdit) const {
495
500
bool result = false ;
496
501
if (control) {
497
- if (manualEdit) {
498
- control->ApplyProperties (m_PropertyPage->GetPropertyValues ());
499
- result = true ;
500
- } else {
501
- control->StoreProperties ();
502
- GUIProperties properties;
503
- properties.Update (control->GetProperties (), true );
504
- control->GetPanel ()->BuildProperties (&properties);
505
- m_PropertyPage->SetPropertyValues (&properties);
506
- result = true ;
507
- }
502
+ if (manualEdit) { control->ApplyProperties (m_PropertyPage->GetPropertyValues ()); }
503
+ control->StoreProperties ();
504
+ GUIProperties properties;
505
+ properties.Update (control->GetProperties (), true );
506
+ control->GetPanel ()->BuildProperties (&properties);
507
+ m_PropertyPage->SetPropertyValues (&properties);
508
+ result = true ;
508
509
}
509
510
RemoveFocus ();
510
511
return result;
0 commit comments