diff --git a/core/changelog.txt b/core/changelog.txt index a6f0cef0f..a4e483ec4 100644 --- a/core/changelog.txt +++ b/core/changelog.txt @@ -30,6 +30,7 @@ Please visit http://aegisub.net to download latest version - Plain-text lines can now be pasted into the grid. They will be inserted as default lines with the text as their content. (AMZ) - Added Paste Over function, which allows you to paste subtitle lines over others, overwriting the fields of your choice. (AMZ) - Renaming a style will now ask you if you want to rename all instances of it on the script. (AMZ) +- Style name collisions (when moving from storage, creating or renaming) will now prompt the user before performing the action. (AMZ) = 1.10 beta - 2006.08.07 =========================== diff --git a/core/dialog_style_editor.cpp b/core/dialog_style_editor.cpp index 0243b5b64..3b042743a 100644 --- a/core/dialog_style_editor.cpp +++ b/core/dialog_style_editor.cpp @@ -379,6 +379,19 @@ void DialogStyleEditor::Apply (bool apply,bool close) { if (apply) { // Style name wxString newStyleName = StyleName->GetValue(); + + // Check if style name is unique + wxArrayString styles = grid->ass->GetStyles(); + for (unsigned int i=0;iass->GetStyle(styles[i]) != style) { + int answer = wxMessageBox(_T("There is already a style with this name. Proceed anyway?"),_T("Style name conflict."),wxYES_NO); + if (answer == wxNO) return; + } + } + } + + // Style name change if (work->name != newStyleName) { // See if user wants to update style name through script int answer = wxMessageBox(_T("Do you want to change all instances of this style in the script to this new name?"),_T("Update script?"),wxYES_NO | wxCANCEL); diff --git a/core/dialog_style_manager.cpp b/core/dialog_style_manager.cpp index 9c1cc8be5..94853c6bb 100644 --- a/core/dialog_style_manager.cpp +++ b/core/dialog_style_manager.cpp @@ -489,15 +489,23 @@ void DialogStyleManager::OnCopyToCurrent (wxCommandEvent &event) { int n = StorageList->GetSelections(selections); AssStyle *temp; for (int i=0;iFindString(StorageList->GetString(selections[i])); - if (test == wxNOT_FOUND) { + bool proceed = test==-1; + if (!proceed) { + int answer = wxMessageBox(_T("There is already a style with that name on the current script. Proceed anyway?"),_T("Style name collision."),wxYES_NO); + if (answer == wxYES) proceed = true; + } + + // Copy + if (proceed) { temp = new AssStyle; *temp = *styleStorageMap.at(selections[i]); AssFile::top->InsertStyle(temp); } - else { - // Bug user? - } + + // Return + else return; } LoadCurrentStyles(AssFile::top); grid->ass->FlagAsModified();