Fix a bug in storage copy and update default note

This commit is contained in:
OmrSi 2021-03-07 18:21:16 +02:00
parent 659999095a
commit 2d23d3df61
4 changed files with 11 additions and 12 deletions

View File

@ -2617,7 +2617,7 @@ Continue?</RestoreDefaultSettingsMsg>
<NewCategory>New category</NewCategory>
<CategoryName>Category name</CategoryName>
<CategorySetDefault>Set as default</CategorySetDefault>
<CategoryNote>Note: "Default" styles will be applied to new ASSA files</CategoryNote>
<CategoryNote>Note: The styles in the default category (colored in green) will be applied to new ASSA files</CategoryNote>
<CategoryDelete>Are you sure you want to delete this category?</CategoryDelete>
<CategoryRename>Rename category</CategoryRename>
<CategoriesManage>Manage</CategoriesManage>

View File

@ -1366,7 +1366,7 @@
this.labelCategoryDefaultNote.Name = "labelCategoryDefaultNote";
this.labelCategoryDefaultNote.Size = new System.Drawing.Size(265, 13);
this.labelCategoryDefaultNote.TabIndex = 5;
this.labelCategoryDefaultNote.Text = "Note: \"Default\" styles will be applied to new ASSA files";
this.labelCategoryDefaultNote.Text = "Note: The styles in the default category (colored in green) will be applied to new ASSA files";
//
// buttonStorageManageCategories
//

View File

@ -804,8 +804,8 @@ namespace Nikse.SubtitleEdit.Forms.Styles
private void AddDefaultStyleToStorage()
{
var defaultStyle = new SsaStyle();
AddStyle(listViewStorage, defaultStyle, Subtitle, _isSubStationAlpha);
_currentCategory.Styles.Add(defaultStyle);
AddStyle(listViewStorage, defaultStyle, Subtitle, _isSubStationAlpha);
}
private void UpdateSelectedIndices(ListView listview, int startingIndex = -1, int numberOfSelectedItems = 1)
@ -1167,7 +1167,7 @@ namespace Nikse.SubtitleEdit.Forms.Styles
_doUpdate = true;
}
UpdateSelectedIndices(listViewStyles, selectionCount);
UpdateSelectedIndices(listViewStyles, numberOfSelectedItems: selectionCount);
}
}
@ -1899,18 +1899,17 @@ namespace Nikse.SubtitleEdit.Forms.Styles
{
foreach (ListViewItem selectedItem in listViewStorage.SelectedItems)
{
var index = selectedItem.Index;
SsaStyle oldStyle = _currentCategory.Styles[index];
var style = new SsaStyle(oldStyle) { Name = string.Format(LanguageSettings.Current.SubStationAlphaStyles.CopyOfY, oldStyle.Name) }; // Copy contructor
var styleName = style.Name;
if (_currentCategory.Styles.Any(p => p.Name == styleName))
var styleName = selectedItem.Text;
var oldStyle = _currentCategory.Styles[selectedItem.Index];
var style = new SsaStyle(oldStyle) { Name = string.Format(LanguageSettings.Current.SubStationAlphaStyles.CopyOfY, styleName) }; // Copy contructor
if (_currentCategory.Styles.Any(p => p.Name == style.Name))
{
int count = 2;
bool doRepeat = true;
while (doRepeat)
{
style.Name = string.Format(LanguageSettings.Current.SubStationAlphaStyles.CopyXOfY, count, styleName);
doRepeat = _currentCategory.Styles.Any(p => p.Name == styleName);
doRepeat = _currentCategory.Styles.Any(p => p.Name == style.Name);
count++;
}
}
@ -1921,7 +1920,7 @@ namespace Nikse.SubtitleEdit.Forms.Styles
_doUpdate = true;
}
UpdateSelectedIndices(listViewStorage, selectionCount);
UpdateSelectedIndices(listViewStorage, numberOfSelectedItems: selectionCount);
}
}

View File

@ -2956,7 +2956,7 @@ can edit in same subtitle file (collaboration)",
NewCategory = "New category",
CategoryName = "Category name",
CategorySetDefault = "Set as default",
CategoryNote = "Note: \"Default\" styles will be applied to new ASSA files",
CategoryNote = "Note: The styles in the default category (colored in green) will be applied to new ASSA files",
CategoryDelete = "Are you sure you want to delete this category?",
CategoryRename = "Rename category",
CategoriesManage = "Manage",