Skip to content

Commit 8c68569

Browse files
committed
More fixes to lists
1 parent 96f552b commit 8c68569

File tree

3 files changed

+37
-34
lines changed

3 files changed

+37
-34
lines changed

Editor/EditorApp.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ namespace RTEGUI {
210210
case GUIEvent::Notification:
211211
if (controlName == "PropertyPage" && editorEvent.GetMsg() == GUIPropertyPage::Enter) {
212212
m_UnsavedChanges = m_EditorManager->UpdateControlProperties(m_EditorManager->GetCurrentSelection().GetControl(), true);
213+
m_EditorManager->UpdateCollectionBoxList();
214+
m_EditorManager->UpdateCollectionBoxChildrenList(dynamic_cast<GUICollectionBox *>(m_EditorManager->GetCurrentSelection().GetControl()));
213215
} else if (controlName == "CollectionBoxList" && editorEvent.GetMsg() == GUIListBox::MouseDown) {
214216
m_EditorManager->SelectActiveControlFromParentList();
215217
} else if (controlName == "ControlsInCollectionBoxList" && editorEvent.GetMsg() == GUIListBox::MouseDown) {

Editor/EditorManager.cpp

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -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;

Editor/EditorManager.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,6 @@ namespace RTEGUI {
142142
#pragma endregion
143143

144144
#pragma region GUI Element Creation
145-
/// <summary>
146-
/// Stores the properties of the currently selected GUI element in the workspace for later recreation.
147-
/// </summary>
148-
void StoreCurrentSelectionCopyInfo() const;
149-
150145
/// <summary>
151146
/// Create a new GUI element in the workspace.
152147
/// </summary>
@@ -244,6 +239,11 @@ namespace RTEGUI {
244239
/// Clears the current selection, the selection in the CollectionBoxList and clears the ControlsInCollectionBoxList and property page.
245240
/// </summary>
246241
void ClearCurrentSelection() const;
242+
243+
/// <summary>
244+
/// Stores the properties of the currently selected GUI element in the workspace for later recreation.
245+
/// </summary>
246+
void StoreCurrentSelectionCopyInfo() const;
247247
#pragma endregion
248248

249249
#pragma region Updates

0 commit comments

Comments
 (0)