Cache OptionValue objects used by the video display

Originally committed to SVN as r4425.
This commit is contained in:
Thomas Goyne 2010-06-04 03:07:33 +00:00
parent 3d04db9e90
commit 625ce943f5
4 changed files with 13 additions and 5 deletions

View file

@ -123,6 +123,7 @@ using std::min;
VideoDisplay::VideoDisplay(VideoBox *box, VideoSlider *ControlSlider, wxTextCtrl *PositionDisplay, wxTextCtrl *SubsPosition, wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) VideoDisplay::VideoDisplay(VideoBox *box, VideoSlider *ControlSlider, wxTextCtrl *PositionDisplay, wxTextCtrl *SubsPosition, wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name)
: wxGLCanvas (parent, id, attribList, pos, size, style, name) : wxGLCanvas (parent, id, attribList, pos, size, style, name)
, alwaysShowTools(OPT_GET("Tool/Visual/Always Show"))
, origSize(size) , origSize(size)
, 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)
@ -278,9 +279,7 @@ void VideoDisplay::Render() try {
} }
} }
if (video.x > INT_MIN || if (video.x > INT_MIN || video.y > INT_MIN || alwaysShowTools->GetBool()) {
video.y > INT_MIN ||
OPT_GET("Tool/Visual/Always Show")->GetBool()) {
tool->Draw(); tool->Draw();
} }

View file

@ -47,6 +47,9 @@ class VideoSlider;
class VideoBox; class VideoBox;
class VideoOutGL; class VideoOutGL;
class IVisualTool; class IVisualTool;
namespace agi {
class OptionValue;
}
struct VideoState { struct VideoState {
int x; int x;
@ -59,6 +62,7 @@ struct VideoState {
/// @class VideoDisplay /// @class VideoDisplay
/// @brief DOCME /// @brief DOCME
class VideoDisplay: public wxGLCanvas { class VideoDisplay: public wxGLCanvas {
agi::OptionValue* alwaysShowTools;
/// The unscaled size of the displayed video /// The unscaled size of the displayed video
wxSize origSize; wxSize origSize;

View file

@ -70,7 +70,8 @@ const wxColour IVisualTool::colour[4] = {wxColour(106,32,19), wxColour(255,169,4
template<class FeatureType> template<class FeatureType>
VisualTool<FeatureType>::VisualTool(VideoDisplay *parent, VideoState const& video) VisualTool<FeatureType>::VisualTool(VideoDisplay *parent, VideoState const& video)
: dragStartX(0) : realtime(OPT_GET("Video/Visual Realtime"))
, dragStartX(0)
, dragStartY(0) , dragStartY(0)
, selChanged(false) , selChanged(false)
, parent(parent) , parent(parent)
@ -103,7 +104,7 @@ VisualTool<FeatureType>::~VisualTool() {
template<class FeatureType> template<class FeatureType>
void VisualTool<FeatureType>::OnMouseEvent (wxMouseEvent &event) { void VisualTool<FeatureType>::OnMouseEvent (wxMouseEvent &event) {
bool realTime = OPT_GET("Video/Visual Realtime")->GetBool(); bool realTime = realtime->GetBool();
if (event.Leaving()) { if (event.Leaving()) {
Update(); Update();

View file

@ -50,6 +50,9 @@
class VideoDisplay; class VideoDisplay;
class AssDialogue; class AssDialogue;
struct VideoState; struct VideoState;
namespace agi {
class OptionValue;
}
/// First window id for visualsubtoolbar items /// First window id for visualsubtoolbar items
#define VISUAL_SUB_TOOL_START 1300 #define VISUAL_SUB_TOOL_START 1300
@ -77,6 +80,7 @@ public:
template<class FeatureType> template<class FeatureType>
class VisualTool : public IVisualTool, public SelectionChangeSubscriber { class VisualTool : public IVisualTool, public SelectionChangeSubscriber {
private: private:
agi::OptionValue* realtime; /// Realtime updating option
int dragStartX; /// Starting x coordinate of the current drag, if any int dragStartX; /// Starting x coordinate of the current drag, if any
int dragStartY; /// Starting y coordinate of the current drag, if any int dragStartY; /// Starting y coordinate of the current drag, if any