Don't let pasting styles duplicate style names. Add "Copy of " where necessary.

Originally committed to SVN as r1550.
This commit is contained in:
Dan Donovan 2007-09-02 19:09:23 +00:00
parent 23cb553ac4
commit a5aa4245f0
1 changed files with 6 additions and 0 deletions

View File

@ -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()));
}