/* * MainWin.h - Media Player for the Haiku Operating System * * Copyright (C) 2006 Marcus Overhagen * Copyright (C) 2007-2009 Stephan Aßmus (MIT ok) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ #ifndef __MAIN_WIN_H #define __MAIN_WIN_H #include #include #include #include #include "Controller.h" #include "ControllerView.h" #include "InfoWin.h" #include "ListenerAdapter.h" #include "Playlist.h" #include "PlaylistItem.h" #include "VideoView.h" class ControllerObserver; class PlaylistObserver; class PlaylistWindow; class MainWin : public BWindow { public: MainWin(); virtual ~MainWin(); virtual void FrameResized(float newWidth, float newHeight); virtual void Zoom(BPoint rectPosition, float rectWidth, float rectHeight); virtual void DispatchMessage(BMessage* message, BHandler* handler); virtual void MessageReceived(BMessage* message); virtual void WindowActivated(bool active); virtual bool QuitRequested(); void OpenPlaylistItem(const PlaylistItemRef& item); void ShowFileInfo(); void ShowPlaylistWindow(); void ShowSettingsWindow(); void VideoFormatChange(int width, int height, float widthToHeightRatio); private: void _RefsReceived(BMessage* message); void _SetupWindow(); void _CreateMenu(); void _SetupVideoAspectItems(BMenu* menu); void _SetupTrackMenus(BMenu* audioTrackMenu, BMenu* videoTrackMenu); void _GetMinimumWindowSize(int& width, int& height) const; void _SetWindowSizeLimits(); void _ResizeWindow(int percent); void _ResizeVideoView(int x, int y, int width, int height); void _MouseDown(BMessage* message, BView* originalHandler); void _MouseMoved(BMessage* message, BView* originalHandler); void _MouseUp(BMessage* message); void _ShowContextMenu(const BPoint& screenPoint); status_t _KeyDown(BMessage* message); void _ToggleFullscreen(); void _ToggleKeepAspectRatio(); void _ToggleAlwaysOnTop(); void _ToggleNoInterface(); void _UpdateControlsEnabledStatus(); void _UpdatePlaylistMenu(); void _AddPlaylistItem(PlaylistItem* item, int32 index); void _RemovePlaylistItem(int32 index); void _MarkPlaylistItem(int32 index); void _MarkItem(BMenu* menu, uint32 command, bool mark); void _AdoptGlobalSettings(); BMenuBar* fMenuBar; BView* fBackground; VideoView* fVideoView; ControllerView* fControls; InfoWin* fInfoWin; PlaylistWindow* fPlaylistWindow; BMenu* fFileMenu; BMenu* fAudioMenu; BMenu* fVideoMenu; BMenu* fVideoAspectMenu; BMenu* fAudioTrackMenu; BMenu* fVideoTrackMenu; BMenu* fSettingsMenu; BMenuItem* fNoInterfaceMenuItem; BMenu* fPlaylistMenu; bool fHasFile; bool fHasVideo; bool fHasAudio; Playlist* fPlaylist; PlaylistObserver* fPlaylistObserver; Controller* fController; ControllerObserver* fControllerObserver; volatile bool fIsFullscreen; volatile bool fKeepAspectRatio; volatile bool fAlwaysOnTop; volatile bool fNoInterface; int fSourceWidth; int fSourceHeight; float fWidthScale; float fHeightScale; int fMenuBarWidth; int fMenuBarHeight; int fControlsHeight; int fControlsWidth; BRect fSavedFrame; bool fMouseDownTracking; BPoint fMouseDownMousePos; BPoint fMouseDownWindowPos; ListenerAdapter fGlobalSettingsListener; bool fCloseWhenDonePlayingMovie; bool fCloseWhenDonePlayingSound; }; #endif // __MAIN_WIN_H