-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
65c015d
commit 1b9fd28
Showing
10 changed files
with
138 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
TuneLab/UI/MainWindow/Editor/FunctionBar/AutoPageButton.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using Avalonia.Media; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using TuneLab.Base.Event; | ||
using TuneLab.GUI; | ||
using TuneLab.GUI.Components; | ||
using TuneLab.GUI.Input; | ||
using TuneLab.Utils; | ||
|
||
namespace TuneLab.UI; | ||
|
||
internal class AutoPageButton : Toggle | ||
{ | ||
public INotifiableProperty<PlayScrollTarget> PlayScrollTarget { get; } | ||
|
||
public AutoPageButton(INotifiableProperty<PlayScrollTarget> playScrollTarget) | ||
{ | ||
PlayScrollTarget = playScrollTarget; | ||
var backContent = new ToggleContent() { Item = new BorderItem() { CornerRadius = 4 }, CheckedColorSet = new() { Color = Style.HIGH_LIGHT }, UncheckedColorSet = new() { HoveredColor = Colors.White.Opacity(0.05), PressedColor = Colors.White.Opacity(0.05) } }; | ||
var iconContent = new ToggleContent() { Item = mIconItem, CheckedColorSet = new() { Color = Colors.White }, UncheckedColorSet = new() { Color = Style.LIGHT_WHITE.Opacity(0.5) } }; | ||
|
||
AddContent(backContent); | ||
AddContent(iconContent); | ||
} | ||
|
||
protected override void OnMouseDown(MouseDownEventArgs e) | ||
{ | ||
switch (e.MouseButtonType) | ||
{ | ||
case MouseButtonType.PrimaryButton: | ||
PlayScrollTarget.Value = PlayScrollTarget.Value == UI.PlayScrollTarget.View ? UI.PlayScrollTarget.None : UI.PlayScrollTarget.View; | ||
mIconItem.Icon = Assets.AutoPage; | ||
break; | ||
case MouseButtonType.SecondaryButton: | ||
PlayScrollTarget.Value = PlayScrollTarget.Value == UI.PlayScrollTarget.Playhead ? UI.PlayScrollTarget.None : UI.PlayScrollTarget.Playhead; | ||
mIconItem.Icon = Assets.AutoScroll; | ||
break; | ||
} | ||
|
||
switch (PlayScrollTarget.Value) | ||
{ | ||
case UI.PlayScrollTarget.None: | ||
|
||
break; | ||
case UI.PlayScrollTarget.View: | ||
|
||
break; | ||
case UI.PlayScrollTarget.Playhead: | ||
|
||
break; | ||
} | ||
|
||
IsChecked = PlayScrollTarget.Value != UI.PlayScrollTarget.None; | ||
InvalidateVisual(); | ||
} | ||
|
||
readonly IconItem mIconItem = new IconItem() { Icon = Assets.AutoPage }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
TuneLab/UI/MainWindow/Editor/FunctionBar/PlayScrollTarget.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace TuneLab.UI; | ||
|
||
internal enum PlayScrollTarget | ||
{ | ||
None, | ||
View, | ||
Playhead, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters