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-07-01 02:19:55 +02:00
class VisualTool ;
2007-01-11 04:53:20 +01:00
class VideoBox ;
2009-10-05 06:22:28 +02:00
class VideoOutGL ;
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 {
2006-01-16 22:02:54 +01:00
private :
2009-09-10 03:41:34 +02:00
/// The current visual typesetting mode
2007-07-01 02:19:55 +02:00
int visualMode ;
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 ;
2009-09-10 03:41:34 +02:00
/// The width of the display
int w ;
/// The height of the display
int h ;
2010-01-24 20:05:20 +01:00
/// The x-coordinate of the bottom left of the area containing video.
2009-09-10 03:41:34 +02:00
/// Always zero unless the display is detatched and is wider than the video.
int dx1 ;
2010-01-24 20:05:20 +01:00
/// The width of the screen area containing video
2009-09-10 03:41:34 +02:00
int dx2 ;
2010-01-24 20:05:20 +01:00
/// The y-coordinate of the bottom left of the area containing video.
2009-09-10 03:41:34 +02:00
/// Always zero unless the display is detatched and is taller than the video.
int dy1 ;
2010-01-24 20:05:20 +01:00
/// The height of the screen area containing video
2009-09-10 03:41:34 +02:00
int dy2 ;
2010-05-13 20:37:46 +02:00
/// The last seen x position of the mouse; stored for some context menu commands
2009-09-10 03:41:34 +02:00
int mouse_x ;
2010-05-13 20:37:46 +02:00
/// The last seen y position of the mouse; stored for some context menu commands
2009-09-10 03:41:34 +02:00
int mouse_y ;
/// 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-13 20:37:46 +02:00
/// @brief Draw the appropriate overscan masks for the current aspect ratio
2010-05-16 08:38:59 +02:00
void DrawTVEffects ( int sh , int sw ) ;
2010-05-13 20:37:46 +02:00
/// @brief Draw an overscan mask
/// @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
2007-06-28 22:29:56 +02:00
void DrawOverscanMask ( int sizeH , int sizeV , wxColour color , double alpha = 0.5 ) ;
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-13 20:37:46 +02:00
/// @brief Handle keypress events for switching visual typesetting modes
/// @param event
2007-01-09 02:52:30 +01:00
void OnKey ( wxKeyEvent & event ) ;
2010-05-13 20:37:46 +02:00
/// @brief Handle mouse events
/// @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
2007-01-21 07:30:19 +01:00
void OnEraseBackground ( wxEraseEvent & event ) { }
2010-05-13 20:37:46 +02:00
/// @brief Handle resize events
/// @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
2007-04-08 00:03:06 +02:00
void OnCopyCoords ( wxCommandEvent & event ) ;
2010-05-13 20:37:46 +02:00
/// @brief Copy the currently display frame to the clipboard, with subtitles
2007-04-08 00:03:06 +02:00
void OnCopyToClipboard ( wxCommandEvent & event ) ;
2010-05-13 20:37:46 +02:00
/// @brief Save the currently display frame to a file, with subtitles
2007-04-08 00:03:06 +02:00
void OnSaveSnapshot ( wxCommandEvent & event ) ;
2010-05-13 20:37:46 +02:00
/// @brief Copy the currently display frame to the clipboard, without subtitles
2007-04-08 00:03:06 +02:00
void OnCopyToClipboardRaw ( wxCommandEvent & event ) ;
2010-05-13 20:37:46 +02:00
/// @brief Save the currently display frame to a file, without subtitles
2007-04-08 00:03:06 +02:00
void OnSaveSnapshotRaw ( wxCommandEvent & event ) ;
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-09-10 03:41:34 +02:00
/// The current visual typesetting tool
VisualTool * visual ;
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 renderer
2009-10-13 19:28:39 +02:00
std : : auto_ptr < VideoOutGL > videoOut ;
2006-01-29 21:48:05 +01:00
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 Convert mouse coordinates relative to the display to coordinates relative to the video
/// @param x X coordinate
/// @param y Y coordinate
2007-01-23 07:32:16 +01:00
void ConvertMouseCoords ( int & x , int & y ) ;
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
double GetZoom ( ) ;
2010-05-13 20:37:46 +02:00
/// @brief Set the current visual typesetting mode
/// @param mode The new mode
/// @param render Whether the display should be rerendered
2009-10-05 06:22:28 +02:00
void SetVisualMode ( int mode , bool render = false ) ;
2010-05-13 20:37:46 +02:00
/// @brief Event handler for the secondary toolbar which some visual tools use
2009-10-05 06:22:28 +02:00
void OnSubTool ( wxCommandEvent & event ) ;
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
} ;