Made recombine lines deal with two new cases.
Originally committed to SVN as r896.
This commit is contained in:
parent
21e8d0ce2c
commit
f711887167
2 changed files with 14 additions and 2 deletions
|
@ -99,6 +99,7 @@ Please visit http://aegisub.net to download latest version
|
|||
- Fixed Custom Aspect Ratio input. (Dansolo)
|
||||
- Made the video display detachable. (AMZ)
|
||||
- Undo and redo now have descriptions. (Dansolo)
|
||||
- The three different "Recombine Lines" were merged into one that autodetects needed changes, and also supports two new cases. (AMZ)
|
||||
|
||||
|
||||
= 1.10 beta - 2006.08.07 ===========================
|
||||
|
|
|
@ -600,14 +600,25 @@ void SubtitlesGrid::OnRecombine(wxCommandEvent &event) {
|
|||
|
||||
// Detect type
|
||||
int type = -1;
|
||||
bool invert = false;
|
||||
if (n1->Text.Right(n2->Text.Length()) == n2->Text) type = 0;
|
||||
else if (n1->Text.Left(n2->Text.Length()) == n2->Text) { type = 1; invert = true; }
|
||||
else if (n2->Text.Left(n1->Text.Length()) == n1->Text) type = 1;
|
||||
else if (n2->Text.Right(n1->Text.Length()) == n1->Text) { type = 0; invert = true; }
|
||||
else {
|
||||
// Unknown type
|
||||
parentFrame->StatusTimeout(_T("Unable to recombine: Neither line is a suffix of the other one."));
|
||||
return;
|
||||
}
|
||||
|
||||
// Invert?
|
||||
if (invert) {
|
||||
n3 = n1;
|
||||
n1 = n2;
|
||||
n2 = n3;
|
||||
n3 = NULL;
|
||||
}
|
||||
|
||||
// 1+2,2 -> 1,2
|
||||
if (type == 0) {
|
||||
n1->Text = n1->Text.SubString(0, n1->Text.Length() - n2->Text.Length() - 1).Trim(true).Trim(false);
|
||||
|
@ -616,8 +627,8 @@ void SubtitlesGrid::OnRecombine(wxCommandEvent &event) {
|
|||
n2->Start = n1->Start;
|
||||
}
|
||||
|
||||
// 1,1+2, -> 1,2
|
||||
else {
|
||||
// 1,1+2 -> 1,2
|
||||
else if (type == 1) {
|
||||
n2->Text = n2->Text.Mid(n1->Text.Length()).Trim(true).Trim(false);
|
||||
while (n2->Text.Left(2) == _T("\\N") || n2->Text.Left(2) == _T("\\n")) n2->Text = n2->Text.Mid(2);
|
||||
while (n2->Text.Right(2) == _T("\\N") || n2->Text.Right(2) == _T("\\n")) n2->Text = n2->Text.Mid(0,n2->Text.Length()-2);
|
||||
|
|
Loading…
Reference in a new issue