Store the video display and slider in the context directly rather than going through the video box. Fxes a crash when detaching video.
Originally committed to SVN as r5845.
This commit is contained in:
parent
0b742ef3c1
commit
feb752c24c
8 changed files with 39 additions and 25 deletions
|
@ -143,7 +143,7 @@ struct video_aspect_custom : public validator_video_loaded {
|
||||||
wxString denum = value.Mid(pos+1);
|
wxString denum = value.Mid(pos+1);
|
||||||
if (num.ToDouble(&a) && denum.ToDouble(&b) && b!=0) {
|
if (num.ToDouble(&a) && denum.ToDouble(&b) && b!=0) {
|
||||||
numval = a/b;
|
numval = a/b;
|
||||||
if (scale) c->videoBox->videoDisplay->SetZoom(b / c->videoController->GetHeight());
|
if (scale) c->videoDisplay->SetZoom(b / c->videoController->GetHeight());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else numval = 0.0;
|
else numval = 0.0;
|
||||||
|
@ -238,7 +238,7 @@ struct video_copy_coordinates : public validator_video_loaded {
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
if (wxTheClipboard->Open()) {
|
if (wxTheClipboard->Open()) {
|
||||||
wxTheClipboard->SetData(new wxTextDataObject(c->videoBox->videoDisplay->GetMousePosition().Str()));
|
wxTheClipboard->SetData(new wxTextDataObject(c->videoDisplay->GetMousePosition().Str()));
|
||||||
wxTheClipboard->Close();
|
wxTheClipboard->Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -258,7 +258,7 @@ struct video_detach : public validator_video_loaded {
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
if (!c->detachedVideo) {
|
if (!c->detachedVideo) {
|
||||||
c->detachedVideo = new DialogDetachedVideo(c, c->videoBox->videoDisplay->GetClientSize());
|
c->detachedVideo = new DialogDetachedVideo(c, c->videoDisplay->GetClientSize());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
c->detachedVideo->Close();
|
c->detachedVideo->Close();
|
||||||
|
@ -288,12 +288,12 @@ struct video_focus_seek : public validator_video_loaded {
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
wxWindow *curFocus = wxWindow::FindFocus();
|
wxWindow *curFocus = wxWindow::FindFocus();
|
||||||
if (curFocus == c->videoBox->videoSlider) {
|
if (curFocus == c->videoSlider) {
|
||||||
if (c->previousFocus) c->previousFocus->SetFocus();
|
if (c->previousFocus) c->previousFocus->SetFocus();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
c->previousFocus = curFocus;
|
c->previousFocus = curFocus;
|
||||||
c->videoBox->videoSlider->SetFocus();
|
c->videoSlider->SetFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -510,7 +510,7 @@ struct video_jump : public validator_video_loaded {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
if (c->videoController->IsLoaded()) {
|
if (c->videoController->IsLoaded()) {
|
||||||
DialogJumpTo(c).ShowModal();
|
DialogJumpTo(c).ShowModal();
|
||||||
c->videoBox->videoSlider->SetFocus();
|
c->videoSlider->SetFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -632,7 +632,7 @@ struct video_show_overscan : public validator_video_loaded {
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
OPT_SET("Video/Overscan Mask")->SetBool(!OPT_GET("Video/Overscan Mask")->GetBool());
|
OPT_SET("Video/Overscan Mask")->SetBool(!OPT_GET("Video/Overscan Mask")->GetBool());
|
||||||
c->videoBox->videoDisplay->Render();
|
c->videoDisplay->Render();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -646,12 +646,12 @@ public:
|
||||||
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
||||||
|
|
||||||
bool IsActive(const agi::Context *c) {
|
bool IsActive(const agi::Context *c) {
|
||||||
return c->videoBox->videoDisplay->GetZoom() == 1.;
|
return c->videoDisplay->GetZoom() == 1.;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
c->videoBox->videoDisplay->SetZoom(1.);
|
c->videoDisplay->SetZoom(1.);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -678,12 +678,12 @@ public:
|
||||||
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
||||||
|
|
||||||
bool IsActive(const agi::Context *c) {
|
bool IsActive(const agi::Context *c) {
|
||||||
return c->videoBox->videoDisplay->GetZoom() == 2.;
|
return c->videoDisplay->GetZoom() == 2.;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
c->videoBox->videoDisplay->SetZoom(2.);
|
c->videoDisplay->SetZoom(2.);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -697,12 +697,12 @@ public:
|
||||||
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
||||||
|
|
||||||
bool IsActive(const agi::Context *c) {
|
bool IsActive(const agi::Context *c) {
|
||||||
return c->videoBox->videoDisplay->GetZoom() == .5;
|
return c->videoDisplay->GetZoom() == .5;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
c->videoBox->videoDisplay->SetZoom(.5);
|
c->videoDisplay->SetZoom(.5);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -714,7 +714,7 @@ struct video_zoom_in : public validator_video_attached {
|
||||||
STR_HELP("Zoom video in.")
|
STR_HELP("Zoom video in.")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
c->videoBox->videoDisplay->SetZoom(c->videoBox->videoDisplay->GetZoom() + .125);
|
c->videoDisplay->SetZoom(c->videoDisplay->GetZoom() + .125);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -726,7 +726,7 @@ struct video_zoom_out : public validator_video_attached {
|
||||||
STR_HELP("Zoom video out.")
|
STR_HELP("Zoom video out.")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
c->videoBox->videoDisplay->SetZoom(c->videoBox->videoDisplay->GetZoom() - .125);
|
c->videoDisplay->SetZoom(c->videoDisplay->GetZoom() - .125);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ namespace {
|
||||||
STR_HELP("Standard mode, double click sets position.")
|
STR_HELP("Standard mode, double click sets position.")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
c->videoBox->videoDisplay->SetTool(new VisualToolCross(c->videoBox->videoDisplay, c));
|
c->videoDisplay->SetTool(new VisualToolCross(c->videoDisplay, c));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ namespace {
|
||||||
STR_HELP("Drag subtitles.")
|
STR_HELP("Drag subtitles.")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
c->videoBox->videoDisplay->SetTool(new VisualToolDrag(c->videoBox->videoDisplay, c));
|
c->videoDisplay->SetTool(new VisualToolDrag(c->videoDisplay, c));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ namespace {
|
||||||
STR_HELP("Rotate subtitles on their Z axis.")
|
STR_HELP("Rotate subtitles on their Z axis.")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
c->videoBox->videoDisplay->SetTool(new VisualToolRotateZ(c->videoBox->videoDisplay, c));
|
c->videoDisplay->SetTool(new VisualToolRotateZ(c->videoDisplay, c));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ namespace {
|
||||||
STR_HELP("Rotate subtitles on their X and Y axes.")
|
STR_HELP("Rotate subtitles on their X and Y axes.")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
c->videoBox->videoDisplay->SetTool(new VisualToolRotateXY(c->videoBox->videoDisplay, c));
|
c->videoDisplay->SetTool(new VisualToolRotateXY(c->videoDisplay, c));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ namespace {
|
||||||
STR_HELP("Scale subtitles on X and Y axes.")
|
STR_HELP("Scale subtitles on X and Y axes.")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
c->videoBox->videoDisplay->SetTool(new VisualToolScale(c->videoBox->videoDisplay, c));
|
c->videoDisplay->SetTool(new VisualToolScale(c->videoDisplay, c));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ namespace {
|
||||||
STR_HELP("Clip subtitles to a rectangle.")
|
STR_HELP("Clip subtitles to a rectangle.")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
c->videoBox->videoDisplay->SetTool(new VisualToolClip(c->videoBox->videoDisplay, c));
|
c->videoDisplay->SetTool(new VisualToolClip(c->videoDisplay, c));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ namespace {
|
||||||
STR_HELP("Clip subtitles to a vectorial arean.")
|
STR_HELP("Clip subtitles to a vectorial arean.")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
c->videoBox->videoDisplay->SetTool(new VisualToolVectorClip(c->videoBox->videoDisplay, c));
|
c->videoDisplay->SetTool(new VisualToolVectorClip(c->videoDisplay, c));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,8 @@
|
||||||
DialogDetachedVideo::DialogDetachedVideo(agi::Context *context, const wxSize &initialDisplaySize)
|
DialogDetachedVideo::DialogDetachedVideo(agi::Context *context, const wxSize &initialDisplaySize)
|
||||||
: wxDialog(context->parent, -1, "Detached Video", wxDefaultPosition, wxSize(400,300), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX | wxMINIMIZE_BOX | wxWANTS_CHARS)
|
: wxDialog(context->parent, -1, "Detached Video", wxDefaultPosition, wxSize(400,300), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX | wxMINIMIZE_BOX | wxWANTS_CHARS)
|
||||||
, context(context)
|
, context(context)
|
||||||
|
, old_display(context->videoDisplay)
|
||||||
|
, old_slider(context->videoSlider)
|
||||||
, video_open(context->videoController->AddVideoOpenListener(&DialogDetachedVideo::OnVideoOpen, this))
|
, video_open(context->videoController->AddVideoOpenListener(&DialogDetachedVideo::OnVideoOpen, this))
|
||||||
{
|
{
|
||||||
// Set obscure stuff
|
// Set obscure stuff
|
||||||
|
@ -104,6 +106,8 @@ DialogDetachedVideo::~DialogDetachedVideo() { }
|
||||||
|
|
||||||
void DialogDetachedVideo::OnClose(wxCloseEvent&) {
|
void DialogDetachedVideo::OnClose(wxCloseEvent&) {
|
||||||
context->detachedVideo = 0;
|
context->detachedVideo = 0;
|
||||||
|
context->videoDisplay = old_display;
|
||||||
|
context->videoSlider = old_slider;
|
||||||
OPT_SET("Video/Detached/Enabled")->SetBool(false);
|
OPT_SET("Video/Detached/Enabled")->SetBool(false);
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
@ -125,6 +129,8 @@ void DialogDetachedVideo::OnKeyDown(wxKeyEvent &evt) {
|
||||||
void DialogDetachedVideo::OnVideoOpen() {
|
void DialogDetachedVideo::OnVideoOpen() {
|
||||||
if (!context->videoController->IsLoaded()) {
|
if (!context->videoController->IsLoaded()) {
|
||||||
context->detachedVideo = 0;
|
context->detachedVideo = 0;
|
||||||
|
context->videoDisplay = old_display;
|
||||||
|
context->videoSlider = old_slider;
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
namespace agi { struct Context; }
|
namespace agi { struct Context; }
|
||||||
class PersistLocation;
|
class PersistLocation;
|
||||||
class VideoBox;
|
class VideoBox;
|
||||||
|
class VideoDisplay;
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
/// @class DialogDetachedVideo
|
/// @class DialogDetachedVideo
|
||||||
|
@ -52,6 +53,8 @@ class VideoBox;
|
||||||
/// DOCME
|
/// DOCME
|
||||||
class DialogDetachedVideo : public wxDialog {
|
class DialogDetachedVideo : public wxDialog {
|
||||||
agi::Context *context;
|
agi::Context *context;
|
||||||
|
VideoDisplay *old_display;
|
||||||
|
wxWindow *old_slider;
|
||||||
agi::signal::Connection video_open;
|
agi::signal::Connection video_open;
|
||||||
agi::scoped_ptr<PersistLocation> persist;
|
agi::scoped_ptr<PersistLocation> persist;
|
||||||
|
|
||||||
|
|
|
@ -249,7 +249,7 @@ void FrameMain::InitContents() {
|
||||||
Search.context = context.get();
|
Search.context = context.get();
|
||||||
|
|
||||||
StartupLog("Create video box");
|
StartupLog("Create video box");
|
||||||
context->videoBox = videoBox = new VideoBox(Panel, false, context.get());
|
videoBox = new VideoBox(Panel, false, context.get());
|
||||||
|
|
||||||
StartupLog("Create audio box");
|
StartupLog("Create audio box");
|
||||||
context->audioBox = audioBox = new AudioBox(Panel, context.get());
|
context->audioBox = audioBox = new AudioBox(Panel, context.get());
|
||||||
|
|
|
@ -9,8 +9,8 @@ class DialogTranslation;
|
||||||
template<class T> class SelectionController;
|
template<class T> class SelectionController;
|
||||||
class SubsTextEditCtrl;
|
class SubsTextEditCtrl;
|
||||||
class SubtitlesGrid;
|
class SubtitlesGrid;
|
||||||
class VideoBox;
|
|
||||||
class VideoContext;
|
class VideoContext;
|
||||||
|
class VideoDisplay;
|
||||||
class wxWindow;
|
class wxWindow;
|
||||||
namespace Automation4 { class ScriptManager; }
|
namespace Automation4 { class ScriptManager; }
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ struct Context {
|
||||||
// Things that should probably be in some sort of UI-context-model
|
// Things that should probably be in some sort of UI-context-model
|
||||||
wxWindow *parent;
|
wxWindow *parent;
|
||||||
wxWindow *previousFocus;
|
wxWindow *previousFocus;
|
||||||
|
wxWindow *videoSlider;
|
||||||
|
|
||||||
// Views (i.e. things that should eventually not be here at all)
|
// Views (i.e. things that should eventually not be here at all)
|
||||||
AudioBox *audioBox;
|
AudioBox *audioBox;
|
||||||
|
@ -38,7 +39,7 @@ struct Context {
|
||||||
DialogTranslation *translationAssistant;
|
DialogTranslation *translationAssistant;
|
||||||
SubsTextEditCtrl *editBox;
|
SubsTextEditCtrl *editBox;
|
||||||
SubtitlesGrid *subsGrid;
|
SubtitlesGrid *subsGrid;
|
||||||
VideoBox *videoBox;
|
VideoDisplay *videoDisplay;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,6 +137,8 @@ VideoDisplay::VideoDisplay(
|
||||||
|
|
||||||
SetCursor(wxNullCursor);
|
SetCursor(wxNullCursor);
|
||||||
|
|
||||||
|
c->videoDisplay = this;
|
||||||
|
|
||||||
if (con->videoController->IsLoaded())
|
if (con->videoController->IsLoaded())
|
||||||
OnVideoOpen();
|
OnVideoOpen();
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,8 @@ VideoSlider::VideoSlider (wxWindow* parent, agi::Context *c)
|
||||||
slots.push_back(c->videoController->AddVideoOpenListener(&VideoSlider::VideoOpened, this));
|
slots.push_back(c->videoController->AddVideoOpenListener(&VideoSlider::VideoOpened, this));
|
||||||
slots.push_back(c->videoController->AddKeyframesListener(&VideoSlider::KeyframesChanged, this));
|
slots.push_back(c->videoController->AddKeyframesListener(&VideoSlider::KeyframesChanged, this));
|
||||||
|
|
||||||
|
c->videoSlider = this;
|
||||||
|
|
||||||
if (c->videoController->IsLoaded()) {
|
if (c->videoController->IsLoaded()) {
|
||||||
VideoOpened();
|
VideoOpened();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue