Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properties panel: Numeric calculation and click bug fix #1005

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions OpenUtau/Controls/NotePropertiesControl.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@
</Grid>
<Grid ColumnDefinitions="130,20,50,20,*">
<Label Content="{DynamicResource notedefaults.portamento.length}"/>
<TextBox Grid.Column="2" Text="{Binding PortamentoLength}" Tag="PortamentoLength"/>
<TextBox Grid.Column="2" Text="{Binding PortamentoLength, Mode=OneWay}" Tag="PortamentoLength"/>
<Slider Grid.Column="4" Classes="fader" Value="{Binding PortamentoLength}" Minimum="2" Maximum="320"
TickPlacement="BottomRight" TickFrequency="1" IsSnapToTickEnabled="true"
Tag="PortamentoLength"/>
</Grid>
<Grid ColumnDefinitions="130,20,50,20,*">
<Label Content="{DynamicResource notedefaults.portamento.start}"/>
<TextBox Grid.Column="2" Text="{Binding PortamentoStart}" Tag="PortamentoStart" Margin="0"/>
<TextBox Grid.Column="2" Text="{Binding PortamentoStart, Mode=OneWay}" Tag="PortamentoStart" Margin="0"/>
<Slider Grid.Column="4" Classes="fader" Value="{Binding PortamentoStart}" Minimum="-200" Maximum="200"
TickPlacement="BottomRight" TickFrequency="1" IsSnapToTickEnabled="true"
Tag="PortamentoStart"/>
Expand Down Expand Up @@ -86,56 +86,56 @@
<Grid ColumnDefinitions="130,20,50,20,*" >
<Label Content="{DynamicResource notedefaults.vibrato.length}"/>
<TextBox Grid.Column="2" Text="{Binding VibratoLength, Mode=OneWay}" Tag="VibratoLength"/>
<Slider Grid.Column="4" Classes="fader" Value="{Binding VibratoLength, Mode=OneWay}" Minimum="0" Maximum="100"
<Slider Grid.Column="4" Classes="fader" Value="{Binding VibratoLength}" Minimum="0" Maximum="100"
TickPlacement="BottomRight" TickFrequency="0.1" IsSnapToTickEnabled="true"
Tag="VibratoLength" IsDirectionReversed="True" />
</Grid>
<Grid ColumnDefinitions="130,20,50,20,*">
<Label Content="{DynamicResource notedefaults.vibrato.period}"/>
<TextBox Grid.Column="2" Text="{Binding VibratoPeriod, Mode=OneWay}" Tag="VibratoPeriod"/>
<Slider Grid.Column="4" Classes="fader" Value="{Binding VibratoPeriod, Mode=OneWay}" Minimum="5" Maximum="500"
<Slider Grid.Column="4" Classes="fader" Value="{Binding VibratoPeriod}" Minimum="5" Maximum="500"
TickPlacement="BottomRight" TickFrequency="0.1" IsSnapToTickEnabled="true"
Tag="VibratoPeriod"/>
</Grid>
<Grid ColumnDefinitions="130,20,50,20,*">
<Label Content="{DynamicResource notedefaults.vibrato.depth}"/>
<TextBox Grid.Column="2" Text="{Binding VibratoDepth, Mode=OneWay}" Tag="VibratoDepth"/>
<Slider Grid.Column="4" Classes="fader" Value="{Binding VibratoDepth, Mode=OneWay}" Minimum="5" Maximum="200"
<Slider Grid.Column="4" Classes="fader" Value="{Binding VibratoDepth}" Minimum="5" Maximum="200"
TickPlacement="BottomRight" TickFrequency="0.1" IsSnapToTickEnabled="true"
Tag="VibratoDepth"/>
</Grid>
<Grid ColumnDefinitions="130,20,50,20,*">
<Label Content="{DynamicResource notedefaults.vibrato.in}"/>
<TextBox Grid.Column="2" Text="{Binding VibratoIn, Mode=OneWay}" Tag="VibratoIn"/>
<Slider Grid.Column="4" Classes="fader" Value="{Binding VibratoIn, Mode=OneWay}" Minimum="0" Maximum="100"
<Slider Grid.Column="4" Classes="fader" Value="{Binding VibratoIn}" Minimum="0" Maximum="100"
TickPlacement="BottomRight" TickFrequency="0.1" IsSnapToTickEnabled="true"
Tag="VibratoIn"/>
</Grid>
<Grid ColumnDefinitions="130,20,50,20,*">
<Label Content="{DynamicResource notedefaults.vibrato.out}"/>
<TextBox Grid.Column="2" Text="{Binding VibratoOut, Mode=OneWay}" Tag="VibratoOut"/>
<Slider Grid.Column="4" Classes="fader" Value="{Binding VibratoOut, Mode=OneWay}" Minimum="0" Maximum="100"
<Slider Grid.Column="4" Classes="fader" Value="{Binding VibratoOut}" Minimum="0" Maximum="100"
TickPlacement="BottomRight" TickFrequency="0.1" IsSnapToTickEnabled="true"
Tag="VibratoOut"/>
</Grid>
<Grid ColumnDefinitions="130,20,50,20,*">
<Label Content="{DynamicResource notedefaults.vibrato.shift}"/>
<TextBox Grid.Column="2" Text="{Binding VibratoShift, Mode=OneWay}" Tag="VibratoShift"/>
<Slider Grid.Column="4" Classes="fader" Value="{Binding VibratoShift, Mode=OneWay}" Minimum="0" Maximum="100"
<Slider Grid.Column="4" Classes="fader" Value="{Binding VibratoShift}" Minimum="0" Maximum="100"
TickPlacement="BottomRight" TickFrequency="0.1" IsSnapToTickEnabled="true"
Tag="VibratoShift"/>
</Grid>
<Grid ColumnDefinitions="130,20,50,20,*">
<Label Content="{DynamicResource notedefaults.vibrato.drift}"/>
<TextBox Grid.Column="2" Text="{Binding VibratoDrift, Mode=OneWay}" Tag="VibratoDrift"/>
<Slider Grid.Column="4" Classes="fader" Value="{Binding VibratoDrift, Mode=OneWay}" Minimum="-100" Maximum="100"
<Slider Grid.Column="4" Classes="fader" Value="{Binding VibratoDrift}" Minimum="-100" Maximum="100"
TickPlacement="BottomRight" TickFrequency="0.1" IsSnapToTickEnabled="true"
Tag="VibratoDrift"/>
</Grid>
<Grid ColumnDefinitions="130,20,50,20,*">
<Label Content="{DynamicResource notedefaults.vibrato.vollink}"/>
<TextBox Grid.Column="2" Text="{Binding VibratoVolLink, Mode=OneWay}" Tag="VibratoVolLink"/>
<Slider Grid.Column="4" Classes="fader" Value="{Binding VibratoVolLink, Mode=OneWay}" Minimum="-100" Maximum="100"
<Slider Grid.Column="4" Classes="fader" Value="{Binding VibratoVolLink}" Minimum="-100" Maximum="100"
TickPlacement="BottomRight" TickFrequency="0.1" IsSnapToTickEnabled="true"
Tag="VibratoVolLink"/>
</Grid>
Expand Down
7 changes: 5 additions & 2 deletions OpenUtau/Controls/NotePropertiesControl.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Linq;
using Avalonia.Controls;
using Avalonia.Input;
Expand Down Expand Up @@ -96,13 +96,16 @@ void SliderPointerPressed(object? sender, PointerPressedEventArgs args) {
void SliderPointerReleased(object? sender, PointerReleasedEventArgs args) {
Log.Debug("Slider released");
if (NotePropertiesViewModel.PanelControlPressed) {
if (sender is Slider slider && slider.Tag is string tag && !string.IsNullOrEmpty(tag)) {
ViewModel.SetNoteParams(tag, (float)slider.Value);
}
NotePropertiesViewModel.PanelControlPressed = false;
DocManager.Inst.EndUndoGroup();
}
}
void SliderPointerMoved(object? sender, PointerEventArgs args) {
if (sender is Slider slider && slider.Tag is string tag && !string.IsNullOrEmpty(tag)) {
ViewModel.SetNoteParams(tag, slider.Value);
ViewModel.SetNoteParams(tag, (float)slider.Value);
}
}

Expand Down
2 changes: 1 addition & 1 deletion OpenUtau/Controls/NotePropertyExpression.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Label Content="{Binding Name}" Grid.Column="0" VerticalAlignment="Center"/>
<TextBox Text="{Binding Value, Mode=OneWay}" Grid.Column="2" IsVisible="{Binding IsNumerical}" VerticalAlignment="Center" IsEnabled="{Binding IsNoteSelected}"
GotFocus="OnTextBoxGotFocus" LostFocus="OnTextBoxLostFocus"/>
<Slider Grid.Column="4" Classes="fader" Value="{Binding Value, Mode=OneWay}" Minimum="{Binding Min}" Maximum="{Binding Max}"
<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}"
Name="slider"/>
<ComboBox Grid.Column="1" Grid.ColumnSpan="4" ItemsSource="{Binding Options}"
Expand Down
5 changes: 4 additions & 1 deletion OpenUtau/Controls/NotePropertyExpression.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,16 @@ void SliderPointerPressed(object? sender, PointerPressedEventArgs args) {
void SliderPointerReleased(object? sender, PointerReleasedEventArgs args) {
Log.Debug("Slider released");
if (NotePropertiesViewModel.PanelControlPressed) {
if (sender is Slider slider && DataContext is NotePropertyExpViewModel ViewModel) {
ViewModel.SetNumericalExpressions((float)slider.Value);
}
NotePropertiesViewModel.PanelControlPressed = false;
DocManager.Inst.EndUndoGroup();
}
}
void SliderPointerMoved(object? sender, PointerEventArgs args) {
if (sender is Slider slider && DataContext is NotePropertyExpViewModel ViewModel) {
ViewModel.SetNumericalExpressions(slider.Value);
ViewModel.SetNumericalExpressions((float)slider.Value);
}
}
}
Expand Down
Loading