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
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);
}

View file

@ -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

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 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 ===========================

View file

@ -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;i<n;i++) {
cur = grid->GetDialogue(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();