From 6ee06d84789d732b34b928c513838573b819703f Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Sat, 30 Dec 2006 14:31:41 +0000 Subject: [PATCH] Tweaked the behavior of the margin boxes, now they no longer show padding zeros. Originally committed to SVN as r658. --- aegisub/ass_dialogue.cpp | 6 +++--- aegisub/ass_dialogue.h | 2 +- aegisub/changelog.txt | 3 ++- aegisub/subs_edit_box.cpp | 35 ++++++++++++++++++++++++----------- 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/aegisub/ass_dialogue.cpp b/aegisub/ass_dialogue.cpp index d71dd23b7..e206a48b7 100644 --- a/aegisub/ass_dialogue.cpp +++ b/aegisub/ass_dialogue.cpp @@ -697,7 +697,7 @@ void AssDialogue::SetMarginString(const wxString origvalue,int which) { ////////////////////////// // Gets string for margin -wxString AssDialogue::GetMarginString(int which) { +wxString AssDialogue::GetMarginString(int which,bool pad) { int value; switch (which) { case 1: value = MarginL; break; @@ -705,8 +705,8 @@ wxString AssDialogue::GetMarginString(int which) { case 3: value = MarginV; break; default: throw _T("Invalid margin"); } - wxString result = wxString::Format(_T("%04i"),value); - return result; + if (pad) return wxString::Format(_T("%04i"),value); + else return wxString::Format(_T("%i"),value); } diff --git a/aegisub/ass_dialogue.h b/aegisub/ass_dialogue.h index 5d9eecf52..47a34830e 100644 --- a/aegisub/ass_dialogue.h +++ b/aegisub/ass_dialogue.h @@ -195,7 +195,7 @@ public: void StripTags(); // Strips all tags from the text void Clear(); // Wipes all data void SetMarginString(const wxString value,int which); // Set string to a margin value (1 = left, 2 = right, 3 = vertical) - wxString GetMarginString(int which); // Returns the string of a margin value (1 = left, 2 = right, 3 = vertical) + wxString GetMarginString(int which,bool pad=true); // Returns the string of a margin value (1 = left, 2 = right, 3 = vertical) void ProcessParameters(void (*callback)(wxString,int,AssOverrideParameter*,void *userData),void *userData=NULL); // Callback to process parameters wxString GetSSAText(); bool CollidesWith(AssDialogue *target); // Checks if two lines collide diff --git a/aegisub/changelog.txt b/aegisub/changelog.txt index 29c9403a0..138692a86 100644 --- a/aegisub/changelog.txt +++ b/aegisub/changelog.txt @@ -31,7 +31,7 @@ Please visit http://aegisub.net to download latest version - Added a "Auto Save on Every Change" option to config.dat (default false), that automatically saves the files whenever you change anything. (AMZ) - Added support for reading ASS, SSA and SRT softsubs directly from Matroska files. (AMZ) - Fixed line selection after pasting. (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) +- 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) - 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) @@ -57,6 +57,7 @@ Please visit http://aegisub.net to download latest version - Actor and Effect fields now show a "ghosted" caption saying their name when they are not focused on and blank. (AMZ) - Aegisub now remembers if it was maximized when it was last quit, and restores its state when opening again. (AMZ) - A few minor tweaks to the Find dialogue. (AMZ) +- Tweaked the behavior of the margin boxes, now they no longer show padding zeroes. (AMZ) = 1.10 beta - 2006.08.07 =========================== diff --git a/aegisub/subs_edit_box.cpp b/aegisub/subs_edit_box.cpp index e5603c068..f0202075f 100644 --- a/aegisub/subs_edit_box.cpp +++ b/aegisub/subs_edit_box.cpp @@ -104,11 +104,14 @@ SubsEditBox::SubsEditBox (wxWindow *parent,SubtitlesGrid *gridp) : wxPanel(paren Duration->SetToolTip(_("Line duration")); Duration->showModified = true; MarginL = new HiliModTextCtrl(this,MARGINL_BOX,_T(""),wxDefaultPosition,wxSize(40,20),wxTE_CENTRE | wxTE_PROCESS_ENTER,NumValidator()); - MarginL->SetToolTip(_("Left Margin (0000 = default)")); + MarginL->SetToolTip(_("Left Margin (0 = default)")); + MarginL->SetMaxLength(4); MarginR = new HiliModTextCtrl(this,MARGINR_BOX,_T(""),wxDefaultPosition,wxSize(40,20),wxTE_CENTRE | wxTE_PROCESS_ENTER,NumValidator()); - MarginR->SetToolTip(_("Right Margin (0000 = default)")); + MarginR->SetToolTip(_("Right Margin (0 = default)")); + MarginR->SetMaxLength(4); MarginV = new HiliModTextCtrl(this,MARGINV_BOX,_T(""),wxDefaultPosition,wxSize(40,20),wxTE_CENTRE | wxTE_PROCESS_ENTER,NumValidator()); - MarginV->SetToolTip(_("Vertical Margin (0000 = default)")); + MarginV->SetToolTip(_("Vertical Margin (0 = default)")); + MarginV->SetMaxLength(4); // Middle-bottom controls Bold = new wxBitmapButton(this,BUTTON_BOLD,wxBITMAP(button_bold),wxDefaultPosition,wxSize(20,20)); @@ -246,9 +249,9 @@ void SubsEditBox::Update (bool timeOnly) { if (!timeOnly) { TextEdit->SetTextTo(curdiag->Text); Layer->SetValue(wxString::Format(_T("%i"),curdiag->Layer)); - MarginL->SetValue(curdiag->GetMarginString(1)); - MarginR->SetValue(curdiag->GetMarginString(2)); - MarginV->SetValue(curdiag->GetMarginString(3)); + MarginL->SetValue(curdiag->GetMarginString(1,false)); + MarginR->SetValue(curdiag->GetMarginString(2,false)); + MarginV->SetValue(curdiag->GetMarginString(3,false)); Effect->SetValue(curdiag->Effect); CommentBox->SetValue(curdiag->Comment); StyleBox->Select(StyleBox->FindString(curdiag->Style)); @@ -564,20 +567,30 @@ void SubsEditBox::OnActorChange(wxCommandEvent &event) { ///////////////// // Layer changed void SubsEditBox::OnLayerChange(wxCommandEvent &event) { + // Value + long temp; + Layer->GetValue().ToLong(&temp); + + // Update Layer->Commited(); grid->BeginBatch(); + + // Get selection wxArrayInt sel = grid->GetSelection(); + + // Update int n = sel.Count(); AssDialogue *cur; for (int i=0;iGetDialogue(sel[i]); if (cur) { - long temp; - Layer->GetValue().ToLong(&temp); cur->Layer = temp; cur->UpdateData(); } } + + // Done + Layer->SetValue(wxString::Format(_("%i"),temp)); grid->ass->FlagAsModified(); grid->CommitChanges(); grid->EndBatch(); @@ -670,7 +683,7 @@ void SubsEditBox::OnMarginLChange(wxCommandEvent &event) { cur->UpdateData(); } } - MarginL->SetValue(cur->GetMarginString(1)); + MarginL->SetValue(cur->GetMarginString(1,false)); grid->ass->FlagAsModified(); grid->CommitChanges(); grid->EndBatch(); @@ -692,7 +705,7 @@ void SubsEditBox::OnMarginRChange(wxCommandEvent &event) { cur->UpdateData(); } } - MarginR->SetValue(cur->GetMarginString(2)); + MarginR->SetValue(cur->GetMarginString(2,false)); grid->ass->FlagAsModified(); grid->CommitChanges(); grid->EndBatch(); @@ -714,7 +727,7 @@ void SubsEditBox::OnMarginVChange(wxCommandEvent &event) { cur->UpdateData(); } } - MarginV->SetValue(cur->GetMarginString(3)); + MarginV->SetValue(cur->GetMarginString(3,false)); grid->ass->FlagAsModified(); grid->CommitChanges(); grid->EndBatch();