mirror of https://github.com/odrling/Aegisub
Renaming a style will now ask you if you want to rename all instances of it on the script.
Originally committed to SVN as r567.
This commit is contained in:
parent
a5105d2552
commit
73fdf2a9d3
|
@ -29,6 +29,7 @@ Please visit http://aegisub.net to download latest version
|
||||||
- Times can now be copy and pasted with ctrl+c and ctrl+v, as well as from context menu, in the time edit boxes. (AMZ)
|
- Times can now be copy and pasted with ctrl+c and ctrl+v, as well as from context menu, in the time edit boxes. (AMZ)
|
||||||
- Plain-text lines can now be pasted into the grid. They will be inserted as default lines with the text as their content. (AMZ)
|
- 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)
|
- 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)
|
||||||
|
|
||||||
|
|
||||||
= 1.10 beta - 2006.08.07 ===========================
|
= 1.10 beta - 2006.08.07 ===========================
|
||||||
|
|
|
@ -39,8 +39,10 @@
|
||||||
#include <wx/fontdlg.h>
|
#include <wx/fontdlg.h>
|
||||||
#include <wx/colordlg.h>
|
#include <wx/colordlg.h>
|
||||||
#include "dialog_style_editor.h"
|
#include "dialog_style_editor.h"
|
||||||
|
#include "ass_dialogue.h"
|
||||||
#include "ass_style.h"
|
#include "ass_style.h"
|
||||||
#include "ass_file.h"
|
#include "ass_file.h"
|
||||||
|
#include "ass_override.h"
|
||||||
#include "validators.h"
|
#include "validators.h"
|
||||||
#include "subs_grid.h"
|
#include "subs_grid.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
@ -356,11 +358,55 @@ void DialogStyleEditor::OnSetColor3 (wxCommandEvent &event) { OnSetColor(3); }
|
||||||
void DialogStyleEditor::OnSetColor4 (wxCommandEvent &event) { OnSetColor(4); }
|
void DialogStyleEditor::OnSetColor4 (wxCommandEvent &event) { OnSetColor(4); }
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////
|
||||||
|
// Replace Style
|
||||||
|
void ReplaceStyle(wxString tag,int n,AssOverrideParameter* param,void *userData) {
|
||||||
|
wxArrayString strings = *((wxArrayString*)userData);
|
||||||
|
if (tag == _T("\\r")) {
|
||||||
|
if (param->GetType() == VARDATA_TEXT) {
|
||||||
|
if (param->AsText() == strings[0]) {
|
||||||
|
param->SetText(strings[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
// Events
|
// Events
|
||||||
void DialogStyleEditor::Apply (bool apply,bool close) {
|
void DialogStyleEditor::Apply (bool apply,bool close) {
|
||||||
// Apply
|
// Apply
|
||||||
if (apply) {
|
if (apply) {
|
||||||
|
// Style name
|
||||||
|
wxString newStyleName = StyleName->GetValue();
|
||||||
|
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);
|
||||||
|
|
||||||
|
// Cancel
|
||||||
|
if (answer == wxCANCEL) return;
|
||||||
|
|
||||||
|
// Update
|
||||||
|
if (answer == wxYES) {
|
||||||
|
int n = grid->GetRows();
|
||||||
|
wxArrayString strings;
|
||||||
|
strings.Add(work->name);
|
||||||
|
strings.Add(newStyleName);
|
||||||
|
for (int i=0;i<n;i++) {
|
||||||
|
AssDialogue *curDiag = grid->GetDialogue(i);
|
||||||
|
if (curDiag->Style == work->name) curDiag->Style = newStyleName;
|
||||||
|
curDiag->ParseASSTags();
|
||||||
|
curDiag->ProcessParameters(ReplaceStyle,&strings);
|
||||||
|
curDiag->UpdateText();
|
||||||
|
curDiag->UpdateData();
|
||||||
|
curDiag->ClearBlocks();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Change name
|
||||||
|
work->name = newStyleName;
|
||||||
|
}
|
||||||
|
|
||||||
// Update scale
|
// Update scale
|
||||||
ScaleX->GetValue().ToDouble(&(work->scalex));
|
ScaleX->GetValue().ToDouble(&(work->scalex));
|
||||||
ScaleY->GetValue().ToDouble(&(work->scaley));
|
ScaleY->GetValue().ToDouble(&(work->scaley));
|
||||||
|
@ -411,9 +457,6 @@ void DialogStyleEditor::Apply (bool apply,bool close) {
|
||||||
work->font = FontName->GetValue();
|
work->font = FontName->GetValue();
|
||||||
FontSize->GetValue().ToDouble(&(work->fontsize));
|
FontSize->GetValue().ToDouble(&(work->fontsize));
|
||||||
|
|
||||||
// Style name
|
|
||||||
work->name = StyleName->GetValue();
|
|
||||||
|
|
||||||
// Copy
|
// Copy
|
||||||
*style = *work;
|
*style = *work;
|
||||||
style->UpdateData();
|
style->UpdateData();
|
||||||
|
|
Loading…
Reference in New Issue