From f4d44f7c182e2432c9a7356f2debac9a8cbf71b6 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Fri, 15 Jul 2011 04:06:16 +0000 Subject: [PATCH] Move the zoom box from the main toolbar to the video box Originally committed to SVN as r5467. --- aegisub/src/dialog_detached_video.cpp | 2 +- aegisub/src/frame_main.cpp | 14 +------------- aegisub/src/frame_main.h | 1 - aegisub/src/video_box.cpp | 10 +++++++++- aegisub/src/video_box.h | 3 ++- 5 files changed, 13 insertions(+), 17 deletions(-) diff --git a/aegisub/src/dialog_detached_video.cpp b/aegisub/src/dialog_detached_video.cpp index e943f12b0..7dc94aa3c 100644 --- a/aegisub/src/dialog_detached_video.cpp +++ b/aegisub/src/dialog_detached_video.cpp @@ -75,7 +75,7 @@ DialogDetachedVideo::DialogDetachedVideo(FrameMain *parent, agi::Context *contex wxPanel *panel = new wxPanel(this,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL | wxCLIP_CHILDREN); // Video area; - videoBox = new VideoBox(panel, true, NULL, context); + videoBox = new VideoBox(panel, true, context); videoBox->videoDisplay->SetClientSize(initialDisplaySize); // Set sizer diff --git a/aegisub/src/frame_main.cpp b/aegisub/src/frame_main.cpp index 04c202f3f..695c3df8c 100644 --- a/aegisub/src/frame_main.cpp +++ b/aegisub/src/frame_main.cpp @@ -254,17 +254,6 @@ void FrameMain::InitToolbar () { toolbar::toolbar->GetToolbar("main", Toolbar); - wxArrayString choices; - for (int i=1;i<=24;i++) { - wxString toAdd = wxString::Format("%i",int(i*12.5)); - if (i%2) toAdd += ".5"; - toAdd += "%"; - choices.Add(toAdd); - } - ZoomBox = new wxComboBox(Toolbar,ID_TOOLBAR_ZOOM_DROPDOWN,"75%",wxDefaultPosition,wxDefaultSize,choices,wxCB_DROPDOWN); - Toolbar->AddControl(ZoomBox); - Toolbar->AddSeparator(); - Toolbar->Realize(); } @@ -286,7 +275,7 @@ void FrameMain::InitContents() { Panel = new wxPanel(this,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL | wxCLIP_CHILDREN); StartupLog("Create video box"); - context->videoBox = videoBox = new VideoBox(Panel, false, ZoomBox, context.get()); + context->videoBox = videoBox = new VideoBox(Panel, false, context.get()); wxBoxSizer *videoSizer = new wxBoxSizer(wxVERTICAL); videoSizer->Add(videoBox , 0, wxEXPAND); videoSizer->AddStretchSpacer(1); @@ -338,7 +327,6 @@ static void validate_toolbar(wxToolBar *toolbar, const char *command, const agi: void FrameMain::UpdateToolbar() { wxToolBar* toolbar = GetToolBar(); const agi::Context *c = context.get(); - ZoomBox->Enable(context->videoController->IsLoaded() && !context->detachedVideo); validate_toolbar(toolbar, "video/jump", c); validate_toolbar(toolbar, "video/zoom/in", c); diff --git a/aegisub/src/frame_main.h b/aegisub/src/frame_main.h index 2c45456e2..11834e4b9 100644 --- a/aegisub/src/frame_main.h +++ b/aegisub/src/frame_main.h @@ -108,7 +108,6 @@ private: wxPanel *Panel; wxToolBar *Toolbar; ///< The main toolbar - wxComboBox *ZoomBox; ///< The video zoom dropdown in the main toolbar std::vector activeMacroItems; int AddMacroMenuItems(wxMenu *menu, const std::vector ¯os); diff --git a/aegisub/src/video_box.cpp b/aegisub/src/video_box.cpp index f4d2e67a0..00c2e8375 100644 --- a/aegisub/src/video_box.cpp +++ b/aegisub/src/video_box.cpp @@ -78,7 +78,7 @@ static void add_option(wxWindow *parent, wxSizer *sizer, const char *command, co sizer->Add(btn, 0, wxTOP | wxLEFT | wxBOTTOM | wxALIGN_CENTER, 2); } -VideoBox::VideoBox(wxWindow *parent, bool isDetached, wxComboBox *zoomBox, agi::Context *context) +VideoBox::VideoBox(wxWindow *parent, bool isDetached, agi::Context *context) : wxPanel (parent,-1) , context(context) { @@ -104,6 +104,13 @@ VideoBox::VideoBox(wxWindow *parent, bool isDetached, wxComboBox *zoomBox, agi:: VideoSubsPos = new wxTextCtrl(this,-1,"",wxDefaultPosition,wxSize(110,20),wxTE_READONLY); VideoSubsPos->SetToolTip(_("Time of this frame relative to start and end of current subs.")); + // Zoom box + wxArrayString choices; + for (int i = 1 ; i <= 24; ++i) { + choices.Add(wxString::Format("%g%%", i * 12.5)); + } + zoomBox = new wxComboBox(this, -1, "75%", wxDefaultPosition, wxDefaultSize, choices, wxCB_DROPDOWN); + // Typesetting buttons visualToolBar = new wxToolBar(this,-1,wxDefaultPosition,wxDefaultSize,wxTB_VERTICAL|wxTB_FLAT|wxTB_NODIVIDER); visualToolBar->AddTool(Video_Mode_Standard,_("Standard"),GETIMAGE(visual_standard_24),_("Standard mode, double click sets position."),wxITEM_RADIO); @@ -140,6 +147,7 @@ VideoBox::VideoBox(wxWindow *parent, bool isDetached, wxComboBox *zoomBox, agi:: videoSliderSizer->Add(videoSlider,1,wxEXPAND|wxLEFT,0); videoBottomSizer->Add(VideoPosition,1,wxLEFT|wxALIGN_CENTER,5); videoBottomSizer->Add(VideoSubsPos,1,wxALIGN_CENTER,0); + videoBottomSizer->Add(zoomBox, 0, wxALIGN_CENTER, 5); // If we're detached we do want to fill out as much space we can. // But if we're in the main window, the subs grid needs space more than us. diff --git a/aegisub/src/video_box.h b/aegisub/src/video_box.h index 119cb78f1..0a355d225 100644 --- a/aegisub/src/video_box.h +++ b/aegisub/src/video_box.h @@ -62,6 +62,7 @@ class VideoBox : public wxPanel { agi::Context *context; ///< Project context wxTextCtrl *VideoPosition; ///< Current frame/time wxTextCtrl *VideoSubsPos; ///< Time relative to the active subtitle line + wxComboBox *zoomBox; /// Handle a click on the play/pause buttons void OnButton(wxCommandEvent &evt); @@ -82,7 +83,7 @@ public: /// DOCME VideoSlider *videoSlider; - VideoBox(wxWindow *parent, bool isDetached, wxComboBox *zoomBox, agi::Context *context); + VideoBox(wxWindow *parent, bool isDetached, agi::Context *context); }; // IDs