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)
: wxGLCanvas (parent, id, attribList, pos, size, style, name)
, alwaysShowTools(OPT_GET("Tool/Visual/Always Show"))
, origSize(size)
, currentFrame(-1)
, 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 ||
video.y > INT_MIN ||
OPT_GET("Tool/Visual/Always Show")->GetBool()) {
if (video.x > INT_MIN || video.y > INT_MIN || alwaysShowTools->GetBool()) {
tool->Draw();
}

View file

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

View file

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

View file

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