Changed the "split line at cursor" functions so they now split what the user sees, not what's actually committed. Fixes #632.
Originally committed to SVN as r1693.
This commit is contained in:
parent
8a6f04512b
commit
b16bfa6676
3 changed files with 19 additions and 6 deletions
|
@ -946,7 +946,9 @@ void SubsTextEditCtrl::OnSplitLinePreserve (wxCommandEvent &event) {
|
||||||
GetSelection(&from, &to);
|
GetSelection(&from, &to);
|
||||||
from = GetReverseUnicodePosition(from);
|
from = GetReverseUnicodePosition(from);
|
||||||
to = GetReverseUnicodePosition(to);
|
to = GetReverseUnicodePosition(to);
|
||||||
control->grid->SplitLine(control->linen,from,0);
|
// Call SplitLine() with the text currently in the editbox.
|
||||||
|
// This makes sure we split what the user sees, not the committed line.
|
||||||
|
control->grid->SplitLine(control->linen,from,0,GetText());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -957,7 +959,9 @@ void SubsTextEditCtrl::OnSplitLineEstimate (wxCommandEvent &event) {
|
||||||
GetSelection(&from, &to);
|
GetSelection(&from, &to);
|
||||||
from = GetReverseUnicodePosition(from);
|
from = GetReverseUnicodePosition(from);
|
||||||
to = GetReverseUnicodePosition(to);
|
to = GetReverseUnicodePosition(to);
|
||||||
control->grid->SplitLine(control->linen,from,1);
|
// Call SplitLine() with the text currently in the editbox.
|
||||||
|
// This makes sure we split what the user sees, not the committed line.
|
||||||
|
control->grid->SplitLine(control->linen,from,1,GetText());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1251,11 +1251,20 @@ void SubtitlesGrid::ShiftLineByFrames(int n,int len,int type) {
|
||||||
|
|
||||||
//////////////
|
//////////////
|
||||||
// Split line
|
// Split line
|
||||||
void SubtitlesGrid::SplitLine(int n,int pos,int mode) {
|
void SubtitlesGrid::SplitLine(int n,int pos,int mode,wxString textIn) {
|
||||||
// Split
|
// Split
|
||||||
AssDialogue *n1,*n2;
|
AssDialogue *n1,*n2;
|
||||||
n1 = GetDialogue(n);
|
// No textIn? Get saved text
|
||||||
n2 = new AssDialogue(n1->GetEntryData());
|
if (textIn.IsEmpty()) {
|
||||||
|
n1 = GetDialogue(n);
|
||||||
|
n2 = new AssDialogue(n1->GetEntryData());
|
||||||
|
}
|
||||||
|
// Otherwise use textIn
|
||||||
|
else {
|
||||||
|
n1 = GetDialogue(n);
|
||||||
|
n1->Text = textIn;
|
||||||
|
n2 = new AssDialogue(n1->GetEntryData());
|
||||||
|
}
|
||||||
InsertLine(n2,n,true,false);
|
InsertLine(n2,n,true,false);
|
||||||
|
|
||||||
// Modify text
|
// Modify text
|
||||||
|
|
|
@ -115,7 +115,7 @@ public:
|
||||||
void JoinLines(int first,int last,bool concat=true);
|
void JoinLines(int first,int last,bool concat=true);
|
||||||
void JoinAsKaraoke(int first,int last);
|
void JoinAsKaraoke(int first,int last);
|
||||||
void AdjoinLines(int first,int last,bool setStart);
|
void AdjoinLines(int first,int last,bool setStart);
|
||||||
void SplitLine(int lineNumber,int splitPosition,int mode);
|
void SplitLine(int lineNumber,int splitPosition,int mode,wxString splitText = _T(""));
|
||||||
void SplitLineByKaraoke(int lineNumber);
|
void SplitLineByKaraoke(int lineNumber);
|
||||||
void DuplicateLines(int first,int last,bool nextFrame=false);
|
void DuplicateLines(int first,int last,bool nextFrame=false);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue