Update the view menu after the display mode has been automatically updated due to opening video or audio. Closes #1344.

Originally committed to SVN as r6135.
This commit is contained in:
Thomas Goyne 2011-12-22 21:30:49 +00:00
parent 5eb516f8d9
commit f0e352f382
2 changed files with 22 additions and 1 deletions

View file

@ -83,13 +83,17 @@ struct app_display_audio_subs : public Command {
STR_HELP("Display audio and subtitles only.") STR_HELP("Display audio and subtitles only.")
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO) CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
void operator()(agi::Context *c) { void operator()(agi::Context *) {
wxGetApp().frame->SetDisplayMode(0,1); wxGetApp().frame->SetDisplayMode(0,1);
} }
bool Validate(const agi::Context *c) { bool Validate(const agi::Context *c) {
return c->audioController->IsAudioOpen(); return c->audioController->IsAudioOpen();
} }
bool IsActive(const agi::Context *) {
return wxGetApp().frame->IsAudioShown() && !wxGetApp().frame->IsVideoShown();
}
}; };
@ -108,6 +112,10 @@ struct app_display_full : public Command {
bool Validate(const agi::Context *c) { bool Validate(const agi::Context *c) {
return c->audioController->IsAudioOpen() && c->videoController->IsLoaded() && !c->detachedVideo; return c->audioController->IsAudioOpen() && c->videoController->IsLoaded() && !c->detachedVideo;
} }
bool IsActive(const agi::Context *) {
return wxGetApp().frame->IsAudioShown() && wxGetApp().frame->IsVideoShown();
}
}; };
@ -122,6 +130,10 @@ struct app_display_subs : public Command {
void operator()(agi::Context *c) { void operator()(agi::Context *c) {
wxGetApp().frame->SetDisplayMode(0,0); wxGetApp().frame->SetDisplayMode(0,0);
} }
bool IsActive(const agi::Context *) {
return !wxGetApp().frame->IsAudioShown() && !wxGetApp().frame->IsVideoShown();
}
}; };
@ -140,6 +152,10 @@ struct app_display_video_subs : public Command {
bool Validate(const agi::Context *c) { bool Validate(const agi::Context *c) {
return c->videoController->IsLoaded() && !c->detachedVideo; return c->videoController->IsLoaded() && !c->detachedVideo;
} }
bool IsActive(const agi::Context *) {
return !wxGetApp().frame->IsAudioShown() && wxGetApp().frame->IsVideoShown();
}
}; };

View file

@ -133,10 +133,15 @@ public:
/// @param text New status bar text /// @param text New status bar text
/// @param ms Time in milliseconds that the message should be visible /// @param ms Time in milliseconds that the message should be visible
void StatusTimeout(wxString text,int ms=10000); void StatusTimeout(wxString text,int ms=10000);
/// @brief Set the video and audio display visibility /// @brief Set the video and audio display visibility
/// @param video -1: leave unchanged; 0: hide; 1: show /// @param video -1: leave unchanged; 0: hide; 1: show
/// @param audio -1: leave unchanged; 0: hide; 1: show /// @param audio -1: leave unchanged; 0: hide; 1: show
void SetDisplayMode(int showVid,int showAudio); void SetDisplayMode(int showVid,int showAudio);
bool IsVideoShown() const { return showVideo; }
bool IsAudioShown() const { return showAudio; }
void LoadSubtitles(wxString filename,wxString charset=""); void LoadSubtitles(wxString filename,wxString charset="");
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()