Changed the "split line at cursor" functions so they now split what the user sees, not what's actually committed. Fixes .

Originally committed to SVN as r1693.
This commit is contained in:
Karl Blomster 2008-01-12 22:40:04 +00:00
parent 8a6f04512b
commit b16bfa6676
3 changed files with 19 additions and 6 deletions

View file

@ -946,7 +946,9 @@ void SubsTextEditCtrl::OnSplitLinePreserve (wxCommandEvent &event) {
GetSelection(&from, &to);
from = GetReverseUnicodePosition(from);
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);
from = GetReverseUnicodePosition(from);
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());
}

View file

@ -1251,11 +1251,20 @@ void SubtitlesGrid::ShiftLineByFrames(int n,int len,int type) {
//////////////
// Split line
void SubtitlesGrid::SplitLine(int n,int pos,int mode) {
void SubtitlesGrid::SplitLine(int n,int pos,int mode,wxString textIn) {
// Split
AssDialogue *n1,*n2;
n1 = GetDialogue(n);
n2 = new AssDialogue(n1->GetEntryData());
// No textIn? Get saved text
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);
// Modify text

View file

@ -115,7 +115,7 @@ public:
void JoinLines(int first,int last,bool concat=true);
void JoinAsKaraoke(int first,int last);
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 DuplicateLines(int first,int last,bool nextFrame=false);