- Text edit boxes in the subtitle editing area will now revert to unmodified if you restore the original text. (AMZ)

- Re-arranged the controls in the subtitle editing area. (AMZ)

Originally committed to SVN as r428.
This commit is contained in:
Rodrigo Braz Monteiro 2006-06-27 04:13:34 +00:00
parent 48bd386fb0
commit 582500e9e6
5 changed files with 70 additions and 21 deletions

View file

@ -80,6 +80,9 @@ Please visit http://aegisub.net to download latest version
- Style editor now uses a dropdown for the encoding field. (AMZ) - Style editor now uses a dropdown for the encoding field. (AMZ)
- Added 2.35 and custom aspect ratio support for video display. (AMZ) - Added 2.35 and custom aspect ratio support for video display. (AMZ)
- The manual has been extensively re-written and extended to include documentation about a lot of new (and some not so new) features. It's reasonably complete... for the moment. (TheFluff, Motoko-chan, AMZ, others) - The manual has been extensively re-written and extended to include documentation about a lot of new (and some not so new) features. It's reasonably complete... for the moment. (TheFluff, Motoko-chan, AMZ, others)
- Text edit boxes in the subtitle editing area will now revert to unmodified if you restore the original text. (AMZ)
- Re-arranged the controls in the subtitle editing area. (AMZ)
= 1.09 beta - 2006.01.16 =========================== = 1.09 beta - 2006.01.16 ===========================

View file

@ -47,6 +47,7 @@ wxTextCtrl(parent,id,value,pos,size,style,validator,name)
{ {
UpdateLocked = false; UpdateLocked = false;
isModified = false; isModified = false;
orig = GetValue();
Connect(wxEVT_COMMAND_TEXT_UPDATED,wxCommandEventHandler(HiliModTextCtrl::OnModified)); Connect(wxEVT_COMMAND_TEXT_UPDATED,wxCommandEventHandler(HiliModTextCtrl::OnModified));
} }
@ -65,6 +66,7 @@ void HiliModTextCtrl::OnModified(wxCommandEvent &event) {
// Commited event // Commited event
void HiliModTextCtrl::Commited() { void HiliModTextCtrl::Commited() {
if (isModified) { if (isModified) {
orig = GetValue();
SetBackgroundColour(wxNullColour); SetBackgroundColour(wxNullColour);
Refresh(false); Refresh(false);
isModified = false; isModified = false;
@ -76,6 +78,7 @@ void HiliModTextCtrl::Commited() {
// Set value // Set value
void HiliModTextCtrl::SetValue(const wxString& value) { void HiliModTextCtrl::SetValue(const wxString& value) {
UpdateLocked = true; UpdateLocked = true;
orig = value;
wxTextCtrl::SetValue(value); wxTextCtrl::SetValue(value);
Commited(); Commited();
UpdateLocked = false; UpdateLocked = false;
@ -85,9 +88,19 @@ void HiliModTextCtrl::SetValue(const wxString& value) {
//////////////// ////////////////
// Was modified // Was modified
void HiliModTextCtrl::Modified() { void HiliModTextCtrl::Modified() {
if (!isModified) { bool match = GetValue() == orig;
// Different from original
if (!isModified && !match) {
isModified = true; isModified = true;
SetBackgroundColour(Options.AsColour(_T("Edit Box Need Enter Background"))); SetBackgroundColour(Options.AsColour(_T("Edit Box Need Enter Background")));
Refresh(false); Refresh(false);
} }
// Same as original
if (isModified && match) {
SetBackgroundColour(wxNullColour);
Refresh(false);
isModified = false;
}
} }

View file

@ -50,6 +50,8 @@ private:
bool UpdateLocked; bool UpdateLocked;
bool isModified; bool isModified;
wxString orig;
void OnModified(wxCommandEvent &event); void OnModified(wxCommandEvent &event);
void OnKey(wxKeyEvent &event); void OnKey(wxKeyEvent &event);

View file

@ -109,25 +109,6 @@ SubsEditBox::SubsEditBox (wxWindow *parent,SubtitlesGrid *gridp) : wxPanel(paren
//SyntaxHighlight->SetToolTip(_("Enable syntax highlighting")); //SyntaxHighlight->SetToolTip(_("Enable syntax highlighting"));
//SyntaxHighlight->SetValue(Options.AsBool(_T("Syntax Highlight Enabled"))); //SyntaxHighlight->SetValue(Options.AsBool(_T("Syntax Highlight Enabled")));
// Top sizer
wxSizer *TopSizer = new wxBoxSizer(wxHORIZONTAL);
TopSizer->Add(CommentBox,0,wxRIGHT | wxALIGN_CENTER,5);
TopSizer->Add(StyleBox,0,wxRIGHT,5);
TopSizer->Add(ActorBox,0,wxRIGHT,5);
TopSizer->Add(MarginL,0,0,0);
TopSizer->Add(MarginR,0,0,0);
TopSizer->Add(MarginV,0,0,0);
// Middle sizer
wxSizer *MiddleSizer = new wxBoxSizer(wxHORIZONTAL);
MiddleSizer->Add(Layer,0,wxRIGHT,5);
MiddleSizer->Add(StartTime,0,wxRIGHT,0);
MiddleSizer->Add(EndTime,0,wxRIGHT,5);
MiddleSizer->Add(Duration,0,wxRIGHT,5);
MiddleSizer->Add(ByTime,0,wxRIGHT | wxALIGN_CENTER,5);
MiddleSizer->Add(ByFrame,0,wxRIGHT | wxALIGN_CENTER,5);
//MiddleSizer->Add(SyntaxHighlight,0,wxRIGHT | wxALIGN_CENTER,5);
// Middle-bottom controls // Middle-bottom controls
Bold = new wxBitmapButton(this,BUTTON_BOLD,wxBITMAP(button_bold),wxDefaultPosition,wxSize(20,20)); Bold = new wxBitmapButton(this,BUTTON_BOLD,wxBITMAP(button_bold),wxDefaultPosition,wxSize(20,20));
Bold->SetToolTip(_("Bold")); Bold->SetToolTip(_("Bold"));
@ -147,6 +128,26 @@ SubsEditBox::SubsEditBox (wxWindow *parent,SubtitlesGrid *gridp) : wxPanel(paren
Color3->SetToolTip(_("Outline color")); Color3->SetToolTip(_("Outline color"));
Color4 = new wxBitmapButton(this,BUTTON_COLOR4,wxBITMAP(button_color4),wxDefaultPosition,wxSize(30,20)); Color4 = new wxBitmapButton(this,BUTTON_COLOR4,wxBITMAP(button_color4),wxDefaultPosition,wxSize(30,20));
Color4->SetToolTip(_("Shadow color")); Color4->SetToolTip(_("Shadow color"));
Effect = new HiliModTextCtrl(this,EFFECT_BOX,_T(""),wxDefaultPosition,wxSize(120,20),0);
Effect->SetToolTip(_("Effect for this line. This can be used to store extra information for karaoke scripts, or for the effects supported by the renderer."));
// Top sizer
wxSizer *TopSizer = new wxBoxSizer(wxHORIZONTAL);
TopSizer->Add(CommentBox,0,wxRIGHT | wxALIGN_CENTER,5);
TopSizer->Add(StyleBox,0,wxRIGHT,5);
TopSizer->Add(ActorBox,0,wxRIGHT,5);
TopSizer->Add(Effect,0,0,0);
// Middle sizer
wxSizer *MiddleSizer = new wxBoxSizer(wxHORIZONTAL);
MiddleSizer->Add(Layer,0,wxRIGHT,5);
MiddleSizer->Add(StartTime,0,wxRIGHT,0);
MiddleSizer->Add(EndTime,0,wxRIGHT,5);
MiddleSizer->Add(Duration,0,wxRIGHT,5);
MiddleSizer->Add(MarginL,0,0,0);
MiddleSizer->Add(MarginR,0,0,0);
MiddleSizer->Add(MarginV,0,0,0);
//MiddleSizer->Add(SyntaxHighlight,0,wxRIGHT | wxALIGN_CENTER,5);
// Middle-bottom sizer // Middle-bottom sizer
wxSizer *MiddleBotSizer = new wxBoxSizer(wxHORIZONTAL); wxSizer *MiddleBotSizer = new wxBoxSizer(wxHORIZONTAL);
@ -159,7 +160,9 @@ SubsEditBox::SubsEditBox (wxWindow *parent,SubtitlesGrid *gridp) : wxPanel(paren
MiddleBotSizer->Add(Color1); MiddleBotSizer->Add(Color1);
MiddleBotSizer->Add(Color2); MiddleBotSizer->Add(Color2);
MiddleBotSizer->Add(Color3); MiddleBotSizer->Add(Color3);
MiddleBotSizer->Add(Color4); MiddleBotSizer->Add(Color4,0,wxRIGHT,10);
MiddleBotSizer->Add(ByTime,0,wxRIGHT | wxALIGN_CENTER,5);
MiddleBotSizer->Add(ByFrame,0,wxRIGHT | wxALIGN_CENTER,5);
// Text editor // Text editor
TextEdit = new SubsTextEditCtrl(this,EDIT_BOX,_T(""),wxDefaultPosition,wxSize(300,50),wxTE_MULTILINE | wxTE_RICH2 | wxTE_NOHIDESEL); TextEdit = new SubsTextEditCtrl(this,EDIT_BOX,_T(""),wxDefaultPosition,wxSize(300,50),wxTE_MULTILINE | wxTE_RICH2 | wxTE_NOHIDESEL);
@ -205,6 +208,7 @@ void SubsEditBox::Update (bool timeOnly) {
MarginL->SetValue(curdiag->GetMarginString(1)); MarginL->SetValue(curdiag->GetMarginString(1));
MarginR->SetValue(curdiag->GetMarginString(2)); MarginR->SetValue(curdiag->GetMarginString(2));
MarginV->SetValue(curdiag->GetMarginString(3)); MarginV->SetValue(curdiag->GetMarginString(3));
Effect->SetValue(curdiag->Effect);
CommentBox->SetValue(curdiag->Comment); CommentBox->SetValue(curdiag->Comment);
StyleBox->Select(StyleBox->FindString(curdiag->Style)); StyleBox->Select(StyleBox->FindString(curdiag->Style));
ActorBox->SetValue(curdiag->Actor); ActorBox->SetValue(curdiag->Actor);
@ -434,6 +438,7 @@ BEGIN_EVENT_TABLE(SubsEditBox, wxPanel)
EVT_TEXT_ENTER(MARGINL_BOX, SubsEditBox::OnMarginLChange) EVT_TEXT_ENTER(MARGINL_BOX, SubsEditBox::OnMarginLChange)
EVT_TEXT_ENTER(MARGINR_BOX, SubsEditBox::OnMarginRChange) EVT_TEXT_ENTER(MARGINR_BOX, SubsEditBox::OnMarginRChange)
EVT_TEXT_ENTER(MARGINV_BOX, SubsEditBox::OnMarginVChange) EVT_TEXT_ENTER(MARGINV_BOX, SubsEditBox::OnMarginVChange)
EVT_TEXT_ENTER(EFFECT_BOX, SubsEditBox::OnEffectChange)
EVT_CHECKBOX(COMMENT_CHECKBOX, SubsEditBox::OnCommentChange) EVT_CHECKBOX(COMMENT_CHECKBOX, SubsEditBox::OnCommentChange)
EVT_MENU(EDIT_MENU_SPLIT_PRESERVE,SubsEditBox::OnSplitLinePreserve) EVT_MENU(EDIT_MENU_SPLIT_PRESERVE,SubsEditBox::OnSplitLinePreserve)
@ -526,6 +531,7 @@ void SubsEditBox::SetControlsState (bool state) {
MarginL->Enable(state); MarginL->Enable(state);
MarginR->Enable(state); MarginR->Enable(state);
MarginV->Enable(state); MarginV->Enable(state);
Effect->Enable(state);
CommentBox->Enable(state); CommentBox->Enable(state);
StyleBox->Enable(state); StyleBox->Enable(state);
ActorBox->Enable(state); ActorBox->Enable(state);
@ -552,6 +558,7 @@ void SubsEditBox::SetControlsState (bool state) {
MarginL->SetValue(_T("")); MarginL->SetValue(_T(""));
MarginR->SetValue(_T("")); MarginR->SetValue(_T(""));
MarginV->SetValue(_T("")); MarginV->SetValue(_T(""));
Effect->SetValue(_T(""));
CommentBox->SetValue(false); CommentBox->SetValue(false);
} }
} }
@ -782,6 +789,27 @@ void SubsEditBox::OnMarginVChange(wxCommandEvent &event) {
} }
//////////////////
// Effect changed
void SubsEditBox::OnEffectChange(wxCommandEvent &event) {
Effect->Commited();
grid->BeginBatch();
wxArrayInt sel = grid->GetSelection();
int n = sel.Count();
AssDialogue *cur;
for (int i=0;i<n;i++) {
cur = grid->GetDialogue(sel[i]);
if (cur) {
cur->Effect = Effect->GetValue();
cur->UpdateData();
}
}
grid->ass->FlagAsModified();
grid->CommitChanges();
grid->EndBatch();
}
///////////////////////// /////////////////////////
// Comment state changed // Comment state changed
void SubsEditBox::OnCommentChange(wxCommandEvent &event) { void SubsEditBox::OnCommentChange(wxCommandEvent &event) {

View file

@ -87,6 +87,7 @@ private:
HiliModTextCtrl *MarginL; HiliModTextCtrl *MarginL;
HiliModTextCtrl *MarginR; HiliModTextCtrl *MarginR;
HiliModTextCtrl *MarginV; HiliModTextCtrl *MarginV;
HiliModTextCtrl *Effect;
wxRadioButton *ByTime; wxRadioButton *ByTime;
wxRadioButton *ByFrame; wxRadioButton *ByFrame;
wxCheckBox *SyntaxHighlight; wxCheckBox *SyntaxHighlight;
@ -131,6 +132,7 @@ private:
void OnMarginRChange(wxCommandEvent &event); void OnMarginRChange(wxCommandEvent &event);
void OnMarginVChange(wxCommandEvent &event); void OnMarginVChange(wxCommandEvent &event);
void OnCommentChange(wxCommandEvent &event); void OnCommentChange(wxCommandEvent &event);
void OnEffectChange(wxCommandEvent &event);
void OnSplitLinePreserve(wxCommandEvent &event); void OnSplitLinePreserve(wxCommandEvent &event);
void OnSplitLineEstimate(wxCommandEvent &event); void OnSplitLineEstimate(wxCommandEvent &event);
@ -192,6 +194,7 @@ enum {
MARGINL_BOX, MARGINL_BOX,
MARGINR_BOX, MARGINR_BOX,
MARGINV_BOX, MARGINV_BOX,
EFFECT_BOX,
COMMENT_CHECKBOX, COMMENT_CHECKBOX,
EDIT_MENU_SPLIT_PRESERVE, EDIT_MENU_SPLIT_PRESERVE,
EDIT_MENU_SPLIT_ESTIMATE, EDIT_MENU_SPLIT_ESTIMATE,