@@ -118,55 +118,65 @@ namespace RTEGUI {
118
118
119
119
void EditorApp::ProcessKeyboardInput () {
120
120
// Handle keyboard input directly from Allegro instead of through AllegroInput to make life easier.
121
+ int emptyStates = 0 ;
121
122
for (int i = 0 ; i < KEY_MAX; ++i) {
123
+ if (key[i] == 0 ) { ++emptyStates; }
122
124
m_KeyStates.at (i) = key[i];
123
125
}
124
- int pressed = -1 ;
126
+ // Skip processing if no keyboard input
127
+ if (emptyStates < KEY_MAX) {
128
+ int pressed = -1 ;
125
129
126
- bool modCtrl = m_KeyStates.at (KEY_LCONTROL) == pressed || m_KeyStates.at (KEY_RCONTROL) == pressed;
127
- bool modShift = m_KeyStates.at (KEY_LSHIFT) == pressed || m_KeyStates.at (KEY_RSHIFT) == pressed;
130
+ bool modCtrl = m_KeyStates.at (KEY_LCONTROL) == pressed || m_KeyStates.at (KEY_RCONTROL) == pressed;
131
+ bool modShift = m_KeyStates.at (KEY_LSHIFT) == pressed || m_KeyStates.at (KEY_RSHIFT) == pressed;
128
132
129
- if (m_KeyStates.at (KEY_ALT) && m_KeyStates.at (KEY_F4)) { OnQuitButton (); }
133
+ if (m_KeyStates.at (KEY_ALT) && m_KeyStates.at (KEY_F4)) { OnQuitButton (); }
130
134
131
- // Escape key - Undo any grab
132
- if (m_KeyStates.at (KEY_ESC) == pressed) { m_EditorManager->ClearCurrentSelection (); }
133
-
134
- if (modCtrl) {
135
- if (m_KeyStates.at (KEY_S) == pressed) {
136
- OnSaveButton (modShift ? true : false );
137
- } else if (m_KeyStates.at (KEY_O) == pressed) {
138
- OnLoadButton (modShift ? true : false );
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 ();
139
138
}
140
139
141
- if (m_KeyStates.at (KEY_1) == pressed) {
142
- m_EditorManager->GetWorkspaceManager ()->ChangeSkin (" Assets/Workspace" , " SkinBlue.ini" );
143
- } else if (m_KeyStates.at (KEY_2) == pressed) {
144
- m_EditorManager->GetWorkspaceManager ()->ChangeSkin (" Assets/Workspace" , " SkinGreen.ini" );
145
- } else if (m_KeyStates.at (KEY_3) == pressed) {
146
- m_EditorManager->GetWorkspaceManager ()->ChangeSkin (" Assets/Workspace" , " SkinBrown.ini" );
147
- } else if (m_KeyStates.at (KEY_4) == pressed) {
148
- m_EditorManager->GetWorkspaceManager ()->ChangeSkin (" Assets/Workspace" , " SkinGray.ini" );
149
- }
150
- }
140
+ // Escape key - Undo any grab
141
+ if (m_KeyStates.at (KEY_ESC) == pressed) { m_EditorManager->ClearCurrentSelection (); }
142
+
143
+ if (modCtrl) {
144
+ if (m_KeyStates.at (KEY_S) == pressed) {
145
+ OnSaveButton (modShift ? true : false );
146
+ } else if (m_KeyStates.at (KEY_O) == pressed) {
147
+ OnLoadButton (modShift ? true : false );
148
+ }
151
149
152
- const EditorSelection ¤tSelection = m_EditorManager->GetCurrentSelection ();
153
-
154
- if (currentSelection.GetControl () && !m_EditorManager->GetPropertyPage ()->HasTextFocus ()) {
155
- if (m_KeyStates.at (KEY_DEL) == pressed) {
156
- m_EditorManager->RemoveControl (currentSelection.GetControl ());
157
- } else {
158
- bool selectionNudged = false ;
159
- if (m_KeyStates.at (KEY_UP) == pressed && m_PrevKeyStates.at (KEY_UP) != pressed) {
160
- selectionNudged = currentSelection.NudgeSelection (EditorSelection::NudgeDirection::NudgeUp, modShift);
161
- } else if (m_KeyStates.at (KEY_DOWN) == pressed && m_PrevKeyStates.at (KEY_DOWN) != pressed) {
162
- selectionNudged = currentSelection.NudgeSelection (EditorSelection::NudgeDirection::NudgeDown, modShift);
150
+ if (m_KeyStates.at (KEY_1) == pressed) {
151
+ m_EditorManager->GetWorkspaceManager ()->ChangeSkin (" Assets/Workspace" , " SkinBlue.ini" );
152
+ } else if (m_KeyStates.at (KEY_2) == pressed) {
153
+ m_EditorManager->GetWorkspaceManager ()->ChangeSkin (" Assets/Workspace" , " SkinGreen.ini" );
154
+ } else if (m_KeyStates.at (KEY_3) == pressed) {
155
+ m_EditorManager->GetWorkspaceManager ()->ChangeSkin (" Assets/Workspace" , " SkinBrown.ini" );
156
+ } else if (m_KeyStates.at (KEY_4) == pressed) {
157
+ m_EditorManager->GetWorkspaceManager ()->ChangeSkin (" Assets/Workspace" , " SkinGray.ini" );
163
158
}
164
- if (m_KeyStates.at (KEY_LEFT) == pressed && m_PrevKeyStates.at (KEY_LEFT) != pressed) {
165
- selectionNudged = currentSelection.NudgeSelection (EditorSelection::NudgeDirection::NudgeLeft, modShift);
166
- } else if (m_KeyStates.at (KEY_RIGHT) == pressed && m_PrevKeyStates.at (KEY_RIGHT) != pressed) {
167
- selectionNudged = currentSelection.NudgeSelection (EditorSelection::NudgeDirection::NudgeRight, modShift);
159
+ }
160
+
161
+ const EditorSelection ¤tSelection = m_EditorManager->GetCurrentSelection ();
162
+
163
+ if (currentSelection.GetControl () && !m_EditorManager->GetPropertyPage ()->HasTextFocus ()) {
164
+ if (m_KeyStates.at (KEY_DEL) == pressed) {
165
+ m_EditorManager->RemoveControl (currentSelection.GetControl ());
166
+ } else {
167
+ bool selectionNudged = false ;
168
+ if (m_KeyStates.at (KEY_UP) == pressed && m_PrevKeyStates.at (KEY_UP) != pressed) {
169
+ selectionNudged = currentSelection.NudgeSelection (EditorSelection::NudgeDirection::NudgeUp, modShift);
170
+ } else if (m_KeyStates.at (KEY_DOWN) == pressed && m_PrevKeyStates.at (KEY_DOWN) != pressed) {
171
+ selectionNudged = currentSelection.NudgeSelection (EditorSelection::NudgeDirection::NudgeDown, modShift);
172
+ }
173
+ if (m_KeyStates.at (KEY_LEFT) == pressed && m_PrevKeyStates.at (KEY_LEFT) != pressed) {
174
+ selectionNudged = currentSelection.NudgeSelection (EditorSelection::NudgeDirection::NudgeLeft, modShift);
175
+ } else if (m_KeyStates.at (KEY_RIGHT) == pressed && m_PrevKeyStates.at (KEY_RIGHT) != pressed) {
176
+ selectionNudged = currentSelection.NudgeSelection (EditorSelection::NudgeDirection::NudgeRight, modShift);
177
+ }
178
+ if (selectionNudged) { m_UnsavedChanges = m_EditorManager->UpdateControlProperties (currentSelection.GetControl ()); }
168
179
}
169
- if (selectionNudged) { m_UnsavedChanges = m_EditorManager->UpdateControlProperties (currentSelection.GetControl ()); }
170
180
}
171
181
}
172
182
m_PrevKeyStates = m_KeyStates;
0 commit comments