diff --git a/aegisub/dialog_detached_video.cpp b/aegisub/dialog_detached_video.cpp index 1e686502b..7e457e792 100644 --- a/aegisub/dialog_detached_video.cpp +++ b/aegisub/dialog_detached_video.cpp @@ -108,5 +108,5 @@ void DialogDetachedVideo::OnClose(wxCloseEvent &event) { FrameMain *par = parent; Destroy(); par->detachedVideo = NULL; - par->SetDisplayMode(1,-1); + par->SetDisplayMode(-1,-1); } diff --git a/aegisub/frame_main.cpp b/aegisub/frame_main.cpp index 4edd50295..580c47f81 100644 --- a/aegisub/frame_main.cpp +++ b/aegisub/frame_main.cpp @@ -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() { diff --git a/aegisub/frame_main.h b/aegisub/frame_main.h index d8175cb73..a07998a64 100644 --- a/aegisub/frame_main.h +++ b/aegisub/frame_main.h @@ -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(); diff --git a/aegisub/frame_main_events.cpp b/aegisub/frame_main_events.cpp index 7ea8e02c9..4feabd80c 100644 --- a/aegisub/frame_main_events.cpp +++ b/aegisub/frame_main_events.cpp @@ -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(); } diff --git a/aegisub/options.cpp b/aegisub/options.cpp index 576544e24..37e26addf 100644 --- a/aegisub/options.cpp +++ b/aegisub/options.cpp @@ -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); diff --git a/aegisub/video_display.cpp b/aegisub/video_display.cpp index 401686a27..82cbb9698 100644 --- a/aegisub/video_display.cpp +++ b/aegisub/video_display.cpp @@ -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