forked from mia/Aegisub
Add some documentation to VideoDisplay and clean up the includes a bit.
Originally committed to SVN as r3501.
This commit is contained in:
parent
a4f844c048
commit
1a4e7375fd
22 changed files with 130 additions and 250 deletions
|
@ -52,6 +52,7 @@
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "help_button.h"
|
#include "help_button.h"
|
||||||
#include "libresrc/libresrc.h"
|
#include "libresrc/libresrc.h"
|
||||||
|
#include "video_context.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
#include "vfr.h"
|
#include "vfr.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "help_button.h"
|
#include "help_button.h"
|
||||||
|
#include "video_context.h"
|
||||||
#include "libresrc/libresrc.h"
|
#include "libresrc/libresrc.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
#include "avisynth_wrap.h"
|
#include "avisynth_wrap.h"
|
||||||
#endif
|
#endif
|
||||||
#include "video_display.h"
|
#include "video_display.h"
|
||||||
|
#include "video_context.h"
|
||||||
#include "video_provider_manager.h"
|
#include "video_provider_manager.h"
|
||||||
#include "video_slider.h"
|
#include "video_slider.h"
|
||||||
#include "ass_file.h"
|
#include "ass_file.h"
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
#include "subs_grid.h"
|
#include "subs_grid.h"
|
||||||
#include "frame_main.h"
|
#include "frame_main.h"
|
||||||
#include "video_display.h"
|
#include "video_display.h"
|
||||||
|
#include "video_context.h"
|
||||||
#include "video_slider.h"
|
#include "video_slider.h"
|
||||||
#include "video_box.h"
|
#include "video_box.h"
|
||||||
#include "ass_file.h"
|
#include "ass_file.h"
|
||||||
|
|
|
@ -54,6 +54,7 @@
|
||||||
#include "audio_display.h"
|
#include "audio_display.h"
|
||||||
#include "hilimod_textctrl.h"
|
#include "hilimod_textctrl.h"
|
||||||
#include "video_display.h"
|
#include "video_display.h"
|
||||||
|
#include "video_context.h"
|
||||||
#include "validators.h"
|
#include "validators.h"
|
||||||
#include "dialog_colorpicker.h"
|
#include "dialog_colorpicker.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
#include "ass_dialogue.h"
|
#include "ass_dialogue.h"
|
||||||
#include "ass_style.h"
|
#include "ass_style.h"
|
||||||
#include "video_display.h"
|
#include "video_display.h"
|
||||||
|
#include "video_context.h"
|
||||||
#include "vfr.h"
|
#include "vfr.h"
|
||||||
#include "subs_edit_box.h"
|
#include "subs_edit_box.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#include <wx/rawbmp.h>
|
#include <wx/rawbmp.h>
|
||||||
#include "video_box.h"
|
#include "video_box.h"
|
||||||
#include "video_display.h"
|
#include "video_display.h"
|
||||||
|
#include "video_context.h"
|
||||||
#include "video_slider.h"
|
#include "video_slider.h"
|
||||||
#include "frame_main.h"
|
#include "frame_main.h"
|
||||||
#include "toggle_bitmap.h"
|
#include "toggle_bitmap.h"
|
||||||
|
@ -103,18 +104,6 @@ VideoBox::VideoBox(wxWindow *parent, bool isDetached)
|
||||||
VideoSubsPos = new wxTextCtrl(videoPage,-1,_T(""),wxDefaultPosition,wxSize(110,20),wxTE_READONLY);
|
VideoSubsPos = new wxTextCtrl(videoPage,-1,_T(""),wxDefaultPosition,wxSize(110,20),wxTE_READONLY);
|
||||||
VideoSubsPos->SetToolTip(_("Time of this frame relative to start and end of current subs."));
|
VideoSubsPos->SetToolTip(_("Time of this frame relative to start and end of current subs."));
|
||||||
|
|
||||||
// Display
|
|
||||||
videoDisplay = new VideoDisplay(videoPage,-1,wxDefaultPosition,wxDefaultSize,wxSUNKEN_BORDER);
|
|
||||||
videoDisplay->ControlSlider = videoSlider;
|
|
||||||
videoDisplay->PositionDisplay = VideoPosition;
|
|
||||||
videoDisplay->SubsPosition = VideoSubsPos;
|
|
||||||
videoDisplay->box = this;
|
|
||||||
VideoContext::Get()->AddDisplay(videoDisplay);
|
|
||||||
videoDisplay->Reset();
|
|
||||||
|
|
||||||
// Set display
|
|
||||||
videoSlider->Display = videoDisplay;
|
|
||||||
|
|
||||||
// Typesetting buttons
|
// Typesetting buttons
|
||||||
visualToolBar = new wxToolBar(videoPage,-1,wxDefaultPosition,wxDefaultSize,wxTB_VERTICAL|wxTB_FLAT|wxTB_NODIVIDER);
|
visualToolBar = new wxToolBar(videoPage,-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);
|
visualToolBar->AddTool(Video_Mode_Standard,_("Standard"),GETIMAGE(visual_standard_24),_("Standard mode, double click sets position."),wxITEM_RADIO);
|
||||||
|
@ -133,6 +122,17 @@ VideoBox::VideoBox(wxWindow *parent, bool isDetached)
|
||||||
visualToolBar->SetBackgroundStyle(wxBG_STYLE_COLOUR);
|
visualToolBar->SetBackgroundStyle(wxBG_STYLE_COLOUR);
|
||||||
visualToolBar->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
|
visualToolBar->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
|
||||||
|
|
||||||
|
// Display
|
||||||
|
videoDisplay = new VideoDisplay(videoPage,-1,this,wxDefaultPosition,wxDefaultSize,wxSUNKEN_BORDER);
|
||||||
|
videoDisplay->ControlSlider = videoSlider;
|
||||||
|
videoDisplay->PositionDisplay = VideoPosition;
|
||||||
|
videoDisplay->SubsPosition = VideoSubsPos;
|
||||||
|
VideoContext::Get()->AddDisplay(videoDisplay);
|
||||||
|
videoDisplay->Reset();
|
||||||
|
|
||||||
|
// Set display
|
||||||
|
videoSlider->Display = videoDisplay;
|
||||||
|
|
||||||
// Top sizer
|
// Top sizer
|
||||||
// Detached and attached video needs different flags, see bugs #742 and #853
|
// Detached and attached video needs different flags, see bugs #742 and #853
|
||||||
int highSizerFlags = isDetached ? wxEXPAND : 0;
|
int highSizerFlags = isDetached ? wxEXPAND : 0;
|
||||||
|
@ -168,7 +168,6 @@ VideoBox::VideoBox(wxWindow *parent, bool isDetached)
|
||||||
SetSizer(VideoSizer);
|
SetSizer(VideoSizer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
// Event table
|
// Event table
|
||||||
BEGIN_EVENT_TABLE(VideoBox, wxPanel)
|
BEGIN_EVENT_TABLE(VideoBox, wxPanel)
|
||||||
|
|
|
@ -81,8 +81,6 @@ public:
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
wxToolBar *visualSubToolBar;
|
wxToolBar *visualSubToolBar;
|
||||||
//wxSizer *visualSubToolBar;
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
ToggleBitmap *AutoScroll;
|
ToggleBitmap *AutoScroll;
|
||||||
|
|
|
@ -34,8 +34,6 @@
|
||||||
/// @ingroup video main_ui
|
/// @ingroup video main_ui
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
////////////
|
|
||||||
// Includes
|
// Includes
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
@ -47,28 +45,15 @@
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#include <GL/glu.h>
|
#include <GL/glu.h>
|
||||||
#endif
|
#endif
|
||||||
#include <wx/image.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <wx/clipbrd.h>
|
#include <wx/clipbrd.h>
|
||||||
#include <wx/filename.h>
|
|
||||||
#include <wx/config.h>
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "video_display.h"
|
#include "video_display.h"
|
||||||
#include "video_provider_manager.h"
|
#include "video_provider_manager.h"
|
||||||
#include "vfr.h"
|
#include "vfr.h"
|
||||||
#include "ass_file.h"
|
|
||||||
#include "ass_time.h"
|
|
||||||
#include "ass_dialogue.h"
|
#include "ass_dialogue.h"
|
||||||
#include "ass_style.h"
|
|
||||||
#include "subs_grid.h"
|
|
||||||
#include "vfw_wrap.h"
|
|
||||||
#include "mkv_wrap.h"
|
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "subs_edit_box.h"
|
|
||||||
#include "audio_display.h"
|
|
||||||
#include "main.h"
|
|
||||||
#include "video_slider.h"
|
|
||||||
#include "video_box.h"
|
#include "video_box.h"
|
||||||
|
#include "video_context.h"
|
||||||
#include "gl_wrap.h"
|
#include "gl_wrap.h"
|
||||||
#include "visual_tool.h"
|
#include "visual_tool.h"
|
||||||
#include "visual_tool_cross.h"
|
#include "visual_tool_cross.h"
|
||||||
|
@ -80,29 +65,20 @@
|
||||||
#include "visual_tool_drag.h"
|
#include "visual_tool_drag.h"
|
||||||
#include "hotkeys.h"
|
#include "hotkeys.h"
|
||||||
|
|
||||||
|
// Menu item IDs
|
||||||
///////
|
|
||||||
// IDs
|
|
||||||
enum {
|
enum {
|
||||||
|
/// Copy mouse coordinates to clipboard
|
||||||
/// DOCME
|
|
||||||
VIDEO_MENU_COPY_COORDS = 1230,
|
VIDEO_MENU_COPY_COORDS = 1230,
|
||||||
|
/// Copy frame to clipboard with subtitles
|
||||||
/// DOCME
|
|
||||||
VIDEO_MENU_COPY_TO_CLIPBOARD,
|
VIDEO_MENU_COPY_TO_CLIPBOARD,
|
||||||
|
/// Copy frame to clipboard without subtitles
|
||||||
/// DOCME
|
|
||||||
VIDEO_MENU_COPY_TO_CLIPBOARD_RAW,
|
VIDEO_MENU_COPY_TO_CLIPBOARD_RAW,
|
||||||
|
/// Save frame with subtitles
|
||||||
/// DOCME
|
|
||||||
VIDEO_MENU_SAVE_SNAPSHOT,
|
VIDEO_MENU_SAVE_SNAPSHOT,
|
||||||
|
/// Save frame without subtitles
|
||||||
/// DOCME
|
|
||||||
VIDEO_MENU_SAVE_SNAPSHOT_RAW
|
VIDEO_MENU_SAVE_SNAPSHOT_RAW
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
///////////////
|
|
||||||
// Event table
|
// Event table
|
||||||
BEGIN_EVENT_TABLE(VideoDisplay, wxGLCanvas)
|
BEGIN_EVENT_TABLE(VideoDisplay, wxGLCanvas)
|
||||||
EVT_MOUSE_EVENTS(VideoDisplay::OnMouseEvent)
|
EVT_MOUSE_EVENTS(VideoDisplay::OnMouseEvent)
|
||||||
|
@ -120,23 +96,20 @@ END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// Attribute list for gl canvases; set the canvases to doublebuffered rgba with an 8 bit stencil buffer
|
||||||
int attribList[] = { WX_GL_RGBA , WX_GL_DOUBLEBUFFER, WX_GL_STENCIL_SIZE, 8, 0 };
|
int attribList[] = { WX_GL_RGBA , WX_GL_DOUBLEBUFFER, WX_GL_STENCIL_SIZE, 8, 0 };
|
||||||
|
|
||||||
|
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
/// @param parent
|
/// @param parent Pointer to a parent window.
|
||||||
/// @param id
|
/// @param id Window identifier. If -1, will automatically create an identifier.
|
||||||
/// @param pos
|
/// @param pos Window position. wxDefaultPosition is (-1, -1) which indicates that wxWidgets should generate a default position for the window.
|
||||||
/// @param size
|
/// @param size Window size. wxDefaultSize is (-1, -1) which indicates that wxWidgets should generate a default size for the window. If no suitable size can be found, the window will be sized to 20x20 pixels so that the window is visible but obviously not correctly sized.
|
||||||
/// @param style
|
/// @param style Window style.
|
||||||
/// @param name
|
/// @param name Window name.
|
||||||
///
|
VideoDisplay::VideoDisplay(wxWindow* parent, wxWindowID id, VideoBox *box, const wxPoint& pos, const wxSize& size, long style, const wxString& name)
|
||||||
VideoDisplay::VideoDisplay(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name)
|
: wxGLCanvas (parent, id, attribList, pos, size, style, name), box(box)
|
||||||
: wxGLCanvas (parent, id, attribList, pos, size, style, name)
|
|
||||||
{
|
{
|
||||||
// Set options
|
|
||||||
box = NULL;
|
|
||||||
locked = false;
|
locked = false;
|
||||||
ControlSlider = NULL;
|
ControlSlider = NULL;
|
||||||
PositionDisplay = NULL;
|
PositionDisplay = NULL;
|
||||||
|
@ -151,43 +124,24 @@ VideoDisplay::VideoDisplay(wxWindow* parent, wxWindowID id, const wxPoint& pos,
|
||||||
SetVisualMode(0);
|
SetVisualMode(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Destructor
|
/// @brief Destructor
|
||||||
///
|
|
||||||
VideoDisplay::~VideoDisplay () {
|
VideoDisplay::~VideoDisplay () {
|
||||||
delete visual;
|
delete visual;
|
||||||
visual = NULL;
|
visual = NULL;
|
||||||
VideoContext::Get()->RemoveDisplay(this);
|
VideoContext::Get()->RemoveDisplay(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief Set the cursor to either default or blank
|
||||||
|
/// @param Whether or not the cursor should be visible
|
||||||
/// @brief Show cursor
|
|
||||||
/// @param show
|
|
||||||
///
|
|
||||||
void VideoDisplay::ShowCursor(bool show) {
|
void VideoDisplay::ShowCursor(bool show) {
|
||||||
// Show
|
|
||||||
if (show) SetCursor(wxNullCursor);
|
if (show) SetCursor(wxNullCursor);
|
||||||
|
|
||||||
// Hide
|
|
||||||
else {
|
else {
|
||||||
// Bleeeh! Hate this 'solution':
|
|
||||||
#if __WXGTK__
|
|
||||||
static char cursor_image[] = {0};
|
|
||||||
wxCursor cursor(cursor_image, 8, 1, -1, -1, cursor_image);
|
|
||||||
#else
|
|
||||||
wxCursor cursor(wxCURSOR_BLANK);
|
wxCursor cursor(wxCURSOR_BLANK);
|
||||||
#endif // __WXGTK__
|
|
||||||
SetCursor(cursor);
|
SetCursor(cursor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief Render the currently visible frame
|
||||||
|
|
||||||
/// @brief Render
|
|
||||||
/// @return
|
|
||||||
///
|
|
||||||
void VideoDisplay::Render()
|
void VideoDisplay::Render()
|
||||||
// Yes it's legal C++ to replace the body of a function with one huge try..catch statement
|
// Yes it's legal C++ to replace the body of a function with one huge try..catch statement
|
||||||
try {
|
try {
|
||||||
|
@ -342,8 +296,7 @@ catch (...) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief TV effects (overscan and so on)
|
/// @brief Draw the appropriate overscan masks for the current aspect ratio
|
||||||
///
|
|
||||||
void VideoDisplay::DrawTVEffects() {
|
void VideoDisplay::DrawTVEffects() {
|
||||||
// Get coordinates
|
// Get coordinates
|
||||||
int sw,sh;
|
int sw,sh;
|
||||||
|
@ -351,9 +304,8 @@ void VideoDisplay::DrawTVEffects() {
|
||||||
context->GetScriptSize(sw,sh);
|
context->GetScriptSize(sw,sh);
|
||||||
bool drawOverscan = Options.AsBool(_T("Show Overscan Mask"));
|
bool drawOverscan = Options.AsBool(_T("Show Overscan Mask"));
|
||||||
|
|
||||||
// Draw overscan mask
|
|
||||||
if (drawOverscan) {
|
if (drawOverscan) {
|
||||||
// Get aspect ration
|
// Get aspect ratio
|
||||||
double ar = context->GetAspectRatioValue();
|
double ar = context->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
|
||||||
|
@ -371,14 +323,11 @@ void VideoDisplay::DrawTVEffects() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief Draw an overscan mask
|
||||||
|
/// @param sizeH The amount of horizontal overscan on one side
|
||||||
/// @brief Draw overscan mask
|
/// @param sizeV The amount of vertical overscan on one side
|
||||||
/// @param sizeH
|
/// @param colour The color of the mask
|
||||||
/// @param sizeV
|
/// @param alpha The alpha of the mask
|
||||||
/// @param colour
|
|
||||||
/// @param alpha
|
|
||||||
///
|
|
||||||
void VideoDisplay::DrawOverscanMask(int sizeH,int sizeV,wxColour colour,double alpha) {
|
void VideoDisplay::DrawOverscanMask(int sizeH,int sizeV,wxColour colour,double alpha) {
|
||||||
// Parameters
|
// Parameters
|
||||||
int sw,sh;
|
int sw,sh;
|
||||||
|
@ -410,15 +359,8 @@ void VideoDisplay::DrawOverscanMask(int sizeH,int sizeV,wxColour colour,double a
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief Update the size of the display
|
||||||
|
|
||||||
/// @brief Update size
|
|
||||||
/// @return
|
|
||||||
///
|
|
||||||
void VideoDisplay::UpdateSize() {
|
void VideoDisplay::UpdateSize() {
|
||||||
// Don't do anything if it's a free sizing display
|
|
||||||
//if (freeSize) return;
|
|
||||||
|
|
||||||
// Loaded?
|
// Loaded?
|
||||||
VideoContext *con = VideoContext::Get();
|
VideoContext *con = VideoContext::Get();
|
||||||
wxASSERT(con);
|
wxASSERT(con);
|
||||||
|
@ -458,11 +400,7 @@ void VideoDisplay::UpdateSize() {
|
||||||
Refresh(false);
|
Refresh(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief Reset the size of the display to the video size
|
||||||
|
|
||||||
/// @brief Resets
|
|
||||||
/// @return
|
|
||||||
///
|
|
||||||
void VideoDisplay::Reset() {
|
void VideoDisplay::Reset() {
|
||||||
// Only calculate sizes if it's visible
|
// Only calculate sizes if it's visible
|
||||||
if (!IsShownOnScreen()) return;
|
if (!IsShownOnScreen()) return;
|
||||||
|
@ -478,35 +416,22 @@ void VideoDisplay::Reset() {
|
||||||
SetSizeHints(_w,_h,_w,_h);
|
SetSizeHints(_w,_h,_w,_h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Paint event
|
/// @brief Paint event
|
||||||
/// @param event
|
/// @param event
|
||||||
///
|
|
||||||
void VideoDisplay::OnPaint(wxPaintEvent& event) {
|
void VideoDisplay::OnPaint(wxPaintEvent& event) {
|
||||||
wxPaintDC dc(this);
|
wxPaintDC dc(this);
|
||||||
Render();
|
Render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief Handle resize events
|
||||||
|
|
||||||
/// @brief Size Event
|
|
||||||
/// @param event
|
/// @param event
|
||||||
///
|
|
||||||
void VideoDisplay::OnSizeEvent(wxSizeEvent &event) {
|
void VideoDisplay::OnSizeEvent(wxSizeEvent &event) {
|
||||||
//Refresh(false);
|
if (freeSize) UpdateSize();
|
||||||
if (freeSize) {
|
|
||||||
UpdateSize();
|
|
||||||
}
|
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief Handle mouse events
|
||||||
|
|
||||||
/// @brief Mouse stuff
|
|
||||||
/// @param event
|
/// @param event
|
||||||
/// @return
|
|
||||||
///
|
|
||||||
void VideoDisplay::OnMouseEvent(wxMouseEvent& event) {
|
void VideoDisplay::OnMouseEvent(wxMouseEvent& event) {
|
||||||
// Locked?
|
// Locked?
|
||||||
if (locked) return;
|
if (locked) return;
|
||||||
|
@ -548,11 +473,8 @@ void VideoDisplay::OnMouseEvent(wxMouseEvent& event) {
|
||||||
if (visual) visual->OnMouseEvent(event);
|
if (visual) visual->OnMouseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief Handle keypress events for switching visual typesetting modes
|
||||||
|
|
||||||
/// @brief Key event
|
|
||||||
/// @param event
|
/// @param event
|
||||||
///
|
|
||||||
void VideoDisplay::OnKey(wxKeyEvent &event) {
|
void VideoDisplay::OnKey(wxKeyEvent &event) {
|
||||||
int key = event.GetKeyCode();
|
int key = event.GetKeyCode();
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
@ -571,22 +493,15 @@ void VideoDisplay::OnKey(wxKeyEvent &event) {
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief Set the zoom level
|
||||||
|
/// @param value The new zoom level
|
||||||
|
|
||||||
/// @brief Sets zoom level
|
|
||||||
/// @param value
|
|
||||||
///
|
|
||||||
void VideoDisplay::SetZoom(double value) {
|
void VideoDisplay::SetZoom(double value) {
|
||||||
zoomValue = value;
|
zoomValue = value;
|
||||||
UpdateSize();
|
UpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief Set the position of the zoom dropdown and switch to that zoom
|
||||||
|
/// @param value The new zoom position
|
||||||
/// @brief Sets zoom position
|
|
||||||
/// @param value
|
|
||||||
///
|
|
||||||
void VideoDisplay::SetZoomPos(int value) {
|
void VideoDisplay::SetZoomPos(int value) {
|
||||||
if (value < 0) value = 0;
|
if (value < 0) value = 0;
|
||||||
if (value > 15) value = 15;
|
if (value > 15) value = 15;
|
||||||
|
@ -594,10 +509,7 @@ void VideoDisplay::SetZoomPos(int value) {
|
||||||
if (zoomBox->GetSelection() != value) zoomBox->SetSelection(value);
|
if (zoomBox->GetSelection() != value) zoomBox->SetSelection(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief Update the absolute frame time display
|
||||||
|
|
||||||
/// @brief Updates position display
|
|
||||||
///
|
|
||||||
void VideoDisplay::UpdatePositionDisplay() {
|
void VideoDisplay::UpdatePositionDisplay() {
|
||||||
// Update position display control
|
// Update position display control
|
||||||
if (!PositionDisplay) {
|
if (!PositionDisplay) {
|
||||||
|
@ -638,12 +550,8 @@ void VideoDisplay::UpdatePositionDisplay() {
|
||||||
UpdateSubsRelativeTime();
|
UpdateSubsRelativeTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief Update the relative-to-subs time display
|
||||||
|
|
||||||
/// @brief Updates box with subs position relative to frame
|
|
||||||
///
|
|
||||||
void VideoDisplay::UpdateSubsRelativeTime() {
|
void VideoDisplay::UpdateSubsRelativeTime() {
|
||||||
// Set variables
|
|
||||||
wxString startSign;
|
wxString startSign;
|
||||||
wxString endSign;
|
wxString endSign;
|
||||||
int startOff,endOff;
|
int startOff,endOff;
|
||||||
|
@ -673,9 +581,8 @@ void VideoDisplay::UpdateSubsRelativeTime() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Copy to clipboard
|
/// @brief Copy the currently display frame to the clipboard, with subtitles
|
||||||
/// @param event
|
/// @param event Unused
|
||||||
///
|
|
||||||
void VideoDisplay::OnCopyToClipboard(wxCommandEvent &event) {
|
void VideoDisplay::OnCopyToClipboard(wxCommandEvent &event) {
|
||||||
if (wxTheClipboard->Open()) {
|
if (wxTheClipboard->Open()) {
|
||||||
wxTheClipboard->SetData(new wxBitmapDataObject(wxBitmap(VideoContext::Get()->GetFrame(-1).GetImage(),24)));
|
wxTheClipboard->SetData(new wxBitmapDataObject(wxBitmap(VideoContext::Get()->GetFrame(-1).GetImage(),24)));
|
||||||
|
@ -685,9 +592,8 @@ void VideoDisplay::OnCopyToClipboard(wxCommandEvent &event) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Copy to clipboard (raw)
|
/// @brief Copy the currently display frame to the clipboard, without subtitles
|
||||||
/// @param event
|
/// @param event Unused
|
||||||
///
|
|
||||||
void VideoDisplay::OnCopyToClipboardRaw(wxCommandEvent &event) {
|
void VideoDisplay::OnCopyToClipboardRaw(wxCommandEvent &event) {
|
||||||
if (wxTheClipboard->Open()) {
|
if (wxTheClipboard->Open()) {
|
||||||
wxTheClipboard->SetData(new wxBitmapDataObject(wxBitmap(VideoContext::Get()->GetFrame(-1,true).GetImage(),24)));
|
wxTheClipboard->SetData(new wxBitmapDataObject(wxBitmap(VideoContext::Get()->GetFrame(-1,true).GetImage(),24)));
|
||||||
|
@ -697,27 +603,24 @@ void VideoDisplay::OnCopyToClipboardRaw(wxCommandEvent &event) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Save snapshot
|
/// @brief Save the currently display frame to a file, with subtitles
|
||||||
/// @param event
|
/// @param event Unused
|
||||||
///
|
|
||||||
void VideoDisplay::OnSaveSnapshot(wxCommandEvent &event) {
|
void VideoDisplay::OnSaveSnapshot(wxCommandEvent &event) {
|
||||||
VideoContext::Get()->SaveSnapshot(false);
|
VideoContext::Get()->SaveSnapshot(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Save snapshot (raw)
|
/// @brief Save the currently display frame to a file, without subtitles
|
||||||
/// @param event
|
/// @param event Unused
|
||||||
///
|
|
||||||
void VideoDisplay::OnSaveSnapshotRaw(wxCommandEvent &event) {
|
void VideoDisplay::OnSaveSnapshotRaw(wxCommandEvent &event) {
|
||||||
VideoContext::Get()->SaveSnapshot(true);
|
VideoContext::Get()->SaveSnapshot(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Copy coordinates
|
/// @brief Copy coordinates of the mouse to the clipboard
|
||||||
/// @param event
|
/// @param event Unused
|
||||||
///
|
|
||||||
void VideoDisplay::OnCopyCoords(wxCommandEvent &event) {
|
void VideoDisplay::OnCopyCoords(wxCommandEvent &event) {
|
||||||
if (wxTheClipboard->Open()) {
|
if (wxTheClipboard->Open()) {
|
||||||
int sw,sh;
|
int sw,sh;
|
||||||
|
@ -731,10 +634,9 @@ void VideoDisplay::OnCopyCoords(wxCommandEvent &event) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Convert mouse coordinates
|
/// @brief Convert mouse coordinates relative to the display to coordinates relative to the video
|
||||||
/// @param x
|
/// @param x X coordinate
|
||||||
/// @param y
|
/// @param y Y coordinate
|
||||||
///
|
|
||||||
void VideoDisplay::ConvertMouseCoords(int &x,int &y) {
|
void VideoDisplay::ConvertMouseCoords(int &x,int &y) {
|
||||||
int w,h;
|
int w,h;
|
||||||
GetClientSize(&w,&h);
|
GetClientSize(&w,&h);
|
||||||
|
@ -748,20 +650,20 @@ void VideoDisplay::ConvertMouseCoords(int &x,int &y) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Set mode
|
/// @brief Set the current visual typesetting mode
|
||||||
/// @param mode
|
/// @param mode The new mode
|
||||||
///
|
|
||||||
void VideoDisplay::SetVisualMode(int mode) {
|
void VideoDisplay::SetVisualMode(int mode) {
|
||||||
// Set visual
|
// Set visual
|
||||||
if (visualMode != mode) {
|
if (visualMode != mode) {
|
||||||
// Get toolbar
|
|
||||||
wxToolBar *toolBar = NULL;
|
wxToolBar *toolBar = NULL;
|
||||||
if (box) {
|
if (box) {
|
||||||
toolBar = box->visualSubToolBar;
|
toolBar = box->visualSubToolBar;
|
||||||
toolBar->ClearTools();
|
toolBar->ClearTools();
|
||||||
toolBar->Realize();
|
toolBar->Realize();
|
||||||
toolBar->Show(false);
|
toolBar->Show(false);
|
||||||
if (!box->visualToolBar->GetToolState(mode + Video_Mode_Standard)) box->visualToolBar->ToggleTool(mode + Video_Mode_Standard,true);
|
if (!box->visualToolBar->GetToolState(mode + Video_Mode_Standard)) {
|
||||||
|
box->visualToolBar->ToggleTool(mode + Video_Mode_Standard,true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace mode
|
// Replace mode
|
||||||
|
@ -778,12 +680,8 @@ void VideoDisplay::SetVisualMode(int mode) {
|
||||||
default: visual = NULL;
|
default: visual = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update size to reflect toolbar changes
|
// Update size as the new typesetting tool may have changed the subtoolbar size
|
||||||
UpdateSize();
|
UpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render
|
|
||||||
Render();
|
Render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,73 +34,54 @@
|
||||||
/// @ingroup video main_ui
|
/// @ingroup video main_ui
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#include <wx/wxprec.h>
|
#include <wx/wxprec.h>
|
||||||
#ifdef __WINDOWS__
|
|
||||||
#include <windows.h>
|
|
||||||
#endif
|
|
||||||
#include <time.h>
|
|
||||||
#include <wx/glcanvas.h>
|
#include <wx/glcanvas.h>
|
||||||
#include <wx/combobox.h>
|
#include <wx/combobox.h>
|
||||||
#include "video_context.h"
|
|
||||||
|
|
||||||
|
|
||||||
//////////////
|
|
||||||
// Prototypes
|
// Prototypes
|
||||||
class SubtitlesGrid;
|
|
||||||
class VideoSlider;
|
class VideoSlider;
|
||||||
class AudioProvider;
|
|
||||||
class AudioDisplay;
|
|
||||||
class AssDialogue;
|
|
||||||
class VideoProvider;
|
|
||||||
class VisualTool;
|
class VisualTool;
|
||||||
class VideoBox;
|
class VideoBox;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
/// @class VideoDisplay
|
/// @class VideoDisplay
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
///
|
///
|
||||||
/// DOCME
|
/// DOCME
|
||||||
class VideoDisplay: public wxGLCanvas {
|
class VideoDisplay: public wxGLCanvas {
|
||||||
friend class AudioProvider;
|
|
||||||
friend class VisualTool;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/// The current visual typesetting mode
|
||||||
/// DOCME
|
|
||||||
int visualMode;
|
int visualMode;
|
||||||
|
|
||||||
|
/// The unscaled size of the displayed video
|
||||||
/// DOCME
|
|
||||||
wxSize origSize;
|
wxSize origSize;
|
||||||
|
|
||||||
/// DOCME
|
/// The width of the display
|
||||||
|
int w;
|
||||||
|
/// The height of the display
|
||||||
|
int h;
|
||||||
|
|
||||||
/// DOCME
|
/// The x-coordinate of the top left of the area containing video.
|
||||||
int w,h;
|
/// Always zero unless the display is detatched and is wider than the video.
|
||||||
|
int dx1;
|
||||||
|
/// The x-coordinate of the bottom right of the area containing video.
|
||||||
|
/// Always equal to the width of the video unless the display is detatched and is wider than the video.
|
||||||
|
int dx2;
|
||||||
|
/// The y-coordinate of the top left of the area containing video.
|
||||||
|
/// Always zero unless the display is detatched and is taller than the video.
|
||||||
|
int dy1;
|
||||||
|
/// The y-coordinate of the bottom of the area containing video.
|
||||||
|
/// Always equal to the height of the video unless the display is detatched and is taller than the video.
|
||||||
|
int dy2;
|
||||||
|
|
||||||
/// DOCME
|
/// The x position of the mouse
|
||||||
|
int mouse_x;
|
||||||
|
/// The y position of the mouse
|
||||||
|
int mouse_y;
|
||||||
|
|
||||||
/// DOCME
|
/// Lock to disable mouse updates during resize operations
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
int dx1,dx2,dy1,dy2;
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
int mouse_x,mouse_y;
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
bool locked;
|
bool locked;
|
||||||
|
|
||||||
void DrawTVEffects();
|
void DrawTVEffects();
|
||||||
|
@ -110,9 +91,8 @@ private:
|
||||||
void OnKey(wxKeyEvent &event);
|
void OnKey(wxKeyEvent &event);
|
||||||
void OnMouseEvent(wxMouseEvent& event);
|
void OnMouseEvent(wxMouseEvent& event);
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief NOP event handler
|
||||||
/// @param event
|
/// @param event Unused
|
||||||
///
|
|
||||||
void OnEraseBackground(wxEraseEvent &event) {}
|
void OnEraseBackground(wxEraseEvent &event) {}
|
||||||
void OnSizeEvent(wxSizeEvent &event);
|
void OnSizeEvent(wxSizeEvent &event);
|
||||||
|
|
||||||
|
@ -122,35 +102,32 @@ private:
|
||||||
void OnCopyToClipboardRaw(wxCommandEvent &event);
|
void OnCopyToClipboardRaw(wxCommandEvent &event);
|
||||||
void OnSaveSnapshotRaw(wxCommandEvent &event);
|
void OnSaveSnapshotRaw(wxCommandEvent &event);
|
||||||
|
|
||||||
public:
|
/// The current zoom level, where 1.0 = 100%
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
VisualTool *visual;
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
VideoBox *box;
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
double zoomValue;
|
double zoomValue;
|
||||||
|
|
||||||
/// DOCME
|
/// The VideoBox this display is contained in
|
||||||
|
VideoBox *box;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/// The current visual typesetting tool
|
||||||
|
VisualTool *visual;
|
||||||
|
|
||||||
|
/// Whether the display can be freely resized by the user
|
||||||
bool freeSize;
|
bool freeSize;
|
||||||
|
|
||||||
|
/// The video position slider; not used by VideoDisplay
|
||||||
/// DOCME
|
|
||||||
VideoSlider *ControlSlider;
|
VideoSlider *ControlSlider;
|
||||||
|
|
||||||
/// DOCME
|
/// The dropdown box for selecting zoom levels
|
||||||
wxComboBox *zoomBox;
|
wxComboBox *zoomBox;
|
||||||
|
|
||||||
/// DOCME
|
/// The display for the absolute time of the video position
|
||||||
wxTextCtrl *PositionDisplay;
|
wxTextCtrl *PositionDisplay;
|
||||||
|
|
||||||
/// DOCME
|
/// The display for the the video position relative to the current subtitle line
|
||||||
wxTextCtrl *SubsPosition;
|
wxTextCtrl *SubsPosition;
|
||||||
|
|
||||||
VideoDisplay(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxPanelNameStr);
|
VideoDisplay(wxWindow* parent, wxWindowID id, VideoBox *box, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxPanelNameStr);
|
||||||
~VideoDisplay();
|
~VideoDisplay();
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
|
@ -167,7 +144,3 @@ public:
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#include <wx/settings.h>
|
#include <wx/settings.h>
|
||||||
#include "video_slider.h"
|
#include "video_slider.h"
|
||||||
#include "video_display.h"
|
#include "video_display.h"
|
||||||
|
#include "video_context.h"
|
||||||
#include "subs_grid.h"
|
#include "subs_grid.h"
|
||||||
#include "ass_dialogue.h"
|
#include "ass_dialogue.h"
|
||||||
#include "vfr.h"
|
#include "vfr.h"
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
|
|
||||||
#include "visual_feature.h"
|
#include "visual_feature.h"
|
||||||
#include "gl_wrap.h"
|
#include "gl_wrap.h"
|
||||||
|
#include "ass_dialogue.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,15 +37,10 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#include "ass_dialogue.h"
|
|
||||||
|
|
||||||
|
|
||||||
//////////////
|
//////////////
|
||||||
// Prototypes
|
// Prototypes
|
||||||
class OpenGLWrapper;
|
class OpenGLWrapper;
|
||||||
|
class AssDialogue;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
#include <wx/wxprec.h>
|
#include <wx/wxprec.h>
|
||||||
#include "visual_tool.h"
|
#include "visual_tool.h"
|
||||||
#include "video_display.h"
|
#include "video_display.h"
|
||||||
|
#include "video_context.h"
|
||||||
#include "video_provider_manager.h"
|
#include "video_provider_manager.h"
|
||||||
#include "vfr.h"
|
#include "vfr.h"
|
||||||
#include "ass_file.h"
|
#include "ass_file.h"
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
// Headers
|
// Headers
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <wx/log.h>
|
#include <wx/log.h>
|
||||||
#include "video_display.h"
|
|
||||||
#include "gl_wrap.h"
|
#include "gl_wrap.h"
|
||||||
#include "visual_feature.h"
|
#include "visual_feature.h"
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#include "ass_file.h"
|
#include "ass_file.h"
|
||||||
#include "ass_dialogue.h"
|
#include "ass_dialogue.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "video_display.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,8 @@
|
||||||
#include "subs_grid.h"
|
#include "subs_grid.h"
|
||||||
#include "subs_edit_box.h"
|
#include "subs_edit_box.h"
|
||||||
#include "ass_file.h"
|
#include "ass_file.h"
|
||||||
|
#include "video_context.h"
|
||||||
|
#include "video_display.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,8 @@
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "vfr.h"
|
#include "vfr.h"
|
||||||
#include "libresrc/libresrc.h"
|
#include "libresrc/libresrc.h"
|
||||||
|
#include "video_context.h"
|
||||||
|
#include "video_display.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#include "ass_file.h"
|
#include "ass_file.h"
|
||||||
#include "ass_dialogue.h"
|
#include "ass_dialogue.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "video_display.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#include "ass_file.h"
|
#include "ass_file.h"
|
||||||
#include "ass_dialogue.h"
|
#include "ass_dialogue.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "video_display.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#include "ass_file.h"
|
#include "ass_file.h"
|
||||||
#include "ass_dialogue.h"
|
#include "ass_dialogue.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "video_display.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include "visual_tool_vector_clip.h"
|
#include "visual_tool_vector_clip.h"
|
||||||
#include "ass_dialogue.h"
|
#include "ass_dialogue.h"
|
||||||
#include "libresrc/libresrc.h"
|
#include "libresrc/libresrc.h"
|
||||||
|
#include "video_display.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue