Fixed closing of video with detached video window open

Originally committed to SVN as r1690.
This commit is contained in:
Rodrigo Braz Monteiro 2008-01-12 03:09:48 +00:00
parent ec2a2fa1e3
commit d7d66733f0
6 changed files with 28 additions and 5 deletions

View File

@ -108,5 +108,5 @@ void DialogDetachedVideo::OnClose(wxCloseEvent &event) {
FrameMain *par = parent;
Destroy();
par->detachedVideo = NULL;
par->SetDisplayMode(1,-1);
par->SetDisplayMode(-1,-1);
}

View File

@ -1014,6 +1014,7 @@ void FrameMain::SynchronizeProject(bool fromSubs) {
// Loads video
void FrameMain::LoadVideo(wxString file,bool autoload) {
if (blockVideoLoad) return;
Freeze();
VideoContext::Get()->Stop();
try {
if (VideoContext::Get()->IsLoaded() && VFR_Output.GetFrameRateType() == VFR && !autoload) {
@ -1064,6 +1065,9 @@ void FrameMain::LoadVideo(wxString file,bool autoload) {
SubsBox->CommitChanges(true);
SetDisplayMode(-1,-1);
EditBox->UpdateFrameTiming();
if (!VideoContext::Get()->IsLoaded()) DetachVideo(false);
Thaw();
}
@ -1136,6 +1140,25 @@ void FrameMain::OpenHelp(wxString page) {
}
///////////////////////
// Detach video window
void FrameMain::DetachVideo(bool detach) {
if (detach) {
if (!detachedVideo) {
detachedVideo = new DialogDetachedVideo(this);
detachedVideo->Show();
}
}
else {
if (detachedVideo) {
detachedVideo->Destroy();
SetDisplayMode(-1,-1);
detachedVideo = NULL;
}
}
}
/////////////////
// Get encodings
wxArrayString FrameMain::GetEncodings() {

View File

@ -279,6 +279,7 @@ public:
static wxArrayString GetEncodings();
void UpdateTitle();
void StatusTimeout(wxString text,int ms=10000);
void DetachVideo(bool detach=true);
void SetAccelerators();
void InitMenu();

View File

@ -80,7 +80,6 @@
#endif
#include "dialog_automation.h"
#include "dialog_version_check.h"
#include "dialog_detached_video.h"
#include "dialog_dummy_video.h"
#include "dialog_spellchecker.h"
#include "dialog_associations.h"
@ -853,8 +852,7 @@ void FrameMain::OnSetZoom(wxCommandEvent &event) {
////////////////
// Detach video
void FrameMain::OnDetachVideo(wxCommandEvent &event) {
detachedVideo = new DialogDetachedVideo(this);
detachedVideo->Show();
DetachVideo();
}

View File

@ -148,6 +148,7 @@ void OptionsManager::LoadDefaults(bool onlyDefaults) {
SetModificationType(MOD_VIDEO);
SetBool(_T("Show keyframes on video slider"),true);
SetBool(_T("Show overscan mask"),false);
SetBool(_T("Detached video"),false);
// Video Provider (Advanced)
SetModificationType(MOD_VIDEO_RELOAD);

View File

@ -176,7 +176,7 @@ void VideoDisplay::Render() {
if (!context->IsLoaded()) return;
// Set GL context
wxMutexLocker glLock(OpenGLWrapper::glMutex);
//wxMutexLocker glLock(OpenGLWrapper::glMutex);
#ifdef __WXMAC__
SetCurrent();
#else