From f0e352f382dfb998c6eef9d7f20c2b29442c7a07 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Thu, 22 Dec 2011 21:30:49 +0000 Subject: [PATCH] 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. --- aegisub/src/command/app.cpp | 18 +++++++++++++++++- aegisub/src/frame_main.h | 5 +++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/aegisub/src/command/app.cpp b/aegisub/src/command/app.cpp index 2128a050b..a5e94893e 100644 --- a/aegisub/src/command/app.cpp +++ b/aegisub/src/command/app.cpp @@ -83,13 +83,17 @@ struct app_display_audio_subs : public Command { STR_HELP("Display audio and subtitles only.") CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO) - void operator()(agi::Context *c) { + void operator()(agi::Context *) { wxGetApp().frame->SetDisplayMode(0,1); } bool Validate(const agi::Context *c) { 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) { 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) { 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) { return c->videoController->IsLoaded() && !c->detachedVideo; } + + bool IsActive(const agi::Context *) { + return !wxGetApp().frame->IsAudioShown() && wxGetApp().frame->IsVideoShown(); + } }; diff --git a/aegisub/src/frame_main.h b/aegisub/src/frame_main.h index 7eb76978e..cb90d164e 100644 --- a/aegisub/src/frame_main.h +++ b/aegisub/src/frame_main.h @@ -133,10 +133,15 @@ public: /// @param text New status bar text /// @param ms Time in milliseconds that the message should be visible void StatusTimeout(wxString text,int ms=10000); + /// @brief Set the video and audio display visibility /// @param video -1: leave unchanged; 0: hide; 1: show /// @param audio -1: leave unchanged; 0: hide; 1: show void SetDisplayMode(int showVid,int showAudio); + + bool IsVideoShown() const { return showVideo; } + bool IsAudioShown() const { return showAudio; } + void LoadSubtitles(wxString filename,wxString charset=""); DECLARE_EVENT_TABLE()