diff --git a/aegisub/src/dialog_detached_video.cpp b/aegisub/src/dialog_detached_video.cpp index 0bd6f8808..d5274cc31 100644 --- a/aegisub/src/dialog_detached_video.cpp +++ b/aegisub/src/dialog_detached_video.cpp @@ -69,7 +69,7 @@ DialogDetachedVideo::DialogDetachedVideo(agi::Context *context, const wxSize &in // Video area; VideoBox *videoBox = new VideoBox(panel, true, context); - videoBox->videoDisplay->SetMinClientSize(initialDisplaySize); + context->videoDisplay->SetMinClientSize(initialDisplaySize); videoBox->Layout(); // Set sizer @@ -79,7 +79,7 @@ DialogDetachedVideo::DialogDetachedVideo(agi::Context *context, const wxSize &in mainSizer->SetSizeHints(this); // Ensure we can grow smaller, without these the window is locked to at least the initial size - videoBox->videoDisplay->SetMinSize(wxSize(1,1)); + context->videoDisplay->SetMinSize(wxSize(1,1)); videoBox->SetMinSize(wxSize(1,1)); SetMinSize(wxSize(1,1)); diff --git a/aegisub/src/frame_main.cpp b/aegisub/src/frame_main.cpp index 02e8659a0..cb6e63147 100644 --- a/aegisub/src/frame_main.cpp +++ b/aegisub/src/frame_main.cpp @@ -410,12 +410,12 @@ void FrameMain::OnVideoOpen() { vidy = context->videoController->GetHeight(); // Set zoom level based on video resolution and window size - double zoom = videoBox->videoDisplay->GetZoom(); + double zoom = context->videoDisplay->GetZoom(); wxSize windowSize = GetSize(); if (vidx*3*zoom > windowSize.GetX()*4 || vidy*4*zoom > windowSize.GetY()*6) - videoBox->videoDisplay->SetZoom(zoom * .25); + context->videoDisplay->SetZoom(zoom * .25); else if (vidx*3*zoom > windowSize.GetX()*2 || vidy*4*zoom > windowSize.GetY()*3) - videoBox->videoDisplay->SetZoom(zoom * .5); + context->videoDisplay->SetZoom(zoom * .5); // Check that the video size matches the script video size specified int scriptx = context->ass->GetScriptInfoAsInt("PlayResX"); @@ -663,7 +663,7 @@ void FrameMain::OnSubtitlesOpen() { double videoZoom = 0.; if (context->ass->GetScriptInfo("Video Zoom Percent").ToDouble(&videoZoom)) - videoBox->videoDisplay->SetZoom(videoZoom); + context->videoDisplay->SetZoom(videoZoom); } } diff --git a/aegisub/src/video_box.cpp b/aegisub/src/video_box.cpp index 3bc133d83..5da7f3f32 100644 --- a/aegisub/src/video_box.cpp +++ b/aegisub/src/video_box.cpp @@ -110,7 +110,7 @@ VideoBox::VideoBox(wxWindow *parent, bool isDetached, agi::Context *context) visualToolBar->SetBackgroundStyle(wxBG_STYLE_COLOUR); visualToolBar->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)); - videoDisplay = new VideoDisplay(this,isDetached,zoomBox,this,context); + videoDisplay = new VideoDisplay(visualSubToolBar,isDetached,zoomBox,this,context); // Top sizer // Detached and attached video needs different flags, see bugs #742 and #853 diff --git a/aegisub/src/video_box.h b/aegisub/src/video_box.h index e3d0e8cc7..d570f3ea5 100644 --- a/aegisub/src/video_box.h +++ b/aegisub/src/video_box.h @@ -75,7 +75,6 @@ class VideoBox : public wxPanel, private SelectionListener { void OnSelectedSetChanged(Selection const&, Selection const&) { } void OnActiveLineChanged(AssDialogue*) { UpdateTimeBoxes(); } -public: /// DOCME wxToolBar *visualToolBar; @@ -89,6 +88,7 @@ public: /// DOCME VideoSlider *videoSlider; +public: VideoBox(wxWindow *parent, bool isDetached, agi::Context *context); ~VideoBox(); }; diff --git a/aegisub/src/video_display.cpp b/aegisub/src/video_display.cpp index 9b0a029f1..32b9f2655 100644 --- a/aegisub/src/video_display.cpp +++ b/aegisub/src/video_display.cpp @@ -67,7 +67,6 @@ #include "threaded_frame_source.h" #include "utils.h" #include "video_out_gl.h" -#include "video_box.h" #include "video_context.h" #include "visual_tool.h" @@ -89,7 +88,7 @@ public: #define E(cmd) cmd; if (GLenum err = glGetError()) throw OpenGlException(#cmd, err) VideoDisplay::VideoDisplay( - VideoBox *box, + wxToolBar *visualSubToolBar, bool freeSize, wxComboBox *zoomBox, wxWindow* parent, @@ -107,13 +106,10 @@ VideoDisplay::VideoDisplay( , viewport_height(0) , zoomValue(OPT_GET("Video/Default Zoom")->GetInt() * .125 + .125) , videoOut(new VideoOutGL()) -, toolBar(box->visualSubToolBar) +, toolBar(visualSubToolBar) , zoomBox(zoomBox) -, box(box) , freeSize(freeSize) { - assert(box); - zoomBox->SetValue(wxString::Format("%g%%", zoomValue * 100.)); zoomBox->Bind(wxEVT_COMMAND_COMBOBOX_SELECTED, &VideoDisplay::SetZoomFromBox, this); @@ -320,7 +316,7 @@ void VideoDisplay::UpdateSize(int arType, double arValue) { SetMaxClientSize(size); SetEvtHandlerEnabled(false); - box->GetParent()->Layout(); + GetGrandParent()->Layout(); // The sizer makes us use the full width, which at very low zoom levels // results in stretched video, so after using the sizer to update the diff --git a/aegisub/src/video_display.h b/aegisub/src/video_display.h index 1942a796a..a32e0faa1 100644 --- a/aegisub/src/video_display.h +++ b/aegisub/src/video_display.h @@ -48,7 +48,6 @@ // Prototypes class FrameReadyEvent; -class VideoBox; class VideoContext; class VideoOutGL; class VisualToolBase; @@ -111,9 +110,6 @@ class VideoDisplay : public wxGLCanvas { /// The dropdown box for selecting zoom levels wxComboBox *zoomBox; - /// The VideoBox this display is contained in - VideoBox *box; - /// Whether the display can be freely resized by the user bool freeSize; @@ -149,7 +145,7 @@ class VideoDisplay : public wxGLCanvas { public: /// @brief Constructor VideoDisplay( - VideoBox *box, + wxToolBar *visualSubToolBar, bool isDetached, wxComboBox *zoomBox, wxWindow* parent,