Change the logic for when the style editor asks the user if they wish to update existing lines when renaming a style to be based on whether it is a newly created style rather than whether the style's name starts with "Copy of". Updates #1060.
Originally committed to SVN as r4103.
This commit is contained in:
parent
509f748cfb
commit
429a57ef68
3 changed files with 13 additions and 38 deletions
|
@ -163,7 +163,7 @@ enum {
|
|||
/// @param local
|
||||
/// @param _store
|
||||
///
|
||||
DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *_style, SubtitlesGrid *_grid,bool local,AssStyleStorage *_store)
|
||||
DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *_style, SubtitlesGrid *_grid,bool local,AssStyleStorage *_store,bool newStyle)
|
||||
: wxDialog (parent,-1,_("Style Editor"),wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER,_T("DialogStyleEditor"))
|
||||
{
|
||||
// Set icon
|
||||
|
@ -171,6 +171,7 @@ DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *_style, Subtit
|
|||
|
||||
// Set variables
|
||||
isLocal = local;
|
||||
isNew = newStyle;
|
||||
store = _store;
|
||||
|
||||
// Set styles
|
||||
|
@ -427,15 +428,12 @@ DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *_style, Subtit
|
|||
LoadPosition();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// @brief Destructor
|
||||
///
|
||||
DialogStyleEditor::~DialogStyleEditor () {
|
||||
delete work;
|
||||
}
|
||||
|
||||
|
||||
///////////////
|
||||
// Event table
|
||||
BEGIN_EVENT_TABLE(DialogStyleEditor, wxDialog)
|
||||
|
@ -501,8 +499,6 @@ void DialogStyleEditor::OnSetColor3 (wxCommandEvent &event) { OnSetColor(3); }
|
|||
///
|
||||
void DialogStyleEditor::OnSetColor4 (wxCommandEvent &event) { OnSetColor(4); }
|
||||
|
||||
|
||||
|
||||
/// @brief Replace Style
|
||||
/// @param tag
|
||||
/// @param n
|
||||
|
@ -520,8 +516,6 @@ void ReplaceStyle(wxString tag,int n,AssOverrideParameter* param,void *userData)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// @brief Events
|
||||
/// @param apply
|
||||
/// @param close
|
||||
|
@ -550,7 +544,7 @@ void DialogStyleEditor::Apply (bool apply,bool close) {
|
|||
|
||||
// Style name change
|
||||
if (work->name != newStyleName) {
|
||||
if (!work->name.StartsWith(_("Copy of ")) && isLocal) {
|
||||
if (!isNew && isLocal) {
|
||||
// See if user wants to update style name through script
|
||||
int answer = wxNO;
|
||||
if (work->name != _T("Default")) answer = wxMessageBox(_("Do you want to change all instances of this style in the script to this new name?"),_("Update script?"),wxYES_NO | wxCANCEL);
|
||||
|
@ -612,8 +606,6 @@ void DialogStyleEditor::Apply (bool apply,bool close) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// @brief Update work style
|
||||
///
|
||||
void DialogStyleEditor::UpdateWorkStyle() {
|
||||
|
@ -663,8 +655,6 @@ void DialogStyleEditor::UpdateWorkStyle() {
|
|||
work->strikeout = BoxStrikeout->IsChecked();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// @brief Choose font box
|
||||
/// @param event
|
||||
///
|
||||
|
@ -692,8 +682,6 @@ void DialogStyleEditor::OnChooseFont (wxCommandEvent &event) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// @brief Sets color for one of the four color buttons
|
||||
/// @param n
|
||||
///
|
||||
|
@ -710,8 +698,6 @@ void DialogStyleEditor::OnSetColor (int n) {
|
|||
if (SubsPreview) SubsPreview->SetStyle(work);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// @brief Child focus change
|
||||
/// @param event
|
||||
///
|
||||
|
@ -721,8 +707,6 @@ void DialogStyleEditor::OnChildFocus (wxChildFocusEvent &event) {
|
|||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// @brief Preview text changed
|
||||
/// @param event
|
||||
///
|
||||
|
@ -733,8 +717,6 @@ void DialogStyleEditor::OnPreviewTextChange (wxCommandEvent &event) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// @brief Change colour of preview's background
|
||||
/// @param event
|
||||
///
|
||||
|
@ -744,8 +726,6 @@ void DialogStyleEditor::OnPreviewColourChange (wxCommandEvent &event) {
|
|||
Options.Save();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// @brief Command event to update preview
|
||||
/// @param event
|
||||
/// @return
|
||||
|
@ -757,8 +737,6 @@ void DialogStyleEditor::OnCommandPreviewUpdate (wxCommandEvent &event) {
|
|||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// @brief Converts control value to alignment
|
||||
/// @param n
|
||||
/// @return
|
||||
|
@ -778,8 +756,6 @@ int DialogStyleEditor::ControlToAlign (int n) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// @brief Converts alignment value to control
|
||||
/// @param n
|
||||
/// @return
|
||||
|
@ -799,8 +775,6 @@ int DialogStyleEditor::AlignToControl (int n) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// @brief Load and save window position for the session
|
||||
///
|
||||
void DialogStyleEditor::SavePosition() {
|
||||
|
@ -817,12 +791,8 @@ void DialogStyleEditor::LoadPosition() {
|
|||
CentreOnParent();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// DOCME
|
||||
wxRect DialogStyleEditor::saved_position;
|
||||
|
||||
/// DOCME
|
||||
bool DialogStyleEditor::use_saved_position = false;
|
||||
|
||||
|
||||
|
|
|
@ -70,6 +70,11 @@ private:
|
|||
/// DOCME
|
||||
bool isLocal;
|
||||
|
||||
/// If true, the style was just created and so the user should not be
|
||||
/// asked if they want to change any existing lines should they rename
|
||||
/// the style
|
||||
bool isNew;
|
||||
|
||||
/// DOCME
|
||||
AssStyle *style;
|
||||
|
||||
|
@ -213,7 +218,7 @@ private:
|
|||
void OnPreviewColourChange (wxCommandEvent &event);
|
||||
|
||||
public:
|
||||
DialogStyleEditor(wxWindow *parent,AssStyle *style,SubtitlesGrid *grid,bool local,AssStyleStorage *store);
|
||||
DialogStyleEditor(wxWindow *parent,AssStyle *style,SubtitlesGrid *grid,bool local,AssStyleStorage *store,bool newStyle=false);
|
||||
~DialogStyleEditor();
|
||||
|
||||
void Apply (bool apply,bool close);
|
||||
|
|
|
@ -663,7 +663,7 @@ void DialogStyleManager::OnStorageCopy (wxCommandEvent &event) {
|
|||
newName += temp->name;
|
||||
temp->name = newName;
|
||||
|
||||
DialogStyleEditor editor(this,temp,grid,false,&Store);
|
||||
DialogStyleEditor editor(this,temp,grid,false,&Store,true);
|
||||
int modified = editor.ShowModal();
|
||||
if (modified) {
|
||||
Store.style.push_back(temp);
|
||||
|
@ -689,7 +689,7 @@ void DialogStyleManager::OnCurrentCopy (wxCommandEvent &event) {
|
|||
newName += temp->name;
|
||||
temp->name = newName;
|
||||
|
||||
DialogStyleEditor editor(this,temp,grid,true,&Store);
|
||||
DialogStyleEditor editor(this,temp,grid,true,&Store,true);
|
||||
int modified = editor.ShowModal();
|
||||
if (modified) {
|
||||
AssFile::top->InsertStyle(temp);
|
||||
|
@ -812,7 +812,7 @@ void DialogStyleManager::PasteToStorage() {
|
|||
void DialogStyleManager::OnStorageNew (wxCommandEvent &event) {
|
||||
AssStyle *temp = new AssStyle;
|
||||
|
||||
DialogStyleEditor editor(this,temp,grid,false,&Store);
|
||||
DialogStyleEditor editor(this,temp,grid,false,&Store,true);
|
||||
int modified = editor.ShowModal();
|
||||
if (modified) {
|
||||
Store.style.push_back(temp);
|
||||
|
@ -831,7 +831,7 @@ void DialogStyleManager::OnStorageNew (wxCommandEvent &event) {
|
|||
void DialogStyleManager::OnCurrentNew (wxCommandEvent &event) {
|
||||
AssStyle *temp = new AssStyle;
|
||||
|
||||
DialogStyleEditor editor(this,temp,grid,true,&Store);
|
||||
DialogStyleEditor editor(this,temp,grid,true,&Store,true);
|
||||
int modified = editor.ShowModal();
|
||||
if (modified) {
|
||||
AssFile::top->InsertStyle(temp);
|
||||
|
|
Loading…
Reference in a new issue