Skip to content

Commit bf0c8be

Browse files
committed
ui fixes
1 parent d33a440 commit bf0c8be

File tree

9 files changed

+41
-29
lines changed

9 files changed

+41
-29
lines changed

OpenUtau/Colors/Brushes.axaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<ResourceDictionary xmlns="https://github.com/avaloniaui"
22
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
33
<SolidColorBrush x:Key="SystemRegionBrush"
4-
Color="{DynamicResource MainWindowColor}"/>
4+
Color="{DynamicResource BackgroundColor}"/>
55
<SolidColorBrush x:Key="SystemControlBackgroundAltHighBrush"
66
Color="{DynamicResource BackgroundColor}"/>
77
<SolidColorBrush x:Key="BackgroundBrushSemi"

OpenUtau/Colors/DarkTheme.axaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
44
<system:Boolean x:Key="IsDarkMode">true</system:Boolean>
55

6-
<Color x:Key="MainWindowColor">#303030</Color>
7-
86
<Color x:Key="BackgroundColor">#303030</Color>
97
<Color x:Key="BackgroundColorPointerOver">#505050</Color>
108
<Color x:Key="BackgroundColorPressed">#707070</Color>

OpenUtau/Colors/LightTheme.axaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
xmlns:system="clr-namespace:System;assembly=mscorlib"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
44
<system:Boolean x:Key="IsDarkMode">false</system:Boolean>
5-
6-
<Color x:Key="MainWindowColor">#FFFFFF</Color>
75

86
<Color x:Key="BackgroundColor">#FFFFFF</Color>
97
<Color x:Key="BackgroundColorPointerOver">#F0F0F0</Color>

OpenUtau/Controls/OtoPlot.cs

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@
1616

1717
namespace OpenUtau.App.Controls {
1818
class OtoPlot : Control {
19+
public struct OtoPlotTiming {
20+
public double cutoff;
21+
public double offset;
22+
public double consonant;
23+
public double preutter;
24+
public double overlap;
25+
}
26+
1927
public static readonly DirectProperty<OtoPlot, bool> ZoomInMelProperty =
2028
AvaloniaProperty.RegisterDirect<OtoPlot, bool>(
2129
nameof(ZoomInMel),
@@ -31,6 +39,11 @@ class OtoPlot : Control {
3139
nameof(F0),
3240
o => o.F0,
3341
(o, v) => o.F0 = v);
42+
public static readonly DirectProperty<OtoPlot, OtoPlotTiming> TimingProperty =
43+
AvaloniaProperty.RegisterDirect<OtoPlot, OtoPlotTiming>(
44+
nameof(Timing),
45+
o => o.Timing,
46+
(o, v) => o.Timing = v);
3447

3548
public bool ZoomInMel {
3649
get => zoomInMel;
@@ -44,16 +57,15 @@ public Tuple<int, double[]>? F0 {
4457
get => f0;
4558
set => SetAndRaise(F0Property, ref f0, value);
4659
}
60+
public OtoPlotTiming Timing {
61+
get => timing;
62+
set => SetAndRaise(TimingProperty, ref timing, value);
63+
}
4764

4865
private bool zoomInMel;
4966
private WaveFile? waveFile;
5067
private Tuple<int, double[]>? f0;
51-
52-
public double Cutoff { get; set; }
53-
public double Offset { get; set; }
54-
public double Consonant { get; set; }
55-
public double Preutter { get; set; }
56-
public double Overlap { get; set; }
68+
private OtoPlotTiming timing;
5769

5870
const int kFftSize = 1024;
5971
const int kMelSize = 80;
@@ -162,7 +174,8 @@ protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs chang
162174
}
163175
UpdateMel(WaveFile);
164176
InvalidateVisual();
165-
} else if (change.Property == F0Property) {
177+
} else if (change.Property == F0Property ||
178+
change.Property == TimingProperty) {
166179
InvalidateVisual();
167180
}
168181
}
@@ -369,13 +382,13 @@ void DrawTiming(DrawingContext context) {
369382
double msToX = 0.001 / xSpan * width;
370383
double xOffset = xStart / xSpan * width;
371384
double totalDurMs = duration * 1000.0;
372-
double cutoff = Cutoff >= 0
373-
? totalDurMs - Cutoff
374-
: Offset - Cutoff;
375-
double offsetX = Offset * msToX - xOffset;
376-
double consonantX = (Offset + Consonant) * msToX - xOffset;
377-
double preutterX = (Offset + Preutter) * msToX - xOffset;
378-
double overlapX = (Offset + Overlap) * msToX - xOffset;
385+
double cutoff = Timing.cutoff >= 0
386+
? totalDurMs - Timing.cutoff
387+
: Timing.offset - Timing.cutoff;
388+
double offsetX = Timing.offset * msToX - xOffset;
389+
double consonantX = (Timing.offset + Timing.consonant) * msToX - xOffset;
390+
double preutterX = (Timing.offset + Timing.preutter) * msToX - xOffset;
391+
double overlapX = (Timing.offset + Timing.overlap) * msToX - xOffset;
379392
double cutoffX = cutoff * msToX - xOffset;
380393

381394
if (offsetX > 0) {

OpenUtau/Controls/TrackAdder.axaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
44
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
55
xmlns:vm="using:OpenUtau.App.ViewModels"
6-
mc:Ignorable="d" d:DesignWidth="250" d:DesignHeight="64"
7-
x:Class="OpenUtau.App.Controls.TrackAdder" Width="250">
6+
mc:Ignorable="d" d:DesignWidth="300" d:DesignHeight="64"
7+
x:Class="OpenUtau.App.Controls.TrackAdder" Width="300">
88
<Border>
99
<Button Classes="clear" VerticalAlignment="Center" HorizontalAlignment="Center"
1010
Width="60" Height="30" CornerRadius="4" Click="ButtonClicked">

OpenUtau/Styles/Styles.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@
148148
</Style>
149149

150150
<Style Selector="ComboBox">
151+
<Setter Property="Background" Value="{DynamicResource SystemRegionBrush}"/>
151152
<Setter Property="FontSize" Value="12"/>
152153
<Setter Property="MinHeight" Value="20"/>
153154
<Setter Property="Height" Value="20"/>

OpenUtau/ViewModels/SingersViewModel.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
using Avalonia.Media.Imaging;
1010
using DynamicData.Binding;
1111
using NAudio.Wave;
12-
using NWaves.Audio;
1312
using NWaves.Signals;
1413
using OpenUtau.Classic;
1514
using OpenUtau.Core;

OpenUtau/Views/SingersDialog.axaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
Click="OnSingerMenuButton">
6060
<Path Classes="clear"
6161
Data="M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z"
62-
Fill="{StaticResource NeutralAccentBrush}">
62+
Fill="{DynamicResource SystemControlForegroundBaseHighBrush}">
6363
<Path.RenderTransform>
6464
<TransformGroup>
6565
<ScaleTransform ScaleX=".67" ScaleY=".67"/>
@@ -187,7 +187,8 @@
187187
<Border BorderThickness="1" CornerRadius="4" ClipToBounds="True"
188188
BorderBrush="{DynamicResource SystemControlForegroundBaseMediumBrush}">
189189
<ToggleButton Background="Transparent" IsChecked="{Binding ZoomInMel}">
190-
<Path Fill="Black" Data="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z">
190+
<Path Fill="{DynamicResource SystemControlForegroundBaseHighBrush}"
191+
Data="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z">
191192
<Path.RenderTransform>
192193
<TransformGroup>
193194
<ScaleTransform ScaleX=".75" ScaleY=".75" />

OpenUtau/Views/SingersDialog.axaml.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,13 @@ void DrawOto(UOto? oto) {
200200
OtoPlot.F0 = null;
201201
return;
202202
}
203-
OtoPlot.Cutoff = oto.Cutoff;
204-
OtoPlot.Offset = oto.Offset;
205-
OtoPlot.Consonant = oto.Consonant;
206-
OtoPlot.Preutter = oto.Preutter;
207-
OtoPlot.Overlap = oto.Overlap;
203+
OtoPlot.Timing = new() {
204+
cutoff = oto.Cutoff,
205+
offset = oto.Offset,
206+
consonant = oto.Consonant,
207+
preutter = oto.Preutter,
208+
overlap = oto.Overlap,
209+
};
208210
OtoPlot.WaveFile = loadWav(oto);
209211
OtoPlot.F0 = LoadF0(oto.File);
210212
}

0 commit comments

Comments
 (0)