BTRFS: Implement BTree::Path and change _Find.
[haiku.git] / src / apps / mediaplayer / MainWin.h
blobc2b2de815fff7c676f9e1c101829c7968f5200b3
1 /*
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.
21 #ifndef __MAIN_WIN_H
22 #define __MAIN_WIN_H
25 #include <Window.h>
26 #include <Menu.h>
27 #include <Button.h>
28 #include <Slider.h>
30 #include "Controller.h"
31 #include "ControllerView.h"
32 #include "InfoWin.h"
33 #include "ListenerAdapter.h"
34 #include "Playlist.h"
35 #include "PlaylistItem.h"
36 #include "VideoView.h"
39 class ControllerObserver;
40 class PlaylistObserver;
41 class PlaylistWindow;
44 class MainWin : public BWindow {
45 public:
46 MainWin(bool isFirstWindow,
47 BMessage* message = NULL);
48 virtual ~MainWin();
50 virtual void FrameResized(float newWidth, float newHeight);
51 virtual void Zoom(BPoint rectPosition, float rectWidth,
52 float rectHeight);
53 virtual void DispatchMessage(BMessage* message,
54 BHandler* handler);
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);
63 void ShowFileInfo();
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,
71 int heightAspect);
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);
82 private:
83 void _RefsReceived(BMessage* message);
84 void _PlaylistItemOpened(
85 const PlaylistItemRef& item,
86 status_t result);
88 void _SetupWindow();
89 void _CreateMenu();
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,
97 int& height) const;
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,
107 int height);
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,
133 int32 index);
134 void _RemovePlaylistItem(int32 index);
135 void _MarkPlaylistItem(int32 index);
136 void _MarkItem(BMenu* menu, uint32 command,
137 bool mark);
139 void _AdoptGlobalSettings();
141 private:
142 bigtime_t fCreationTime;
144 BMenuBar* fMenuBar;
145 BView* fBackground;
146 VideoView* fVideoView;
147 ControllerView* fControls;
148 InfoWin* fInfoWin;
149 PlaylistWindow* fPlaylistWindow;
151 BMenu* fFileMenu;
152 BMenu* fPlaylistMenu;
153 BMenu* fAudioMenu;
154 BMenu* fVideoMenu;
155 BMenu* fVideoAspectMenu;
156 BMenu* fAudioTrackMenu;
157 BMenu* fVideoTrackMenu;
158 BMenu* fSubTitleTrackMenu;
159 BMenuItem* fNoInterfaceMenuItem;
160 BMenu* fAttributesMenu;
161 BMenu* fRatingMenu;
163 bool fHasFile;
164 bool fHasVideo;
165 bool fHasAudio;
167 Playlist* fPlaylist;
168 PlaylistObserver* fPlaylistObserver;
169 Controller* fController;
170 ControllerObserver* fControllerObserver;
172 bool fIsFullscreen;
173 bool fAlwaysOnTop;
174 bool fNoInterface;
175 bool fShowsFullscreenControls;
177 int fSourceWidth;
178 int fSourceHeight;
179 int fWidthAspect;
180 int fHeightAspect;
181 int fMenuBarWidth;
182 int fMenuBarHeight;
183 int fControlsHeight;
184 int fControlsWidth;
185 int fNoVideoWidth;
186 BRect fSavedFrame;
187 BRect fNoVideoFrame;
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;
199 bool fLoopMovies;
200 bool fLoopSounds;
201 bool fScaleFullscreenControls;
202 bigtime_t fInitialSeekPosition;
203 bool fAllowWinding;
205 static int sNoVideoWidth;
208 #endif // __MAIN_WIN_H