1 // Copyright (c) 2005, Rodrigo Braz Monteiro 2 // All rights reserved. 3 // 4 // Redistribution and use in source and binary forms, with or without 5 // modification, are permitted provided that the following conditions are met: 6 // 7 // * Redistributions of source code must retain the above copyright notice, 8 // this list of conditions and the following disclaimer. 9 // * Redistributions in binary form must reproduce the above copyright notice, 10 // this list of conditions and the following disclaimer in the documentation 11 // and/or other materials provided with the distribution. 12 // * Neither the name of the Aegisub Group nor the names of its contributors 13 // may be used to endorse or promote products derived from this software 14 // without specific prior written permission. 15 // 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 // POSSIBILITY OF SUCH DAMAGE. 27 // 28 // Aegisub Project http://www.aegisub.org/ 29 30 #include <memory> 31 #include <wx/frame.h> 32 #include <wx/timer.h> 33 34 class AegisubApp; 35 class AsyncVideoProvider; 36 class AudioBox; 37 class VideoBox; 38 namespace agi { class AudioProvider; } 39 namespace agi { struct Context; class OptionValue; } 40 41 class FrameMain : public wxFrame { 42 friend class AegisubApp; 43 44 std::unique_ptr<agi::Context> context; 45 46 // XXX: Make Freeze()/Thaw() noops on GTK, this seems to be buggy 47 #ifdef __WXGTK__ Freeze(void)48 void Freeze(void) {} Thaw(void)49 void Thaw(void) {} 50 #endif 51 52 bool showVideo = true; ///< Is the video display shown? 53 bool showAudio = true; ///< Is the audio display shown? 54 wxTimer StatusClear; ///< Status bar timeout timer 55 56 void InitContents(); 57 58 void UpdateTitle(); 59 60 void OnKeyDown(wxKeyEvent &event); 61 void OnMouseWheel(wxMouseEvent &evt); 62 63 void OnStatusClear(wxTimerEvent &event); 64 void OnCloseWindow (wxCloseEvent &event); 65 66 void OnAudioOpen(agi::AudioProvider *provider); 67 void OnVideoOpen(AsyncVideoProvider *provider); 68 void OnVideoDetach(agi::OptionValue const& opt); 69 void OnSubtitlesOpen(); 70 71 void EnableToolBar(agi::OptionValue const& opt); 72 73 AudioBox *audioBox; ///< The audio area 74 VideoBox *videoBox; ///< The video area 75 76 wxSizer *MainSizer; ///< Arranges things from top to bottom in the window 77 wxSizer *TopSizer; ///< Arranges video box and tool box from left to right 78 wxSizer *ToolsSizer; ///< Arranges audio and editing areas top to bottom 79 80 public: 81 FrameMain(); 82 ~FrameMain(); 83 84 /// Set the status bar text 85 /// @param text New status bar text 86 /// @param ms Time in milliseconds that the message should be visible 87 void StatusTimeout(wxString text,int ms=10000); 88 89 /// @brief Set the video and audio display visibility 90 /// @param video -1: leave unchanged; 0: hide; 1: show 91 /// @param audio -1: leave unchanged; 0: hide; 1: show 92 void SetDisplayMode(int showVid,int showAudio); 93 IsVideoShown()94 bool IsVideoShown() const { return showVideo; } IsAudioShown()95 bool IsAudioShown() const { return showAudio; } 96 97 DECLARE_EVENT_TABLE() 98 }; 99