Skip to content

Commit 52b36f1

Browse files
committed
Some renaming and misc changes
1 parent 5d11f88 commit 52b36f1

File tree

2 files changed

+30
-26
lines changed

2 files changed

+30
-26
lines changed

Editor/GUIEditorApp.cpp

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ namespace RTEGUI {
125125
m_RightColumn->SetDrawColor(makecol(23, 23, 23));
126126
m_RightColumn->SetDrawType(GUICollectionBox::Color);
127127

128-
m_ActiveCollectionBoxList.reset(dynamic_cast<GUIListBox *>(m_EditorManager->AddControl("ActiveCollectionBoxes", "LISTBOX", m_RightColumn.get(), 15, 5, 270, 230)));
129-
m_ControlsInActiveCollectionBoxList.reset(dynamic_cast<GUIListBox *>(m_EditorManager->AddControl("ControlsInActiveCollectionBox", "LISTBOX", m_RightColumn.get(), 15, m_ActiveCollectionBoxList->GetRelYPos() + 240, 270, 350)));
128+
m_CollectionBoxList.reset(dynamic_cast<GUIListBox *>(m_EditorManager->AddControl("ActiveCollectionBoxes", "LISTBOX", m_RightColumn.get(), 15, 5, 270, 230)));
129+
m_ControlsInActiveCollectionBoxList.reset(dynamic_cast<GUIListBox *>(m_EditorManager->AddControl("ControlsInActiveCollectionBox", "LISTBOX", m_RightColumn.get(), 15, m_CollectionBoxList->GetRelYPos() + 240, 270, 350)));
130130

131131
// Add an area showing the editing box
132132
GUICollectionBox *workspace = dynamic_cast<GUICollectionBox *>(m_EditorManager->AddControl("Workspace", "COLLECTIONBOX", m_EditorBase.get(), m_WorkspacePosX, m_WorkspacePosY, m_WorkspaceWidth, m_WorkspaceHeight));
@@ -187,8 +187,9 @@ namespace RTEGUI {
187187

188188
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
189189

190-
void GUIEditorApp::UpdateActiveBoxList() {
191-
const GUIListPanel::Item *item = m_ActiveCollectionBoxList->GetSelected();
190+
void GUIEditorApp::UpdateCollectionBoxList() {
191+
const GUIListPanel::Item *item = m_CollectionBoxList->GetSelected();
192+
192193
if (item) {
193194
// Try to find the box of that name, and select it
194195
GUIControl *boxControl = m_ControlManager->GetControl(item->m_Name);
@@ -197,7 +198,7 @@ namespace RTEGUI {
197198
m_SelectionInfo.GrabbedHandle = false;
198199
m_SelectionInfo.Control = boxControl;
199200

200-
PopulateControlsInActiveCollectionBoxList(dynamic_cast<GUICollectionBox *>(boxControl));
201+
PopulateCollectionBoxChildrenList(dynamic_cast<GUICollectionBox *>(boxControl));
201202
}
202203
} else {
203204
// Deselection if clicked on no list item
@@ -211,52 +212,51 @@ namespace RTEGUI {
211212

212213
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
213214

214-
void GUIEditorApp::AddItemToActiveCollectionBoxList(GUIControl *control, const std::string &indent) const {
215-
m_ActiveCollectionBoxList->AddItem(indent + control->GetName());
216-
215+
void GUIEditorApp::AddItemToCollectionBoxList(GUIControl *control, const std::string &indent) const {
216+
m_CollectionBoxList->AddItem(indent + control->GetName());
217217
for (GUIControl *childControl : *control->GetChildren()) {
218218
if ((control = dynamic_cast<GUICollectionBox *>(childControl))) {
219-
AddItemToActiveCollectionBoxList(control, indent + "\t");
219+
AddItemToCollectionBoxList(control, indent + "\t");
220220
}
221221
}
222222
}
223223

224224
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
225225

226-
void GUIEditorApp::PopulateActiveCollectionBoxList() const {
227-
m_ActiveCollectionBoxList->ClearList();
226+
void GUIEditorApp::PopulateCollectionBoxList() const {
227+
m_CollectionBoxList->ClearList();
228228
GUICollectionBox *collectionBox = nullptr;
229229

230230
// Go through all the top-level (directly under root) controls and add only the CollectionBoxes to the list here
231231
for (GUIControl *control : *m_ControlManager->GetControlList()) {
232232
// Look for CollectionBoxes with the root control as parent
233233
if ((collectionBox = dynamic_cast<GUICollectionBox *>(control)) && collectionBox->GetParent() == m_RootControl) {
234-
m_ActiveCollectionBoxList->AddItem(collectionBox->GetName());
234+
m_CollectionBoxList->AddItem(collectionBox->GetName());
235235

236236
for (GUIControl *childControl : *collectionBox->GetChildren()) {
237237
if ((collectionBox = dynamic_cast<GUICollectionBox *>(childControl))) {
238-
AddItemToActiveCollectionBoxList(collectionBox, "\t");
238+
AddItemToCollectionBoxList(collectionBox, "\t");
239239
}
240240
}
241241
// Check if this is selected in the editor, and if so, select it in the list too
242242
if (m_SelectionInfo.Control == collectionBox) {
243-
m_ActiveCollectionBoxList->SetSelectedIndex(m_ActiveCollectionBoxList->GetItemList()->size() - 1);
244-
PopulateControlsInActiveCollectionBoxList(collectionBox);
243+
m_CollectionBoxList->SetSelectedIndex(m_CollectionBoxList->GetItemList()->size() - 1);
244+
PopulateCollectionBoxChildrenList(collectionBox);
245245
}
246246
}
247247
}
248248
}
249249

250250
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
251251

252-
void GUIEditorApp::PopulateControlsInActiveCollectionBoxList(GUICollectionBox *collectionBox) const {
252+
void GUIEditorApp::PopulateCollectionBoxChildrenList(GUICollectionBox *collectionBox) const {
253253
m_ControlsInActiveCollectionBoxList->ClearList();
254254

255255
// Go through all the top-level (directly under root) controls and add only the CollectionBoxes to the list here
256256
for (GUIControl *control : *collectionBox->GetChildren()) {
257257
m_ControlsInActiveCollectionBoxList->AddItem(control->GetName());
258258
// Check if this is selected in the editor, and if so, select it in the list too
259-
if (collectionBox == m_SelectionInfo.Control) { m_ControlsInActiveCollectionBoxList->SetSelectedIndex(m_ActiveCollectionBoxList->GetItemList()->size() - 1); }
259+
if (collectionBox == m_SelectionInfo.Control) { m_ControlsInActiveCollectionBoxList->SetSelectedIndex(m_CollectionBoxList->GetItemList()->size() - 1); }
260260
}
261261
}
262262

@@ -427,7 +427,11 @@ namespace RTEGUI {
427427

428428
if (parent) { m_ControlManager->AddControl(name, controlClass, parent, 0, 0, -1, -1); }
429429

430-
PopulateActiveCollectionBoxList();
430+
if (controlClass == "COLLECTIONBOX") {
431+
PopulateCollectionBoxList();
432+
} else {
433+
PopulateCollectionBoxChildrenList(dynamic_cast<GUICollectionBox *>(parent));
434+
}
431435
}
432436

433437
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -477,7 +481,7 @@ namespace RTEGUI {
477481
break;
478482
case GUIEvent::Notification:
479483
if (editorEvent.GetControl()->GetName() == "ActiveCollectionBoxes" && editorEvent.GetMsg() == GUIListBox::MouseDown) {
480-
UpdateActiveBoxList();
484+
UpdateCollectionBoxList();
481485
} else if (editorEvent.GetControl()->GetName() == "PropertyPage") {
482486
UpdatePropertyPage(editorEvent);
483487
} else if (editorEvent.GetControl()->GetName() == "GridSizeTextBox" && editorEvent.GetMsg() == GUITextBox::Enter) {
@@ -752,7 +756,7 @@ namespace RTEGUI {
752756
m_PropertyPage->ClearValues();
753757
m_UnsavedChanges = false;
754758

755-
PopulateActiveCollectionBoxList();
759+
PopulateCollectionBoxList();
756760
}
757761
}
758762

@@ -792,7 +796,7 @@ namespace RTEGUI {
792796
m_LeftColumn->Resize(m_LeftColumn->GetWidth(), resizeInfo->new_h);
793797
m_RightColumn->Resize(m_RightColumn->GetWidth(), resizeInfo->new_h);
794798
m_RightColumn->Move(resizeInfo->new_w - m_RightColumn->GetWidth(), 0);
795-
m_ControlsInActiveCollectionBoxList->Resize(m_ActiveCollectionBoxList->GetWidth(), resizeInfo->new_h - m_ControlsInActiveCollectionBoxList->GetRelYPos() - 5);
799+
m_ControlsInActiveCollectionBoxList->Resize(m_CollectionBoxList->GetWidth(), resizeInfo->new_h - m_ControlsInActiveCollectionBoxList->GetRelYPos() - 5);
796800
m_WindowResized = true;
797801
}
798802
}

Editor/GUIEditorApp.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ namespace RTEGUI {
118118
std::unique_ptr<GUIControlManager> m_ControlManager = nullptr;
119119
std::unique_ptr<GUIControlManager> m_EditorManager = nullptr;
120120
std::unique_ptr<GUIPropertyPage> m_PropertyPage = nullptr;
121-
std::unique_ptr<GUIListBox> m_ActiveCollectionBoxList = nullptr;
121+
std::unique_ptr<GUIListBox> m_CollectionBoxList = nullptr;
122122
std::unique_ptr<GUIListBox> m_ControlsInActiveCollectionBoxList = nullptr;
123123
std::unique_ptr<GUICollectionBox> m_EditorBase = nullptr;
124124
std::unique_ptr<GUICollectionBox> m_LeftColumn = nullptr;
@@ -151,22 +151,22 @@ namespace RTEGUI {
151151
/// <summary>
152152
/// Updates the list of Active top level ControlBoxs found in the editor.
153153
/// </summary>
154-
void UpdateActiveBoxList();
154+
void UpdateCollectionBoxList();
155155

156156
/// <summary>
157157
///
158158
/// </summary>
159-
void AddItemToActiveCollectionBoxList(GUIControl *control, const std::string &indent) const;
159+
void AddItemToCollectionBoxList(GUIControl *control, const std::string &indent) const;
160160

161161
/// <summary>
162162
///
163163
/// </summary>
164-
void PopulateActiveCollectionBoxList() const;
164+
void PopulateCollectionBoxList() const;
165165

166166
/// <summary>
167167
///
168168
/// </summary>
169-
void PopulateControlsInActiveCollectionBoxList(GUICollectionBox *collectionBox) const;
169+
void PopulateCollectionBoxChildrenList(GUICollectionBox *collectionBox) const;
170170

171171
/// <summary>
172172
/// Checks if a control is under the mouse point.

0 commit comments

Comments
 (0)