Skip to content
Merged
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
6,740 changes: 3,324 additions & 3,416 deletions src/ui/Assets/Languages/Romanian.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,12 @@ internal static Button ColorButton(string text, string name, System.Windows.Inpu
};
var content = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8, VerticalAlignment = VerticalAlignment.Center };
content.Children.Add(swatch);
content.Children.Add(new TextBlock { Text = text, FontSize = 12.5, VerticalAlignment = VerticalAlignment.Center });
content.Children.Add(new TextBlock { Text = text, FontSize = EditorChrome.FieldFontSize, VerticalAlignment = VerticalAlignment.Center });
var button = new Button
{
Content = content,
Command = command,
MinHeight = 28,
MinHeight = EditorChrome.FieldHeight,
Padding = new Thickness(8, 0, 10, 0),
CornerRadius = new CornerRadius(6),
Background = EditorChrome.FieldBrush,
Expand Down
18 changes: 9 additions & 9 deletions src/ui/Features/Main/AssistedSplit/AssistedCardChrome.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ internal static void Apply(Window window)
internal static Border MakeHeader(string heading, string currentText)
{
var labelHeader = EditorChrome.MakeDimLabel(heading, new Thickness(0));
labelHeader.FontSize = 12.5;
labelHeader.FontSize = EditorChrome.FieldFontSize;
labelHeader.FontWeight = FontWeight.SemiBold;
labelHeader.TextWrapping = TextWrapping.Wrap;

var originalText = new TextBlock
{
Text = currentText,
FontSize = 12.5,
FontSize = EditorChrome.FieldFontSize,
TextWrapping = TextWrapping.Wrap,
};
var frame = new Border
Expand Down Expand Up @@ -92,16 +92,16 @@ internal static Button MakeCard(int number, string title, ICommand command, obje
{
var badge = new Border
{
Width = 30,
Height = 30,
CornerRadius = new CornerRadius(15),
Width = EditorChrome.ScaledSize(30),
Height = EditorChrome.ScaledSize(30),
CornerRadius = new CornerRadius(EditorChrome.ScaledSize(15)),
Background = EditorChrome.AccentSoftBrush,
VerticalAlignment = VerticalAlignment.Center,
Margin = new Thickness(0, 0, 12, 0),
Child = new TextBlock
{
Text = number.ToString(),
FontSize = 15,
FontSize = EditorChrome.ScaledFont(15),
FontWeight = FontWeight.Bold,
Foreground = EditorChrome.AccentBrush,
HorizontalAlignment = HorizontalAlignment.Center,
Expand All @@ -117,7 +117,7 @@ internal static Button MakeCard(int number, string title, ICommand command, obje
panelTexts.Children.Add(new TextBlock
{
Text = title,
FontSize = 12.5,
FontSize = EditorChrome.FieldFontSize,
FontWeight = FontWeight.SemiBold,
TextWrapping = TextWrapping.Wrap,
});
Expand Down Expand Up @@ -158,14 +158,14 @@ internal static Border MakePreview(string text, string info)
var textBlock = new TextBlock
{
Text = text,
FontSize = 12.5,
FontSize = EditorChrome.FieldFontSize,
TextWrapping = TextWrapping.Wrap,
};

var infoBlock = new TextBlock
{
Text = info,
FontSize = 11,
FontSize = EditorChrome.ScaledFont(11),
Foreground = EditorChrome.DimTextBrush,
Margin = new Thickness(0, 3, 0, 0),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public MinGapCalculateWindow(MinGapCalculateViewModel vm)

var labelCalculation = new TextBlock
{
FontSize = 12.5,
FontSize = EditorChrome.FieldFontSize,
Foreground = EditorChrome.DimTextBrush,
TextWrapping = TextWrapping.Wrap,
[!TextBlock.TextProperty] = new Binding(nameof(vm.CalculationText)),
Expand Down
14 changes: 7 additions & 7 deletions src/ui/Features/Options/Settings/SettingsChrome.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ namespace Nikse.SubtitleEdit.Features.Options.Settings;
internal static class SettingsChrome
{
/// <summary>Width of the label column, so the fields of every setting line up.</summary>
internal const double LabelWidth = 250;
internal static double LabelWidth => EditorChrome.ScaledSize(250);

/// <summary>Width of a compact number field.</summary>
internal const double FieldWidth = 110;
internal static double FieldWidth => EditorChrome.ScaledSize(110);

/// <summary>Class of the category rows in the side panel.</summary>
internal const string NavClass = "settings-nav";
Expand Down Expand Up @@ -60,8 +60,8 @@ private static void AddStyles(Styles styles)
{
Setters =
{
new Setter(TemplatedControl.FontSizeProperty, 12.5),
new Setter(Layoutable.MinHeightProperty, 28.0),
new Setter(TemplatedControl.FontSizeProperty, EditorChrome.FieldFontSize),
new Setter(Layoutable.MinHeightProperty, EditorChrome.FieldHeight),
new Setter(TemplatedControl.PaddingProperty, new Thickness(10, 5)),
},
});
Expand All @@ -71,8 +71,8 @@ private static void AddStyles(Styles styles)
{
Setters =
{
new Setter(TemplatedControl.FontSizeProperty, 12.5),
new Setter(Layoutable.MinHeightProperty, 28.0),
new Setter(TemplatedControl.FontSizeProperty, EditorChrome.FieldFontSize),
new Setter(Layoutable.MinHeightProperty, EditorChrome.FieldHeight),
new Setter(TemplatedControl.PaddingProperty, new Thickness(12, 4)),
new Setter(TemplatedControl.CornerRadiusProperty, new CornerRadius(6)),
new Setter(ContentControl.VerticalContentAlignmentProperty, VerticalAlignment.Center),
Expand Down Expand Up @@ -182,7 +182,7 @@ internal static TextBlock MakeLabel(string text)
return new TextBlock
{
Text = text,
FontSize = 12.5,
FontSize = EditorChrome.FieldFontSize,
Foreground = EditorChrome.DimTextBrush,
VerticalAlignment = VerticalAlignment.Center,
TextWrapping = TextWrapping.Wrap,
Expand Down
2 changes: 1 addition & 1 deletion src/ui/Features/Options/Settings/SettingsItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public Control Build(bool includeLabel = true)
? new TextBlock
{
Text = _label,
FontSize = 12.5,
FontSize = EditorChrome.FieldFontSize,
VerticalAlignment = VerticalAlignment.Center,
TextWrapping = TextWrapping.Wrap,
}
Expand Down
4 changes: 2 additions & 2 deletions src/ui/Features/Options/Settings/SettingsPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,15 @@ private static Button MakeMenuItem(SettingsSection section, IRelayCommand comman
var label = new TextBlock
{
Text = section.Title,
FontSize = 12.5,
FontSize = EditorChrome.FieldFontSize,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Refresh persistent navigation labels after font-scale changes

When the user changes Font scale and clicks Apply, this local FontSize remains the value computed when the Settings page was constructed. Apply() reapplies styles and RefreshSections() rebuilds only the selected content section, while the side-menu buttons are retained in _menuButtons; UiTheme.ApplyScaleToWindow() also updates only explicit sizes carrying DesignFontSizeProperty. Consequently the settings fields resize immediately but the category labels retain the old size until the window is reopened. Recreate/update these labels or opt them into DesignFontSizeProperty.

Useful? React with 👍 / 👎.

VerticalAlignment = VerticalAlignment.Center,
TextTrimming = TextTrimming.CharacterEllipsis,
};

// Icon on a colored rounded square, matching the section header in the scroll view.
var image = new ContentControl
{
FontSize = 11,
FontSize = EditorChrome.ScaledFont(11),
Foreground = Brushes.White,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Expand Down
2 changes: 1 addition & 1 deletion src/ui/Features/Options/Settings/SettingsSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public Control Build(bool first = true)
// (and the group icons in the shortcuts window).
var icon = new ContentControl
{
FontSize = 11,
FontSize = EditorChrome.ScaledFont(11),
Foreground = Brushes.White,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Expand Down
4 changes: 3 additions & 1 deletion src/ui/Features/Options/Settings/SettingsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3169,10 +3169,12 @@ private async Task Apply()
// rebuilds the layout (and the video player) a second time (issue #14218).
AppliedSettingsSnapshot = SettingsChangeSnapshot.Take();

// Icon theme and recoloring can change without changing the actual theme variant.
// Icon theme and recoloring can change without changing the actual theme variant, and
// the editor styles bake in the font scale when applied (#16242) - follow both here.
if (Window != null &&
UiTheme.GetUnscaledContent(Window) is SettingsPage page)
{
SettingsChrome.Apply(Window);
page.RefreshSections();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public VideoControlsItemsWindow(VideoControlsItemsViewModel vm)
var eyeIcon = new Optris.Icons.Avalonia.Icon { Value = IconNames.Eye, Margin = new Thickness(0, 0, 6, 0), VerticalAlignment = VerticalAlignment.Center };
var checkBoxVisible = new CheckBox
{
FontSize = 12.5,
FontSize = EditorChrome.FieldFontSize,
Content = new StackPanel
{
Orientation = Orientation.Horizontal,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public WaveformThemesWindow(WaveformThemesViewModel vm)
private static TextBlock MakeColorLabel(string text)
{
var label = EditorChrome.MakeDimLabel(text, new Thickness(0));
label.FontSize = 12.5;
label.FontSize = EditorChrome.FieldFontSize;
return label;
}

Expand Down
10 changes: 5 additions & 5 deletions src/ui/Features/Shared/BinaryEdit/BinaryEditChrome.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ static Style Presenter(System.Func<Selector?, Selector> toggle, params (Avalonia
new Setter(TemplatedControl.BorderThicknessProperty, new Thickness(0)),
new Setter(TemplatedControl.CornerRadiusProperty, new CornerRadius(5)),
new Setter(TemplatedControl.ForegroundProperty, EditorChrome.IconBrush),
new Setter(TemplatedControl.FontSizeProperty, 12.5),
new Setter(TemplatedControl.FontSizeProperty, EditorChrome.FieldFontSize),
new Setter(TemplatedControl.PaddingProperty, new Thickness(12, 3)),
new Setter(Layoutable.MinHeightProperty, 24.0),
new Setter(Layoutable.MinHeightProperty, EditorChrome.ScaledSize(24)),
},
});
styles.Add(Presenter(x => x.OfType<ToggleButton>().Class("segment").Class(":pointerover"),
Expand All @@ -64,8 +64,8 @@ static Style Presenter(System.Func<Selector?, Selector> toggle, params (Avalonia
{
Setters =
{
new Setter(TemplatedControl.FontSizeProperty, 12.5),
new Setter(Layoutable.MinHeightProperty, 28.0),
new Setter(TemplatedControl.FontSizeProperty, EditorChrome.FieldFontSize),
new Setter(Layoutable.MinHeightProperty, EditorChrome.FieldHeight),
},
});
}
Expand Down Expand Up @@ -139,7 +139,7 @@ internal static Border MakeSliderSection(string title, Slider slider, string val
AutomationProperties.SetName(slider, title);
var value = new TextBlock
{
FontSize = 12,
FontSize = EditorChrome.ScaledFont(12),
Foreground = EditorChrome.DimTextBrush,
VerticalAlignment = VerticalAlignment.Center,
[!TextBlock.TextProperty] = new Binding(valueProperty),
Expand Down
4 changes: 2 additions & 2 deletions src/ui/Features/Sync/PointSync/PointSyncChrome.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ internal static TextBlock MakeFileNameLabel(object source, string fileNamePath)
{
var label = new TextBlock
{
FontSize = 12.5,
FontSize = EditorChrome.FieldFontSize,
Foreground = EditorChrome.DimTextBrush,
VerticalAlignment = VerticalAlignment.Center,
TextTrimming = TextTrimming.CharacterEllipsis,
Expand Down Expand Up @@ -220,7 +220,7 @@ internal static Grid MakeHeaderRow(Control left, Control? right)
{
var grid = new Grid
{
MinHeight = 30,
MinHeight = EditorChrome.ScaledSize(30),
ColumnSpacing = 8,
ColumnDefinitions =
{
Expand Down
2 changes: 1 addition & 1 deletion src/ui/Features/Sync/SyncTimingChrome.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RadioButton Make(string text, string property, bool needsSelection)
var radioButton = new RadioButton
{
Content = text,
FontSize = 12.5,
FontSize = EditorChrome.FieldFontSize,
[!RadioButton.IsCheckedProperty] = new Binding(property),
};
if (needsSelection && isSelectionAvailable != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ internal static ComboBox Compact(ComboBox comboBox, string accessibleName, doubl
/// </summary>
internal static RadioButton Compact(RadioButton radioButton)
{
radioButton.FontSize = 12.5;
radioButton.FontSize = EditorChrome.FieldFontSize;
radioButton.VerticalAlignment = VerticalAlignment.Center;
radioButton.Margin = new Thickness(0);
if (radioButton.Content is string text)
Expand Down Expand Up @@ -185,11 +185,11 @@ internal static Button MakeButton(string? icon, string text, System.Windows.Inpu
content.Children.Add(new Optris.Icons.Avalonia.Icon { Value = icon, FontSize = 13, VerticalAlignment = VerticalAlignment.Center });
}

content.Children.Add(new TextBlock { Text = text, FontSize = 12.5, VerticalAlignment = VerticalAlignment.Center });
content.Children.Add(new TextBlock { Text = text, FontSize = EditorChrome.FieldFontSize, VerticalAlignment = VerticalAlignment.Center });
var button = new Button
{
Content = content,
MinHeight = 30,
MinHeight = EditorChrome.ScaledSize(30),
Padding = new Thickness(12, 4),
Command = command,
HorizontalAlignment = HorizontalAlignment.Left,
Expand Down
2 changes: 1 addition & 1 deletion src/ui/Features/Video/SpeechToText/SpeechToTextChrome.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal static class SpeechToTextChrome
internal static StackPanel Stacked(TextBlock label, Control content)
{
label.Foreground = EditorChrome.DimTextBrush;
label.FontSize = 12;
label.FontSize = EditorChrome.ScaledFont(12);
label.TextWrapping = TextWrapping.Wrap;
label.Margin = new Thickness(0);
var panel = new StackPanel { Spacing = 4 };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ internal static StackPanel MakeTitle(string title, string? intro)
panel.Children.Add(new TextBlock
{
Text = title,
FontSize = 17,
FontSize = EditorChrome.ScaledFont(17),
FontWeight = FontWeight.SemiBold,
TextWrapping = TextWrapping.Wrap,
});
Expand All @@ -32,7 +32,7 @@ internal static StackPanel MakeTitle(string title, string? intro)
panel.Children.Add(new TextBlock
{
Text = intro,
FontSize = 12.5,
FontSize = EditorChrome.FieldFontSize,
Foreground = EditorChrome.DimTextBrush,
TextWrapping = TextWrapping.Wrap,
});
Expand Down
34 changes: 26 additions & 8 deletions src/ui/Logic/EditorChrome.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,24 @@ internal static partial class EditorChrome
// windows are open), so everything built from it repaints without rebuilding.
internal static bool IsLightTheme => Application.Current?.ActualThemeVariant == ThemeVariant.Light;

// The editor look's sizes are design values at 100 % that follow the "Font scale (%)" setting
// (#16242): an explicit FontSize does not inherit the scaled window font, so every text size
// goes through ScaledFont, and the fixed heights and widths that must fit the text (the 28 px
// fields) through ScaledSize. Icons keep their size: an Icon with its own FontSize is left
// alone, and one that inherits gets the scale undone by the icon style in UiTheme.

/// <summary>The text size of the fields, labels and buttons: 12.5 at 100 %.</summary>
internal static double FieldFontSize => ScaledFont(12.5);

/// <summary>The height of the compact fields, combo boxes and buttons: 28 at 100 %.</summary>
internal static double FieldHeight => ScaledSize(28);

/// <summary>A text size of the editor look scaled by the "Font scale (%)" setting.</summary>
internal static double ScaledFont(double designSize) => UiUtil.ScaledFontSize(designSize);

/// <summary>A height or width of the editor look that holds text, scaled by the "Font scale (%)" setting.</summary>
internal static double ScaledSize(double designSize) => Math.Round(designSize * UiTheme.FontScale);

/// <summary>
/// Text and icons on hover - white on the dark palette, near black on the light one.
/// </summary>
Expand Down Expand Up @@ -224,9 +242,9 @@ static Style ToolPresenter(Func<Selector?, Selector> button, params (AvaloniaPro
Setters =
{
new Setter(NumericUpDown.ShowButtonSpinnerProperty, false),
new Setter(NumericUpDown.MinHeightProperty, 28.0),
new Setter(NumericUpDown.HeightProperty, 28.0),
new Setter(NumericUpDown.FontSizeProperty, 12.5),
new Setter(NumericUpDown.MinHeightProperty, FieldHeight),
new Setter(NumericUpDown.HeightProperty, FieldHeight),
new Setter(NumericUpDown.FontSizeProperty, FieldFontSize),
new Setter(NumericUpDown.BackgroundProperty, FieldBrush),
new Setter(NumericUpDown.BorderBrushProperty, FieldBorderBrush),
new Setter(NumericUpDown.CornerRadiusProperty, new CornerRadius(6)),
Expand Down Expand Up @@ -316,7 +334,7 @@ static Style ToolPresenter(Func<Selector?, Selector> button, params (AvaloniaPro
Setters =
{
new Setter(Border.CornerRadiusProperty, new CornerRadius(6)),
new Setter(Border.MinHeightProperty, 28.0),
new Setter(Border.MinHeightProperty, FieldHeight),
},
});
styles.Add(new Style(x => x.OfType<TreeViewItem>().Class(":selected").Template().OfType<Border>().Name("PART_LayoutRoot"))
Expand Down Expand Up @@ -352,7 +370,7 @@ internal static TextBlock MakeDimLabel(string text, Thickness margin)
{
Text = text,
Foreground = DimTextBrush,
FontSize = 12,
FontSize = ScaledFont(12),
VerticalAlignment = VerticalAlignment.Center,
Margin = margin,
};
Expand Down Expand Up @@ -380,7 +398,7 @@ internal static NumericUpDown MakeField(string property, double minimum, double
{
Text = prefix,
Foreground = FaintTextBrush,
FontSize = 11,
FontSize = ScaledFont(11),
VerticalAlignment = VerticalAlignment.Center,
Margin = new Thickness(8, 0, 0, 0),
};
Expand Down Expand Up @@ -484,7 +502,7 @@ internal static StackPanel MakeToggleRow(string property, string text)
AutomationProperties.SetName(toggle, text);
var row = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8 };
row.Children.Add(toggle);
row.Children.Add(new TextBlock { Text = text, FontSize = 12.5, VerticalAlignment = VerticalAlignment.Center, TextWrapping = TextWrapping.Wrap });
row.Children.Add(new TextBlock { Text = text, FontSize = FieldFontSize, VerticalAlignment = VerticalAlignment.Center, TextWrapping = TextWrapping.Wrap });
return row;
}

Expand All @@ -493,7 +511,7 @@ internal static TextBlock MakeSectionHeader(string text)
return new TextBlock
{
Text = text.ToUpperInvariant(),
FontSize = 11,
FontSize = ScaledFont(11),
FontWeight = FontWeight.SemiBold,
LetterSpacing = 0.6,
Foreground = DimTextBrush,
Expand Down
Loading
Loading