1 /* 2 * MainWin.h - Media Player for the Haiku Operating System 3 * 4 * Copyright (C) 2006 Marcus Overhagen <marcus@overhagen.de> 5 * Copyright (C) 2007 Stephan Aßmus <superstippi@gmx.de> 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * version 2 as published by the Free Software Foundation. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 * 20 */ 21 #ifndef __MAIN_WIN_H 22 #define __MAIN_WIN_H 23 24 #include <Window.h> 25 #include <Menu.h> 26 #include <Button.h> 27 #include <Slider.h> 28 #include <FilePanel.h> 29 30 #include "Controller.h" 31 #include "ControllerView.h" 32 #include "InfoWin.h" 33 #include "ListenerAdapter.h" 34 #include "Playlist.h" 35 #include "VideoView.h" 36 37 class ControllerObserver; 38 class PlaylistObserver; 39 class PlaylistWindow; 40 41 class MainWin : public BWindow { 42 public: 43 MainWin(); 44 virtual ~MainWin(); 45 46 virtual void FrameResized(float newWidth, float newHeight); 47 virtual void Zoom(BPoint rectPosition, float rectWidth, 48 float rectHeight); 49 virtual void DispatchMessage(BMessage* message, 50 BHandler* handler); 51 virtual void MessageReceived(BMessage* message); 52 virtual void WindowActivated(bool active); 53 virtual bool QuitRequested(); 54 55 void OpenFile(const entry_ref& ref); 56 57 void ShowFileInfo(); 58 void ShowPlaylistWindow(); 59 void ShowSettingsWindow(); 60 61 void VideoFormatChange(int width, int height, 62 float widthScale, float heightScale); 63 64 private: 65 void _RefsReceived(BMessage *message); 66 67 void _SetupWindow(); 68 void _CreateMenu(); 69 void _SetupTrackMenus(); 70 void _SetWindowSizeLimits(); 71 void _ResizeWindow(int percent); 72 void _ResizeVideoView(int x, int y, int width, 73 int height); 74 75 void _MouseDown(BMessage* message, 76 BView* originalHandler); 77 void _MouseMoved(BMessage* message, 78 BView* originalHandler); 79 void _MouseUp(BMessage* message); 80 void _ShowContextMenu(const BPoint& screenPoint); 81 status_t _KeyDown(BMessage* message); 82 83 void _ToggleFullscreen(); 84 void _ToggleKeepAspectRatio(); 85 void _ToggleAlwaysOnTop(); 86 void _ToggleNoBorder(); 87 void _ToggleNoMenu(); 88 void _ToggleNoControls(); 89 void _ToggleNoBorderNoMenu(); 90 91 void _UpdateControlsEnabledStatus(); 92 void _UpdatePlaylistMenu(); 93 void _AddPlaylistItem(const entry_ref& ref, 94 int32 index); 95 void _RemovePlaylistItem(int32 index); 96 void _MarkPlaylistItem(int32 index); 97 void _MarkSettingsItem(uint32 command, bool mark); 98 99 void _AdoptGlobalSettings(); 100 101 BMenuBar* fMenuBar; 102 BView* fBackground; 103 VideoView* fVideoView; 104 BFilePanel* fFilePanel; 105 ControllerView* fControls; 106 InfoWin* fInfoWin; 107 PlaylistWindow* fPlaylistWindow; 108 109 BMenu* fFileMenu; 110 BMenu* fAudioMenu; 111 BMenu* fVideoMenu; 112 BMenu* fAudioTrackMenu; 113 BMenu* fVideoTrackMenu; 114 BMenu* fSettingsMenu; 115 BMenu* fPlaylistMenu; 116 BMenu* fDebugMenu; 117 118 bool fHasFile; 119 bool fHasVideo; 120 bool fHasAudio; 121 122 Playlist* fPlaylist; 123 PlaylistObserver* fPlaylistObserver; 124 Controller* fController; 125 ControllerObserver* fControllerObserver; 126 volatile bool fIsFullscreen; 127 volatile bool fKeepAspectRatio; 128 volatile bool fAlwaysOnTop; 129 volatile bool fNoMenu; 130 volatile bool fNoBorder; 131 volatile bool fNoControls; 132 int fSourceWidth; 133 int fSourceHeight; 134 float fWidthScale; 135 float fHeightScale; 136 int fMenuBarWidth; 137 int fMenuBarHeight; 138 int fControlsHeight; 139 int fControlsWidth; 140 BRect fSavedFrame; 141 bool fMouseDownTracking; 142 BPoint fMouseDownMousePos; 143 BPoint fMouseDownWindowPos; 144 145 ListenerAdapter fGlobalSettingsListener; 146 bool fCloseWhenDonePlayingMovie; 147 bool fCloseWhenDonePlayingSound; 148 }; 149 150 #endif // __MAIN_WIN_H 151