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 #include "Controller.h" 30 #include "ControllerView.h" 31 #include "InfoWin.h" 32 #include "VideoView.h" 33 #include "Playlist.h" 34 35 36 class ControllerObserver; 37 class PlaylistObserver; 38 class PlaylistWindow; 39 40 class MainWin : public BWindow { 41 public: 42 MainWin(); 43 virtual ~MainWin(); 44 45 virtual void FrameResized(float newWidth, float newHeight); 46 virtual void Zoom(BPoint rectPosition, float rectWidth, 47 float rectHeight); 48 virtual void DispatchMessage(BMessage* message, 49 BHandler* handler); 50 virtual void MessageReceived(BMessage* message); 51 virtual bool QuitRequested(); 52 53 void OpenFile(const entry_ref& ref); 54 55 void ShowFileInfo(); 56 void ShowPlaylistWindow(); 57 58 void VideoFormatChange(int width, int height, 59 float widthScale, float heightScale); 60 61 private: 62 void _RefsReceived(BMessage *message); 63 64 void _SetupWindow(); 65 void _CreateMenu(); 66 void _SetupTrackMenus(); 67 void _SetWindowSizeLimits(); 68 void _ResizeWindow(int percent); 69 void _ResizeVideoView(int x, int y, int width, 70 int height); 71 72 void _MouseDown(BMessage* message, 73 BView* originalHandler); 74 void _MouseMoved(BMessage* message, 75 BView* originalHandler); 76 void _MouseUp(BMessage* message); 77 void _ShowContextMenu(const BPoint& screenPoint); 78 status_t _KeyDown(BMessage* message); 79 80 void _ToggleFullscreen(); 81 void _ToggleKeepAspectRatio(); 82 void _ToggleAlwaysOnTop(); 83 void _ToggleNoBorder(); 84 void _ToggleNoMenu(); 85 void _ToggleNoControls(); 86 void _ToggleNoBorderNoMenu(); 87 88 void _UpdateControlsEnabledStatus(); 89 void _UpdatePlaylistMenu(); 90 void _AddPlaylistItem(const entry_ref& ref, 91 int32 index); 92 void _RemovePlaylistItem(int32 index); 93 void _MarkPlaylistItem(int32 index); 94 void _MarkSettingsItem(uint32 command, bool mark); 95 96 BMenuBar* fMenuBar; 97 BView* fBackground; 98 VideoView* fVideoView; 99 BFilePanel* fFilePanel; 100 ControllerView* fControls; 101 InfoWin* fInfoWin; 102 PlaylistWindow* fPlaylistWindow; 103 104 BMenu* fFileMenu; 105 BMenu* fAudioMenu; 106 BMenu* fVideoMenu; 107 BMenu* fAudioTrackMenu; 108 BMenu* fVideoTrackMenu; 109 BMenu* fSettingsMenu; 110 BMenu* fPlaylistMenu; 111 BMenu* fDebugMenu; 112 113 bool fHasFile; 114 bool fHasVideo; 115 bool fHasAudio; 116 117 Playlist* fPlaylist; 118 PlaylistObserver* fPlaylistObserver; 119 Controller* fController; 120 ControllerObserver* fControllerObserver; 121 volatile bool fIsFullscreen; 122 volatile bool fKeepAspectRatio; 123 volatile bool fAlwaysOnTop; 124 volatile bool fNoMenu; 125 volatile bool fNoBorder; 126 volatile bool fNoControls; 127 int fSourceWidth; 128 int fSourceHeight; 129 float fWidthScale; 130 float fHeightScale; 131 int fMenuBarWidth; 132 int fMenuBarHeight; 133 int fControlsHeight; 134 int fControlsWidth; 135 BRect fSavedFrame; 136 bool fMouseDownTracking; 137 BPoint fMouseDownMousePos; 138 BPoint fMouseDownWindowPos; 139 }; 140 141 #endif // __MAIN_WIN_H 142