Store OptionValues used by VideoContext

Originally committed to SVN as r4462.
This commit is contained in:
Thomas Goyne 2010-06-08 06:09:13 +00:00
parent a12ec002c6
commit c7da8d9f61
2 changed files with 16 additions and 14 deletions

View File

@ -123,6 +123,7 @@ VideoContext::VideoContext()
, grid(NULL) , grid(NULL)
, curLine(NULL) , curLine(NULL)
, audio(NULL) , audio(NULL)
, playAudioOnStep(OPT_GET("Audio/Plays When Stepping Video"))
{ {
} }
@ -331,7 +332,8 @@ void VideoContext::UpdateDisplays(bool full) {
// Update audio display // Update audio display
if (audio && audio->loaded && audio->IsShownOnScreen()) { if (audio && audio->loaded && audio->IsShownOnScreen()) {
if (OPT_GET("Audio/Display/Draw/Video Position")->GetBool()) { static agi::OptionValue* opt = OPT_GET("Audio/Display/Draw/Video Position");
if (opt->GetBool()) {
audio->UpdateImage(false); audio->UpdateImage(false);
} }
} }
@ -376,7 +378,8 @@ void VideoContext::JumpToFrame(int n) {
UpdateDisplays(false); UpdateDisplays(false);
// Update grid // Update grid
if (!isPlaying && OPT_GET("Subtitle/Grid/Highlight Subtitles in Frame")->GetBool()) grid->Refresh(false); static agi::OptionValue* highlight = OPT_GET("Subtitle/Grid/Highlight Subtitles in Frame");
if (!isPlaying && highlight->GetBool()) grid->Refresh(false);
} }
@ -441,7 +444,8 @@ AegiVideoFrame VideoContext::GetFrame(int n,bool raw) {
/// ///
void VideoContext::SaveSnapshot(bool raw) { void VideoContext::SaveSnapshot(bool raw) {
// Get folder // Get folder
wxString option = lagi_wxString(OPT_GET("Path/Screenshot")->GetString()); static agi::OptionValue* ssPath = OPT_GET("Path/Screenshot");
wxString option = lagi_wxString(ssPath->GetString());
wxFileName videoFile(videoName); wxFileName videoFile(videoName);
wxString basepath; wxString basepath;
// Is it a path specifier and not an actual fixed path? // Is it a path specifier and not an actual fixed path?
@ -495,7 +499,7 @@ void VideoContext::PlayNextFrame() {
int thisFrame = frame_n; int thisFrame = frame_n;
JumpToFrame(frame_n + 1); JumpToFrame(frame_n + 1);
// Start playing audio // Start playing audio
if (OPT_GET("Audio/Plays When Stepping Video")->GetBool()) if (playAudioOnStep->GetBool())
audio->Play(VFR_Output.GetTimeAtFrame(thisFrame),VFR_Output.GetTimeAtFrame(thisFrame + 1)); audio->Play(VFR_Output.GetTimeAtFrame(thisFrame),VFR_Output.GetTimeAtFrame(thisFrame + 1));
} }
@ -509,7 +513,7 @@ void VideoContext::PlayPrevFrame() {
int thisFrame = frame_n; int thisFrame = frame_n;
JumpToFrame(frame_n -1); JumpToFrame(frame_n -1);
// Start playing audio // Start playing audio
if (OPT_GET("Audio/Plays When Stepping Video")->GetBool()) if (playAudioOnStep->GetBool())
audio->Play(VFR_Output.GetTimeAtFrame(thisFrame - 1),VFR_Output.GetTimeAtFrame(thisFrame)); audio->Play(VFR_Output.GetTimeAtFrame(thisFrame - 1),VFR_Output.GetTimeAtFrame(thisFrame));
} }

View File

@ -34,8 +34,6 @@
/// @ingroup video /// @ingroup video
/// ///
///////////
// Headers
#ifndef AGI_PRE #ifndef AGI_PRE
#include <time.h> #include <time.h>
@ -56,23 +54,21 @@
#else #else
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glu.h> #include <GL/glu.h>
/// DOCME
typedef GLuint GLhandleARB;
#endif #endif
#include "video_frame.h" #include "video_frame.h"
//////////////
// Prototypes
class SubtitlesGrid; class SubtitlesGrid;
class AudioProvider; class AudioProvider;
class AudioDisplay; class AudioDisplay;
class AssDialogue; class AssDialogue;
class SubtitlesProvider;
class VideoProvider; class VideoProvider;
class VideoDisplay; class VideoDisplay;
class SubtitlesProvider;
namespace agi {
class OptionValue;
}
/// DOCME /// DOCME
/// @class VideoContext /// @class VideoContext
@ -175,6 +171,8 @@ private:
bool hasSubtitles; bool hasSubtitles;
agi::OptionValue* playAudioOnStep;
void OnPlayTimer(wxTimerEvent &event); void OnPlayTimer(wxTimerEvent &event);
public: public: