Small tests to prepare for real-time subtitle visual manipulation

Originally committed to SVN as r744.
This commit is contained in:
Rodrigo Braz Monteiro 2007-01-08 05:32:29 +00:00
parent 1e1d88b613
commit 739806ea4e
5 changed files with 27 additions and 16 deletions

View file

@ -860,16 +860,17 @@ void SubsEditBox::KeyPress(wxKeyEvent &event) {
/////////////// ///////////////
// Commit text // Commit text
void SubsEditBox::CommitText() { void SubsEditBox::CommitText(bool weak) {
AssDialogue *cur = grid->GetDialogue(linen); AssDialogue *cur = grid->GetDialogue(linen);
// Update line // Update line
if (cur) { if (cur) {
cur->Text = TextEdit->GetText(); cur->Text = TextEdit->GetText();
//cur->ParseASSTags();
cur->UpdateData(); cur->UpdateData();
grid->Refresh(false); if (!weak) {
audio->SetDialogue(grid,cur,linen); grid->Refresh(false);
audio->SetDialogue(grid,cur,linen);
}
} }
} }

View file

@ -152,7 +152,7 @@ public:
void SetStyleFlag (wxString tag,wxString preValue=_T(""),int pos=-1); void SetStyleFlag (wxString tag,wxString preValue=_T(""),int pos=-1);
void SetSplitLineMode(wxSize size=wxSize(-1,-1)); void SetSplitLineMode(wxSize size=wxSize(-1,-1));
void CommitText(); void CommitText(bool weak=false);
void Update(bool timeOnly=false); void Update(bool timeOnly=false);
void UpdateGlobals(); void UpdateGlobals();
void SetToLine(int n); void SetToLine(int n);

View file

@ -1269,7 +1269,7 @@ void SubtitlesGrid::SplitLineByKaraoke(int lineNumber) {
// Commit changes // Commit changes
// -------------- // --------------
// This will save the work .ass and refresh it // 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) { if (video->loaded || force) {
// Check if it's playing // Check if it's playing
bool playing = false; bool playing = false;
@ -1289,15 +1289,17 @@ void SubtitlesGrid::CommitChanges(bool force) {
if (playing) video->Play(); if (playing) video->Play();
} }
// Autosave if option is enabled if (!videoOnly) {
if (Options.AsBool(_T("Auto Save on Every Change"))) { // Autosave if option is enabled
if (ass->IsModified() && !ass->filename.IsEmpty()) parentFrame->SaveSubtitles(false); if (Options.AsBool(_T("Auto Save on Every Change"))) {
} if (ass->IsModified() && !ass->filename.IsEmpty()) parentFrame->SaveSubtitles(false);
}
// Update parent frame // Update parent frame
parentFrame->UpdateTitle(); parentFrame->UpdateTitle();
SetColumnWidths(); SetColumnWidths();
Refresh(false); Refresh(false);
}
} }

View file

@ -103,7 +103,7 @@ public:
void LoadDefault(AssFile *ass=NULL); void LoadDefault(AssFile *ass=NULL);
void LoadFromAss(AssFile *ass=NULL,bool keepSelection=false,bool dontModify=false); 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 SetVideoToSubs(bool start);
void SetSubsToVideo(bool start); void SetSubsToVideo(bool start);

View file

@ -393,7 +393,15 @@ void VideoDisplay::OnMouseEvent(wxMouseEvent& event) {
grid->editBox->SetOverride(_T("\\pos"),wxString::Format(_T("(%i,%i)"),vx,vy),0); grid->editBox->SetOverride(_T("\\pos"),wxString::Format(_T("(%i,%i)"),vx,vy),0);
grid->editBox->CommitText(); grid->editBox->CommitText();
grid->ass->FlagAsModified(); 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 // Hover