-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #751 from maiko3tattun/0619_NoteProperty
[WIP] Add Note Params panel
- Loading branch information
Showing
11 changed files
with
666 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
<UserControl xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:vm="using:OpenUtau.App.ViewModels" | ||
mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="600" Width="400" | ||
x:Class="OpenUtau.App.Controls.NotePropertiesControl" KeyDown="OnKeyDown" Margin="0"> | ||
<UserControl.Styles> | ||
<Style Selector="Button,CheckBox"> | ||
<Setter Property="Focusable" Value="False"/> | ||
</Style> | ||
<Style Selector="Label,TextBox,Slider,ComboBox,CheckBox"> | ||
<Setter Property="VerticalAlignment" Value="Center"/> | ||
</Style> | ||
</UserControl.Styles> | ||
|
||
<Grid> | ||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Visible"> | ||
<StackPanel Margin="10"> | ||
|
||
<HeaderedContentControl Classes="groupbox" Header="{DynamicResource notedefaults.lyric}"> | ||
<Grid ColumnDefinitions="143,*"> | ||
<Label Content="{DynamicResource notedefaults.lyric}" Grid.Column="0"/> | ||
<TextBox Text="{Binding Lyric}" IsEnabled="{Binding IsNoteSelected}" Grid.Column="1"/> | ||
</Grid> | ||
</HeaderedContentControl> | ||
|
||
<HeaderedContentControl Classes="groupbox" Header="{DynamicResource notedefaults.portamento}"> | ||
<StackPanel IsEnabled="{Binding IsNoteSelected}"> | ||
<Grid ColumnDefinitions="123,20,*"> | ||
<Label Content="{DynamicResource notedefaults.preset}"/> | ||
<ComboBox Grid.Column="2" ItemsSource="{Binding PortamentoPresets}" | ||
SelectedItem="{Binding ApplyPortamentoPreset}" HorizontalAlignment="Stretch"/> | ||
</Grid> | ||
<Grid ColumnDefinitions="123,20,*,20,*"> | ||
<Button Grid.Column="2" Content="{DynamicResource notedefaults.preset.save}" | ||
HorizontalAlignment="Stretch" Click="OnSavePortamentoPreset" | ||
ToolTip.Tip="{DynamicResource notedefaults.preset.save.tooltip}"/> | ||
<Button Grid.Column="4" Content="{DynamicResource notedefaults.preset.remove}" | ||
HorizontalAlignment="Stretch" Command="{Binding RemoveAppliedPortamentoPreset}" | ||
ToolTip.Tip="{DynamicResource notedefaults.preset.remove.tooltip}"/> | ||
</Grid> | ||
<Grid ColumnDefinitions="130,20,50,20,*"> | ||
<Label Content="{DynamicResource notedefaults.portamento.length}"/> | ||
<TextBox Grid.Column="2" Text="{Binding PortamentoLength}" /> | ||
<Slider Grid.Column="4" Classes="fader" Value="{Binding PortamentoLength}" Minimum="2" Maximum="320" | ||
TickPlacement="BottomRight" TickFrequency="1" IsSnapToTickEnabled="true" /> | ||
</Grid> | ||
<Grid ColumnDefinitions="130,20,50,20,*"> | ||
<Label Content="{DynamicResource notedefaults.portamento.start}"/> | ||
<TextBox Grid.Column="2" Text="{Binding PortamentoStart}" /> | ||
<Slider Grid.Column="4" Classes="fader" Value="{Binding PortamentoStart}" Minimum="-200" Maximum="200" | ||
TickPlacement="BottomRight" TickFrequency="1" IsSnapToTickEnabled="true" /> | ||
</Grid> | ||
</StackPanel> | ||
</HeaderedContentControl> | ||
|
||
<HeaderedContentControl Classes="groupbox" Header="{DynamicResource notedefaults.vibrato}"> | ||
<StackPanel IsEnabled="{Binding IsNoteSelected}"> | ||
<ToggleSwitch IsChecked="{Binding VibratoEnable}" OnContent="{DynamicResource prefs.on}" OffContent="{DynamicResource prefs.off}"/> | ||
<StackPanel IsEnabled="{Binding VibratoEnable}"> | ||
<Grid ColumnDefinitions="123,20,*"> | ||
<Label Content="{DynamicResource notedefaults.preset}"/> | ||
<ComboBox Grid.Column="2" ItemsSource="{Binding VibratoPresets}" | ||
SelectedItem="{Binding ApplyVibratoPreset}" HorizontalAlignment="Stretch" /> | ||
</Grid> | ||
<Grid ColumnDefinitions="123,20,*,20,*"> | ||
<Button Grid.Column="2" Content="{DynamicResource notedefaults.preset.save}" | ||
HorizontalAlignment="Stretch" Click="OnSaveVibratoPreset" | ||
ToolTip.Tip="{DynamicResource notedefaults.preset.save.tooltip}"/> | ||
<Button Grid.Column="4" Content="{DynamicResource notedefaults.preset.remove}" | ||
HorizontalAlignment="Stretch" Command="{Binding RemoveAppliedVibratoPreset}" | ||
ToolTip.Tip="{DynamicResource notedefaults.preset.remove.tooltip}"/> | ||
</Grid> | ||
<Grid ColumnDefinitions="130,20,50,20,*"> | ||
<Label Content="{DynamicResource notedefaults.vibrato.length}"/> | ||
<TextBox Grid.Column="2" Text="{Binding VibratoLength}" /> | ||
<Slider Grid.Column="4" Classes="fader" Value="{Binding VibratoLength}" Minimum="0" Maximum="100" | ||
TickPlacement="BottomRight" TickFrequency="0.1" IsSnapToTickEnabled="true" /> | ||
</Grid> | ||
<Grid ColumnDefinitions="130,20,50,20,*"> | ||
<Label Content="{DynamicResource notedefaults.vibrato.period}"/> | ||
<TextBox Grid.Column="2" Text="{Binding VibratoPeriod}" /> | ||
<Slider Grid.Column="4" Classes="fader" Value="{Binding VibratoPeriod}" Minimum="5" Maximum="500" | ||
TickPlacement="BottomRight" TickFrequency="0.1" IsSnapToTickEnabled="true" /> | ||
</Grid> | ||
<Grid ColumnDefinitions="130,20,50,20,*"> | ||
<Label Content="{DynamicResource notedefaults.vibrato.depth}"/> | ||
<TextBox Grid.Column="2" Text="{Binding VibratoDepth}" /> | ||
<Slider Grid.Column="4" Classes="fader" Value="{Binding VibratoDepth}" Minimum="5" Maximum="200" | ||
TickPlacement="BottomRight" TickFrequency="0.1" IsSnapToTickEnabled="true" /> | ||
</Grid> | ||
<Grid ColumnDefinitions="130,20,50,20,*"> | ||
<Label Content="{DynamicResource notedefaults.vibrato.in}"/> | ||
<TextBox Grid.Column="2" Text="{Binding VibratoIn}" /> | ||
<Slider Grid.Column="4" Classes="fader" Value="{Binding VibratoIn}" Minimum="0" Maximum="100" | ||
TickPlacement="BottomRight" TickFrequency="0.1" IsSnapToTickEnabled="true" /> | ||
</Grid> | ||
<Grid ColumnDefinitions="130,20,50,20,*"> | ||
<Label Content="{DynamicResource notedefaults.vibrato.out}"/> | ||
<TextBox Grid.Column="2" Text="{Binding VibratoOut}" /> | ||
<Slider Grid.Column="4" Classes="fader" Value="{Binding VibratoOut}" Minimum="0" Maximum="100" | ||
TickPlacement="BottomRight" TickFrequency="0.1" IsSnapToTickEnabled="true" /> | ||
</Grid> | ||
<Grid ColumnDefinitions="130,20,50,20,*"> | ||
<Label Content="{DynamicResource notedefaults.vibrato.shift}"/> | ||
<TextBox Grid.Column="2" Text="{Binding VibratoShift}" /> | ||
<Slider Grid.Column="4" Classes="fader" Value="{Binding VibratoShift}" Minimum="0" Maximum="100" | ||
TickPlacement="BottomRight" TickFrequency="0.1" IsSnapToTickEnabled="true" /> | ||
</Grid> | ||
<Grid ColumnDefinitions="123,20,*"> | ||
<Label Content="{DynamicResource noteproperty.setlongnote}"/> | ||
<CheckBox Grid.Column="2" IsChecked="{Binding AutoVibratoToggle}"/> | ||
</Grid> | ||
<Grid ColumnDefinitions="180,20,50,20,*"> | ||
<Label Content="{DynamicResource notedefaults.vibrato.autominlength}"/> | ||
<TextBox Grid.Column="2" IsEnabled="{Binding AutoVibratoToggle}" Text="{Binding AutoVibratoNoteLength}" /> | ||
<Slider Grid.Column="4" Classes="fader" IsEnabled="{Binding AutoVibratoToggle}" Value="{Binding AutoVibratoNoteLength}" Minimum="10" Maximum="1920" | ||
TickPlacement="BottomRight" TickFrequency="1" IsSnapToTickEnabled="true" /> | ||
</Grid> | ||
</StackPanel> | ||
</StackPanel> | ||
</HeaderedContentControl> | ||
|
||
<HeaderedContentControl Classes="groupbox" Header="{DynamicResource exps.caption}"> | ||
<StackPanel Name="ExpressionsPanel" /> | ||
</HeaderedContentControl> | ||
</StackPanel> | ||
</ScrollViewer> | ||
</Grid> | ||
</UserControl> |
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,77 @@ | ||
using System; | ||
using System.Reactive.Linq; | ||
using Avalonia.Controls; | ||
using Avalonia.Input; | ||
using Avalonia.Interactivity; | ||
using OpenUtau.App.ViewModels; | ||
using OpenUtau.App.Views; | ||
using OpenUtau.Core; | ||
using OpenUtau.Core.Ustx; | ||
using ReactiveUI; | ||
|
||
namespace OpenUtau.App.Controls { | ||
public partial class NotePropertiesControl : UserControl, ICmdSubscriber { | ||
private readonly NotePropertiesViewModel ViewModel; | ||
|
||
public NotePropertiesControl() { | ||
InitializeComponent(); | ||
DataContext = ViewModel = new NotePropertiesViewModel(); | ||
|
||
DocManager.Inst.AddSubscriber(this); | ||
} | ||
|
||
private void LoadPart(UPart? part) { | ||
ViewModel.LoadPart(part); | ||
ExpressionsPanel.Children.Clear(); | ||
foreach (NotePropertyExpViewModel expVM in ViewModel.Expressions) { | ||
var control = new NotePropertyExpression() { DataContext = expVM }; | ||
ExpressionsPanel.Children.Add(control); | ||
} | ||
} | ||
|
||
void OnSavePortamentoPreset(object sender, RoutedEventArgs e) { | ||
var dialog = new TypeInDialog() { | ||
Title = ThemeManager.GetString("notedefaults.preset.namenew"), | ||
onFinish = name => ViewModel.SavePortamentoPreset(name), | ||
}; | ||
//dialog.ShowDialog(this); | ||
} | ||
|
||
void OnRemovePortamentoPreset(object sender, RoutedEventArgs e) { | ||
ViewModel.RemoveAppliedPortamentoPreset(); | ||
} | ||
|
||
void OnSaveVibratoPreset(object sender, RoutedEventArgs e) { | ||
var dialog = new TypeInDialog() { | ||
Title = ThemeManager.GetString("notedefaults.preset.namenew"), | ||
onFinish = name => ViewModel.SaveVibratoPreset(name), | ||
}; | ||
//dialog.ShowDialog(this); | ||
} | ||
|
||
void OnRemoveVibratoPreset(object sender, RoutedEventArgs e) { | ||
ViewModel.RemoveAppliedVibratoPreset(); | ||
} | ||
|
||
private void OnKeyDown(object? sender, KeyEventArgs e) { | ||
switch (e.Key) { | ||
case Key.Enter: | ||
//OnFinish(sender, e); | ||
e.Handled = true; | ||
break; | ||
case Key.Escape: | ||
//OnCancel(sender, e); | ||
e.Handled = true; | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
|
||
public void OnNext(UCommand cmd, bool isUndo) { | ||
if (cmd is LoadPartNotification loadPart) { | ||
LoadPart(loadPart.part); | ||
} | ||
} | ||
} | ||
} |
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,15 @@ | ||
<UserControl xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:vm="using:OpenUtau.App.ViewModels" | ||
x:Class="OpenUtau.App.Controls.NotePropertyExpression"> | ||
<Grid ColumnDefinitions="143,7,50,20,*"> | ||
<Label Content="{Binding Name}" Grid.Column="0" VerticalAlignment="Center"/> | ||
<TextBox Text="{Binding Value}" Grid.Column="2" IsVisible="{Binding IsNumerical}" VerticalAlignment="Center" IsEnabled="{Binding IsNoteSelected}"/> | ||
<Slider Grid.Column="4" Classes="fader" Value="{Binding Value}" Minimum="{Binding Min}" Maximum="{Binding Max}" | ||
TickPlacement="BottomRight" TickFrequency="1" IsSnapToTickEnabled="true" IsVisible="{Binding IsNumerical}" VerticalAlignment="Center" IsEnabled="{Binding IsNoteSelected}" /> | ||
<ComboBox Grid.Column="1" Grid.ColumnSpan="4" ItemsSource="{Binding Options}" | ||
SelectedIndex="{Binding SelectedOption}" MinWidth="120" IsVisible="{Binding IsOptions}" VerticalAlignment="Center" IsEnabled="{Binding IsNoteSelected}" /> | ||
</Grid> | ||
</UserControl> |
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,13 @@ | ||
using Avalonia; | ||
using Avalonia.Controls; | ||
using Avalonia.Input; | ||
using OpenUtau.App.ViewModels; | ||
|
||
namespace OpenUtau.App.Controls { | ||
public partial class NotePropertyExpression : UserControl { | ||
public NotePropertyExpression() { | ||
InitializeComponent(); | ||
} | ||
|
||
} | ||
} |
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
Oops, something went wrong.