Skip to content

Commit

Permalink
Add keybind to swap flick direction
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharied committed Sep 30, 2024
1 parent 771fa0f commit 91260f0
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,28 @@ public void KeyboardAction_FastSetObjectIsCritical(ActionExecutionContext e)
}));
}

public void KeyboardAction_FastSwitchFlickDirection(ActionExecutionContext e)
{
var selectedFlicks = SelectObjects.OfType<Flick>().ToList();

if (selectedFlicks.Count == 0)
{
ToastNotify(Resources.NoFlickCouldBeSwitched);
return;
}

UndoRedoManager.ExecuteAction(LambdaUndoAction.Create(Resources.BatchSwitchFlickDirection, ChangeFlicks, ChangeFlicks));
return;

void ChangeFlicks()
{
foreach (var flick in selectedFlicks)
flick.Direction = flick.Direction == Flick.FlickDirection.Left
? Flick.FlickDirection.Right
: Flick.FlickDirection.Left;
}
}

public bool CheckAndNotifyIfPlaceBeyondDuration(Point placePoint)
{
if (placePoint.Y > TotalDurationHeight || placePoint.Y < 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:valueconverters="clr-namespace:OngekiFumenEditor.UI.ValueConverters"
xmlns:viewmodels="clr-namespace:OngekiFumenEditor.Modules.FumenVisualEditor.ViewModels"
cal:Message.Attach="[Key OemTilde] = [Action KeyboardAction_FastPlaceDockableObjectToWallLeft]; [Key D4] = [Action KeyboardAction_FastPlaceDockableObjectToWallRight]; [Key D3] = [Action KeyboardAction_FastPlaceDockableObjectToRight]; [Key D2] = [Action KeyboardAction_FastPlaceDockableObjectToCenter]; [Key D1] = [Action KeyboardAction_FastPlaceDockableObjectToLeft]; [Event DragEnter] = [Action Grid_DragEnter($executionContext)]; [Event Drop] = [Action Grid_Drop($executionContext)]; [Event FocusableChanged] = [Action OnFocusableChanged($executionContext)]; [Key Delete] = [Action KeyboardAction_DeleteSelectingObjects]; [Gesture Ctrl+A] = [Action KeyboardAction_SelectAllObjects]; [Key Escape] = [Action KeyboardAction_CancelSelectingObjects]; [Key C] = [Action KeyboardAction_FastSetObjectIsCritical($executionContext)]; [Key Q] = [Action KeyboardAction_HideOrShow];[Key A] = [Action KeyboardAction_FastAddConnectableChild($executionContext)]; [Gesture Ctrl+C]=[Action MenuItemAction_CopySelectedObjects]; [Gesture Ctrl+V]=[Action MenuItemAction_PasteCopiesObjects]; "
cal:Message.Attach="[Key OemTilde] = [Action KeyboardAction_FastPlaceDockableObjectToWallLeft]; [Key D4] = [Action KeyboardAction_FastPlaceDockableObjectToWallRight]; [Key D3] = [Action KeyboardAction_FastPlaceDockableObjectToRight]; [Key D2] = [Action KeyboardAction_FastPlaceDockableObjectToCenter]; [Key D1] = [Action KeyboardAction_FastPlaceDockableObjectToLeft]; [Event DragEnter] = [Action Grid_DragEnter($executionContext)]; [Event Drop] = [Action Grid_Drop($executionContext)]; [Event FocusableChanged] = [Action OnFocusableChanged($executionContext)]; [Key Delete] = [Action KeyboardAction_DeleteSelectingObjects]; [Gesture Ctrl+A] = [Action KeyboardAction_SelectAllObjects]; [Key Escape] = [Action KeyboardAction_CancelSelectingObjects]; [Key C] = [Action KeyboardAction_FastSetObjectIsCritical($executionContext)]; [Key Q] = [Action KeyboardAction_HideOrShow];[Key A] = [Action KeyboardAction_FastAddConnectableChild($executionContext)]; [Key F] = [Action KeyboardAction_FastSwitchFlickDirection($executionContext)]; [Gesture Ctrl+C]=[Action MenuItemAction_CopySelectedObjects]; [Gesture Ctrl+V]=[Action MenuItemAction_PasteCopiesObjects]; "
d:DataContext="{d:DesignInstance Type=viewmodels:FumenVisualEditorViewModel}"
d:DesignHeight="450"
d:DesignWidth="800"
Expand Down
18 changes: 18 additions & 0 deletions OngekiFumenEditor/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions OngekiFumenEditor/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@
<data name="BatchSetIsCritical" xml:space="preserve">
<value>Batch set property IsCritical</value>
</data>
<data name="BatchSwitchFlickDirection" xml:space="preserve">
<value>Batch switch flick direction</value>
</data>
<data name="BeatSplit" xml:space="preserve">
<value>Subdivision multiplier for the meter:</value>
</data>
Expand Down Expand Up @@ -1005,6 +1008,9 @@
<data name="NoObjectCouldBeSetIsCritical" xml:space="preserve">
<value>No suitable objects to setting property IsCritical</value>
</data>
<data name="NoFlickCouldBeSwitched" xml:space="preserve">
<value>No flicks to switch in selection</value>
</data>
<data name="NotInterpolatedCurve" xml:space="preserve">
<value>The curve lane has not been interpolated yet</value>
</data>
Expand Down

0 comments on commit 91260f0

Please sign in to comment.