@@ -153,24 +153,6 @@ namespace RTEGUI {
153153 dynamic_cast <GUILabel *>(m_EditorControlManager->GetControl (" FrameTimer" ))->SetText (" Frame Time: " + std::to_string (frameTime) + " ms" );
154154 }
155155
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-
174156// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
175157
176158 bool EditorManager::AddNewControl (GUIEvent &editorEvent) {
@@ -298,6 +280,7 @@ namespace RTEGUI {
298280 s_SelectionInfo.SetControl (control);
299281 }
300282 UpdateCollectionBoxChildrenList (dynamic_cast <GUICollectionBox *>(control));
283+ UpdateControlProperties (s_SelectionInfo.GetControl ());
301284 }
302285 } else {
303286 // Deselection if clicked on no list item
@@ -318,6 +301,7 @@ namespace RTEGUI {
318301 if (control) {
319302 s_SelectionInfo.ReleaseAnyGrabs ();
320303 s_SelectionInfo.SetControl (control);
304+ UpdateControlProperties (s_SelectionInfo.GetControl ());
321305 }
322306 } else {
323307 // Deselection if clicked on no list item
@@ -388,6 +372,9 @@ namespace RTEGUI {
388372// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
389373
390374 void EditorManager::UpdateCollectionBoxChildrenList (GUICollectionBox *collectionBox) const {
375+ if (!collectionBox) {
376+ return ;
377+ }
391378 m_ControlsInCollectionBoxList->ClearList ();
392379
393380 // 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 {
470457 RemoveFocus ();
471458 }
472459
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+
473478// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
474479
475480 void EditorManager::UpdateSnapGridSize (GUIEvent &editorEvent) const {
@@ -494,17 +499,13 @@ namespace RTEGUI {
494499 bool EditorManager::UpdateControlProperties (GUIControl *control, bool manualEdit) const {
495500 bool result = false ;
496501 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 ;
508509 }
509510 RemoveFocus ();
510511 return result;
0 commit comments