Tweaked the behavior of the margin boxes, now they no longer show padding zeros.

Originally committed to SVN as r658.
This commit is contained in:
Rodrigo Braz Monteiro 2006-12-30 14:31:41 +00:00
parent fcdf986f81
commit 6ee06d8478
4 changed files with 30 additions and 16 deletions

View File

@ -697,7 +697,7 @@ void AssDialogue::SetMarginString(const wxString origvalue,int which) {
////////////////////////// //////////////////////////
// Gets string for margin // Gets string for margin
wxString AssDialogue::GetMarginString(int which) { wxString AssDialogue::GetMarginString(int which,bool pad) {
int value; int value;
switch (which) { switch (which) {
case 1: value = MarginL; break; case 1: value = MarginL; break;
@ -705,8 +705,8 @@ wxString AssDialogue::GetMarginString(int which) {
case 3: value = MarginV; break; case 3: value = MarginV; break;
default: throw _T("Invalid margin"); default: throw _T("Invalid margin");
} }
wxString result = wxString::Format(_T("%04i"),value); if (pad) return wxString::Format(_T("%04i"),value);
return result; else return wxString::Format(_T("%i"),value);
} }

View File

@ -195,7 +195,7 @@ public:
void StripTags(); // Strips all tags from the text void StripTags(); // Strips all tags from the text
void Clear(); // Wipes all data void Clear(); // Wipes all data
void SetMarginString(const wxString value,int which); // Set string to a margin value (1 = left, 2 = right, 3 = vertical) 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 void ProcessParameters(void (*callback)(wxString,int,AssOverrideParameter*,void *userData),void *userData=NULL); // Callback to process parameters
wxString GetSSAText(); wxString GetSSAText();
bool CollidesWith(AssDialogue *target); // Checks if two lines collide bool CollidesWith(AssDialogue *target); // Checks if two lines collide

View File

@ -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 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) - Added support for reading ASS, SSA and SRT softsubs directly from Matroska files. (AMZ)
- Fixed line selection after pasting. (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) - 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) - 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) - 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) - 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) - 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 =========================== = 1.10 beta - 2006.08.07 ===========================

View File

@ -104,11 +104,14 @@ SubsEditBox::SubsEditBox (wxWindow *parent,SubtitlesGrid *gridp) : wxPanel(paren
Duration->SetToolTip(_("Line duration")); Duration->SetToolTip(_("Line duration"));
Duration->showModified = true; Duration->showModified = true;
MarginL = new HiliModTextCtrl(this,MARGINL_BOX,_T(""),wxDefaultPosition,wxSize(40,20),wxTE_CENTRE | wxTE_PROCESS_ENTER,NumValidator()); 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 = 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 = 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 // 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));
@ -246,9 +249,9 @@ void SubsEditBox::Update (bool timeOnly) {
if (!timeOnly) { if (!timeOnly) {
TextEdit->SetTextTo(curdiag->Text); TextEdit->SetTextTo(curdiag->Text);
Layer->SetValue(wxString::Format(_T("%i"),curdiag->Layer)); Layer->SetValue(wxString::Format(_T("%i"),curdiag->Layer));
MarginL->SetValue(curdiag->GetMarginString(1)); MarginL->SetValue(curdiag->GetMarginString(1,false));
MarginR->SetValue(curdiag->GetMarginString(2)); MarginR->SetValue(curdiag->GetMarginString(2,false));
MarginV->SetValue(curdiag->GetMarginString(3)); MarginV->SetValue(curdiag->GetMarginString(3,false));
Effect->SetValue(curdiag->Effect); Effect->SetValue(curdiag->Effect);
CommentBox->SetValue(curdiag->Comment); CommentBox->SetValue(curdiag->Comment);
StyleBox->Select(StyleBox->FindString(curdiag->Style)); StyleBox->Select(StyleBox->FindString(curdiag->Style));
@ -564,20 +567,30 @@ void SubsEditBox::OnActorChange(wxCommandEvent &event) {
///////////////// /////////////////
// Layer changed // Layer changed
void SubsEditBox::OnLayerChange(wxCommandEvent &event) { void SubsEditBox::OnLayerChange(wxCommandEvent &event) {
// Value
long temp;
Layer->GetValue().ToLong(&temp);
// Update
Layer->Commited(); Layer->Commited();
grid->BeginBatch(); grid->BeginBatch();
// Get selection
wxArrayInt sel = grid->GetSelection(); wxArrayInt sel = grid->GetSelection();
// Update
int n = sel.Count(); int n = sel.Count();
AssDialogue *cur; AssDialogue *cur;
for (int i=0;i<n;i++) { for (int i=0;i<n;i++) {
cur = grid->GetDialogue(sel[i]); cur = grid->GetDialogue(sel[i]);
if (cur) { if (cur) {
long temp;
Layer->GetValue().ToLong(&temp);
cur->Layer = temp; cur->Layer = temp;
cur->UpdateData(); cur->UpdateData();
} }
} }
// Done
Layer->SetValue(wxString::Format(_("%i"),temp));
grid->ass->FlagAsModified(); grid->ass->FlagAsModified();
grid->CommitChanges(); grid->CommitChanges();
grid->EndBatch(); grid->EndBatch();
@ -670,7 +683,7 @@ void SubsEditBox::OnMarginLChange(wxCommandEvent &event) {
cur->UpdateData(); cur->UpdateData();
} }
} }
MarginL->SetValue(cur->GetMarginString(1)); MarginL->SetValue(cur->GetMarginString(1,false));
grid->ass->FlagAsModified(); grid->ass->FlagAsModified();
grid->CommitChanges(); grid->CommitChanges();
grid->EndBatch(); grid->EndBatch();
@ -692,7 +705,7 @@ void SubsEditBox::OnMarginRChange(wxCommandEvent &event) {
cur->UpdateData(); cur->UpdateData();
} }
} }
MarginR->SetValue(cur->GetMarginString(2)); MarginR->SetValue(cur->GetMarginString(2,false));
grid->ass->FlagAsModified(); grid->ass->FlagAsModified();
grid->CommitChanges(); grid->CommitChanges();
grid->EndBatch(); grid->EndBatch();
@ -714,7 +727,7 @@ void SubsEditBox::OnMarginVChange(wxCommandEvent &event) {
cur->UpdateData(); cur->UpdateData();
} }
} }
MarginV->SetValue(cur->GetMarginString(3)); MarginV->SetValue(cur->GetMarginString(3,false));
grid->ass->FlagAsModified(); grid->ass->FlagAsModified();
grid->CommitChanges(); grid->CommitChanges();
grid->EndBatch(); grid->EndBatch();