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; FrameMain *par = parent;
Destroy(); Destroy();
par->detachedVideo = NULL; par->detachedVideo = NULL;
par->SetDisplayMode(1,-1); par->SetDisplayMode(-1,-1);
} }

View file

@ -1014,6 +1014,7 @@ void FrameMain::SynchronizeProject(bool fromSubs) {
// Loads video // Loads video
void FrameMain::LoadVideo(wxString file,bool autoload) { void FrameMain::LoadVideo(wxString file,bool autoload) {
if (blockVideoLoad) return; if (blockVideoLoad) return;
Freeze();
VideoContext::Get()->Stop(); VideoContext::Get()->Stop();
try { try {
if (VideoContext::Get()->IsLoaded() && VFR_Output.GetFrameRateType() == VFR && !autoload) { if (VideoContext::Get()->IsLoaded() && VFR_Output.GetFrameRateType() == VFR && !autoload) {
@ -1064,6 +1065,9 @@ void FrameMain::LoadVideo(wxString file,bool autoload) {
SubsBox->CommitChanges(true); SubsBox->CommitChanges(true);
SetDisplayMode(-1,-1); SetDisplayMode(-1,-1);
EditBox->UpdateFrameTiming(); 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 // Get encodings
wxArrayString FrameMain::GetEncodings() { wxArrayString FrameMain::GetEncodings() {

View file

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

View file

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

View file

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

View file

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