1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-10 08:44:47 +00:00
Funkin/source/funkin/ui/debug/charting/handlers/ChartEditorShortcutHandler.hx
2023-11-24 00:42:07 -05:00

62 lines
2 KiB
Haxe

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');
}
/**
* 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}';
}
}