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
10 changes: 10 additions & 0 deletions src/ui/Features/Main/MainView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@ protected override object Build()
Dispatcher.UIThread.Post(() =>
{
InitLayout.MakeLayout(this, _vm, Se.Settings.General.LayoutNumber);

// The window level right to left pass runs when the window opens,
// which is before this deferred layout build, so the freshly built
// grid and text boxes would stay left to right until the mode is
// toggled. Re-apply after building.
if (Se.Settings.Appearance.RightToLeft && TopLevel.GetTopLevel(this) is Window rtlWindow)
{
MainHelpers.RightToLeftHelper.SetRightToLeftForDataGridAndText(rtlWindow);
}

_vm.ContentGrid.InvalidateMeasure();
_vm.ContentGrid.InvalidateArrange();
Dispatcher.UIThread.Post(() => _vm.SubtitleGrid.Focus());
Expand Down
12 changes: 12 additions & 0 deletions src/ui/Features/Main/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,12 @@ private void SetLayout(int layoutNumber)
var idx = SubtitleGrid.SelectedIndex;
var savedAudioTrack = _audioTrack;
Se.Settings.General.LayoutNumber = InitLayout.MakeLayout(MainView!, this, layoutNumber);
if (Se.Settings.Appearance.RightToLeft && Window != null)
{
// The rebuilt layout starts left to right; re-apply the mode.
RightToLeftHelper.SetRightToLeftForDataGridAndText(Window);
}

SelectAndScrollToRow(Math.Max(0, idx));
Dispatcher.UIThread.Post(() => SubtitleGrid.Focus());
RefreshSubtitlePreview();
Expand Down Expand Up @@ -5765,6 +5771,12 @@ private void VideoUndockControls()
});

InitLayout.MakeLayout12KeepVideo(MainView!, this);
if (Se.Settings.Appearance.RightToLeft && Window != null)
{
// The rebuilt layout starts left to right; re-apply the mode.
RightToLeftHelper.SetRightToLeftForDataGridAndText(Window);
}

RefreshSubtitlePreview();
});
}
Expand Down