Skip to content

Commit 8e053ae

Browse files
committed
Changes to control property updates
1 parent 4ff1e49 commit 8e053ae

File tree

3 files changed

+20
-41
lines changed

3 files changed

+20
-41
lines changed

Editor/EditorApp.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,9 @@ namespace RTEGUI {
5555

5656
void EditorApp::ProcessMouseInput() {
5757
std::array<int, 3> mouseButtons;
58-
std::array<int, 3> mouseStates;
5958
int mousePosX;
6059
int mousePosY;
61-
m_Input->GetMouseButtons(mouseButtons.data(), mouseStates.data());
60+
m_Input->GetMouseButtons(mouseButtons.data(), nullptr);
6261
m_Input->GetMousePosition(&mousePosX, &mousePosY);
6362

6463
EditorSelection &currentSelection = m_EditorManager->GetCurrentSelection();
@@ -132,11 +131,6 @@ namespace RTEGUI {
132131

133132
if (m_KeyStates.at(KEY_ALT) && m_KeyStates.at(KEY_F4)) { OnQuitButton(); }
134133

135-
if (m_EditorManager->GetPropertyPage()->HasTextFocus() && (m_KeyStates.at(KEY_ENTER) == pressed || m_KeyStates.at(KEY_ENTER_PAD) == pressed)) {
136-
//m_EditorManager->UpdateControlProperties(m_EditorManager->GetCurrentSelection().GetControl());
137-
m_UnsavedChanges = m_EditorManager->UpdatePropertyPage();
138-
}
139-
140134
// Escape key - Undo any grab
141135
if (m_KeyStates.at(KEY_ESC) == pressed) { m_EditorManager->ClearCurrentSelection(); }
142136

@@ -208,8 +202,8 @@ namespace RTEGUI {
208202
}
209203
break;
210204
case GUIEvent::Notification:
211-
if (controlName == "PropertyPage") {
212-
m_UnsavedChanges = m_EditorManager->UpdatePropertyPage(editorEvent);
205+
if (controlName == "PropertyPage" && editorEvent.GetMsg() == GUIPropertyPage::Enter) {
206+
m_UnsavedChanges = m_EditorManager->UpdateControlProperties(m_EditorManager->GetCurrentSelection().GetControl(), true);
213207
} else if (controlName == "CollectionBoxList" && editorEvent.GetMsg() == GUIListBox::MouseDown) {
214208
m_EditorManager->SelectActiveControlFromParentList();
215209
} else if (controlName == "ControlsInCollectionBoxList" && editorEvent.GetMsg() == GUIListBox::MouseDown) {

Editor/EditorManager.cpp

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -423,32 +423,22 @@ namespace RTEGUI {
423423

424424
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
425425

426-
bool EditorManager::UpdateControlProperties(GUIControl *control) const {
427-
control->StoreProperties();
428-
429-
GUIProperties properties;
430-
properties.Update(control->GetProperties(), true);
431-
control->GetPanel()->BuildProperties(&properties);
432-
m_PropertyPage->SetPropertyValues(&properties);
433-
434-
return true;
435-
}
436-
437-
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
438-
439-
bool EditorManager::UpdatePropertyPage(GUIEvent &editorEvent) const {
426+
bool EditorManager::UpdateControlProperties(GUIControl *control, bool manualEdit) const {
440427
bool result = false;
441-
if (editorEvent.GetMsg() == GUIPropertyPage::Enter) {
442-
// Update the focused control properties
443-
GUIControl *control = s_SelectionInfo.GetControl();
444-
if (control) { control->ApplyProperties(m_PropertyPage->GetPropertyValues()); }
445-
result = true;
446-
RemoveFocus();
447-
}
448-
if (editorEvent.GetMsg() == GUIPropertyPage::Changed) {
449-
// The properties are dirty and need to be updated
450-
result = true;
428+
if (control) {
429+
if (manualEdit) {
430+
control->ApplyProperties(m_PropertyPage->GetPropertyValues());
431+
result = true;
432+
} else {
433+
//control->StoreProperties();
434+
GUIProperties properties;
435+
properties.Update(control->GetProperties(), true);
436+
control->GetPanel()->BuildProperties(&properties);
437+
m_PropertyPage->SetPropertyValues(&properties);
438+
result = true;
439+
}
451440
}
441+
RemoveFocus();
452442
return result;
453443
}
454444
}

Editor/EditorManager.h

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,9 @@ namespace RTEGUI {
246246
/// <summary>
247247
/// Updates the properties of an element in the workspace.
248248
/// </summary>
249-
/// <param name="control">The element to update properties for.</param>
250-
bool UpdateControlProperties(GUIControl *control) const;
251-
252-
/// <summary>
253-
/// Updates the property page in the left column with all the properties of the currently selected element.
254-
/// </summary>
255-
/// <param name="editorEvent">The editor event to get update info from.</param>
256-
bool UpdatePropertyPage(GUIEvent &editorEvent) const;
249+
/// <param name"control">The control to update properties for.</param>
250+
/// <param name="manualEdit">Whether this update was triggered by manually editing values in the property page and pressing Enter.</param>
251+
bool UpdateControlProperties(GUIControl *control, bool manualEdit = false) const;
257252
#pragma endregion
258253

259254
private:

0 commit comments

Comments
 (0)