diff --git a/aegisub/src/frame_main.cpp b/aegisub/src/frame_main.cpp index aaa64c78c..816e72239 100644 --- a/aegisub/src/frame_main.cpp +++ b/aegisub/src/frame_main.cpp @@ -243,14 +243,14 @@ void FrameMain::InitContents() { StartupLog("Create background panel"); Panel = new wxPanel(this,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL | wxCLIP_CHILDREN); - StartupLog("Create video box"); - context->videoBox = videoBox = new VideoBox(Panel, false, context.get()); - StartupLog("Create subtitles grid"); context->subsGrid = SubsGrid = new SubtitlesGrid(Panel,context.get(),wxSize(600,100),wxWANTS_CHARS | wxSUNKEN_BORDER,"Subs grid"); context->selectionController = context->subsGrid; Search.context = context.get(); + StartupLog("Create video box"); + context->videoBox = videoBox = new VideoBox(Panel, false, context.get()); + StartupLog("Create audio box"); context->audioBox = audioBox = new AudioBox(Panel, context.get()); diff --git a/aegisub/src/video_box.cpp b/aegisub/src/video_box.cpp index f80e020d4..a5189178a 100644 --- a/aegisub/src/video_box.cpp +++ b/aegisub/src/video_box.cpp @@ -161,6 +161,12 @@ VideoBox::VideoBox(wxWindow *parent, bool isDetached, agi::Context *context) slots.push_back(context->videoController->AddTimecodesListener(&VideoBox::UpdateTimeBoxes, this)); slots.push_back(context->videoController->AddVideoOpenListener(&VideoBox::UpdateTimeBoxes, this)); slots.push_back(context->ass->AddCommitListener(&VideoBox::UpdateTimeBoxes, this)); + + context->selectionController->AddSelectionListener(this); +} + +VideoBox::~VideoBox() { + context->selectionController->RemoveSelectionListener(this); } void VideoBox::OnButton(wxCommandEvent &evt) { diff --git a/aegisub/src/video_box.h b/aegisub/src/video_box.h index 0a355d225..1899ac80a 100644 --- a/aegisub/src/video_box.h +++ b/aegisub/src/video_box.h @@ -46,7 +46,10 @@ #include +#include "selection_controller.h" + namespace agi { struct Context; } +class AssDialogue; class ToggleBitmap; class VideoDisplay; class VideoSlider; @@ -57,7 +60,7 @@ class wxComboBox; /// @brief DOCME /// /// DOCME -class VideoBox : public wxPanel { +class VideoBox : public wxPanel, private SelectionListener { std::list slots; agi::Context *context; ///< Project context wxTextCtrl *VideoPosition; ///< Current frame/time @@ -69,6 +72,9 @@ class VideoBox : public wxPanel { /// Update VideoPosition and VideoSubsPos void UpdateTimeBoxes(); + + void OnSelectedSetChanged(Selection const&, Selection const&) { } + void OnActiveLineChanged(AssDialogue*) { UpdateTimeBoxes(); } public: /// DOCME @@ -84,6 +90,7 @@ public: VideoSlider *videoSlider; VideoBox(wxWindow *parent, bool isDetached, agi::Context *context); + ~VideoBox(); }; // IDs