Save selected paragraph when sorting

This commit is contained in:
Martijn van Berkel (Flitskikker) 2024-02-10 12:34:00 +01:00
parent b15dea31a8
commit ae5f53aec8
2 changed files with 24 additions and 9 deletions

View File

@ -60,6 +60,7 @@
//
this.labelControlSubtitleFilename.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.labelControlSubtitleFilename.AutoEllipsis = true;
this.labelControlSubtitleFilename.Location = new System.Drawing.Point(12, 16);
this.labelControlSubtitleFilename.Name = "labelControlSubtitleFilename";
this.labelControlSubtitleFilename.Size = new System.Drawing.Size(824, 15);
@ -81,7 +82,7 @@
//
this.buttonDismissAndNext.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonDismissAndNext.Enabled = false;
this.buttonDismissAndNext.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.buttonDismissAndNext.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.buttonDismissAndNext.Location = new System.Drawing.Point(412, 551);
this.buttonDismissAndNext.Name = "buttonDismissAndNext";
this.buttonDismissAndNext.Size = new System.Drawing.Size(170, 36);
@ -94,7 +95,7 @@
//
this.buttonInsertAndNext.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonInsertAndNext.Enabled = false;
this.buttonInsertAndNext.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.buttonInsertAndNext.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.buttonInsertAndNext.Location = new System.Drawing.Point(702, 551);
this.buttonInsertAndNext.Name = "buttonInsertAndNext";
this.buttonInsertAndNext.Size = new System.Drawing.Size(170, 36);
@ -141,7 +142,7 @@
//
this.buttonInsert.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonInsert.Enabled = false;
this.buttonInsert.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.buttonInsert.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.buttonInsert.Location = new System.Drawing.Point(588, 551);
this.buttonInsert.Name = "buttonInsert";
this.buttonInsert.Size = new System.Drawing.Size(115, 36);
@ -154,7 +155,7 @@
//
this.buttonDismiss.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonDismiss.Enabled = false;
this.buttonDismiss.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.buttonDismiss.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.buttonDismiss.Location = new System.Drawing.Point(298, 551);
this.buttonDismiss.Name = "buttonDismiss";
this.buttonDismiss.Size = new System.Drawing.Size(115, 36);

View File

@ -53,11 +53,6 @@ namespace Nikse.SubtitleEdit.Forms
toolStripMenuItemSortByCoverage.Checked = settings.ListSort == ListSortEnum.Coverage;
toolStripMenuItemSortByTime.Checked = settings.ListSort == ListSortEnum.Time;
buttonDismiss.Font = new Font(buttonDismissAndNext.Font, FontStyle.Bold);
buttonDismissAndNext.Font = new Font(buttonDismissAndNext.Font, FontStyle.Bold);
buttonInsert.Font = new Font(buttonInsertAndNext.Font, FontStyle.Bold);
buttonInsertAndNext.Font = new Font(buttonInsertAndNext.Font, FontStyle.Bold);
subtitleListView.InitializeLanguage(LanguageSettings.Current.General, Configuration.Settings);
UiUtil.InitializeSubtitleFont(subtitleListView);
subtitleListView.ShowExtraColumn(language.Coverage);
@ -326,12 +321,31 @@ namespace Nikse.SubtitleEdit.Forms
private void ChangeListSort(ListSortEnum sort)
{
// Update context menu items checked staed
toolStripMenuItemSortByCoverage.Checked = sort == ListSortEnum.Coverage;
toolStripMenuItemSortByTime.Checked = sort == ListSortEnum.Time;
// Save selected paragraph, if any
Paragraph selectedParagraph = null;
if (subtitleListView.SelectedIndices.Count == 1)
{
var index = subtitleListView.SelectedIndices[0];
var paragraph = sortedControlParagraphsWithCoverage[index].Item1;
selectedParagraph = paragraph;
}
// Reload listview
Cursor = Cursors.WaitCursor;
PopulateListView();
Cursor = Cursors.Default;
// Restore selected index
if (selectedParagraph != null)
{
subtitleListView.SelectIndexAndEnsureVisible(selectedParagraph);
}
}
private void subtitleListView_ColumnClick(object sender, ColumnClickEventArgs e)