2 * MainWin.h - Media Player for the Haiku Operating System
4 * Copyright (C) 2006 Marcus Overhagen <marcus@overhagen.de>
5 * Copyright (C) 2007-2010 Stephan Aßmus <superstippi@gmx.de> (MIT ok)
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.
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.
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.
30 #include "Controller.h"
31 #include "ControllerView.h"
33 #include "ListenerAdapter.h"
35 #include "PlaylistItem.h"
36 #include "VideoView.h"
39 class ControllerObserver
;
40 class PlaylistObserver
;
44 class MainWin
: public BWindow
{
46 MainWin(bool isFirstWindow
,
47 BMessage
* message
= NULL
);
50 virtual void FrameResized(float newWidth
, float newHeight
);
51 virtual void Zoom(BPoint rectPosition
, float rectWidth
,
53 virtual void DispatchMessage(BMessage
* message
,
55 virtual void MessageReceived(BMessage
* message
);
56 virtual void WindowActivated(bool active
);
57 virtual bool QuitRequested();
58 virtual void MenusBeginning();
60 void OpenPlaylist(const BMessage
* playlistArchive
);
61 void OpenPlaylistItem(const PlaylistItemRef
& item
);
64 void ShowPlaylistWindow();
65 void ShowSettingsWindow();
67 void VideoAspectChange(int forcedWidth
,
68 int forcedHeight
, float widthScale
);
69 void VideoAspectChange(float widthScale
);
70 void VideoAspectChange(int widthAspect
,
72 void VideoFormatChange(int width
, int height
,
73 int widthAspect
, int heightAspect
);
75 void GetQuitMessage(BMessage
* message
);
77 virtual BHandler
* ResolveSpecifier(BMessage
* message
, int32 index
,
78 BMessage
* specifier
, int32 what
,
79 const char* property
);
80 virtual status_t
GetSupportedSuites(BMessage
* data
);
83 void _RefsReceived(BMessage
* message
);
84 void _PlaylistItemOpened(
85 const PlaylistItemRef
& item
,
90 void _SetupVideoAspectItems(BMenu
* menu
);
91 void _SetupTrackMenus(BMenu
* audioTrackMenu
,
92 BMenu
* videoTrackMenu
,
93 BMenu
* subTitleTrackMenu
);
94 void _UpdateAudioChannelCount(int32 audioTrackIndex
);
96 void _GetMinimumWindowSize(int& width
,
98 void _SetWindowSizeLimits();
99 void _GetUnscaledVideoSize(int& videoWidth
,
100 int& videoHeight
) const;
101 int _CurrentVideoSizeInPercent() const;
102 void _ZoomVideoView(int percentDiff
);
103 void _ResizeWindow(int percent
,
104 bool useNoVideoWidth
= false,
105 bool stayOnScreen
= false);
106 void _ResizeVideoView(int x
, int y
, int width
,
109 void _MouseDown(BMessage
* message
,
110 BView
* originalHandler
);
111 void _MouseMoved(BMessage
* message
,
112 BView
* originalHandler
);
113 void _MouseUp(BMessage
* message
);
114 void _ShowContextMenu(const BPoint
& screenPoint
);
115 bool _KeyDown(BMessage
* message
);
117 void _ToggleFullscreen();
118 void _ToggleAlwaysOnTop();
119 void _ToggleNoInterface();
120 void _ShowIfNeeded();
121 void _ShowFullscreenControls(bool show
,
122 bool animate
= true);
124 void _Wind(bigtime_t howMuch
, int64 frames
);
126 void _UpdatePlaylistItemFile();
127 void _UpdateAttributesMenu(const BNode
& node
);
128 void _SetRating(int32 rating
);
130 void _UpdateControlsEnabledStatus();
131 void _UpdatePlaylistMenu();
132 void _AddPlaylistItem(PlaylistItem
* item
,
134 void _RemovePlaylistItem(int32 index
);
135 void _MarkPlaylistItem(int32 index
);
136 void _MarkItem(BMenu
* menu
, uint32 command
,
139 void _AdoptGlobalSettings();
142 bigtime_t fCreationTime
;
146 VideoView
* fVideoView
;
147 ControllerView
* fControls
;
149 PlaylistWindow
* fPlaylistWindow
;
152 BMenu
* fPlaylistMenu
;
155 BMenu
* fVideoAspectMenu
;
156 BMenu
* fAudioTrackMenu
;
157 BMenu
* fVideoTrackMenu
;
158 BMenu
* fSubTitleTrackMenu
;
159 BMenuItem
* fNoInterfaceMenuItem
;
160 BMenu
* fAttributesMenu
;
168 PlaylistObserver
* fPlaylistObserver
;
169 Controller
* fController
;
170 ControllerObserver
* fControllerObserver
;
175 bool fShowsFullscreenControls
;
189 bool fMouseDownTracking
;
190 BPoint fMouseDownMousePos
;
191 BPoint fMouseDownWindowPos
;
192 BPoint fLastMousePos
;
193 bigtime_t fLastMouseMovedTime
;
194 float fMouseMoveDist
;
196 ListenerAdapter fGlobalSettingsListener
;
197 bool fCloseWhenDonePlayingMovie
;
198 bool fCloseWhenDonePlayingSound
;
201 bool fScaleFullscreenControls
;
202 bigtime_t fInitialSeekPosition
;
205 static int sNoVideoWidth
;
208 #endif // __MAIN_WIN_H