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 * Released under the terms of the MIT license.
18 #include "Controller.h"
19 #include "ControllerView.h"
21 #include "ListenerAdapter.h"
23 #include "PlaylistItem.h"
24 #include "VideoView.h"
27 class ControllerObserver
;
28 class PlaylistObserver
;
32 class MainWin
: public BWindow
{
34 MainWin(bool isFirstWindow
,
35 BMessage
* message
= NULL
);
38 virtual void FrameResized(float newWidth
, float newHeight
);
39 virtual void Zoom(BPoint rectPosition
, float rectWidth
,
41 virtual void DispatchMessage(BMessage
* message
,
43 virtual void MessageReceived(BMessage
* message
);
44 virtual void WindowActivated(bool active
);
45 virtual bool QuitRequested();
46 virtual void MenusBeginning();
48 void OpenPlaylist(const BMessage
* playlistArchive
);
49 void OpenPlaylistItem(const PlaylistItemRef
& item
);
52 void ShowPlaylistWindow();
53 void ShowSettingsWindow();
55 void VideoAspectChange(int forcedWidth
,
56 int forcedHeight
, float widthScale
);
57 void VideoAspectChange(float widthScale
);
58 void VideoAspectChange(int widthAspect
,
60 void VideoFormatChange(int width
, int height
,
61 int widthAspect
, int heightAspect
);
63 void GetQuitMessage(BMessage
* message
);
65 virtual BHandler
* ResolveSpecifier(BMessage
* message
, int32 index
,
66 BMessage
* specifier
, int32 what
,
67 const char* property
);
68 virtual status_t
GetSupportedSuites(BMessage
* data
);
71 void _RefsReceived(BMessage
* message
);
72 void _PlaylistItemOpened(
73 const PlaylistItemRef
& item
,
78 void _SetupVideoAspectItems(BMenu
* menu
);
79 void _SetupTrackMenus(BMenu
* audioTrackMenu
,
80 BMenu
* videoTrackMenu
,
81 BMenu
* subTitleTrackMenu
);
82 void _UpdateAudioChannelCount(int32 audioTrackIndex
);
84 void _GetMinimumWindowSize(int& width
,
86 void _SetWindowSizeLimits();
87 void _GetUnscaledVideoSize(int& videoWidth
,
88 int& videoHeight
) const;
89 int _CurrentVideoSizeInPercent() const;
90 void _ZoomVideoView(int percentDiff
);
91 void _ResizeWindow(int percent
,
92 bool useNoVideoWidth
= false,
93 bool stayOnScreen
= false);
94 void _ResizeVideoView(int x
, int y
, int width
,
97 void _MouseDown(BMessage
* message
,
98 BView
* originalHandler
);
99 void _MouseMoved(BMessage
* message
,
100 BView
* originalHandler
);
101 void _MouseUp(BMessage
* message
);
102 void _ShowContextMenu(const BPoint
& screenPoint
);
103 bool _KeyDown(BMessage
* message
);
105 void _ToggleFullscreen();
106 void _ToggleAlwaysOnTop();
107 void _ToggleNoInterface();
108 void _ShowIfNeeded();
109 void _ShowFullscreenControls(bool show
,
110 bool animate
= true);
112 void _Wind(bigtime_t howMuch
, int64 frames
);
114 void _UpdatePlaylistItemFile();
115 void _UpdateAttributesMenu(const BNode
& node
);
116 void _SetRating(int32 rating
);
118 void _UpdateControlsEnabledStatus();
119 void _UpdatePlaylistMenu();
120 void _AddPlaylistItem(PlaylistItem
* item
,
122 void _RemovePlaylistItem(int32 index
);
123 void _MarkPlaylistItem(int32 index
);
124 void _MarkItem(BMenu
* menu
, uint32 command
,
127 void _AdoptGlobalSettings();
130 bigtime_t fCreationTime
;
134 VideoView
* fVideoView
;
135 ControllerView
* fControls
;
137 PlaylistWindow
* fPlaylistWindow
;
140 BMenu
* fPlaylistMenu
;
143 BMenu
* fVideoAspectMenu
;
144 BMenu
* fAudioTrackMenu
;
145 BMenu
* fVideoTrackMenu
;
146 BMenu
* fSubTitleTrackMenu
;
147 BMenuItem
* fNoInterfaceMenuItem
;
148 BMenu
* fAttributesMenu
;
156 PlaylistObserver
* fPlaylistObserver
;
157 Controller
* fController
;
158 ControllerObserver
* fControllerObserver
;
163 bool fShowsFullscreenControls
;
177 bool fMouseDownTracking
;
178 BPoint fMouseDownMousePos
;
179 BPoint fMouseDownWindowPos
;
180 BPoint fLastMousePos
;
181 bigtime_t fLastMouseMovedTime
;
182 float fMouseMoveDist
;
184 ListenerAdapter fGlobalSettingsListener
;
185 bool fCloseWhenDonePlayingMovie
;
186 bool fCloseWhenDonePlayingSound
;
189 bool fScaleFullscreenControls
;
190 bigtime_t fInitialSeekPosition
;
193 static int sNoVideoWidth
;
196 #endif // __MAIN_WIN_H