Needed to call updatedata when changing style name. Also, add some error handling to pasting styles.

Originally committed to SVN as r1551.
This commit is contained in:
Dan Donovan 2007-09-02 19:31:17 +00:00
parent a5aa4245f0
commit c5a91a11fe
1 changed files with 36 additions and 16 deletions

View File

@ -689,17 +689,27 @@ void DialogStyleManager::PasteToCurrent() {
wxStringTokenizer st(data,_T('\n'));
while (st.HasMoreTokens()) {
try {
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;
s->UpdateData();
AssFile::top->InsertStyle(s);
LoadCurrentStyles(AssFile::top);
}
grid->ass->FlagAsModified(_("style paste"));
grid->CommitChanges();
}
else
wxMessageBox(_("Could not parse style"), _("Could not parse style"), wxOK | wxICON_EXCLAMATION , this);
}
catch (...) {
wxMessageBox(_("Could not parse style"), _("Could not parse style"), wxOK | wxICON_EXCLAMATION , this);
}
}
}
void DialogStyleManager::PasteToStorage() {
wxString data = _T("");
@ -715,17 +725,27 @@ void DialogStyleManager::PasteToStorage() {
wxStringTokenizer st(data,_T('\n'));
while (st.HasMoreTokens()) {
try {
AssStyle *s = new AssStyle(st.GetNextToken().Trim(true));
if (s->Valid) {
while (Store.GetStyle(s->name) != NULL)
s->name = _T("Copy of ") + s->name;
s->UpdateData();
Store.style.push_back(s);
Store.Save(CatalogList->GetString(CatalogList->GetSelection()));
}
LoadStorageStyles();
StorageList->SetStringSelection(s->name);
}
else
wxMessageBox(_("Could not parse style"), _("Could not parse style"), wxOK | wxICON_EXCLAMATION , this);
}
catch(...) {
wxMessageBox(_("Could not parse style"), _("Could not parse style"), wxOK | wxICON_EXCLAMATION , this);
}
}
}
///////////////
// Storage new