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-2009 Stephan Aßmus <superstippi@gmx.de> (MIT ok) 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 29 #include "Controller.h" 30 #include "ControllerView.h" 31 #include "InfoWin.h" 32 #include "ListenerAdapter.h" 33 #include "Playlist.h" 34 #include "PlaylistItem.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 OpenPlaylistItem(const PlaylistItemRef& item); 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(PlaylistItem* item, 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 ControllerView* fControls; 105 InfoWin* fInfoWin; 106 PlaylistWindow* fPlaylistWindow; 107 108 BMenu* fFileMenu; 109 BMenu* fAudioMenu; 110 BMenu* fVideoMenu; 111 BMenu* fAudioTrackMenu; 112 BMenu* fVideoTrackMenu; 113 BMenu* fSettingsMenu; 114 BMenu* fPlaylistMenu; 115 BMenu* fDebugMenu; 116 117 bool fHasFile; 118 bool fHasVideo; 119 bool fHasAudio; 120 121 Playlist* fPlaylist; 122 PlaylistObserver* fPlaylistObserver; 123 Controller* fController; 124 ControllerObserver* fControllerObserver; 125 volatile bool fIsFullscreen; 126 volatile bool fKeepAspectRatio; 127 volatile bool fAlwaysOnTop; 128 volatile bool fNoMenu; 129 volatile bool fNoBorder; 130 volatile bool fNoControls; 131 int fSourceWidth; 132 int fSourceHeight; 133 float fWidthScale; 134 float fHeightScale; 135 int fMenuBarWidth; 136 int fMenuBarHeight; 137 int fControlsHeight; 138 int fControlsWidth; 139 BRect fSavedFrame; 140 bool fMouseDownTracking; 141 BPoint fMouseDownMousePos; 142 BPoint fMouseDownWindowPos; 143 144 ListenerAdapter fGlobalSettingsListener; 145 bool fCloseWhenDonePlayingMovie; 146 bool fCloseWhenDonePlayingSound; 147 }; 148 149 #endif // __MAIN_WIN_H 150