From a5aa4245f0e9c08281fb60abf256e1bbe05a5b0c Mon Sep 17 00:00:00 2001 From: Dan Donovan Date: Sun, 2 Sep 2007 19:09:23 +0000 Subject: [PATCH] Don't let pasting styles duplicate style names. Add "Copy of " where necessary. Originally committed to SVN as r1550. --- aegisub/dialog_style_manager.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/aegisub/dialog_style_manager.cpp b/aegisub/dialog_style_manager.cpp index 87d2e358a..2f8c9e66c 100644 --- a/aegisub/dialog_style_manager.cpp +++ b/aegisub/dialog_style_manager.cpp @@ -691,6 +691,9 @@ void DialogStyleManager::PasteToCurrent() { while (st.HasMoreTokens()) { AssStyle *s = new AssStyle(st.GetNextToken().Trim(true)); if (s->Valid) { + while (AssFile::top->GetStyle(s->name) != NULL) + s->name = _T("Copy of ") + s->name; + AssFile::top->InsertStyle(s); LoadCurrentStyles(AssFile::top); } @@ -714,6 +717,9 @@ void DialogStyleManager::PasteToStorage() { while (st.HasMoreTokens()) { AssStyle *s = new AssStyle(st.GetNextToken().Trim(true)); if (s->Valid) { + while (Store.GetStyle(s->name) != NULL) + s->name = _T("Copy of ") + s->name; + Store.style.push_back(s); Store.Save(CatalogList->GetString(CatalogList->GetSelection())); }