2006-01-16 22:02:54 +01:00
|
|
|
// Copyright (c) 2005, Rodrigo Braz Monteiro
|
|
|
|
// 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/
|
|
|
|
|
|
|
|
/// @file timeedit_ctrl.h
|
|
|
|
/// @see timeedit_ctrl.cpp
|
|
|
|
/// @ingroup custom_control
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2007-09-12 01:22:26 +02:00
|
|
|
#include <wx/textctrl.h>
|
2009-09-11 04:36:34 +02:00
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
#include "ass_time.h"
|
|
|
|
|
2011-12-22 22:18:16 +01:00
|
|
|
#include <libaegisub/signal.h>
|
|
|
|
|
|
|
|
namespace agi {
|
|
|
|
class OptionValue;
|
|
|
|
struct Context;
|
|
|
|
}
|
2009-09-11 04:36:34 +02:00
|
|
|
|
2011-12-22 22:18:16 +01:00
|
|
|
/// @brief A text edit control for editing AssTime objects
|
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
|
|
|
///
|
2011-12-22 22:18:16 +01:00
|
|
|
/// This control constrains values to valid times, and can display the time
|
|
|
|
/// being edited as either a h:mm:ss.cc formatted time, or a frame number
|
2006-01-16 22:02:54 +01:00
|
|
|
class TimeEdit : public wxTextCtrl {
|
2011-12-22 22:18:16 +01:00
|
|
|
agi::Context *c; ///< Project context
|
|
|
|
bool byFrame; ///< Is the time displayed as a frame number?
|
|
|
|
bool isEnd; ///< Should the time be treated as an end time for time <-> frame conversions?
|
|
|
|
AssTime time; ///< The time, which may be displayed as either a frame number or time
|
|
|
|
bool insert; ///< If true, disable overwriting behavior in time mode
|
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
|
|
|
|
2011-12-22 22:18:16 +01:00
|
|
|
agi::signal::Connection insert_opt;
|
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
|
|
|
|
2006-12-17 18:19:45 +01:00
|
|
|
void CopyTime();
|
|
|
|
void PasteTime();
|
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
|
|
|
|
2011-12-22 22:18:16 +01:00
|
|
|
/// Set the value of the text box from the current time and byFrame setting
|
|
|
|
void UpdateText();
|
2006-12-17 18:19:45 +01:00
|
|
|
|
2011-08-31 06:17:37 +02:00
|
|
|
void OnContextMenu(wxContextMenuEvent &event);
|
2011-12-22 22:29:18 +01:00
|
|
|
void OnFocusLost(wxFocusEvent &evt);
|
2011-12-22 22:18:16 +01:00
|
|
|
void OnInsertChanged(agi::OptionValue const& opt);
|
2006-01-16 22:02:54 +01:00
|
|
|
void OnKeyDown(wxKeyEvent &event);
|
2011-12-22 22:18:16 +01:00
|
|
|
void OnModified(wxCommandEvent &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
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
public:
|
2011-12-22 22:18:16 +01:00
|
|
|
/// Get the current time as an AssTime object
|
|
|
|
AssTime GetTime() const { return time; }
|
|
|
|
/// Set the time
|
2011-12-22 22:28:51 +01:00
|
|
|
void SetTime(AssTime time);
|
2011-12-22 22:18:16 +01:00
|
|
|
|
2011-12-22 22:30:22 +01:00
|
|
|
/// Get the current time as a frame number, or 0 if timecodes are unavailable
|
|
|
|
int GetFrame() const;
|
|
|
|
/// Set the time to a frame number. Does nothing if timecodes are unavailable
|
|
|
|
void SetFrame(int fn);
|
|
|
|
|
2011-12-22 22:18:16 +01:00
|
|
|
/// Set whether the time is displayed as a time or the corresponding frame number
|
|
|
|
/// @param enableByFrame If true, frame numbers are displayed
|
|
|
|
void SetByFrame(bool enableByFrame);
|
|
|
|
|
|
|
|
/// Constructor
|
|
|
|
/// @param parent Parent window
|
|
|
|
/// @param id Window id
|
|
|
|
/// @param c Project context
|
|
|
|
/// @param value Initial value. Must be a valid time string or empty
|
|
|
|
/// @param size Initial control size
|
|
|
|
/// @param asEnd Treat the time as a line end time (rather than start) for time <-> frame number conversions
|
2012-01-31 01:44:43 +01:00
|
|
|
TimeEdit(wxWindow* parent, wxWindowID id, agi::Context *c, const wxString& value = wxString(), const wxSize& size = wxDefaultSize, bool asEnd = false);
|
2006-12-17 18:19:45 +01:00
|
|
|
};
|