Remove the 'audio' and 'grid' public members from VideoContext and migrate everything that used them over to Context
Originally committed to SVN as r5211.
This commit is contained in:
parent
169d3cd31c
commit
d84b768171
30 changed files with 173 additions and 174 deletions
|
@ -140,7 +140,7 @@ struct tool_style_assistant : public Command {
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
if (!c->stylingAssistant) c->stylingAssistant = new DialogStyling(c->parent, c->subsGrid);
|
if (!c->stylingAssistant) c->stylingAssistant = new DialogStyling(c);
|
||||||
c->stylingAssistant->Show(true);
|
c->stylingAssistant->Show(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -197,7 +197,7 @@ struct tool_translation_assistant : public Command {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
int start = c->subsGrid->GetFirstSelRow();
|
int start = c->subsGrid->GetFirstSelRow();
|
||||||
if (start == -1) start = 0;
|
if (start == -1) start = 0;
|
||||||
DialogTranslation(c->parent, c->ass, c->subsGrid, start, true).ShowModal();
|
DialogTranslation(c, start, true).ShowModal();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -55,11 +55,10 @@
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
/// @param par FrameMain this was spawned from
|
/// @param par FrameMain this was spawned from
|
||||||
/// @param initialDisplaySize Initial size of the window
|
/// @param initialDisplaySize Initial size of the window
|
||||||
DialogDetachedVideo::DialogDetachedVideo(FrameMain *par, const wxSize &initialDisplaySize)
|
DialogDetachedVideo::DialogDetachedVideo(FrameMain *parent, agi::Context *context, const wxSize &initialDisplaySize)
|
||||||
: wxDialog(par,-1,_T("Detached Video"),wxDefaultPosition,wxSize(400,300),wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX | wxMINIMIZE_BOX | wxWANTS_CHARS)
|
: wxDialog(parent,-1,_T("Detached Video"),wxDefaultPosition,wxSize(400,300),wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX | wxMINIMIZE_BOX | wxWANTS_CHARS)
|
||||||
|
, parent(parent)
|
||||||
{
|
{
|
||||||
parent = par;
|
|
||||||
|
|
||||||
// Set up window
|
// Set up window
|
||||||
int x = OPT_GET("Video/Detached/Last/X")->GetInt();
|
int x = OPT_GET("Video/Detached/Last/X")->GetInt();
|
||||||
int y = OPT_GET("Video/Detached/Last/Y")->GetInt();
|
int y = OPT_GET("Video/Detached/Last/Y")->GetInt();
|
||||||
|
@ -77,10 +76,10 @@ DialogDetachedVideo::DialogDetachedVideo(FrameMain *par, const wxSize &initialDi
|
||||||
wxPanel *panel = new wxPanel(this,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL | wxCLIP_CHILDREN);
|
wxPanel *panel = new wxPanel(this,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL | wxCLIP_CHILDREN);
|
||||||
|
|
||||||
// Video area;
|
// Video area;
|
||||||
videoBox = new VideoBox(panel, true, NULL, VideoContext::Get()->grid->ass);
|
videoBox = new VideoBox(panel, true, NULL, context);
|
||||||
videoBox->videoDisplay->freeSize = true;
|
videoBox->videoDisplay->freeSize = true;
|
||||||
videoBox->videoDisplay->SetClientSize(initialDisplaySize);
|
videoBox->videoDisplay->SetClientSize(initialDisplaySize);
|
||||||
videoBox->videoSlider->grid = par->SubsGrid;
|
videoBox->videoSlider->grid = context->subsGrid;
|
||||||
|
|
||||||
// Set sizer
|
// Set sizer
|
||||||
wxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
|
wxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
@ -97,7 +96,7 @@ DialogDetachedVideo::DialogDetachedVideo(FrameMain *par, const wxSize &initialDi
|
||||||
if (display_index == wxNOT_FOUND)
|
if (display_index == wxNOT_FOUND)
|
||||||
{
|
{
|
||||||
int caption_size = wxSystemSettings::GetMetric(wxSYS_CAPTION_Y, this);
|
int caption_size = wxSystemSettings::GetMetric(wxSYS_CAPTION_Y, this);
|
||||||
Move(par->GetPosition() + wxPoint(caption_size, caption_size));
|
Move(parent->GetPosition() + wxPoint(caption_size, caption_size));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -130,7 +129,7 @@ DialogDetachedVideo::DialogDetachedVideo(FrameMain *par, const wxSize &initialDi
|
||||||
OPT_SET("Video/Detached/Enabled")->SetBool(true);
|
OPT_SET("Video/Detached/Enabled")->SetBool(true);
|
||||||
|
|
||||||
// Copy the main accelerator table to this dialog
|
// Copy the main accelerator table to this dialog
|
||||||
wxAcceleratorTable *table = par->GetAcceleratorTable();
|
wxAcceleratorTable *table = parent->GetAcceleratorTable();
|
||||||
SetAcceleratorTable(*table);
|
SetAcceleratorTable(*table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,11 +148,10 @@ END_EVENT_TABLE()
|
||||||
/// @brief Close window
|
/// @brief Close window
|
||||||
/// @param event UNUSED
|
/// @param event UNUSED
|
||||||
void DialogDetachedVideo::OnClose(wxCloseEvent &WXUNUSED(event)) {
|
void DialogDetachedVideo::OnClose(wxCloseEvent &WXUNUSED(event)) {
|
||||||
FrameMain *par = parent;
|
|
||||||
OPT_SET("Video/Detached/Enabled")->SetBool(false);
|
OPT_SET("Video/Detached/Enabled")->SetBool(false);
|
||||||
Destroy();
|
Destroy();
|
||||||
par->context->detachedVideo = 0;
|
parent->context->detachedVideo = 0;
|
||||||
par->SetDisplayMode(1,-1);
|
parent->SetDisplayMode(1,-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Move window
|
/// @brief Move window
|
||||||
|
|
|
@ -40,9 +40,9 @@
|
||||||
#include <wx/dialog.h>
|
#include <wx/dialog.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class VideoBox;
|
namespace agi { struct Context; }
|
||||||
class FrameMain;
|
class FrameMain;
|
||||||
|
class VideoBox;
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
/// @class DialogDetachedVideo
|
/// @class DialogDetachedVideo
|
||||||
|
@ -63,7 +63,7 @@ private:
|
||||||
void OnMinimize(wxIconizeEvent &event);
|
void OnMinimize(wxIconizeEvent &event);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DialogDetachedVideo(FrameMain *parent, const wxSize &initialDisplaySize);
|
DialogDetachedVideo(FrameMain *parent, agi::Context *context, const wxSize &initialDisplaySize);
|
||||||
~DialogDetachedVideo();
|
~DialogDetachedVideo();
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#include <wx/recguard.h>
|
#include <wx/recguard.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "include/aegisub/context.h"
|
||||||
#include "include/aegisub/hotkey.h"
|
#include "include/aegisub/hotkey.h"
|
||||||
|
|
||||||
#include "ass_dialogue.h"
|
#include "ass_dialogue.h"
|
||||||
|
@ -66,16 +67,16 @@
|
||||||
/// @param parent
|
/// @param parent
|
||||||
/// @param _grid
|
/// @param _grid
|
||||||
///
|
///
|
||||||
DialogStyling::DialogStyling (wxWindow *parent,SubtitlesGrid *_grid) :
|
DialogStyling::DialogStyling(agi::Context *context)
|
||||||
wxDialog (parent, -1, _("Styling assistant"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMINIMIZE_BOX)
|
: wxDialog(context->parent, -1, _("Styling assistant"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMINIMIZE_BOX)
|
||||||
{
|
{
|
||||||
// Set icon
|
// Set icon
|
||||||
SetIcon(BitmapToIcon(GETIMAGE(styling_toolbutton_24)));
|
SetIcon(BitmapToIcon(GETIMAGE(styling_toolbutton_24)));
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
grid = _grid;
|
grid = context->subsGrid;
|
||||||
audio = VideoContext::Get()->audio;
|
audio = context->audioController;
|
||||||
video = VideoContext::Get();
|
video = context->videoController;
|
||||||
needCommit = false;
|
needCommit = false;
|
||||||
linen = -1;
|
linen = -1;
|
||||||
|
|
||||||
|
|
|
@ -47,18 +47,13 @@
|
||||||
#include <wx/textctrl.h>
|
#include <wx/textctrl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace agi { struct Context; }
|
||||||
//////////////
|
|
||||||
// Prototypes
|
|
||||||
class AssFile;
|
class AssFile;
|
||||||
class AssDialogue;
|
class AssDialogue;
|
||||||
class SubtitlesGrid;
|
|
||||||
class DialogStyling;
|
|
||||||
class AudioDisplay;
|
|
||||||
class VideoContext;
|
|
||||||
class AudioController;
|
class AudioController;
|
||||||
|
class DialogStyling;
|
||||||
|
class SubtitlesGrid;
|
||||||
|
class VideoContext;
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
/// @class StyleEditBox
|
/// @class StyleEditBox
|
||||||
|
@ -148,7 +143,7 @@ public:
|
||||||
/// DOCME
|
/// DOCME
|
||||||
VideoContext *video;
|
VideoContext *video;
|
||||||
|
|
||||||
DialogStyling (wxWindow *parent,SubtitlesGrid *grid);
|
DialogStyling(agi::Context *context);
|
||||||
~DialogStyling ();
|
~DialogStyling ();
|
||||||
|
|
||||||
void JumpToLine(int n);
|
void JumpToLine(int n);
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#include <wx/settings.h>
|
#include <wx/settings.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "include/aegisub/context.h"
|
||||||
#include "include/aegisub/hotkey.h"
|
#include "include/aegisub/hotkey.h"
|
||||||
|
|
||||||
#include "ass_dialogue.h"
|
#include "ass_dialogue.h"
|
||||||
|
@ -68,19 +69,19 @@
|
||||||
/// @param startrow
|
/// @param startrow
|
||||||
/// @param preview
|
/// @param preview
|
||||||
///
|
///
|
||||||
DialogTranslation::DialogTranslation (wxWindow *parent,AssFile *_subs,SubtitlesGrid *_grid,int startrow,bool preview)
|
DialogTranslation::DialogTranslation(agi::Context *c, int startrow, bool preview)
|
||||||
: wxDialog(parent, -1, _("Translation Assistant"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMINIMIZE_BOX, _T("TranslationAssistant"))
|
: wxDialog(c->parent, -1, _("Translation Assistant"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMINIMIZE_BOX, _T("TranslationAssistant"))
|
||||||
{
|
{
|
||||||
// Set icon
|
// Set icon
|
||||||
SetIcon(BitmapToIcon(GETIMAGE(translation_toolbutton_24)));
|
SetIcon(BitmapToIcon(GETIMAGE(translation_toolbutton_24)));
|
||||||
|
|
||||||
// Set variables
|
// Set variables
|
||||||
enablePreview = preview;
|
enablePreview = preview;
|
||||||
main = parent;
|
main = c->parent;
|
||||||
subs = _subs;
|
subs = c->ass;
|
||||||
grid = _grid;
|
grid = c->subsGrid;
|
||||||
audio = VideoContext::Get()->audio;
|
audio = c->audioController;
|
||||||
video = VideoContext::Get();
|
video = c->videoController;
|
||||||
|
|
||||||
// Translation controls
|
// Translation controls
|
||||||
OrigText = new ScintillaTextCtrl(this,TEXT_ORIGINAL,_T(""),wxDefaultPosition,wxSize(320,80));
|
OrigText = new ScintillaTextCtrl(this,TEXT_ORIGINAL,_T(""),wxDefaultPosition,wxSize(320,80));
|
||||||
|
|
|
@ -39,13 +39,14 @@
|
||||||
#include <wx/stattext.h>
|
#include <wx/stattext.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class AssFile;
|
namespace agi { struct Context; }
|
||||||
class AssDialogue;
|
class AssDialogue;
|
||||||
|
class AssFile;
|
||||||
|
class AudioController;
|
||||||
class AudioDisplay;
|
class AudioDisplay;
|
||||||
class ScintillaTextCtrl;
|
class ScintillaTextCtrl;
|
||||||
class SubtitlesGrid;
|
class SubtitlesGrid;
|
||||||
class VideoContext;
|
class VideoContext;
|
||||||
class AudioController;
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
|
@ -111,7 +112,7 @@ public:
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
bool enablePreview;
|
bool enablePreview;
|
||||||
DialogTranslation (wxWindow *parent,AssFile *subs,SubtitlesGrid *grid,int startrow=0,bool preview=false);
|
DialogTranslation(agi::Context *context, int startrow=0, bool preview=false);
|
||||||
|
|
||||||
void OnTransBoxKey(wxKeyEvent &event);
|
void OnTransBoxKey(wxKeyEvent &event);
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,6 @@ FrameMain::FrameMain (wxArrayString args)
|
||||||
context->selectionController = 0;
|
context->selectionController = 0;
|
||||||
|
|
||||||
context->videoController = VideoContext::Get(); // derp
|
context->videoController = VideoContext::Get(); // derp
|
||||||
context->videoController->audio = context->audioController;
|
|
||||||
context->videoController->AddVideoOpenListener(&FrameMain::OnVideoOpen, this);
|
context->videoController->AddVideoOpenListener(&FrameMain::OnVideoOpen, this);
|
||||||
|
|
||||||
StartupLog("Initializing context frames");
|
StartupLog("Initializing context frames");
|
||||||
|
@ -193,6 +192,9 @@ FrameMain::FrameMain (wxArrayString args)
|
||||||
context->stylingAssistant = 0;
|
context->stylingAssistant = 0;
|
||||||
InitContents();
|
InitContents();
|
||||||
|
|
||||||
|
StartupLog("Complete context initialization");
|
||||||
|
context->videoController->SetContext(context.get());
|
||||||
|
|
||||||
StartupLog("Set up Auto Save");
|
StartupLog("Set up Auto Save");
|
||||||
AutoSave.SetOwner(this, ID_APP_TIMER_AUTOSAVE);
|
AutoSave.SetOwner(this, ID_APP_TIMER_AUTOSAVE);
|
||||||
int time = OPT_GET("App/Auto/Save Every Seconds")->GetInt();
|
int time = OPT_GET("App/Auto/Save Every Seconds")->GetInt();
|
||||||
|
@ -290,7 +292,7 @@ void FrameMain::InitContents() {
|
||||||
Panel = new wxPanel(this,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL | wxCLIP_CHILDREN);
|
Panel = new wxPanel(this,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL | wxCLIP_CHILDREN);
|
||||||
|
|
||||||
StartupLog("Create video box");
|
StartupLog("Create video box");
|
||||||
context->videoBox = videoBox = new VideoBox(Panel, false, ZoomBox, context->ass);
|
context->videoBox = videoBox = new VideoBox(Panel, false, ZoomBox, context.get());
|
||||||
wxBoxSizer *videoSizer = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer *videoSizer = new wxBoxSizer(wxVERTICAL);
|
||||||
videoSizer->Add(videoBox , 0, wxEXPAND);
|
videoSizer->Add(videoBox , 0, wxEXPAND);
|
||||||
videoSizer->AddStretchSpacer(1);
|
videoSizer->AddStretchSpacer(1);
|
||||||
|
@ -299,7 +301,6 @@ void FrameMain::InitContents() {
|
||||||
context->subsGrid = SubsGrid = new SubtitlesGrid(this,Panel,-1,context->ass,wxDefaultPosition,wxSize(600,100),wxWANTS_CHARS | wxSUNKEN_BORDER,"Subs grid");
|
context->subsGrid = SubsGrid = new SubtitlesGrid(this,Panel,-1,context->ass,wxDefaultPosition,wxSize(600,100),wxWANTS_CHARS | wxSUNKEN_BORDER,"Subs grid");
|
||||||
context->selectionController = context->subsGrid;
|
context->selectionController = context->subsGrid;
|
||||||
context->videoBox->videoSlider->grid = SubsGrid;
|
context->videoBox->videoSlider->grid = SubsGrid;
|
||||||
context->videoController->grid = SubsGrid;
|
|
||||||
Search.grid = SubsGrid;
|
Search.grid = SubsGrid;
|
||||||
|
|
||||||
StartupLog("Create tool area splitter window");
|
StartupLog("Create tool area splitter window");
|
||||||
|
@ -350,7 +351,6 @@ void FrameMain::DeInitContents() {
|
||||||
delete videoBox;
|
delete videoBox;
|
||||||
delete context->ass;
|
delete context->ass;
|
||||||
HelpButton::ClearPages();
|
HelpButton::ClearPages();
|
||||||
context->videoController->audio = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Update toolbar
|
/// @brief Update toolbar
|
||||||
|
@ -650,7 +650,7 @@ void FrameMain::OpenHelp(wxString) {
|
||||||
void FrameMain::DetachVideo(bool detach) {
|
void FrameMain::DetachVideo(bool detach) {
|
||||||
if (detach) {
|
if (detach) {
|
||||||
if (!context->detachedVideo) {
|
if (!context->detachedVideo) {
|
||||||
context->detachedVideo = new DialogDetachedVideo(this, videoBox->videoDisplay->GetClientSize());
|
context->detachedVideo = new DialogDetachedVideo(this, context.get(), videoBox->videoDisplay->GetClientSize());
|
||||||
context->detachedVideo->Show();
|
context->detachedVideo->Show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,8 +43,8 @@
|
||||||
#include <wx/statline.h>
|
#include <wx/statline.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "ass_dialogue.h"
|
#include "include/aegisub/context.h"
|
||||||
#include "ass_file.h"
|
|
||||||
#include "frame_main.h"
|
#include "frame_main.h"
|
||||||
#include "help_button.h"
|
#include "help_button.h"
|
||||||
#include "libresrc/libresrc.h"
|
#include "libresrc/libresrc.h"
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
/// @param parent
|
/// @param parent
|
||||||
/// @param isDetached
|
/// @param isDetached
|
||||||
///
|
///
|
||||||
VideoBox::VideoBox(wxWindow *parent, bool isDetached, wxComboBox *zoomBox, AssFile *ass)
|
VideoBox::VideoBox(wxWindow *parent, bool isDetached, wxComboBox *zoomBox, agi::Context *context)
|
||||||
: wxPanel (parent,-1)
|
: wxPanel (parent,-1)
|
||||||
{
|
{
|
||||||
// Parent
|
// Parent
|
||||||
|
@ -113,7 +113,7 @@ VideoBox::VideoBox(wxWindow *parent, bool isDetached, wxComboBox *zoomBox, AssFi
|
||||||
visualToolBar->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
|
visualToolBar->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
|
||||||
|
|
||||||
// Display
|
// Display
|
||||||
videoDisplay = new VideoDisplay(this,VideoPosition,VideoSubsPos,zoomBox,videoPage,ass);
|
videoDisplay = new VideoDisplay(this,VideoPosition,VideoSubsPos,zoomBox,videoPage,context);
|
||||||
|
|
||||||
// Set display
|
// Set display
|
||||||
videoSlider->Display = videoDisplay;
|
videoSlider->Display = videoDisplay;
|
||||||
|
|
|
@ -44,15 +44,13 @@
|
||||||
#include <wx/toolbar.h>
|
#include <wx/toolbar.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class AssFile;
|
namespace agi { struct Context; }
|
||||||
class VideoDisplay;
|
class VideoDisplay;
|
||||||
class VideoSlider;
|
class VideoSlider;
|
||||||
class ToggleBitmap;
|
class ToggleBitmap;
|
||||||
class FrameMain;
|
class FrameMain;
|
||||||
class wxComboBox;
|
class wxComboBox;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
/// @class VideoBox
|
/// @class VideoBox
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
|
@ -99,7 +97,7 @@ public:
|
||||||
/// DOCME
|
/// DOCME
|
||||||
VideoSlider *videoSlider;
|
VideoSlider *videoSlider;
|
||||||
|
|
||||||
VideoBox (wxWindow *parent, bool isDetached, wxComboBox *zoomBox, AssFile *ass);
|
VideoBox(wxWindow *parent, bool isDetached, wxComboBox *zoomBox, agi::Context *context);
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
|
@ -53,8 +53,9 @@
|
||||||
#include <GL/glu.h>
|
#include <GL/glu.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "include/aegisub/audio_player.h"
|
#include <libaegisub/access.h>
|
||||||
#include "include/aegisub/audio_provider.h"
|
#include <libaegisub/keyframe.h>
|
||||||
|
|
||||||
#include "ass_dialogue.h"
|
#include "ass_dialogue.h"
|
||||||
#include "ass_file.h"
|
#include "ass_file.h"
|
||||||
#include "ass_style.h"
|
#include "ass_style.h"
|
||||||
|
@ -63,15 +64,13 @@
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#include "include/aegisub/audio_player.h"
|
#include "include/aegisub/audio_player.h"
|
||||||
#include "include/aegisub/audio_provider.h"
|
#include "include/aegisub/audio_provider.h"
|
||||||
|
#include "include/aegisub/context.h"
|
||||||
#include "include/aegisub/video_provider.h"
|
#include "include/aegisub/video_provider.h"
|
||||||
#include <libaegisub/keyframe.h>
|
|
||||||
#include <libaegisub/access.h>
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "mkv_wrap.h"
|
#include "mkv_wrap.h"
|
||||||
#include "standard_paths.h"
|
|
||||||
#include "selection_controller.h"
|
#include "selection_controller.h"
|
||||||
|
#include "standard_paths.h"
|
||||||
#include "subs_edit_box.h"
|
#include "subs_edit_box.h"
|
||||||
#include "subs_grid.h"
|
|
||||||
#include "threaded_frame_source.h"
|
#include "threaded_frame_source.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "video_box.h"
|
#include "video_box.h"
|
||||||
|
@ -102,8 +101,6 @@ VideoContext::VideoContext()
|
||||||
, arType(0)
|
, arType(0)
|
||||||
, hasSubtitles(false)
|
, hasSubtitles(false)
|
||||||
, playAudioOnStep(OPT_GET("Audio/Plays When Stepping Video"))
|
, playAudioOnStep(OPT_GET("Audio/Plays When Stepping Video"))
|
||||||
, grid(NULL)
|
|
||||||
, audio(NULL)
|
|
||||||
, VFR_Input(videoFPS)
|
, VFR_Input(videoFPS)
|
||||||
, VFR_Output(ovrFPS)
|
, VFR_Output(ovrFPS)
|
||||||
{
|
{
|
||||||
|
@ -152,6 +149,12 @@ void VideoContext::Reset() {
|
||||||
provider.reset();
|
provider.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VideoContext::SetContext(agi::Context *context) {
|
||||||
|
this->context = context;
|
||||||
|
context->ass->AddCommitListener(&VideoContext::OnSubtitlesCommit, this);
|
||||||
|
context->ass->AddCommitListener(&VideoContext::OnSubtitlesSave, this);
|
||||||
|
}
|
||||||
|
|
||||||
void VideoContext::SetVideo(const wxString &filename) {
|
void VideoContext::SetVideo(const wxString &filename) {
|
||||||
Stop();
|
Stop();
|
||||||
Reset();
|
Reset();
|
||||||
|
@ -198,9 +201,7 @@ void VideoContext::SetVideo(const wxString &filename) {
|
||||||
hasSubtitles = MatroskaWrapper::HasSubtitles(filename);
|
hasSubtitles = MatroskaWrapper::HasSubtitles(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
provider->LoadSubtitles(grid->ass);
|
provider->LoadSubtitles(context->ass);
|
||||||
grid->ass->AddCommitListener(&VideoContext::OnSubtitlesCommit, this);
|
|
||||||
grid->ass->AddCommitListener(&VideoContext::OnSubtitlesSave, this);
|
|
||||||
VideoOpen();
|
VideoOpen();
|
||||||
KeyframesOpen(keyFrames);
|
KeyframesOpen(keyFrames);
|
||||||
TimecodesOpen(FPS());
|
TimecodesOpen(FPS());
|
||||||
|
@ -229,7 +230,7 @@ void VideoContext::OnSubtitlesCommit() {
|
||||||
bool wasPlaying = isPlaying;
|
bool wasPlaying = isPlaying;
|
||||||
Stop();
|
Stop();
|
||||||
|
|
||||||
provider->LoadSubtitles(grid->ass);
|
provider->LoadSubtitles(context->ass);
|
||||||
GetFrameAsync(frame_n);
|
GetFrameAsync(frame_n);
|
||||||
|
|
||||||
if (wasPlaying) Play();
|
if (wasPlaying) Play();
|
||||||
|
@ -237,11 +238,11 @@ void VideoContext::OnSubtitlesCommit() {
|
||||||
|
|
||||||
void VideoContext::OnSubtitlesSave() {
|
void VideoContext::OnSubtitlesSave() {
|
||||||
if (!IsLoaded()) {
|
if (!IsLoaded()) {
|
||||||
grid->ass->SetScriptInfo("Video File", "");
|
context->ass->SetScriptInfo("Video File", "");
|
||||||
grid->ass->SetScriptInfo("Video Aspect Ratio", "");
|
context->ass->SetScriptInfo("Video Aspect Ratio", "");
|
||||||
grid->ass->SetScriptInfo("Video Position", "");
|
context->ass->SetScriptInfo("Video Position", "");
|
||||||
grid->ass->SetScriptInfo("VFR File", "");
|
context->ass->SetScriptInfo("VFR File", "");
|
||||||
grid->ass->SetScriptInfo("Keyframes File", "");
|
context->ass->SetScriptInfo("Keyframes File", "");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,11 +252,11 @@ void VideoContext::OnSubtitlesSave() {
|
||||||
else
|
else
|
||||||
ar = wxString::Format("%d", arType);
|
ar = wxString::Format("%d", arType);
|
||||||
|
|
||||||
grid->ass->SetScriptInfo("Video File", MakeRelativePath(videoName, grid->ass->filename));
|
context->ass->SetScriptInfo("Video File", MakeRelativePath(videoName, context->ass->filename));
|
||||||
grid->ass->SetScriptInfo("Video Aspect Ratio", ar);
|
context->ass->SetScriptInfo("Video Aspect Ratio", ar);
|
||||||
grid->ass->SetScriptInfo("Video Position", wxString::Format("%d", frame_n));
|
context->ass->SetScriptInfo("Video Position", wxString::Format("%d", frame_n));
|
||||||
grid->ass->SetScriptInfo("VFR File", MakeRelativePath(GetTimecodesName(), grid->ass->filename));
|
context->ass->SetScriptInfo("VFR File", MakeRelativePath(GetTimecodesName(), context->ass->filename));
|
||||||
grid->ass->SetScriptInfo("Keyframes File", MakeRelativePath(GetKeyFramesName(), grid->ass->filename));
|
context->ass->SetScriptInfo("Keyframes File", MakeRelativePath(GetKeyFramesName(), context->ass->filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoContext::JumpToFrame(int n) {
|
void VideoContext::JumpToFrame(int n) {
|
||||||
|
@ -327,7 +328,7 @@ void VideoContext::SaveSnapshot(bool raw) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoContext::GetScriptSize(int &sw,int &sh) {
|
void VideoContext::GetScriptSize(int &sw,int &sh) {
|
||||||
grid->ass->GetResolution(sw,sh);
|
context->ass->GetResolution(sw,sh);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoContext::NextFrame() {
|
void VideoContext::NextFrame() {
|
||||||
|
@ -337,9 +338,9 @@ void VideoContext::NextFrame() {
|
||||||
JumpToFrame(frame_n + 1);
|
JumpToFrame(frame_n + 1);
|
||||||
// Start playing audio
|
// Start playing audio
|
||||||
if (playAudioOnStep->GetBool()) {
|
if (playAudioOnStep->GetBool()) {
|
||||||
audio->PlayRange(SampleRange(
|
context->audioController->PlayRange(SampleRange(
|
||||||
audio->SamplesFromMilliseconds(TimeAtFrame(frame_n - 1)),
|
context->audioController->SamplesFromMilliseconds(TimeAtFrame(frame_n - 1)),
|
||||||
audio->SamplesFromMilliseconds(TimeAtFrame(frame_n))));
|
context->audioController->SamplesFromMilliseconds(TimeAtFrame(frame_n))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,9 +351,9 @@ void VideoContext::PrevFrame() {
|
||||||
JumpToFrame(frame_n - 1);
|
JumpToFrame(frame_n - 1);
|
||||||
// Start playing audio
|
// Start playing audio
|
||||||
if (playAudioOnStep->GetBool()) {
|
if (playAudioOnStep->GetBool()) {
|
||||||
audio->PlayRange(SampleRange(
|
context->audioController->PlayRange(SampleRange(
|
||||||
audio->SamplesFromMilliseconds(TimeAtFrame(frame_n)),
|
context->audioController->SamplesFromMilliseconds(TimeAtFrame(frame_n)),
|
||||||
audio->SamplesFromMilliseconds(TimeAtFrame(frame_n + 1))));
|
context->audioController->SamplesFromMilliseconds(TimeAtFrame(frame_n + 1))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,7 +368,7 @@ void VideoContext::Play() {
|
||||||
endFrame = -1;
|
endFrame = -1;
|
||||||
|
|
||||||
// Start playing audio
|
// Start playing audio
|
||||||
audio->PlayToEnd(audio->SamplesFromMilliseconds(TimeAtFrame(startFrame)));
|
context->audioController->PlayToEnd(context->audioController->SamplesFromMilliseconds(TimeAtFrame(startFrame)));
|
||||||
|
|
||||||
//audio->Play will override this if we put it before, so put it after.
|
//audio->Play will override this if we put it before, so put it after.
|
||||||
isPlaying = true;
|
isPlaying = true;
|
||||||
|
@ -379,18 +380,18 @@ void VideoContext::Play() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoContext::PlayLine() {
|
void VideoContext::PlayLine() {
|
||||||
AssDialogue *curline = grid->GetActiveLine();
|
AssDialogue *curline = context->selectionController->GetActiveLine();
|
||||||
if (!curline) return;
|
if (!curline) return;
|
||||||
|
|
||||||
// Start playing audio
|
// Start playing audio
|
||||||
audio->PlayRange(SampleRange(
|
context->audioController->PlayRange(SampleRange(
|
||||||
audio->SamplesFromMilliseconds(curline->Start.GetMS()),
|
context->audioController->SamplesFromMilliseconds(curline->Start.GetMS()),
|
||||||
audio->SamplesFromMilliseconds(curline->End.GetMS())));
|
context->audioController->SamplesFromMilliseconds(curline->End.GetMS())));
|
||||||
|
|
||||||
// Set variables
|
// Set variables
|
||||||
isPlaying = true;
|
isPlaying = true;
|
||||||
startFrame = FrameAtTime(grid->GetActiveLine()->Start.GetMS(),agi::vfr::START);
|
startFrame = FrameAtTime(context->selectionController->GetActiveLine()->Start.GetMS(),agi::vfr::START);
|
||||||
endFrame = FrameAtTime(grid->GetActiveLine()->End.GetMS(),agi::vfr::END);
|
endFrame = FrameAtTime(context->selectionController->GetActiveLine()->End.GetMS(),agi::vfr::END);
|
||||||
|
|
||||||
// Jump to start
|
// Jump to start
|
||||||
playNextFrame = startFrame;
|
playNextFrame = startFrame;
|
||||||
|
@ -408,7 +409,7 @@ void VideoContext::Stop() {
|
||||||
if (isPlaying) {
|
if (isPlaying) {
|
||||||
playback.Stop();
|
playback.Stop();
|
||||||
isPlaying = false;
|
isPlaying = false;
|
||||||
audio->Stop();
|
context->audioController->Stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,8 +445,8 @@ void VideoContext::OnPlayTimer(wxTimerEvent &event) {
|
||||||
if (nextFrame == frame_n) return;
|
if (nextFrame == frame_n) return;
|
||||||
|
|
||||||
// Next frame is before or over 2 frames ahead, so force audio resync
|
// Next frame is before or over 2 frames ahead, so force audio resync
|
||||||
if (audio->IsPlaying() && keepAudioSync && (nextFrame < frame_n || nextFrame > frame_n + 2)) {
|
if (context->audioController->IsPlaying() && keepAudioSync && (nextFrame < frame_n || nextFrame > frame_n + 2)) {
|
||||||
audio->ResyncPlaybackPosition(audio->SamplesFromMilliseconds(TimeAtFrame(nextFrame)));
|
context->audioController->ResyncPlaybackPosition(context->audioController->SamplesFromMilliseconds(TimeAtFrame(nextFrame)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Jump to next frame
|
// Jump to next frame
|
||||||
|
@ -454,18 +455,18 @@ void VideoContext::OnPlayTimer(wxTimerEvent &event) {
|
||||||
JumpToFrame(nextFrame);
|
JumpToFrame(nextFrame);
|
||||||
|
|
||||||
// Sync audio
|
// Sync audio
|
||||||
if (keepAudioSync && nextFrame % 10 == 0 && audio->IsPlaying()) {
|
if (keepAudioSync && nextFrame % 10 == 0 && context->audioController->IsPlaying()) {
|
||||||
int64_t audPos = audio->SamplesFromMilliseconds(TimeAtFrame(nextFrame));
|
int64_t audPos = context->audioController->SamplesFromMilliseconds(TimeAtFrame(nextFrame));
|
||||||
int64_t curPos = audio->GetPlaybackPosition();
|
int64_t curPos = context->audioController->GetPlaybackPosition();
|
||||||
int delta = int(audPos-curPos);
|
int delta = int(audPos-curPos);
|
||||||
if (delta < 0) delta = -delta;
|
if (delta < 0) delta = -delta;
|
||||||
int maxDelta = audio->SamplesFromMilliseconds(1000);
|
int maxDelta = context->audioController->SamplesFromMilliseconds(1000);
|
||||||
if (delta > maxDelta) audio->ResyncPlaybackPosition(audPos);
|
if (delta > maxDelta) context->audioController->ResyncPlaybackPosition(audPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double VideoContext::GetARFromType(int type) const {
|
double VideoContext::GetARFromType(int type) const {
|
||||||
if (type == 0) return (double)VideoContext::Get()->GetWidth()/(double)VideoContext::Get()->GetHeight();
|
if (type == 0) return (double)GetWidth()/(double)GetHeight();
|
||||||
if (type == 1) return 4.0/3.0;
|
if (type == 1) return 4.0/3.0;
|
||||||
if (type == 2) return 16.0/9.0;
|
if (type == 2) return 16.0/9.0;
|
||||||
if (type == 3) return 2.35;
|
if (type == 3) return 2.35;
|
||||||
|
|
|
@ -64,6 +64,7 @@ class VideoProviderErrorEvent;
|
||||||
class AudioController;
|
class AudioController;
|
||||||
|
|
||||||
namespace agi {
|
namespace agi {
|
||||||
|
struct Context;
|
||||||
class OptionValue;
|
class OptionValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +87,8 @@ class VideoContext : public wxEvtHandler {
|
||||||
/// Aspect ratio was changed (type, value)
|
/// Aspect ratio was changed (type, value)
|
||||||
agi::signal::Signal<int, double> ARChange;
|
agi::signal::Signal<int, double> ARChange;
|
||||||
|
|
||||||
private:
|
agi::Context *context;
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
std::tr1::shared_ptr<VideoProvider> videoProvider;
|
std::tr1::shared_ptr<VideoProvider> videoProvider;
|
||||||
|
|
||||||
|
@ -159,21 +161,22 @@ private:
|
||||||
void OnSubtitlesSave();
|
void OnSubtitlesSave();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// DOCME
|
|
||||||
SubtitlesGrid *grid;
|
|
||||||
|
|
||||||
/// File name of currently open video, if any
|
/// File name of currently open video, if any
|
||||||
wxString videoName;
|
wxString videoName;
|
||||||
|
|
||||||
/// The audio controller for this video context
|
|
||||||
AudioController *audio;
|
|
||||||
|
|
||||||
const agi::vfr::Framerate &VFR_Input;
|
const agi::vfr::Framerate &VFR_Input;
|
||||||
const agi::vfr::Framerate &VFR_Output;
|
const agi::vfr::Framerate &VFR_Output;
|
||||||
|
|
||||||
VideoContext();
|
VideoContext();
|
||||||
~VideoContext();
|
~VideoContext();
|
||||||
|
|
||||||
|
/// @brief Set the context that this is the video controller for
|
||||||
|
/// @param context Initialized project context
|
||||||
|
///
|
||||||
|
/// Once this is no longer a singleton this can probably be moved into
|
||||||
|
/// the constructor
|
||||||
|
void SetContext(agi::Context *context);
|
||||||
|
|
||||||
/// @brief Get the video provider used for the currently open video
|
/// @brief Get the video provider used for the currently open video
|
||||||
VideoProvider *GetProvider() const { return videoProvider.get(); }
|
VideoProvider *GetProvider() const { return videoProvider.get(); }
|
||||||
std::tr1::shared_ptr<AegiVideoFrame> GetFrame(int n, bool raw = false);
|
std::tr1::shared_ptr<AegiVideoFrame> GetFrame(int n, bool raw = false);
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
#include <GL/glu.h>
|
#include <GL/glu.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "include/aegisub/context.h"
|
||||||
#include "include/aegisub/hotkey.h"
|
#include "include/aegisub/hotkey.h"
|
||||||
|
|
||||||
#include "video_display.h"
|
#include "video_display.h"
|
||||||
|
@ -130,10 +131,10 @@ VideoDisplay::VideoDisplay(
|
||||||
wxTextCtrl *SubsPosition,
|
wxTextCtrl *SubsPosition,
|
||||||
wxComboBox *zoomBox,
|
wxComboBox *zoomBox,
|
||||||
wxWindow* parent,
|
wxWindow* parent,
|
||||||
AssFile *model)
|
agi::Context *c)
|
||||||
: wxGLCanvas (parent, -1, attribList, wxDefaultPosition, wxDefaultSize, 0, wxPanelNameStr)
|
: wxGLCanvas (parent, -1, attribList, wxDefaultPosition, wxDefaultSize, 0, wxPanelNameStr)
|
||||||
, alwaysShowTools(OPT_GET("Tool/Visual/Always Show"))
|
, alwaysShowTools(OPT_GET("Tool/Visual/Always Show"))
|
||||||
, vc(VideoContext::Get())
|
, con(c)
|
||||||
, currentFrame(-1)
|
, currentFrame(-1)
|
||||||
, w(8), h(8), viewport_x(0), viewport_width(0), viewport_bottom(0), viewport_top(0), viewport_height(0)
|
, w(8), h(8), viewport_x(0), viewport_width(0), viewport_bottom(0), viewport_top(0), viewport_height(0)
|
||||||
, zoomValue(OPT_GET("Video/Default Zoom")->GetInt() * .125 + .125)
|
, zoomValue(OPT_GET("Video/Default Zoom")->GetInt() * .125 + .125)
|
||||||
|
@ -145,28 +146,25 @@ VideoDisplay::VideoDisplay(
|
||||||
, scriptW(INT_MIN)
|
, scriptW(INT_MIN)
|
||||||
, scriptH(INT_MIN)
|
, scriptH(INT_MIN)
|
||||||
, zoomBox(zoomBox)
|
, zoomBox(zoomBox)
|
||||||
, model(model)
|
|
||||||
, box(box)
|
, box(box)
|
||||||
, freeSize(false)
|
, freeSize(false)
|
||||||
{
|
{
|
||||||
assert(vc);
|
|
||||||
assert(box);
|
assert(box);
|
||||||
assert(model);
|
|
||||||
|
|
||||||
if (zoomBox) zoomBox->SetValue(wxString::Format("%g%%", zoomValue * 100.));
|
if (zoomBox) zoomBox->SetValue(wxString::Format("%g%%", zoomValue * 100.));
|
||||||
box->Bind(wxEVT_COMMAND_TOOL_CLICKED, &VideoDisplay::OnMode, this, Video_Mode_Standard, Video_Mode_Vector_Clip);
|
box->Bind(wxEVT_COMMAND_TOOL_CLICKED, &VideoDisplay::OnMode, this, Video_Mode_Standard, Video_Mode_Vector_Clip);
|
||||||
|
|
||||||
vc->Bind(EVT_FRAME_READY, &VideoDisplay::UploadFrameData, this);
|
con->videoController->Bind(EVT_FRAME_READY, &VideoDisplay::UploadFrameData, this);
|
||||||
slots.push_back(vc->AddSeekListener(&VideoDisplay::SetFrame, this));
|
slots.push_back(con->videoController->AddSeekListener(&VideoDisplay::SetFrame, this));
|
||||||
slots.push_back(vc->AddVideoOpenListener(&VideoDisplay::OnVideoOpen, this));
|
slots.push_back(con->videoController->AddVideoOpenListener(&VideoDisplay::OnVideoOpen, this));
|
||||||
slots.push_back(vc->AddARChangeListener(&VideoDisplay::UpdateSize, this));
|
slots.push_back(con->videoController->AddARChangeListener(&VideoDisplay::UpdateSize, this));
|
||||||
slots.push_back(model->AddCommitListener(&VideoDisplay::OnCommit, this));
|
slots.push_back(model->AddCommitListener(&VideoDisplay::OnCommit, this));
|
||||||
|
|
||||||
SetCursor(wxNullCursor);
|
SetCursor(wxNullCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoDisplay::~VideoDisplay () {
|
VideoDisplay::~VideoDisplay () {
|
||||||
vc->Unbind(EVT_FRAME_READY, &VideoDisplay::UploadFrameData, this);
|
con->videoController->Unbind(EVT_FRAME_READY, &VideoDisplay::UploadFrameData, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VideoDisplay::InitContext() {
|
bool VideoDisplay::InitContext() {
|
||||||
|
@ -194,7 +192,7 @@ void VideoDisplay::UpdateRelativeTimes(int time) {
|
||||||
int startOff = 0;
|
int startOff = 0;
|
||||||
int endOff = 0;
|
int endOff = 0;
|
||||||
|
|
||||||
if (AssDialogue *curLine = vc->grid->GetActiveLine()) {
|
if (AssDialogue *curLine = con->selectionController->GetActiveLine()) {
|
||||||
startOff = time - curLine->Start.GetMS();
|
startOff = time - curLine->Start.GetMS();
|
||||||
endOff = time - curLine->End.GetMS();
|
endOff = time - curLine->End.GetMS();
|
||||||
}
|
}
|
||||||
|
@ -213,7 +211,7 @@ void VideoDisplay::SetFrame(int frameNumber) {
|
||||||
|
|
||||||
// Get time for frame
|
// Get time for frame
|
||||||
{
|
{
|
||||||
int time = vc->TimeAtFrame(frameNumber, agi::vfr::EXACT);
|
int time = con->videoController->TimeAtFrame(frameNumber, agi::vfr::EXACT);
|
||||||
int h = time / 3600000;
|
int h = time / 3600000;
|
||||||
int m = time % 3600000 / 60000;
|
int m = time % 3600000 / 60000;
|
||||||
int s = time % 60000 / 1000;
|
int s = time % 60000 / 1000;
|
||||||
|
@ -221,7 +219,7 @@ void VideoDisplay::SetFrame(int frameNumber) {
|
||||||
|
|
||||||
// Set the text box for frame number and time
|
// Set the text box for frame number and time
|
||||||
PositionDisplay->SetValue(wxString::Format(L"%01i:%02i:%02i.%03i - %i", h, m, s, ms, frameNumber));
|
PositionDisplay->SetValue(wxString::Format(L"%01i:%02i:%02i.%03i - %i", h, m, s, ms, frameNumber));
|
||||||
if (std::binary_search(vc->GetKeyFrames().begin(), vc->GetKeyFrames().end(), frameNumber)) {
|
if (std::binary_search(con->videoController->GetKeyFrames().begin(), con->videoController->GetKeyFrames().end(), frameNumber)) {
|
||||||
// Set the background color to indicate this is a keyframe
|
// Set the background color to indicate this is a keyframe
|
||||||
PositionDisplay->SetBackgroundColour(lagi_wxColour(OPT_GET("Colour/Subtitle Grid/Background/Selection")->GetColour()));
|
PositionDisplay->SetBackgroundColour(lagi_wxColour(OPT_GET("Colour/Subtitle Grid/Background/Selection")->GetColour()));
|
||||||
PositionDisplay->SetForegroundColour(lagi_wxColour(OPT_GET("Colour/Subtitle Grid/Selection")->GetColour()));
|
PositionDisplay->SetForegroundColour(lagi_wxColour(OPT_GET("Colour/Subtitle Grid/Selection")->GetColour()));
|
||||||
|
@ -235,9 +233,9 @@ void VideoDisplay::SetFrame(int frameNumber) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render the new frame
|
// Render the new frame
|
||||||
if (vc->IsLoaded()) {
|
if (con->videoController->IsLoaded()) {
|
||||||
tool->SetFrame(frameNumber);
|
tool->SetFrame(frameNumber);
|
||||||
vc->GetFrameAsync(currentFrame);
|
con->videoController->GetFrameAsync(currentFrame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,7 +251,7 @@ void VideoDisplay::UploadFrameData(FrameReadyEvent &evt) {
|
||||||
L"programs and updating your video card drivers may fix this.\n"
|
L"programs and updating your video card drivers may fix this.\n"
|
||||||
L"Error message reported: %s",
|
L"Error message reported: %s",
|
||||||
err.GetMessage().c_str());
|
err.GetMessage().c_str());
|
||||||
vc->Reset();
|
con->videoController->Reset();
|
||||||
}
|
}
|
||||||
catch (const VideoOutRenderException& err) {
|
catch (const VideoOutRenderException& err) {
|
||||||
wxLogError(
|
wxLogError(
|
||||||
|
@ -265,24 +263,24 @@ void VideoDisplay::UploadFrameData(FrameReadyEvent &evt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoDisplay::OnVideoOpen() {
|
void VideoDisplay::OnVideoOpen() {
|
||||||
if (!vc->IsLoaded()) return;
|
if (!con->videoController->IsLoaded()) return;
|
||||||
UpdateSize();
|
UpdateSize();
|
||||||
currentFrame = 0;
|
currentFrame = 0;
|
||||||
vc->GetFrameAsync(0);
|
con->videoController->GetFrameAsync(0);
|
||||||
UpdateRelativeTimes(0);
|
UpdateRelativeTimes(0);
|
||||||
if (!tool.get()) tool.reset(new VisualToolCross(this, video, toolBar));
|
if (!tool.get()) tool.reset(new VisualToolCross(this, con, video, toolBar));
|
||||||
tool->Refresh();
|
tool->Refresh();
|
||||||
}
|
}
|
||||||
void VideoDisplay::OnCommit(int type) {
|
void VideoDisplay::OnCommit(int type) {
|
||||||
if (type == AssFile::COMMIT_FULL || type == AssFile::COMMIT_UNDO)
|
if (type == AssFile::COMMIT_FULL || type == AssFile::COMMIT_UNDO)
|
||||||
vc->GetScriptSize(scriptW, scriptH);
|
con->videoController->GetScriptSize(scriptW, scriptH);
|
||||||
if (tool.get()) tool->Refresh();
|
if (tool.get()) tool->Refresh();
|
||||||
UpdateRelativeTimes(vc->TimeAtFrame(currentFrame, agi::vfr::EXACT));
|
UpdateRelativeTimes(con->videoController->TimeAtFrame(currentFrame, agi::vfr::EXACT));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoDisplay::Render() try {
|
void VideoDisplay::Render() try {
|
||||||
if (!InitContext()) return;
|
if (!InitContext()) return;
|
||||||
if (!vc->IsLoaded()) return;
|
if (!con->videoController->IsLoaded()) return;
|
||||||
assert(wxIsMainThread());
|
assert(wxIsMainThread());
|
||||||
if (!viewport_height || !viewport_width) UpdateSize();
|
if (!viewport_height || !viewport_width) UpdateSize();
|
||||||
|
|
||||||
|
@ -294,7 +292,7 @@ void VideoDisplay::Render() try {
|
||||||
E(glOrtho(0.0f, w, h, 0.0f, -1000.0f, 1000.0f));
|
E(glOrtho(0.0f, w, h, 0.0f, -1000.0f, 1000.0f));
|
||||||
|
|
||||||
if (OPT_GET("Video/Overscan Mask")->GetBool()) {
|
if (OPT_GET("Video/Overscan Mask")->GetBool()) {
|
||||||
double ar = vc->GetAspectRatioValue();
|
double ar = con->videoController->GetAspectRatioValue();
|
||||||
|
|
||||||
// Based on BBC's guidelines: http://www.bbc.co.uk/guidelines/dq/pdf/tv/tv_standards_london.pdf
|
// Based on BBC's guidelines: http://www.bbc.co.uk/guidelines/dq/pdf/tv/tv_standards_london.pdf
|
||||||
// 16:9 or wider
|
// 16:9 or wider
|
||||||
|
@ -321,27 +319,27 @@ catch (const VideoOutException &err) {
|
||||||
L"An error occurred trying to render the video frame on the screen.\n"
|
L"An error occurred trying to render the video frame on the screen.\n"
|
||||||
L"Error message reported: %s",
|
L"Error message reported: %s",
|
||||||
err.GetMessage().c_str());
|
err.GetMessage().c_str());
|
||||||
vc->Reset();
|
con->videoController->Reset();
|
||||||
}
|
}
|
||||||
catch (const OpenGlException &err) {
|
catch (const OpenGlException &err) {
|
||||||
wxLogError(
|
wxLogError(
|
||||||
L"An error occurred trying to render visual overlays on the screen.\n"
|
L"An error occurred trying to render visual overlays on the screen.\n"
|
||||||
L"Error message reported: %s",
|
L"Error message reported: %s",
|
||||||
err.GetMessage().c_str());
|
err.GetMessage().c_str());
|
||||||
vc->Reset();
|
con->videoController->Reset();
|
||||||
}
|
}
|
||||||
catch (const wchar_t *err) {
|
catch (const wchar_t *err) {
|
||||||
wxLogError(
|
wxLogError(
|
||||||
L"An error occurred trying to render the video frame on the screen.\n"
|
L"An error occurred trying to render the video frame on the screen.\n"
|
||||||
L"Error message reported: %s",
|
L"Error message reported: %s",
|
||||||
err);
|
err);
|
||||||
vc->Reset();
|
con->videoController->Reset();
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
wxLogError(
|
wxLogError(
|
||||||
L"An error occurred trying to render the video frame to screen.\n"
|
L"An error occurred trying to render the video frame to screen.\n"
|
||||||
L"No further error message given.");
|
L"No further error message given.");
|
||||||
vc->Reset();
|
con->videoController->Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoDisplay::DrawOverscanMask(int sizeH, int sizeV, wxColor color, double alpha) const {
|
void VideoDisplay::DrawOverscanMask(int sizeH, int sizeV, wxColor color, double alpha) const {
|
||||||
|
@ -370,15 +368,15 @@ void VideoDisplay::DrawOverscanMask(int sizeH, int sizeV, wxColor color, double
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoDisplay::UpdateSize(int arType, double arValue) {
|
void VideoDisplay::UpdateSize(int arType, double arValue) {
|
||||||
if (!vc->IsLoaded()) return;
|
if (!con->videoController->IsLoaded()) return;
|
||||||
if (!IsShownOnScreen()) return;
|
if (!IsShownOnScreen()) return;
|
||||||
|
|
||||||
int vidW = vc->GetWidth();
|
int vidW = con->videoController->GetWidth();
|
||||||
int vidH = vc->GetHeight();
|
int vidH = con->videoController->GetHeight();
|
||||||
|
|
||||||
if (arType == -1) {
|
if (arType == -1) {
|
||||||
arType = vc->GetAspectRatioType();
|
arType = con->videoController->GetAspectRatioType();
|
||||||
arValue = vc->GetAspectRatioValue();
|
arValue = con->videoController->GetAspectRatioValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (freeSize) {
|
if (freeSize) {
|
||||||
|
@ -440,7 +438,7 @@ void VideoDisplay::UpdateSize(int arType, double arValue) {
|
||||||
SetEvtHandlerEnabled(true);
|
SetEvtHandlerEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
vc->GetScriptSize(scriptW, scriptH);
|
con->videoController->GetScriptSize(scriptW, scriptH);
|
||||||
video.w = w;
|
video.w = w;
|
||||||
video.h = h;
|
video.h = h;
|
||||||
|
|
||||||
|
@ -462,7 +460,7 @@ void VideoDisplay::OnMouseEvent(wxMouseEvent& event) {
|
||||||
assert(w > 0);
|
assert(w > 0);
|
||||||
|
|
||||||
// Disable when playing
|
// Disable when playing
|
||||||
if (vc->IsPlaying()) return;
|
if (con->videoController->IsPlaying()) return;
|
||||||
|
|
||||||
if (event.ButtonUp(wxMOUSE_BTN_RIGHT)) {
|
if (event.ButtonUp(wxMOUSE_BTN_RIGHT)) {
|
||||||
wxMenu menu;
|
wxMenu menu;
|
||||||
|
@ -546,7 +544,7 @@ double VideoDisplay::GetZoom() const {
|
||||||
template<class T>
|
template<class T>
|
||||||
void VideoDisplay::SetTool() {
|
void VideoDisplay::SetTool() {
|
||||||
tool.reset();
|
tool.reset();
|
||||||
tool.reset(new T(this, video, toolBar));
|
tool.reset(new T(this, con, video, toolBar));
|
||||||
box->Bind(wxEVT_COMMAND_TOOL_CLICKED, &T::OnSubTool, static_cast<T*>(tool.get()), VISUAL_SUB_TOOL_START, VISUAL_SUB_TOOL_END);
|
box->Bind(wxEVT_COMMAND_TOOL_CLICKED, &T::OnSubTool, static_cast<T*>(tool.get()), VISUAL_SUB_TOOL_START, VISUAL_SUB_TOOL_END);
|
||||||
}
|
}
|
||||||
void VideoDisplay::OnMode(const wxCommandEvent &event) {
|
void VideoDisplay::OnMode(const wxCommandEvent &event) {
|
||||||
|
@ -594,24 +592,24 @@ void VideoDisplay::FromScriptCoords(int *x, int *y) const {
|
||||||
|
|
||||||
void VideoDisplay::OnCopyToClipboard(wxCommandEvent &) {
|
void VideoDisplay::OnCopyToClipboard(wxCommandEvent &) {
|
||||||
if (wxTheClipboard->Open()) {
|
if (wxTheClipboard->Open()) {
|
||||||
wxTheClipboard->SetData(new wxBitmapDataObject(wxBitmap(vc->GetFrame(currentFrame)->GetImage(),24)));
|
wxTheClipboard->SetData(new wxBitmapDataObject(wxBitmap(con->videoController->GetFrame(currentFrame)->GetImage(),24)));
|
||||||
wxTheClipboard->Close();
|
wxTheClipboard->Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoDisplay::OnCopyToClipboardRaw(wxCommandEvent &) {
|
void VideoDisplay::OnCopyToClipboardRaw(wxCommandEvent &) {
|
||||||
if (wxTheClipboard->Open()) {
|
if (wxTheClipboard->Open()) {
|
||||||
wxTheClipboard->SetData(new wxBitmapDataObject(wxBitmap(vc->GetFrame(currentFrame,true)->GetImage(),24)));
|
wxTheClipboard->SetData(new wxBitmapDataObject(wxBitmap(con->videoController->GetFrame(currentFrame,true)->GetImage(),24)));
|
||||||
wxTheClipboard->Close();
|
wxTheClipboard->Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoDisplay::OnSaveSnapshot(wxCommandEvent &) {
|
void VideoDisplay::OnSaveSnapshot(wxCommandEvent &) {
|
||||||
vc->SaveSnapshot(false);
|
con->videoController->SaveSnapshot(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoDisplay::OnSaveSnapshotRaw(wxCommandEvent &) {
|
void VideoDisplay::OnSaveSnapshotRaw(wxCommandEvent &) {
|
||||||
vc->SaveSnapshot(true);
|
con->videoController->SaveSnapshot(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoDisplay::OnCopyCoords(wxCommandEvent &) {
|
void VideoDisplay::OnCopyCoords(wxCommandEvent &) {
|
||||||
|
|
|
@ -54,7 +54,9 @@ class VideoContext;
|
||||||
class VideoOutGL;
|
class VideoOutGL;
|
||||||
class IVisualTool;
|
class IVisualTool;
|
||||||
class wxToolBar;
|
class wxToolBar;
|
||||||
|
|
||||||
namespace agi {
|
namespace agi {
|
||||||
|
struct Context;
|
||||||
class OptionValue;
|
class OptionValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,8 +76,7 @@ class VideoDisplay : public wxGLCanvas {
|
||||||
|
|
||||||
const agi::OptionValue* alwaysShowTools;
|
const agi::OptionValue* alwaysShowTools;
|
||||||
|
|
||||||
/// The video context providing video to this display
|
agi::Context *con;
|
||||||
VideoContext *vc;
|
|
||||||
|
|
||||||
/// The frame number currently being displayed
|
/// The frame number currently being displayed
|
||||||
int currentFrame;
|
int currentFrame;
|
||||||
|
@ -201,7 +202,7 @@ public:
|
||||||
wxTextCtrl *SubsPosition,
|
wxTextCtrl *SubsPosition,
|
||||||
wxComboBox *zoomBox,
|
wxComboBox *zoomBox,
|
||||||
wxWindow* parent,
|
wxWindow* parent,
|
||||||
AssFile *model);
|
agi::Context *context);
|
||||||
~VideoDisplay();
|
~VideoDisplay();
|
||||||
|
|
||||||
/// @brief Render the currently visible frame
|
/// @brief Render the currently visible frame
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#include "ass_override.h"
|
#include "ass_override.h"
|
||||||
#include "ass_style.h"
|
#include "ass_style.h"
|
||||||
#include "ass_time.h"
|
#include "ass_time.h"
|
||||||
|
#include "include/aegisub/context.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "selection_controller.h"
|
#include "selection_controller.h"
|
||||||
#include "subs_edit_box.h"
|
#include "subs_edit_box.h"
|
||||||
|
@ -62,13 +63,13 @@
|
||||||
const wxColour IVisualTool::colour[4] = {wxColour(106,32,19), wxColour(255,169,40), wxColour(255,253,185), wxColour(187,0,0)};
|
const wxColour IVisualTool::colour[4] = {wxColour(106,32,19), wxColour(255,169,40), wxColour(255,253,185), wxColour(187,0,0)};
|
||||||
|
|
||||||
template<class FeatureType>
|
template<class FeatureType>
|
||||||
VisualTool<FeatureType>::VisualTool(VideoDisplay *parent, VideoState const& video)
|
VisualTool<FeatureType>::VisualTool(VideoDisplay *parent, agi::Context *context, VideoState const& video)
|
||||||
: dragStartX(0)
|
: dragStartX(0)
|
||||||
, dragStartY(0)
|
, dragStartY(0)
|
||||||
, commitId(-1)
|
, commitId(-1)
|
||||||
, selChanged(false)
|
, selChanged(false)
|
||||||
, selectedFeatures(selFeatures)
|
, selectedFeatures(selFeatures)
|
||||||
, grid(VideoContext::Get()->grid)
|
, grid(context->subsGrid)
|
||||||
, parent(parent)
|
, parent(parent)
|
||||||
, holding(false)
|
, holding(false)
|
||||||
, dragging(false)
|
, dragging(false)
|
||||||
|
@ -80,7 +81,7 @@ VisualTool<FeatureType>::VisualTool(VideoDisplay *parent, VideoState const& vide
|
||||||
, ctrlDown(false)
|
, ctrlDown(false)
|
||||||
, altDown(false)
|
, altDown(false)
|
||||||
{
|
{
|
||||||
frameNumber = VideoContext::Get()->GetFrameN();
|
frameNumber = context->videoController->GetFrameN();
|
||||||
curDiag = GetActiveDialogueLine();
|
curDiag = GetActiveDialogueLine();
|
||||||
grid->AddSelectionListener(this);
|
grid->AddSelectionListener(this);
|
||||||
curFeature = features.begin();
|
curFeature = features.begin();
|
||||||
|
|
|
@ -49,11 +49,12 @@
|
||||||
#include "gl_wrap.h"
|
#include "gl_wrap.h"
|
||||||
#include "selection_controller.h"
|
#include "selection_controller.h"
|
||||||
|
|
||||||
class VideoDisplay;
|
|
||||||
class AssDialogue;
|
class AssDialogue;
|
||||||
class SubtitlesGrid;
|
class SubtitlesGrid;
|
||||||
|
class VideoDisplay;
|
||||||
struct VideoState;
|
struct VideoState;
|
||||||
namespace agi {
|
namespace agi {
|
||||||
|
struct Context;
|
||||||
class OptionValue;
|
class OptionValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +227,7 @@ public:
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
/// @param parent The VideoDisplay to use for coordinate conversion
|
/// @param parent The VideoDisplay to use for coordinate conversion
|
||||||
/// @param video Video and mouse information passing blob
|
/// @param video Video and mouse information passing blob
|
||||||
VisualTool(VideoDisplay *parent, VideoState const& video);
|
VisualTool(VideoDisplay *parent, agi::Context *context, VideoState const& video);
|
||||||
|
|
||||||
/// @brief Destructor
|
/// @brief Destructor
|
||||||
virtual ~VisualTool();
|
virtual ~VisualTool();
|
||||||
|
|
|
@ -46,8 +46,8 @@
|
||||||
#include "video_display.h"
|
#include "video_display.h"
|
||||||
#include "visual_tool_clip.h"
|
#include "visual_tool_clip.h"
|
||||||
|
|
||||||
VisualToolClip::VisualToolClip(VideoDisplay *parent, VideoState const& video, wxToolBar *)
|
VisualToolClip::VisualToolClip(VideoDisplay *parent, agi::Context *context, VideoState const& video, wxToolBar *)
|
||||||
: VisualTool<ClipCorner>(parent, video)
|
: VisualTool<ClipCorner>(parent, context, video)
|
||||||
, curX1(0)
|
, curX1(0)
|
||||||
, curY1(0)
|
, curY1(0)
|
||||||
, curX2(video.w)
|
, curX2(video.w)
|
||||||
|
|
|
@ -76,5 +76,5 @@ class VisualToolClip : public VisualTool<ClipCorner> {
|
||||||
|
|
||||||
void Draw();
|
void Draw();
|
||||||
public:
|
public:
|
||||||
VisualToolClip(VideoDisplay *parent, VideoState const& video, wxToolBar *);
|
VisualToolClip(VideoDisplay *parent, agi::Context *context, VideoState const& video, wxToolBar *);
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,8 +42,8 @@
|
||||||
#include "video_display.h"
|
#include "video_display.h"
|
||||||
#include "visual_tool_cross.h"
|
#include "visual_tool_cross.h"
|
||||||
|
|
||||||
VisualToolCross::VisualToolCross(VideoDisplay *parent, VideoState const& video, wxToolBar *)
|
VisualToolCross::VisualToolCross(VideoDisplay *parent, agi::Context *context, VideoState const& video, wxToolBar *)
|
||||||
: VisualTool<VisualDraggableFeature>(parent, video)
|
: VisualTool<VisualDraggableFeature>(parent, context, video)
|
||||||
, glText(new OpenGLText)
|
, glText(new OpenGLText)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,5 +53,5 @@ class VisualToolCross : public VisualTool<VisualDraggableFeature> {
|
||||||
void Draw();
|
void Draw();
|
||||||
std::tr1::shared_ptr<OpenGLText> glText;
|
std::tr1::shared_ptr<OpenGLText> glText;
|
||||||
public:
|
public:
|
||||||
VisualToolCross(VideoDisplay *parent, VideoState const& video, wxToolBar *);
|
VisualToolCross(VideoDisplay *parent, agi::Context *context, VideoState const& video, wxToolBar *);
|
||||||
};
|
};
|
||||||
|
|
|
@ -54,8 +54,8 @@ static const DraggableFeatureType DRAG_END = DRAG_BIG_CIRCLE;
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
/// @param _parent
|
/// @param _parent
|
||||||
/// @param toolBar
|
/// @param toolBar
|
||||||
VisualToolDrag::VisualToolDrag(VideoDisplay *parent, VideoState const& video, wxToolBar * toolBar)
|
VisualToolDrag::VisualToolDrag(VideoDisplay *parent, agi::Context *context, VideoState const& video, wxToolBar * toolBar)
|
||||||
: VisualTool<VisualToolDragDraggableFeature>(parent, video)
|
: VisualTool<VisualToolDragDraggableFeature>(parent, context, video)
|
||||||
, toolBar(toolBar)
|
, toolBar(toolBar)
|
||||||
, primary(NULL)
|
, primary(NULL)
|
||||||
, toggleMoveOnMove(true)
|
, toggleMoveOnMove(true)
|
||||||
|
|
|
@ -95,7 +95,7 @@ class VisualToolDrag : public VisualTool<VisualToolDragDraggableFeature> {
|
||||||
void Draw();
|
void Draw();
|
||||||
bool Update();
|
bool Update();
|
||||||
public:
|
public:
|
||||||
VisualToolDrag(VideoDisplay *parent, VideoState const& video, wxToolBar *toolbar);
|
VisualToolDrag(VideoDisplay *parent, agi::Context *context, VideoState const& video, wxToolBar *toolbar);
|
||||||
|
|
||||||
void OnSubTool(wxCommandEvent &event);
|
void OnSubTool(wxCommandEvent &event);
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,8 +47,8 @@
|
||||||
#include "video_display.h"
|
#include "video_display.h"
|
||||||
#include "visual_tool_rotatexy.h"
|
#include "visual_tool_rotatexy.h"
|
||||||
|
|
||||||
VisualToolRotateXY::VisualToolRotateXY(VideoDisplay *parent, VideoState const& video, wxToolBar *)
|
VisualToolRotateXY::VisualToolRotateXY(VideoDisplay *parent, agi::Context *context, VideoState const& video, wxToolBar *)
|
||||||
: VisualTool<VisualDraggableFeature>(parent, video)
|
: VisualTool<VisualDraggableFeature>(parent, context, video)
|
||||||
{
|
{
|
||||||
features.resize(1);
|
features.resize(1);
|
||||||
org = &features.back();
|
org = &features.back();
|
||||||
|
|
|
@ -56,5 +56,5 @@ class VisualToolRotateXY : public VisualTool<VisualDraggableFeature> {
|
||||||
|
|
||||||
void Draw();
|
void Draw();
|
||||||
public:
|
public:
|
||||||
VisualToolRotateXY(VideoDisplay *parent, VideoState const& video, wxToolBar *);
|
VisualToolRotateXY(VideoDisplay *parent, agi::Context *context, VideoState const& video, wxToolBar *);
|
||||||
};
|
};
|
||||||
|
|
|
@ -50,8 +50,8 @@
|
||||||
static const float deg2rad = 3.1415926536f / 180.f;
|
static const float deg2rad = 3.1415926536f / 180.f;
|
||||||
static const float rad2deg = 180.f / 3.1415926536f;
|
static const float rad2deg = 180.f / 3.1415926536f;
|
||||||
|
|
||||||
VisualToolRotateZ::VisualToolRotateZ(VideoDisplay *parent, VideoState const& video, wxToolBar *)
|
VisualToolRotateZ::VisualToolRotateZ(VideoDisplay *parent, agi::Context *context, VideoState const& video, wxToolBar *)
|
||||||
: VisualTool<VisualDraggableFeature>(parent, video)
|
: VisualTool<VisualDraggableFeature>(parent, context, video)
|
||||||
{
|
{
|
||||||
features.resize(1);
|
features.resize(1);
|
||||||
org = &features.back();
|
org = &features.back();
|
||||||
|
|
|
@ -61,5 +61,5 @@ class VisualToolRotateZ : public VisualTool<VisualDraggableFeature> {
|
||||||
void Draw();
|
void Draw();
|
||||||
bool Update() { return true; }
|
bool Update() { return true; }
|
||||||
public:
|
public:
|
||||||
VisualToolRotateZ(VideoDisplay *parent, VideoState const& video, wxToolBar *);
|
VisualToolRotateZ(VideoDisplay *parent, agi::Context *context, VideoState const& video, wxToolBar *);
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,8 +47,8 @@
|
||||||
#include "video_display.h"
|
#include "video_display.h"
|
||||||
#include "visual_tool_scale.h"
|
#include "visual_tool_scale.h"
|
||||||
|
|
||||||
VisualToolScale::VisualToolScale(VideoDisplay *parent, VideoState const& video, wxToolBar *)
|
VisualToolScale::VisualToolScale(VideoDisplay *parent, agi::Context *context, VideoState const& video, wxToolBar *)
|
||||||
: VisualTool<VisualDraggableFeature>(parent, video)
|
: VisualTool<VisualDraggableFeature>(parent, context, video)
|
||||||
, curScaleX(0.f)
|
, curScaleX(0.f)
|
||||||
, origScaleX(0.f)
|
, origScaleX(0.f)
|
||||||
, curScaleY(0.f)
|
, curScaleY(0.f)
|
||||||
|
|
|
@ -56,5 +56,5 @@ class VisualToolScale : public VisualTool<VisualDraggableFeature> {
|
||||||
void DoRefresh();
|
void DoRefresh();
|
||||||
void Draw();
|
void Draw();
|
||||||
public:
|
public:
|
||||||
VisualToolScale(VideoDisplay *parent, VideoState const& video, wxToolBar *);
|
VisualToolScale(VideoDisplay *parent, agi::Context *context, VideoState const& video, wxToolBar *);
|
||||||
};
|
};
|
||||||
|
|
|
@ -81,8 +81,8 @@ static void for_each_iter(C &container, O obj, M method) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VisualToolVectorClip::VisualToolVectorClip(VideoDisplay *parent, VideoState const& video, wxToolBar * toolBar)
|
VisualToolVectorClip::VisualToolVectorClip(VideoDisplay *parent, agi::Context *context, VideoState const& video, wxToolBar * toolBar)
|
||||||
: VisualTool<VisualToolVectorClipDraggableFeature>(parent, video)
|
: VisualTool<VisualToolVectorClipDraggableFeature>(parent, context, video)
|
||||||
, spline(*parent)
|
, spline(*parent)
|
||||||
, toolBar(toolBar)
|
, toolBar(toolBar)
|
||||||
{
|
{
|
||||||
|
|
|
@ -87,7 +87,7 @@ class VisualToolVectorClip : public VisualTool<VisualToolVectorClipDraggableFeat
|
||||||
void Draw();
|
void Draw();
|
||||||
bool Update() { return mode >= 1 && mode <= 4; }
|
bool Update() { return mode >= 1 && mode <= 4; }
|
||||||
public:
|
public:
|
||||||
VisualToolVectorClip(VideoDisplay *parent, VideoState const& video, wxToolBar *toolbar);
|
VisualToolVectorClip(VideoDisplay *parent, agi::Context *context, VideoState const& video, wxToolBar *toolbar);
|
||||||
|
|
||||||
/// Subtoolbar button click handler
|
/// Subtoolbar button click handler
|
||||||
void OnSubTool(wxCommandEvent &event);
|
void OnSubTool(wxCommandEvent &event);
|
||||||
|
|
Loading…
Reference in a new issue