2010-05-13 20:37:41 +02:00
// Copyright (c) 2005-2010, Rodrigo Braz Monteiro
2006-01-16 22:02:54 +01:00
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Aegisub Group nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
2009-07-29 07:43:02 +02:00
// Aegisub Project http://www.aegisub.org/
2006-01-16 22:02:54 +01:00
//
2009-07-29 07:43:02 +02:00
// $Id$
/// @file video_display.h
/// @see video_display.cpp
/// @ingroup video main_ui
///
2006-01-16 22:02:54 +01:00
2009-09-11 04:36:34 +02:00
# ifndef AGI_PRE
2007-06-19 06:14:25 +02:00
# include <wx/glcanvas.h>
2007-09-12 01:22:26 +02:00
# include <wx/combobox.h>
2009-09-10 12:26:50 +02:00
# include <wx/textctrl.h>
2009-10-13 19:28:39 +02:00
# include <memory>
2009-09-11 04:36:34 +02:00
# endif
2006-01-16 22:02:54 +01:00
// Prototypes
class VideoSlider ;
2007-01-11 04:53:20 +01:00
class VideoBox ;
2009-10-05 06:22:28 +02:00
class VideoOutGL ;
2010-05-16 08:39:11 +02:00
class VisualTool ;
struct VideoState {
int x ;
int y ;
int w ;
int h ;
} ;
2007-01-08 22:11:06 +01:00
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
/// @class VideoDisplay
/// @brief DOCME
2007-01-21 07:30:19 +01:00
class VideoDisplay : public wxGLCanvas {
2009-09-10 03:41:34 +02:00
/// The unscaled size of the displayed video
2006-01-16 22:02:54 +01:00
wxSize origSize ;
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
2009-10-05 06:22:28 +02:00
/// The frame number currently being displayed
int currentFrame ;
2010-05-16 08:39:11 +02:00
/// The width of the canvas in screen pixels
2009-09-10 03:41:34 +02:00
int w ;
2010-05-16 08:39:11 +02:00
/// The height of the canvas in screen pixels
2009-09-10 03:41:34 +02:00
int h ;
2010-05-16 08:39:11 +02:00
/// Screen pixels between the left of the canvas and the left of the video
int viewport_x ;
/// The width of the video in screen pixels
int viewport_width ;
/// Screen pixels between the bottom of the canvas and the bottom of the video; used for glViewport
int viewport_bottom ;
/// Screen pixels between the bottom of the canvas and the top of the video; used for coordinate space conversion
int viewport_top ;
/// The height of the video in screen pixels
int viewport_height ;
2009-09-10 03:41:34 +02:00
/// Lock to disable mouse updates during resize operations
2007-01-23 21:50:41 +01:00
bool locked ;
2006-01-16 22:02:54 +01:00
2010-05-16 08:39:11 +02:00
/// @brief Draw an overscan mask
2010-05-13 20:37:46 +02:00
/// @param sizeH The amount of horizontal overscan on one side
/// @param sizeV The amount of vertical overscan on one side
/// @param colour The color of the mask
/// @param alpha The alpha of the mask
2010-05-16 08:39:11 +02:00
void DrawOverscanMask ( int sizeH , int sizeV , wxColor color , double alpha ) const ;
2007-06-28 22:29:56 +02:00
2010-05-13 20:37:46 +02:00
/// @brief Paint event
2006-01-16 22:02:54 +01:00
void OnPaint ( wxPaintEvent & event ) ;
2010-05-16 08:39:11 +02:00
/// @brief Key event handler
/// @param event
2007-01-09 02:52:30 +01:00
void OnKey ( wxKeyEvent & event ) ;
2010-05-16 08:39:11 +02:00
/// @brief Mouse event handler
2010-05-13 20:37:46 +02:00
/// @param event
2007-05-28 20:45:57 +02:00
void OnMouseEvent ( wxMouseEvent & event ) ;
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
2009-09-10 03:41:34 +02:00
/// @brief NOP event handler
2010-05-16 08:39:11 +02:00
void OnEraseBackground ( wxEraseEvent & ) { }
/// @brief Recalculate video positioning and scaling when the available area or zoom changes
2010-05-13 20:37:46 +02:00
/// @param event
2007-01-23 05:42:08 +01:00
void OnSizeEvent ( wxSizeEvent & event ) ;
2006-01-16 22:02:54 +01:00
2010-05-13 20:37:46 +02:00
/// @brief Copy coordinates of the mouse to the clipboard
2010-05-16 08:39:11 +02:00
void OnCopyCoords ( wxCommandEvent & ) ;
2010-05-13 20:37:46 +02:00
/// @brief Copy the currently display frame to the clipboard, with subtitles
2010-05-16 08:39:11 +02:00
void OnCopyToClipboard ( wxCommandEvent & ) ;
2010-05-13 20:37:46 +02:00
/// @brief Save the currently display frame to a file, with subtitles
2010-05-16 08:39:11 +02:00
void OnSaveSnapshot ( wxCommandEvent & ) ;
2010-05-13 20:37:46 +02:00
/// @brief Copy the currently display frame to the clipboard, without subtitles
2010-05-16 08:39:11 +02:00
void OnCopyToClipboardRaw ( wxCommandEvent & ) ;
2010-05-13 20:37:46 +02:00
/// @brief Save the currently display frame to a file, without subtitles
2010-05-16 08:39:11 +02:00
void OnSaveSnapshotRaw ( wxCommandEvent & ) ;
2007-04-08 00:03:06 +02:00
2009-09-10 03:41:34 +02:00
/// The current zoom level, where 1.0 = 100%
double zoomValue ;
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
2009-10-05 06:22:28 +02:00
/// The video position slider
VideoSlider * ControlSlider ;
/// The display for the the video position relative to the current subtitle line
wxTextCtrl * SubsPosition ;
/// The display for the absolute time of the video position
wxTextCtrl * PositionDisplay ;
2006-12-18 03:44:38 +01:00
2009-10-05 06:22:28 +02:00
/// The video renderer
2009-10-13 19:28:39 +02:00
std : : auto_ptr < VideoOutGL > videoOut ;
2006-01-29 21:48:05 +01:00
2010-05-16 08:39:11 +02:00
/// The active visual typesetting tool
std : : auto_ptr < VisualTool > tool ;
/// The current tool's ID
int activeMode ;
/// The toolbar used by individual typesetting tools
wxToolBar * toolBar ;
void OnMode ( const wxCommandEvent & event ) ;
void SetMode ( int mode ) ;
/// @brief Switch the active tool to a new object of the specified class
/// @param T The class of the new visual typsetting tool
template < class T > void SetTool ( ) ;
/// The current script width
int scriptW ;
/// The current script height
int scriptH ;
VideoState video ;
2009-10-05 06:22:28 +02:00
public :
/// The VideoBox this display is contained in
VideoBox * box ;
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
2009-09-10 03:41:34 +02:00
/// The dropdown box for selecting zoom levels
2006-01-16 22:02:54 +01:00
wxComboBox * zoomBox ;
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
2009-10-05 06:22:28 +02:00
/// Whether the display can be freely resized by the user
bool freeSize ;
2006-01-16 22:02:54 +01:00
2010-05-13 20:37:46 +02:00
/// @brief Constructor
/// @param parent Pointer to a parent window.
/// @param id Window identifier. If -1, will automatically create an identifier.
/// @param pos Window position. wxDefaultPosition is (-1, -1) which indicates that wxWidgets should generate a default position for the window.
/// @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 Window style.
/// @param name Window name.
2009-10-05 06:22:28 +02:00
VideoDisplay ( VideoBox * box , VideoSlider * ControlSlider , wxTextCtrl * PositionDisplay , wxTextCtrl * SubsPosition , wxWindow * parent , wxWindowID id , const wxPoint & pos = wxDefaultPosition , const wxSize & size = wxDefaultSize , long style = 0 , const wxString & name = wxPanelNameStr ) ;
2006-01-16 22:02:54 +01:00
~ VideoDisplay ( ) ;
2010-05-13 20:37:46 +02:00
/// @brief Reset the size of the display to the video size
2006-01-16 22:02:54 +01:00
void Reset ( ) ;
2007-01-21 07:30:19 +01:00
2010-05-13 20:37:46 +02:00
/// @brief Set this video display to the given frame
/// @frameNumber The desired frame number
2009-10-05 06:22:28 +02:00
void SetFrame ( int frameNumber ) ;
2010-05-13 20:37:46 +02:00
/// @brief Get the number of the currently displayed framed
2009-10-05 06:22:28 +02:00
int GetFrame ( ) const { return currentFrame ; }
2010-05-13 20:37:46 +02:00
/// @brief Set the range of valid frame numbers for the slider
/// @from Minimum frame number
/// @to Maximum frame number; must be >= from or strange things may happen
2009-10-05 06:22:28 +02:00
void SetFrameRange ( int from , int to ) ;
2010-05-13 20:37:46 +02:00
/// @brief Render the currently visible frame
2009-10-27 15:27:39 +01:00
void Render ( ) ;
2007-01-21 07:30:19 +01:00
2010-05-13 20:37:46 +02:00
/// @brief Set the cursor to either default or blank
/// @param show Whether or not the cursor should be visible
2007-04-18 06:51:17 +02:00
void ShowCursor ( bool show ) ;
2010-05-13 20:37:46 +02:00
/// @brief Set the size of the display based on the current zoom and video resolution
2007-01-21 07:30:19 +01:00
void UpdateSize ( ) ;
2010-05-01 03:07:05 +02:00
/// @brief Set the zoom level
/// @param value The new zoom level
2006-01-22 13:44:53 +01:00
void SetZoom ( double value ) ;
2010-05-01 03:07:05 +02:00
/// @brief Set the zoom level to that indicated by the dropdown
void SetZoomFromBox ( ) ;
/// @brief Get the current zoom level
2010-05-16 08:39:11 +02:00
double GetZoom ( ) const ;
/// @brief Convert a point from screen to script coordinate frame
/// @param x x coordinate; in/out
/// @param y y coordinate; in/out
void ToScriptCoords ( int * x , int * y ) const ;
/// @brief Convert a point from script to screen coordinate frame
/// @param x x coordinate; in/out
/// @param y y coordinate; in/out
void FromScriptCoords ( int * x , int * y ) const ;
2006-01-16 22:02:54 +01:00
2006-01-19 11:33:56 +01:00
DECLARE_EVENT_TABLE ( )
2006-01-16 22:02:54 +01:00
} ;