Update the video box time boxes when the active line changes

Originally committed to SVN as r5809.
This commit is contained in:
Thomas Goyne 2011-11-04 05:11:24 +00:00
parent 4d2a2c618e
commit 29f0786c81
3 changed files with 17 additions and 4 deletions

View File

@ -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());

View File

@ -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) {

View File

@ -46,7 +46,10 @@
#include <libaegisub/signal.h>
#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<AssDialogue> {
std::list<agi::signal::Connection> 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