1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-12 08:25:13 +00:00
Funkin/source/funkin/ui/debug/charting/handlers/ChartEditorShortcutHandler.hx

62 lines
2 KiB
Haxe
Raw Normal View History

2023-10-28 23:56:34 +00:00
package funkin.ui.debug.charting.handlers;
import funkin.util.PlatformUtil;
@:access(funkin.ui.debug.charting.ChartEditorState)
class ChartEditorShortcutHandler
{
public static function applyPlatformShortcutText(state:ChartEditorState):Void
{
state.menubarItemNewChart.shortcutText = ctrlOrCmd('N');
state.menubarItemOpenChart.shortcutText = ctrlOrCmd('O');
state.menubarItemSaveChartAs.shortcutText = ctrlOrCmd(shift('S'));
state.menubarItemExit.shortcutText = ctrlOrCmd('Q');
state.menubarItemUndo.shortcutText = ctrlOrCmd('Z');
state.menubarItemRedo.shortcutText = ctrlOrCmd('Y');
state.menubarItemCut.shortcutText = ctrlOrCmd('X');
state.menubarItemCopy.shortcutText = ctrlOrCmd('C');
state.menubarItemPaste.shortcutText = ctrlOrCmd('V');
state.menubarItemSelectAll.shortcutText = ctrlOrCmd('A');
state.menubarItemSelectInverse.shortcutText = ctrlOrCmd('I');
state.menubarItemSelectNone.shortcutText = ctrlOrCmd('D');
state.menubarItemSelectBeforeCursor.shortcutText = shift('Home');
state.menubarItemSelectAfterCursor.shortcutText = shift('End');
state.menubarItemDifficultyDown.shortcutText = ctrlOrCmd('');
state.menubarItemDifficultyUp.shortcutText = ctrlOrCmd('');
state.menubarItemPlaytestFull.shortcutText = 'Enter';
state.menubarItemPlaytestMinimal.shortcutText = shift('Enter');
2023-10-28 23:56:34 +00:00
}
/**
* Display `Ctrl` on Windows and `` (Command) on macOS.
* @param input
*/
static inline function ctrlOrCmd(input:String)
{
return (PlatformUtil.isMacOS()) ? '+${input}' : 'Ctrl+${input}';
}
/**
* Display `Ctrl` on Windows and `^` (Control) on macOS.
* @param input
*/
static inline function ctrl(input:String)
{
return (PlatformUtil.isMacOS()) ? '^+${input}' : 'Ctrl+${input}';
}
static inline function alt(input:String)
{
return (PlatformUtil.isMacOS()) ? '+${input}' : 'Alt+${input}';
}
static inline function shift(input:String)
{
return (PlatformUtil.isMacOS()) ? '+${input}' : 'Shift+${input}';
}
}