Small tests to prepare for real-time subtitle visual manipulation
Originally committed to SVN as r744.
This commit is contained in:
parent
1e1d88b613
commit
739806ea4e
5 changed files with 27 additions and 16 deletions
|
@ -860,16 +860,17 @@ void SubsEditBox::KeyPress(wxKeyEvent &event) {
|
|||
|
||||
///////////////
|
||||
// Commit text
|
||||
void SubsEditBox::CommitText() {
|
||||
void SubsEditBox::CommitText(bool weak) {
|
||||
AssDialogue *cur = grid->GetDialogue(linen);
|
||||
|
||||
// Update line
|
||||
if (cur) {
|
||||
cur->Text = TextEdit->GetText();
|
||||
//cur->ParseASSTags();
|
||||
cur->UpdateData();
|
||||
grid->Refresh(false);
|
||||
audio->SetDialogue(grid,cur,linen);
|
||||
if (!weak) {
|
||||
grid->Refresh(false);
|
||||
audio->SetDialogue(grid,cur,linen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ public:
|
|||
void SetStyleFlag (wxString tag,wxString preValue=_T(""),int pos=-1);
|
||||
|
||||
void SetSplitLineMode(wxSize size=wxSize(-1,-1));
|
||||
void CommitText();
|
||||
void CommitText(bool weak=false);
|
||||
void Update(bool timeOnly=false);
|
||||
void UpdateGlobals();
|
||||
void SetToLine(int n);
|
||||
|
|
|
@ -1269,7 +1269,7 @@ void SubtitlesGrid::SplitLineByKaraoke(int lineNumber) {
|
|||
// Commit changes
|
||||
// --------------
|
||||
// This will save the work .ass and refresh it
|
||||
void SubtitlesGrid::CommitChanges(bool force) {
|
||||
void SubtitlesGrid::CommitChanges(bool force,bool videoOnly) {
|
||||
if (video->loaded || force) {
|
||||
// Check if it's playing
|
||||
bool playing = false;
|
||||
|
@ -1289,15 +1289,17 @@ void SubtitlesGrid::CommitChanges(bool force) {
|
|||
if (playing) video->Play();
|
||||
}
|
||||
|
||||
// Autosave if option is enabled
|
||||
if (Options.AsBool(_T("Auto Save on Every Change"))) {
|
||||
if (ass->IsModified() && !ass->filename.IsEmpty()) parentFrame->SaveSubtitles(false);
|
||||
}
|
||||
if (!videoOnly) {
|
||||
// Autosave if option is enabled
|
||||
if (Options.AsBool(_T("Auto Save on Every Change"))) {
|
||||
if (ass->IsModified() && !ass->filename.IsEmpty()) parentFrame->SaveSubtitles(false);
|
||||
}
|
||||
|
||||
// Update parent frame
|
||||
parentFrame->UpdateTitle();
|
||||
SetColumnWidths();
|
||||
Refresh(false);
|
||||
// Update parent frame
|
||||
parentFrame->UpdateTitle();
|
||||
SetColumnWidths();
|
||||
Refresh(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ public:
|
|||
|
||||
void LoadDefault(AssFile *ass=NULL);
|
||||
void LoadFromAss(AssFile *ass=NULL,bool keepSelection=false,bool dontModify=false);
|
||||
void CommitChanges(bool force=false);
|
||||
void CommitChanges(bool force=false,bool videoOnly=false);
|
||||
|
||||
void SetVideoToSubs(bool start);
|
||||
void SetSubsToVideo(bool start);
|
||||
|
|
|
@ -393,7 +393,15 @@ void VideoDisplay::OnMouseEvent(wxMouseEvent& event) {
|
|||
grid->editBox->SetOverride(_T("\\pos"),wxString::Format(_T("(%i,%i)"),vx,vy),0);
|
||||
grid->editBox->CommitText();
|
||||
grid->ass->FlagAsModified();
|
||||
grid->CommitChanges();
|
||||
grid->CommitChanges(false,true);
|
||||
}
|
||||
|
||||
// Drag
|
||||
if (event.LeftIsDown() && false) {
|
||||
grid->editBox->SetOverride(_T("\\pos"),wxString::Format(_T("(%i,%i)"),vx,vy),0);
|
||||
grid->editBox->CommitText(true);
|
||||
//grid->ass->FlagAsModified();
|
||||
grid->CommitChanges(false,true);
|
||||
}
|
||||
|
||||
// Hover
|
||||
|
|
Loading…
Reference in a new issue