A game framework written with osu! in mind.

Merge branch 'master' into bassmix

+321 -257
+8 -8
osu.Framework.Tests/Visual/UserInterface/TestSceneDropdown.cs
··· 204 204 AddAssert("Previous item is selected", () => testDropdown.SelectedIndex == Math.Max(0, previousIndex - 1)); 205 205 206 206 AddStep("Select last item", 207 - () => performPlatformAction(new PlatformAction(PlatformActionType.ListEnd, PlatformActionMethod.Move), platformActionContainerKeyboardSelection, testDropdown.Header)); 207 + () => performPlatformAction(PlatformAction.MoveToListEnd, platformActionContainerKeyboardSelection, testDropdown.Header)); 208 208 AddAssert("Last item selected", () => testDropdown.SelectedItem == testDropdown.Menu.DrawableMenuItems.Last().Item); 209 209 210 210 AddStep("Select first item", 211 - () => performPlatformAction(new PlatformAction(PlatformActionType.ListStart, PlatformActionMethod.Move), platformActionContainerKeyboardSelection, testDropdown.Header)); 211 + () => performPlatformAction(PlatformAction.MoveToListStart, platformActionContainerKeyboardSelection, testDropdown.Header)); 212 212 AddAssert("First item selected", () => testDropdown.SelectedItem == testDropdown.Menu.DrawableMenuItems.First().Item); 213 213 214 214 AddStep("Select next item when empty", () => performKeypress(emptyDropdown.Header, Key.Up)); ··· 274 274 AddAssert("First item is preselected", () => testDropdownMenu.Menu.PreselectedItem.Item == testDropdownMenu.Menu.DrawableMenuItems.First().Item); 275 275 276 276 AddStep("Preselect last item", 277 - () => performPlatformAction(new PlatformAction(PlatformActionType.ListEnd, PlatformActionMethod.Move), platformActionContainerKeyboardPreselection, testDropdownMenu)); 277 + () => performPlatformAction(PlatformAction.MoveToListEnd, platformActionContainerKeyboardPreselection, testDropdownMenu)); 278 278 AddAssert("Last item preselected", () => testDropdownMenu.Menu.PreselectedItem.Item == testDropdownMenu.Menu.DrawableMenuItems.Last().Item); 279 279 280 280 AddStep("Finalize selection", () => performKeypress(testDropdownMenu.Menu, Key.Enter)); ··· 285 285 assertDropdownIsOpen(testDropdownMenu); 286 286 287 287 AddStep("Preselect first item", 288 - () => performPlatformAction(new PlatformAction(PlatformActionType.ListStart, PlatformActionMethod.Move), platformActionContainerKeyboardPreselection, testDropdownMenu)); 288 + () => performPlatformAction(PlatformAction.MoveToListStart, platformActionContainerKeyboardPreselection, testDropdownMenu)); 289 289 AddAssert("First item preselected", () => testDropdownMenu.Menu.PreselectedItem.Item == testDropdownMenu.Menu.DrawableMenuItems.First().Item); 290 290 291 291 AddStep("Discard preselection", () => performKeypress(testDropdownMenu.Menu, Key.Escape)); ··· 298 298 AddStep("Preselect first visible item when empty", () => performKeypress(emptyDropdown.Menu, Key.PageUp)); 299 299 AddStep("Preselect last visible item when empty", () => performKeypress(emptyDropdown.Menu, Key.PageDown)); 300 300 AddStep("Preselect first item when empty", 301 - () => performPlatformAction(new PlatformAction(PlatformActionType.ListStart, PlatformActionMethod.Move), platformActionContainerEmptyDropdown, emptyDropdown)); 301 + () => performPlatformAction(PlatformAction.MoveToListStart, platformActionContainerEmptyDropdown, emptyDropdown)); 302 302 AddStep("Preselect last item when empty", 303 - () => performPlatformAction(new PlatformAction(PlatformActionType.ListEnd, PlatformActionMethod.Move), platformActionContainerEmptyDropdown, emptyDropdown)); 303 + () => performPlatformAction(PlatformAction.MoveToListEnd, platformActionContainerEmptyDropdown, emptyDropdown)); 304 304 305 305 void assertLastItemSelected() => AddAssert("Last item selected", () => testDropdownMenu.SelectedItem == testDropdownMenu.Menu.DrawableMenuItems.Last().Item); 306 306 } ··· 330 330 AddStep("attempt to select previous", () => performKeypress(disabledDropdown, Key.Up)); 331 331 valueIsUnchanged(); 332 332 333 - AddStep("attempt to select first", () => disabledDropdown.Header.OnPressed(new PlatformAction(PlatformActionType.ListStart))); 333 + AddStep("attempt to select first", () => disabledDropdown.Header.OnPressed(PlatformAction.MoveToListStart)); 334 334 valueIsUnchanged(); 335 335 336 - AddStep("attempt to select last", () => disabledDropdown.Header.OnPressed(new PlatformAction(PlatformActionType.ListEnd))); 336 + AddStep("attempt to select last", () => disabledDropdown.Header.OnPressed(PlatformAction.MoveToListEnd)); 337 337 valueIsUnchanged(); 338 338 339 339 AddStep("enable current", () => disabledDropdown.Current.Disabled = false);
+4 -4
osu.Framework.Tests/Visual/UserInterface/TestSceneTabControl.cs
··· 147 147 }); 148 148 149 149 AddStep("Set first tab", () => switchingTabControl.Current.Value = switchingTabControl.Items.First()); 150 - AddStep("Switch forward", () => platformActionContainer.TriggerPressed(new PlatformAction(PlatformActionType.DocumentNext))); 150 + AddStep("Switch forward", () => platformActionContainer.TriggerPressed(PlatformAction.DocumentNext)); 151 151 AddAssert("Ensure second tab", () => switchingTabControl.Current.Value == switchingTabControl.Items.ElementAt(1)); 152 152 153 - AddStep("Switch backward", () => platformActionContainer.TriggerPressed(new PlatformAction(PlatformActionType.DocumentPrevious))); 153 + AddStep("Switch backward", () => platformActionContainer.TriggerPressed(PlatformAction.DocumentPrevious)); 154 154 AddAssert("Ensure first Tab", () => switchingTabControl.Current.Value == switchingTabControl.Items.First()); 155 155 156 - AddStep("Switch backward", () => platformActionContainer.TriggerPressed(new PlatformAction(PlatformActionType.DocumentPrevious))); 156 + AddStep("Switch backward", () => platformActionContainer.TriggerPressed(PlatformAction.DocumentPrevious)); 157 157 AddAssert("Ensure last tab", () => switchingTabControl.Current.Value == switchingTabControl.Items.Last()); 158 158 159 - AddStep("Switch forward", () => platformActionContainer.TriggerPressed(new PlatformAction(PlatformActionType.DocumentNext))); 159 + AddStep("Switch forward", () => platformActionContainer.TriggerPressed(PlatformAction.DocumentNext)); 160 160 AddAssert("Ensure first tab", () => switchingTabControl.Current.Value == switchingTabControl.Items.First()); 161 161 162 162 AddStep("Add all items", () => items.ForEach(item => removeAllTabControl.AddItem(item)));
+8 -8
osu.Framework.Tests/Visual/UserInterface/TestSceneTextBox.cs
··· 451 451 InputManager.Click(MouseButton.Left); 452 452 }); 453 453 454 - AddStep("select all", () => textBox.OnPressed(new PlatformAction(PlatformActionType.SelectAll))); 454 + AddStep("select all", () => textBox.OnPressed(PlatformAction.SelectAll)); 455 455 AddStep("insert string", () => textBox.InsertString("another")); 456 456 AddAssert("text replaced", () => textBox.FlowingText == "another" && textBox.FlowingText == textBox.Text); 457 457 } ··· 516 516 }); 517 517 AddStep("make first textbox readonly again", () => firstTextBox.ReadOnly = true); 518 518 AddAssert("first textbox yielded focus", () => !firstTextBox.HasFocus); 519 - AddStep("delete last character", () => firstTextBox.OnPressed(new PlatformAction(PlatformActionType.CharPrevious, PlatformActionMethod.Delete))); 519 + AddStep("delete last character", () => firstTextBox.OnPressed(PlatformAction.DeleteBackwardChar)); 520 520 AddAssert("no text removed", () => firstTextBox.Text == "Readonly textbox"); 521 521 } 522 522 ··· 557 557 DeletePreviousCharacter(); 558 558 } 559 559 560 - public void MoveToStart() => OnPressed(new PlatformAction(PlatformActionType.LineStart, PlatformActionMethod.Move)); 561 - public void MoveToEnd() => OnPressed(new PlatformAction(PlatformActionType.LineEnd, PlatformActionMethod.Move)); 560 + public void MoveToStart() => OnPressed(PlatformAction.MoveBackwardLine); 561 + public void MoveToEnd() => OnPressed(PlatformAction.MoveForwardLine); 562 562 563 - public void DeletePreviousCharacter() => OnPressed(new PlatformAction(PlatformActionType.CharPrevious, PlatformActionMethod.Delete)); 564 - public void DeleteNextCharacter() => OnPressed(new PlatformAction(PlatformActionType.CharNext, PlatformActionMethod.Delete)); 563 + public void DeletePreviousCharacter() => OnPressed(PlatformAction.DeleteBackwardChar); 564 + public void DeleteNextCharacter() => OnPressed(PlatformAction.DeleteForwardChar); 565 565 566 - public void DeletePreviousWord() => OnPressed(new PlatformAction(PlatformActionType.WordPrevious, PlatformActionMethod.Delete)); 567 - public void DeleteNextWord() => OnPressed(new PlatformAction(PlatformActionType.WordNext, PlatformActionMethod.Delete)); 566 + public void DeletePreviousWord() => OnPressed(PlatformAction.DeleteBackwardWord); 567 + public void DeleteNextWord() => OnPressed(PlatformAction.DeleteForwardWord); 568 568 } 569 569 570 570 private class NumberTextBox : BasicTextBox
+1 -1
osu.Framework.Tests/Visual/UserInterface/TestSceneTextBoxEvents.cs
··· 122 122 // Ensure dequeued caret move event has selecting = false. 123 123 textBox.CaretMovedQueue.Dequeue() == false && textBox.CommittedTextQueue.Count == 0); 124 124 125 - AddStep("invoke select action to expand selection", () => textBox.OnPressed(new PlatformAction(PlatformActionType.CharNext, PlatformActionMethod.Select))); 125 + AddStep("invoke select action to expand selection", () => textBox.OnPressed(PlatformAction.SelectForwardChar)); 126 126 AddAssert("caret moved event", () => 127 127 // Ensure dequeued caret move event has selecting = true. 128 128 textBox.CaretMovedQueue.Dequeue() && textBox.CommittedTextQueue.Count == 0);
+29 -28
osu.Framework.iOS/IOSGameHost.cs
··· 130 130 131 131 public override IEnumerable<KeyBinding> PlatformKeyBindings => new[] 132 132 { 133 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.X), new PlatformAction(PlatformActionType.Cut)), 134 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.C), new PlatformAction(PlatformActionType.Copy)), 135 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.V), new PlatformAction(PlatformActionType.Paste)), 136 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.A), new PlatformAction(PlatformActionType.SelectAll)), 137 - new KeyBinding(InputKey.Left, new PlatformAction(PlatformActionType.CharPrevious, PlatformActionMethod.Move)), 138 - new KeyBinding(InputKey.Right, new PlatformAction(PlatformActionType.CharNext, PlatformActionMethod.Move)), 139 - new KeyBinding(InputKey.BackSpace, new PlatformAction(PlatformActionType.CharPrevious, PlatformActionMethod.Delete)), 140 - new KeyBinding(InputKey.Delete, new PlatformAction(PlatformActionType.CharNext, PlatformActionMethod.Delete)), 141 - new KeyBinding(new KeyCombination(InputKey.Shift, InputKey.Left), new PlatformAction(PlatformActionType.CharPrevious, PlatformActionMethod.Select)), 142 - new KeyBinding(new KeyCombination(InputKey.Shift, InputKey.Right), new PlatformAction(PlatformActionType.CharNext, PlatformActionMethod.Select)), 143 - new KeyBinding(new KeyCombination(InputKey.Shift, InputKey.BackSpace), new PlatformAction(PlatformActionType.CharPrevious, PlatformActionMethod.Delete)), 144 - new KeyBinding(new KeyCombination(InputKey.Shift, InputKey.Delete), new PlatformAction(PlatformActionType.CharNext, PlatformActionMethod.Delete)), 145 - new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Left), new PlatformAction(PlatformActionType.WordPrevious, PlatformActionMethod.Move)), 146 - new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Right), new PlatformAction(PlatformActionType.WordNext, PlatformActionMethod.Move)), 147 - new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.BackSpace), new PlatformAction(PlatformActionType.WordPrevious, PlatformActionMethod.Delete)), 148 - new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Delete), new PlatformAction(PlatformActionType.WordNext, PlatformActionMethod.Delete)), 149 - new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Shift, InputKey.Left), new PlatformAction(PlatformActionType.WordPrevious, PlatformActionMethod.Select)), 150 - new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Shift, InputKey.Right), new PlatformAction(PlatformActionType.WordNext, PlatformActionMethod.Select)), 151 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Left), new PlatformAction(PlatformActionType.LineStart, PlatformActionMethod.Move)), 152 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Right), new PlatformAction(PlatformActionType.LineEnd, PlatformActionMethod.Move)), 153 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.BackSpace), new PlatformAction(PlatformActionType.LineStart, PlatformActionMethod.Delete)), 154 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Delete), new PlatformAction(PlatformActionType.LineEnd, PlatformActionMethod.Delete)), 155 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Shift, InputKey.Left), new PlatformAction(PlatformActionType.LineStart, PlatformActionMethod.Select)), 156 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Shift, InputKey.Right), new PlatformAction(PlatformActionType.LineEnd, PlatformActionMethod.Select)), 157 - new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Super, InputKey.Left), new PlatformAction(PlatformActionType.DocumentPrevious)), 158 - new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Super, InputKey.Right), new PlatformAction(PlatformActionType.DocumentNext)), 159 - new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Tab), new PlatformAction(PlatformActionType.DocumentNext)), 160 - new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Shift, InputKey.Tab), new PlatformAction(PlatformActionType.DocumentPrevious)), 133 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.X), PlatformAction.Cut), 134 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.C), PlatformAction.Copy), 135 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.V), PlatformAction.Paste), 136 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.A), PlatformAction.SelectAll), 137 + new KeyBinding(InputKey.Left, PlatformAction.MoveBackwardChar), 138 + new KeyBinding(InputKey.Right, PlatformAction.MoveForwardChar), 139 + new KeyBinding(InputKey.BackSpace, PlatformAction.DeleteBackwardChar), 140 + new KeyBinding(InputKey.Delete, PlatformAction.DeleteForwardChar), 141 + new KeyBinding(new KeyCombination(InputKey.Shift, InputKey.Left), PlatformAction.SelectBackwardChar), 142 + new KeyBinding(new KeyCombination(InputKey.Shift, InputKey.Right), PlatformAction.SelectForwardChar), 143 + new KeyBinding(new KeyCombination(InputKey.Shift, InputKey.BackSpace), PlatformAction.DeleteBackwardChar), 144 + new KeyBinding(new KeyCombination(InputKey.Shift, InputKey.Delete), PlatformAction.DeleteForwardChar), 145 + new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Left), PlatformAction.MoveBackwardWord), 146 + new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Right), PlatformAction.MoveForwardWord), 147 + new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.BackSpace), PlatformAction.DeleteBackwardWord), 148 + new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Delete), PlatformAction.DeleteForwardWord), 149 + new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Shift, InputKey.Left), PlatformAction.SelectBackwardWord), 150 + new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Shift, InputKey.Right), PlatformAction.SelectForwardWord), 151 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Left), PlatformAction.MoveBackwardLine), 152 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Right), PlatformAction.MoveForwardLine), 153 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.BackSpace), PlatformAction.DeleteBackwardLine), 154 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Delete), PlatformAction.DeleteForwardLine), 155 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Shift, InputKey.Left), PlatformAction.SelectBackwardLine), 156 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Shift, InputKey.Right), PlatformAction.SelectForwardLine), 157 + new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Super, InputKey.Left), PlatformAction.DocumentPrevious), 158 + new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Super, InputKey.Right), PlatformAction.DocumentNext), 159 + new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Tab), PlatformAction.DocumentNext), 160 + new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Shift, InputKey.Tab), PlatformAction.DocumentPrevious), 161 + new KeyBinding(new KeyCombination(InputKey.Delete), PlatformAction.Delete), 161 162 }; 162 163 } 163 164 }
+2 -2
osu.Framework/Game.cs
··· 359 359 360 360 public virtual bool OnPressed(PlatformAction action) 361 361 { 362 - switch (action.ActionType) 362 + switch (action) 363 363 { 364 - case PlatformActionType.Exit: 364 + case PlatformAction.Exit: 365 365 Host.Window?.Close(); 366 366 return true; 367 367 }
+3 -3
osu.Framework/Graphics/Containers/ScrollContainer.cs
··· 635 635 if (!IsHandlingKeyboardScrolling) 636 636 return false; 637 637 638 - switch (action.ActionType) 638 + switch (action) 639 639 { 640 - case PlatformActionType.LineStart: 640 + case PlatformAction.MoveBackwardLine: 641 641 ScrollToStart(); 642 642 return true; 643 643 644 - case PlatformActionType.LineEnd: 644 + case PlatformAction.MoveForwardLine: 645 645 ScrollToEnd(); 646 646 return true; 647 647
+3 -3
osu.Framework/Graphics/UserInterface/Dropdown.cs
··· 581 581 582 582 public bool OnPressed(PlatformAction action) 583 583 { 584 - switch (action.ActionType) 584 + switch (action) 585 585 { 586 - case PlatformActionType.ListStart: 586 + case PlatformAction.MoveToListStart: 587 587 PreselectItem(Items.FirstOrDefault()); 588 588 return true; 589 589 590 - case PlatformActionType.ListEnd: 590 + case PlatformAction.MoveToListEnd: 591 591 PreselectItem(Items.LastOrDefault()); 592 592 return true; 593 593
+3 -3
osu.Framework/Graphics/UserInterface/DropdownHeader.cs
··· 131 131 if (!Enabled.Value) 132 132 return true; 133 133 134 - switch (action.ActionType) 134 + switch (action) 135 135 { 136 - case PlatformActionType.ListStart: 136 + case PlatformAction.MoveToListStart: 137 137 ChangeSelection?.Invoke(DropdownSelectionAction.First); 138 138 return true; 139 139 140 - case PlatformActionType.ListEnd: 140 + case PlatformAction.MoveToListEnd: 141 141 ChangeSelection?.Invoke(DropdownSelectionAction.Last); 142 142 return true; 143 143
+4 -4
osu.Framework/Graphics/UserInterface/TabControl.cs
··· 97 97 public bool SelectFirstTabByDefault { get; set; } = true; 98 98 99 99 /// <summary> 100 - /// When true, tabs can be switched back and forth using <see cref="PlatformActionType.DocumentPrevious"/> and <see cref="PlatformActionType.DocumentNext"/> respectively. 100 + /// When true, tabs can be switched back and forth using <see cref="PlatformAction.DocumentPrevious"/> and <see cref="PlatformAction.DocumentNext"/> respectively. 101 101 /// </summary> 102 102 public bool IsSwitchable { get; set; } 103 103 ··· 408 408 { 409 409 if (IsSwitchable) 410 410 { 411 - switch (action.ActionType) 411 + switch (action) 412 412 { 413 - case PlatformActionType.DocumentNext: 413 + case PlatformAction.DocumentNext: 414 414 SwitchTab(1); 415 415 return true; 416 416 417 - case PlatformActionType.DocumentPrevious: 417 + case PlatformAction.DocumentPrevious: 418 418 SwitchTab(-1); 419 419 return true; 420 420 }
+136 -78
osu.Framework/Graphics/UserInterface/TextBox.cs
··· 161 161 162 162 public virtual bool OnPressed(PlatformAction action) 163 163 { 164 - int? amount = null; 165 - 166 164 if (!HasFocus) 167 165 return false; 168 166 169 - if (!HandleLeftRightArrows && 170 - action.ActionMethod == PlatformActionMethod.Move && 171 - (action.ActionType == PlatformActionType.CharNext || action.ActionType == PlatformActionType.CharPrevious)) 167 + if (!HandleLeftRightArrows && (action == PlatformAction.MoveBackwardChar || action == PlatformAction.MoveForwardChar)) 172 168 return false; 173 169 174 - switch (action.ActionType) 170 + switch (action) 175 171 { 176 172 // Clipboard 177 - case PlatformActionType.Cut: 178 - case PlatformActionType.Copy: 173 + case PlatformAction.Cut: 174 + case PlatformAction.Copy: 179 175 if (string.IsNullOrEmpty(SelectedText) || !AllowClipboardExport) return true; 180 176 181 177 clipboard?.SetText(SelectedText); 182 178 183 - if (action.ActionType == PlatformActionType.Cut) 184 - { 185 - string removedText = removeSelection(); 186 - OnUserTextRemoved(removedText); 187 - } 179 + if (action == PlatformAction.Cut) 180 + DeleteBy(0); 188 181 189 182 return true; 190 183 191 - case PlatformActionType.Paste: 184 + case PlatformAction.Paste: 192 185 //the text may get pasted into the hidden textbox, so we don't need any direct clipboard interaction here. 193 186 string pending = textInput?.GetPendingText(); 194 187 ··· 198 191 InsertString(pending); 199 192 return true; 200 193 201 - case PlatformActionType.SelectAll: 194 + case PlatformAction.SelectAll: 202 195 selectionStart = 0; 203 196 selectionEnd = text.Length; 204 197 cursorAndLayout.Invalidate(); 205 198 return true; 206 199 207 200 // Cursor Manipulation 208 - case PlatformActionType.CharNext: 209 - amount = 1; 210 - break; 201 + case PlatformAction.MoveBackwardChar: 202 + MoveCursorBy(-1); 203 + return true; 211 204 212 - case PlatformActionType.CharPrevious: 213 - amount = -1; 214 - break; 205 + case PlatformAction.MoveForwardChar: 206 + MoveCursorBy(1); 207 + return true; 215 208 216 - case PlatformActionType.LineEnd: 217 - amount = text.Length; 218 - break; 209 + case PlatformAction.MoveBackwardWord: 210 + MoveCursorBy(GetBackwardWordAmount()); 211 + return true; 219 212 220 - case PlatformActionType.LineStart: 221 - amount = -text.Length; 222 - break; 213 + case PlatformAction.MoveForwardWord: 214 + MoveCursorBy(GetForwardWordAmount()); 215 + return true; 223 216 224 - case PlatformActionType.WordNext: 225 - if (!AllowWordNavigation) 226 - amount = 1; 227 - else 228 - { 229 - int searchNext = Math.Clamp(selectionEnd, 0, Math.Max(0, Text.Length - 1)); 230 - while (searchNext < Text.Length && text[searchNext] == ' ') 231 - searchNext++; 232 - int nextSpace = text.IndexOf(' ', searchNext); 233 - amount = (nextSpace >= 0 ? nextSpace : text.Length) - selectionEnd; 234 - } 217 + case PlatformAction.MoveBackwardLine: 218 + MoveCursorBy(GetBackwardLineAmount()); 219 + return true; 235 220 236 - break; 221 + case PlatformAction.MoveForwardLine: 222 + MoveCursorBy(GetForwardLineAmount()); 223 + return true; 237 224 238 - case PlatformActionType.WordPrevious: 239 - if (!AllowWordNavigation) 240 - amount = -1; 241 - else 242 - { 243 - int searchPrev = Math.Clamp(selectionEnd - 2, 0, Math.Max(0, Text.Length - 1)); 244 - while (searchPrev > 0 && text[searchPrev] == ' ') 245 - searchPrev--; 246 - int lastSpace = text.LastIndexOf(' ', searchPrev); 247 - amount = lastSpace > 0 ? -(selectionEnd - lastSpace - 1) : -selectionEnd; 248 - } 225 + // Deletion 226 + case PlatformAction.DeleteBackwardChar: 227 + DeleteBy(-1); 228 + return true; 249 229 250 - break; 251 - } 230 + case PlatformAction.DeleteForwardChar: 231 + DeleteBy(1); 232 + return true; 252 233 253 - if (amount.HasValue) 254 - { 255 - switch (action.ActionMethod) 256 - { 257 - case PlatformActionMethod.Move: 258 - resetSelection(); 259 - moveSelection(amount.Value, false); 260 - break; 234 + case PlatformAction.DeleteBackwardWord: 235 + DeleteBy(GetBackwardWordAmount()); 236 + return true; 261 237 262 - case PlatformActionMethod.Select: 263 - moveSelection(amount.Value, true); 264 - break; 238 + case PlatformAction.DeleteForwardWord: 239 + DeleteBy(GetForwardWordAmount()); 240 + return true; 265 241 266 - case PlatformActionMethod.Delete: 267 - if (selectionLength == 0) 268 - selectionEnd = Math.Clamp(selectionStart + amount.Value, 0, text.Length); 242 + case PlatformAction.DeleteBackwardLine: 243 + DeleteBy(GetBackwardLineAmount()); 244 + return true; 269 245 270 - if (selectionLength > 0) 271 - { 272 - string removedText = removeSelection(); 273 - OnUserTextRemoved(removedText); 274 - } 246 + case PlatformAction.DeleteForwardLine: 247 + DeleteBy(GetForwardLineAmount()); 248 + return true; 249 + 250 + // Expand selection 251 + case PlatformAction.SelectBackwardChar: 252 + ExpandSelectionBy(-1); 253 + return true; 254 + 255 + case PlatformAction.SelectForwardChar: 256 + ExpandSelectionBy(1); 257 + return true; 275 258 276 - break; 277 - } 259 + case PlatformAction.SelectBackwardWord: 260 + ExpandSelectionBy(GetBackwardWordAmount()); 261 + return true; 278 262 279 - return true; 263 + case PlatformAction.SelectForwardWord: 264 + ExpandSelectionBy(GetForwardWordAmount()); 265 + return true; 266 + 267 + case PlatformAction.SelectBackwardLine: 268 + ExpandSelectionBy(GetBackwardLineAmount()); 269 + return true; 270 + 271 + case PlatformAction.SelectForwardLine: 272 + ExpandSelectionBy(GetForwardLineAmount()); 273 + return true; 280 274 } 281 275 282 276 return false; ··· 286 280 { 287 281 } 288 282 289 - internal override void UpdateClock(IFrameBasedClock clock) 283 + /// <summary> 284 + /// Find the word boundary in the backward direction, then return the negative amount of characters. 285 + /// </summary> 286 + protected int GetBackwardWordAmount() 287 + { 288 + if (!AllowWordNavigation) 289 + return -1; 290 + 291 + int searchPrev = Math.Clamp(selectionEnd - 2, 0, Math.Max(0, Text.Length - 1)); 292 + while (searchPrev > 0 && text[searchPrev] == ' ') 293 + searchPrev--; 294 + int lastSpace = text.LastIndexOf(' ', searchPrev); 295 + return lastSpace > 0 ? -(selectionEnd - lastSpace - 1) : -selectionEnd; 296 + } 297 + 298 + /// <summary> 299 + /// Find the word boundary in the forward direction, then return the positive amount of characters. 300 + /// </summary> 301 + protected int GetForwardWordAmount() 290 302 { 291 - base.UpdateClock(clock); 292 - textUpdateScheduler.UpdateClock(Clock); 303 + if (!AllowWordNavigation) 304 + return 1; 305 + 306 + int searchNext = Math.Clamp(selectionEnd, 0, Math.Max(0, Text.Length - 1)); 307 + while (searchNext < Text.Length && text[searchNext] == ' ') 308 + searchNext++; 309 + int nextSpace = text.IndexOf(' ', searchNext); 310 + return (nextSpace >= 0 ? nextSpace : text.Length) - selectionEnd; 293 311 } 294 312 295 - private void resetSelection() 313 + // Currently only single line is supported and line length and text length are the same. 314 + protected int GetBackwardLineAmount() => -text.Length; 315 + 316 + protected int GetForwardLineAmount() => text.Length; 317 + 318 + /// <summary> 319 + /// Move the current cursor by the signed <paramref name="amount"/>. 320 + /// </summary> 321 + protected void MoveCursorBy(int amount) 296 322 { 297 323 selectionStart = selectionEnd; 298 324 cursorAndLayout.Invalidate(); 325 + moveSelection(amount, false); 326 + } 327 + 328 + /// <summary> 329 + /// Expand the current selection by the signed <paramref name="amount"/>. 330 + /// </summary> 331 + protected void ExpandSelectionBy(int amount) 332 + { 333 + moveSelection(amount, true); 334 + } 335 + 336 + /// <summary> 337 + /// If there is a selection, delete the selected text. 338 + /// Otherwise, delete characters from the cursor position by the signed <paramref name="amount"/>. 339 + /// A negative amount represents a backward deletion, and a positive amount represents a forward deletion. 340 + /// </summary> 341 + protected void DeleteBy(int amount) 342 + { 343 + if (selectionLength == 0) 344 + selectionEnd = Math.Clamp(selectionStart + amount, 0, text.Length); 345 + 346 + if (selectionLength > 0) 347 + { 348 + string removedText = removeSelection(); 349 + OnUserTextRemoved(removedText); 350 + } 351 + } 352 + 353 + internal override void UpdateClock(IFrameBasedClock clock) 354 + { 355 + base.UpdateClock(clock); 356 + textUpdateScheduler.UpdateClock(Clock); 299 357 } 300 358 301 359 protected override void Dispose(bool isDisposing)
+47
osu.Framework/Input/PlatformAction.cs
··· 1 + // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. 2 + // See the LICENCE file in the repository root for full licence text. 3 + 4 + namespace osu.Framework.Input 5 + { 6 + public enum PlatformAction 7 + { 8 + Cut, 9 + Copy, 10 + Paste, 11 + Delete, 12 + SelectAll, 13 + Save, 14 + Undo, 15 + Redo, 16 + Exit, 17 + MoveToListStart, 18 + MoveToListEnd, 19 + DocumentPrevious, 20 + DocumentNext, 21 + DocumentClose, 22 + TabNew, 23 + TabRestore, 24 + 25 + // Text edit specific actions 26 + MoveBackwardChar, 27 + MoveForwardChar, 28 + DeleteBackwardChar, 29 + DeleteForwardChar, 30 + SelectBackwardChar, 31 + SelectForwardChar, 32 + 33 + MoveBackwardWord, 34 + MoveForwardWord, 35 + DeleteBackwardWord, 36 + DeleteForwardWord, 37 + SelectBackwardWord, 38 + SelectForwardWord, 39 + 40 + MoveBackwardLine, 41 + MoveForwardLine, 42 + DeleteBackwardLine, 43 + DeleteForwardLine, 44 + SelectBackwardLine, 45 + SelectForwardLine, 46 + } 47 + }
-44
osu.Framework/Input/PlatformActionContainer.cs
··· 25 25 26 26 protected override bool SendRepeats => true; 27 27 } 28 - 29 - public struct PlatformAction 30 - { 31 - public PlatformActionType ActionType; 32 - public PlatformActionMethod? ActionMethod; 33 - 34 - public PlatformAction(PlatformActionType actionType, PlatformActionMethod? actionMethod = null) 35 - { 36 - ActionType = actionType; 37 - ActionMethod = actionMethod; 38 - } 39 - } 40 - 41 - public enum PlatformActionType 42 - { 43 - Cut, 44 - Copy, 45 - Paste, 46 - SelectAll, 47 - CharPrevious, 48 - CharNext, 49 - WordPrevious, 50 - WordNext, 51 - LineStart, 52 - LineEnd, 53 - DocumentPrevious, 54 - DocumentNext, 55 - DocumentClose, 56 - TabNew, 57 - TabRestore, 58 - ListStart, 59 - ListEnd, 60 - Save, 61 - Undo, 62 - Redo, 63 - Exit 64 - } 65 - 66 - public enum PlatformActionMethod 67 - { 68 - Move, 69 - Select, 70 - Delete 71 - } 72 28 }
+35 -34
osu.Framework/Platform/GameHost.cs
··· 1001 1001 /// </summary> 1002 1002 public virtual IEnumerable<KeyBinding> PlatformKeyBindings => new[] 1003 1003 { 1004 - new KeyBinding(new KeyCombination(InputKey.Control, InputKey.X), new PlatformAction(PlatformActionType.Cut)), 1005 - new KeyBinding(new KeyCombination(InputKey.Control, InputKey.C), new PlatformAction(PlatformActionType.Copy)), 1006 - new KeyBinding(new KeyCombination(InputKey.Control, InputKey.V), new PlatformAction(PlatformActionType.Paste)), 1007 - new KeyBinding(new KeyCombination(InputKey.Control, InputKey.A), new PlatformAction(PlatformActionType.SelectAll)), 1008 - new KeyBinding(InputKey.Left, new PlatformAction(PlatformActionType.CharPrevious, PlatformActionMethod.Move)), 1009 - new KeyBinding(InputKey.Right, new PlatformAction(PlatformActionType.CharNext, PlatformActionMethod.Move)), 1010 - new KeyBinding(InputKey.BackSpace, new PlatformAction(PlatformActionType.CharPrevious, PlatformActionMethod.Delete)), 1011 - new KeyBinding(InputKey.Delete, new PlatformAction(PlatformActionType.CharNext, PlatformActionMethod.Delete)), 1012 - new KeyBinding(new KeyCombination(InputKey.Shift, InputKey.Left), new PlatformAction(PlatformActionType.CharPrevious, PlatformActionMethod.Select)), 1013 - new KeyBinding(new KeyCombination(InputKey.Shift, InputKey.Right), new PlatformAction(PlatformActionType.CharNext, PlatformActionMethod.Select)), 1014 - new KeyBinding(new KeyCombination(InputKey.Shift, InputKey.BackSpace), new PlatformAction(PlatformActionType.CharPrevious, PlatformActionMethod.Delete)), 1015 - new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Left), new PlatformAction(PlatformActionType.WordPrevious, PlatformActionMethod.Move)), 1016 - new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Right), new PlatformAction(PlatformActionType.WordNext, PlatformActionMethod.Move)), 1017 - new KeyBinding(new KeyCombination(InputKey.Control, InputKey.BackSpace), new PlatformAction(PlatformActionType.WordPrevious, PlatformActionMethod.Delete)), 1018 - new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Delete), new PlatformAction(PlatformActionType.WordNext, PlatformActionMethod.Delete)), 1019 - new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Shift, InputKey.Left), new PlatformAction(PlatformActionType.WordPrevious, PlatformActionMethod.Select)), 1020 - new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Shift, InputKey.Right), new PlatformAction(PlatformActionType.WordNext, PlatformActionMethod.Select)), 1021 - new KeyBinding(InputKey.Home, new PlatformAction(PlatformActionType.LineStart, PlatformActionMethod.Move)), 1022 - new KeyBinding(InputKey.End, new PlatformAction(PlatformActionType.LineEnd, PlatformActionMethod.Move)), 1023 - new KeyBinding(new KeyCombination(InputKey.Shift, InputKey.Home), new PlatformAction(PlatformActionType.LineStart, PlatformActionMethod.Select)), 1024 - new KeyBinding(new KeyCombination(InputKey.Shift, InputKey.End), new PlatformAction(PlatformActionType.LineEnd, PlatformActionMethod.Select)), 1025 - new KeyBinding(new KeyCombination(InputKey.Control, InputKey.PageUp), new PlatformAction(PlatformActionType.DocumentPrevious)), 1026 - new KeyBinding(new KeyCombination(InputKey.Control, InputKey.PageDown), new PlatformAction(PlatformActionType.DocumentNext)), 1027 - new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Tab), new PlatformAction(PlatformActionType.DocumentNext)), 1028 - new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Shift, InputKey.Tab), new PlatformAction(PlatformActionType.DocumentPrevious)), 1029 - new KeyBinding(new KeyCombination(InputKey.Control, InputKey.W), new PlatformAction(PlatformActionType.DocumentClose)), 1030 - new KeyBinding(new KeyCombination(InputKey.Control, InputKey.F4), new PlatformAction(PlatformActionType.DocumentClose)), 1031 - new KeyBinding(new KeyCombination(InputKey.Control, InputKey.T), new PlatformAction(PlatformActionType.TabNew)), 1032 - new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Shift, InputKey.T), new PlatformAction(PlatformActionType.TabRestore)), 1033 - new KeyBinding(new KeyCombination(InputKey.Control, InputKey.S), new PlatformAction(PlatformActionType.Save)), 1034 - new KeyBinding(InputKey.Home, new PlatformAction(PlatformActionType.ListStart, PlatformActionMethod.Move)), 1035 - new KeyBinding(InputKey.End, new PlatformAction(PlatformActionType.ListEnd, PlatformActionMethod.Move)), 1036 - new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Z), new PlatformAction(PlatformActionType.Undo)), 1037 - new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Shift, InputKey.Z), new PlatformAction(PlatformActionType.Redo)), 1004 + new KeyBinding(new KeyCombination(InputKey.Control, InputKey.X), PlatformAction.Cut), 1005 + new KeyBinding(new KeyCombination(InputKey.Control, InputKey.C), PlatformAction.Copy), 1006 + new KeyBinding(new KeyCombination(InputKey.Control, InputKey.V), PlatformAction.Paste), 1007 + new KeyBinding(new KeyCombination(InputKey.Control, InputKey.A), PlatformAction.SelectAll), 1008 + new KeyBinding(InputKey.Left, PlatformAction.MoveBackwardChar), 1009 + new KeyBinding(InputKey.Right, PlatformAction.MoveForwardChar), 1010 + new KeyBinding(InputKey.BackSpace, PlatformAction.DeleteBackwardChar), 1011 + new KeyBinding(InputKey.Delete, PlatformAction.DeleteForwardChar), 1012 + new KeyBinding(new KeyCombination(InputKey.Shift, InputKey.Left), PlatformAction.SelectBackwardChar), 1013 + new KeyBinding(new KeyCombination(InputKey.Shift, InputKey.Right), PlatformAction.SelectForwardChar), 1014 + new KeyBinding(new KeyCombination(InputKey.Shift, InputKey.BackSpace), PlatformAction.DeleteBackwardChar), 1015 + new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Left), PlatformAction.MoveBackwardWord), 1016 + new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Right), PlatformAction.MoveForwardWord), 1017 + new KeyBinding(new KeyCombination(InputKey.Control, InputKey.BackSpace), PlatformAction.DeleteBackwardWord), 1018 + new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Delete), PlatformAction.DeleteForwardWord), 1019 + new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Shift, InputKey.Left), PlatformAction.SelectBackwardWord), 1020 + new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Shift, InputKey.Right), PlatformAction.SelectForwardWord), 1021 + new KeyBinding(InputKey.Home, PlatformAction.MoveBackwardLine), 1022 + new KeyBinding(InputKey.End, PlatformAction.MoveForwardLine), 1023 + new KeyBinding(new KeyCombination(InputKey.Shift, InputKey.Home), PlatformAction.SelectBackwardLine), 1024 + new KeyBinding(new KeyCombination(InputKey.Shift, InputKey.End), PlatformAction.SelectForwardLine), 1025 + new KeyBinding(new KeyCombination(InputKey.Control, InputKey.PageUp), PlatformAction.DocumentPrevious), 1026 + new KeyBinding(new KeyCombination(InputKey.Control, InputKey.PageDown), PlatformAction.DocumentNext), 1027 + new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Tab), PlatformAction.DocumentNext), 1028 + new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Shift, InputKey.Tab), PlatformAction.DocumentPrevious), 1029 + new KeyBinding(new KeyCombination(InputKey.Control, InputKey.W), PlatformAction.DocumentClose), 1030 + new KeyBinding(new KeyCombination(InputKey.Control, InputKey.F4), PlatformAction.DocumentClose), 1031 + new KeyBinding(new KeyCombination(InputKey.Control, InputKey.T), PlatformAction.TabNew), 1032 + new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Shift, InputKey.T), PlatformAction.TabRestore), 1033 + new KeyBinding(new KeyCombination(InputKey.Control, InputKey.S), PlatformAction.Save), 1034 + new KeyBinding(InputKey.Home, PlatformAction.MoveToListStart), 1035 + new KeyBinding(InputKey.End, PlatformAction.MoveToListEnd), 1036 + new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Z), PlatformAction.Undo), 1037 + new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Shift, InputKey.Z), PlatformAction.Redo), 1038 + new KeyBinding(InputKey.Delete, PlatformAction.Delete), 1038 1039 }; 1039 1040 1040 1041 /// <summary>
+37 -36
osu.Framework/Platform/MacOS/MacOSGameHost.cs
··· 73 73 74 74 public override IEnumerable<KeyBinding> PlatformKeyBindings => new[] 75 75 { 76 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.X), new PlatformAction(PlatformActionType.Cut)), 77 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.C), new PlatformAction(PlatformActionType.Copy)), 78 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.V), new PlatformAction(PlatformActionType.Paste)), 79 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.A), new PlatformAction(PlatformActionType.SelectAll)), 80 - new KeyBinding(InputKey.Left, new PlatformAction(PlatformActionType.CharPrevious, PlatformActionMethod.Move)), 81 - new KeyBinding(InputKey.Right, new PlatformAction(PlatformActionType.CharNext, PlatformActionMethod.Move)), 82 - new KeyBinding(InputKey.BackSpace, new PlatformAction(PlatformActionType.CharPrevious, PlatformActionMethod.Delete)), 83 - new KeyBinding(InputKey.Delete, new PlatformAction(PlatformActionType.CharNext, PlatformActionMethod.Delete)), 84 - new KeyBinding(new KeyCombination(InputKey.Shift, InputKey.Left), new PlatformAction(PlatformActionType.CharPrevious, PlatformActionMethod.Select)), 85 - new KeyBinding(new KeyCombination(InputKey.Shift, InputKey.Right), new PlatformAction(PlatformActionType.CharNext, PlatformActionMethod.Select)), 86 - new KeyBinding(new KeyCombination(InputKey.Shift, InputKey.BackSpace), new PlatformAction(PlatformActionType.CharPrevious, PlatformActionMethod.Delete)), 87 - new KeyBinding(new KeyCombination(InputKey.Shift, InputKey.Delete), new PlatformAction(PlatformActionType.CharNext, PlatformActionMethod.Delete)), 88 - new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Left), new PlatformAction(PlatformActionType.WordPrevious, PlatformActionMethod.Move)), 89 - new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Right), new PlatformAction(PlatformActionType.WordNext, PlatformActionMethod.Move)), 90 - new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.BackSpace), new PlatformAction(PlatformActionType.WordPrevious, PlatformActionMethod.Delete)), 91 - new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Delete), new PlatformAction(PlatformActionType.WordNext, PlatformActionMethod.Delete)), 92 - new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Shift, InputKey.Left), new PlatformAction(PlatformActionType.WordPrevious, PlatformActionMethod.Select)), 93 - new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Shift, InputKey.Right), new PlatformAction(PlatformActionType.WordNext, PlatformActionMethod.Select)), 94 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Left), new PlatformAction(PlatformActionType.LineStart, PlatformActionMethod.Move)), 95 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Right), new PlatformAction(PlatformActionType.LineEnd, PlatformActionMethod.Move)), 96 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.BackSpace), new PlatformAction(PlatformActionType.LineStart, PlatformActionMethod.Delete)), 97 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Delete), new PlatformAction(PlatformActionType.LineEnd, PlatformActionMethod.Delete)), 98 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Shift, InputKey.Left), new PlatformAction(PlatformActionType.LineStart, PlatformActionMethod.Select)), 99 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Shift, InputKey.Right), new PlatformAction(PlatformActionType.LineEnd, PlatformActionMethod.Select)), 100 - new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Super, InputKey.Left), new PlatformAction(PlatformActionType.DocumentPrevious)), 101 - new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Super, InputKey.Right), new PlatformAction(PlatformActionType.DocumentNext)), 102 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.W), new PlatformAction(PlatformActionType.DocumentClose)), 103 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.T), new PlatformAction(PlatformActionType.TabNew)), 104 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Shift, InputKey.T), new PlatformAction(PlatformActionType.TabRestore)), 105 - new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Tab), new PlatformAction(PlatformActionType.DocumentNext)), 106 - new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Shift, InputKey.Tab), new PlatformAction(PlatformActionType.DocumentPrevious)), 107 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.S), new PlatformAction(PlatformActionType.Save)), 108 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Up), new PlatformAction(PlatformActionType.ListStart, PlatformActionMethod.Move)), 109 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Down), new PlatformAction(PlatformActionType.ListEnd, PlatformActionMethod.Move)), 110 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Z), new PlatformAction(PlatformActionType.Undo)), 111 - new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Shift, InputKey.Z), new PlatformAction(PlatformActionType.Redo)), 76 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.X), PlatformAction.Cut), 77 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.C), PlatformAction.Copy), 78 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.V), PlatformAction.Paste), 79 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.A), PlatformAction.SelectAll), 80 + new KeyBinding(InputKey.Left, PlatformAction.MoveBackwardChar), 81 + new KeyBinding(InputKey.Right, PlatformAction.MoveForwardChar), 82 + new KeyBinding(InputKey.BackSpace, PlatformAction.DeleteBackwardChar), 83 + new KeyBinding(InputKey.Delete, PlatformAction.DeleteForwardChar), 84 + new KeyBinding(new KeyCombination(InputKey.Shift, InputKey.Left), PlatformAction.SelectBackwardChar), 85 + new KeyBinding(new KeyCombination(InputKey.Shift, InputKey.Right), PlatformAction.SelectForwardChar), 86 + new KeyBinding(new KeyCombination(InputKey.Shift, InputKey.BackSpace), PlatformAction.DeleteBackwardChar), 87 + new KeyBinding(new KeyCombination(InputKey.Shift, InputKey.Delete), PlatformAction.DeleteForwardChar), 88 + new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Left), PlatformAction.MoveBackwardWord), 89 + new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Right), PlatformAction.MoveForwardWord), 90 + new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.BackSpace), PlatformAction.DeleteBackwardWord), 91 + new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Delete), PlatformAction.DeleteForwardWord), 92 + new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Shift, InputKey.Left), PlatformAction.SelectBackwardWord), 93 + new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Shift, InputKey.Right), PlatformAction.SelectForwardWord), 94 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Left), PlatformAction.MoveBackwardLine), 95 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Right), PlatformAction.MoveForwardLine), 96 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.BackSpace), PlatformAction.DeleteBackwardLine), 97 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Delete), PlatformAction.DeleteForwardLine), 98 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Shift, InputKey.Left), PlatformAction.SelectBackwardLine), 99 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Shift, InputKey.Right), PlatformAction.SelectForwardLine), 100 + new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Super, InputKey.Left), PlatformAction.DocumentPrevious), 101 + new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.Super, InputKey.Right), PlatformAction.DocumentNext), 102 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.W), PlatformAction.DocumentClose), 103 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.T), PlatformAction.TabNew), 104 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Shift, InputKey.T), PlatformAction.TabRestore), 105 + new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Tab), PlatformAction.DocumentNext), 106 + new KeyBinding(new KeyCombination(InputKey.Control, InputKey.Shift, InputKey.Tab), PlatformAction.DocumentPrevious), 107 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.S), PlatformAction.Save), 108 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Up), PlatformAction.MoveToListStart), 109 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Down), PlatformAction.MoveToListEnd), 110 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Z), PlatformAction.Undo), 111 + new KeyBinding(new KeyCombination(InputKey.Super, InputKey.Shift, InputKey.Z), PlatformAction.Redo), 112 + new KeyBinding(new KeyCombination(InputKey.Delete), PlatformAction.Delete), 112 113 }; 113 114 } 114 115 }
+1 -1
osu.Framework/Platform/Windows/WindowsGameHost.cs
··· 66 66 67 67 public override IEnumerable<KeyBinding> PlatformKeyBindings => base.PlatformKeyBindings.Concat(new[] 68 68 { 69 - new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.F4), new PlatformAction(PlatformActionType.Exit)) 69 + new KeyBinding(new KeyCombination(InputKey.Alt, InputKey.F4), PlatformAction.Exit) 70 70 }).ToList(); 71 71 72 72 protected override void Dispose(bool isDisposing)