forked from stakira/OpenUtau
-
Notifications
You must be signed in to change notification settings - Fork 0
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 stakira#815 from maiko3tattun/0830_PasteParam
Add "Select and paste parameters" and related methods
- Loading branch information
Showing
12 changed files
with
217 additions
and
38 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
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
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,33 @@ | ||
using System.Collections.ObjectModel; | ||
using OpenUtau.Core; | ||
using ReactiveUI.Fody.Helpers; | ||
|
||
namespace OpenUtau.App.ViewModels { | ||
public class PasteParamViewModel { | ||
|
||
public PasteParamViewModel() { | ||
Params.Add(new PasteParameter("pitch points", "")); | ||
Params.Add(new PasteParameter("vibrato", "")); | ||
foreach(var exp in DocManager.Inst.Project.expressions) { | ||
if(exp.Value.type != Core.Ustx.UExpressionType.Curve) { | ||
Params.Add(new PasteParameter(exp.Value.name, exp.Key)); | ||
} | ||
} | ||
Params[0].IsSelected = true; | ||
} | ||
|
||
public ObservableCollection<PasteParameter> Params { get; } = new ObservableCollection<PasteParameter>(); | ||
} | ||
|
||
public class PasteParameter { | ||
public PasteParameter(string name, string abbr) { | ||
Name = name; | ||
Abbr = abbr; | ||
} | ||
public string Name { get; set; } | ||
public string Abbr { get; set; } | ||
[Reactive] public bool IsSelected { get; set; } = false; | ||
|
||
public override string ToString() { return Name; } | ||
} | ||
} |
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,23 @@ | ||
<Window 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" | ||
mc:Ignorable="d" MinWidth="200" MinHeight="200" Width="300" Height="350" | ||
x:Class="OpenUtau.App.Views.PasteParamDialog" | ||
Icon="/Assets/open-utau.ico" | ||
Title="{DynamicResource context.note.pasteparameters}" | ||
WindowStartupLocation="CenterScreen" | ||
ExtendClientAreaToDecorationsHint="False"> | ||
<Grid RowDefinitions="*, 40" > | ||
<ListBox SelectionMode="Multiple,Toggle" ItemsSource="{Binding Params}" | ||
Grid.Row="0" Margin="10" ScrollViewer.VerticalScrollBarVisibility="Auto" Background="Transparent" > | ||
<ListBox.Styles> | ||
<Style Selector="ListBoxItem"> | ||
<Setter Property="IsSelected" Value="{Binding IsSelected}"/> | ||
</Style> | ||
</ListBox.Styles> | ||
</ListBox> | ||
|
||
<Button Content="OK" Click="OkButtonClick" Grid.Row="1" Width="100" HorizontalAlignment="Center"/> | ||
</Grid> | ||
</Window> |
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,34 @@ | ||
using Avalonia.Controls; | ||
using Avalonia.Input; | ||
using Avalonia.Interactivity; | ||
|
||
namespace OpenUtau.App.Views { | ||
public partial class PasteParamDialog : Window { | ||
public bool Apply { get; private set; } = false; | ||
|
||
public PasteParamDialog() { | ||
InitializeComponent(); | ||
} | ||
|
||
private void OkButtonClick(object? sender, RoutedEventArgs e) { | ||
Finish(); | ||
} | ||
|
||
private void Finish() { | ||
Apply = true; | ||
Close(); | ||
} | ||
|
||
protected override void OnKeyDown(KeyEventArgs e) { | ||
if (e.Key == Key.Escape) { | ||
e.Handled = true; | ||
Close(); | ||
} else if (e.Key == Key.Enter) { | ||
e.Handled = true; | ||
Finish(); | ||
} else { | ||
base.OnKeyDown(e); | ||
} | ||
} | ||
} | ||
} |
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