Unified the "no menu, border, controls" settings to a single "no interface"
setting and made them available in the context menu again. During my testing, I couldn't find any weird behavior, only the window dragging should still be a problem on slower computers when multiple mouse messages piled up. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31324 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -68,12 +68,9 @@ enum {
|
|||||||
M_FILE_QUIT,
|
M_FILE_QUIT,
|
||||||
M_VIEW_SIZE,
|
M_VIEW_SIZE,
|
||||||
M_TOGGLE_FULLSCREEN,
|
M_TOGGLE_FULLSCREEN,
|
||||||
M_TOGGLE_NO_BORDER,
|
|
||||||
M_TOGGLE_NO_MENU,
|
|
||||||
M_TOGGLE_NO_CONTROLS,
|
|
||||||
M_TOGGLE_NO_BORDER_NO_MENU_NO_CONTROLS,
|
|
||||||
M_TOGGLE_ALWAYS_ON_TOP,
|
|
||||||
M_TOGGLE_KEEP_ASPECT_RATIO,
|
M_TOGGLE_KEEP_ASPECT_RATIO,
|
||||||
|
M_TOGGLE_ALWAYS_ON_TOP,
|
||||||
|
M_TOGGLE_NO_INTERFACE,
|
||||||
M_VOLUME_UP,
|
M_VOLUME_UP,
|
||||||
M_VOLUME_DOWN,
|
M_VOLUME_DOWN,
|
||||||
M_SKIP_NEXT,
|
M_SKIP_NEXT,
|
||||||
@@ -116,9 +113,7 @@ MainWin::MainWin()
|
|||||||
fIsFullscreen(false),
|
fIsFullscreen(false),
|
||||||
fKeepAspectRatio(true),
|
fKeepAspectRatio(true),
|
||||||
fAlwaysOnTop(false),
|
fAlwaysOnTop(false),
|
||||||
fNoMenu(false),
|
fNoInterface(false),
|
||||||
fNoBorder(false),
|
|
||||||
fNoControls(false),
|
|
||||||
fSourceWidth(-1),
|
fSourceWidth(-1),
|
||||||
fSourceHeight(-1),
|
fSourceHeight(-1),
|
||||||
fWidthScale(1.0),
|
fWidthScale(1.0),
|
||||||
@@ -241,8 +236,8 @@ MainWin::FrameResized(float newWidth, float newHeight)
|
|||||||
debugger("size wrong\n");
|
debugger("size wrong\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool noMenu = fNoMenu || fIsFullscreen;
|
bool noMenu = fNoInterface || fIsFullscreen;
|
||||||
bool noControls = fNoControls || fIsFullscreen;
|
bool noControls = fNoInterface || fIsFullscreen;
|
||||||
|
|
||||||
// printf("FrameResized enter: newWidth %.0f, newHeight %.0f\n",
|
// printf("FrameResized enter: newWidth %.0f, newHeight %.0f\n",
|
||||||
// newWidth, newHeight);
|
// newWidth, newHeight);
|
||||||
@@ -260,7 +255,7 @@ MainWin::FrameResized(float newWidth, float newHeight)
|
|||||||
if (!fMenuBar->IsHidden())
|
if (!fMenuBar->IsHidden())
|
||||||
fMenuBar->Hide();
|
fMenuBar->Hide();
|
||||||
} else {
|
} else {
|
||||||
// fMenuBar->MoveTo(0, y);
|
fMenuBar->MoveTo(0, y);
|
||||||
fMenuBar->ResizeTo(newWidth, fMenuBarHeight - 1);
|
fMenuBar->ResizeTo(newWidth, fMenuBarHeight - 1);
|
||||||
if (fMenuBar->IsHidden())
|
if (fMenuBar->IsHidden())
|
||||||
fMenuBar->Show();
|
fMenuBar->Show();
|
||||||
@@ -268,9 +263,7 @@ MainWin::FrameResized(float newWidth, float newHeight)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (maxVideoHeight == 0) {
|
if (maxVideoHeight == 0) {
|
||||||
bool hidden = fVideoView->IsHidden();
|
if (!fVideoView->IsHidden())
|
||||||
// printf(" video view hidden: %d\n", hidden);
|
|
||||||
if (!hidden)
|
|
||||||
fVideoView->Hide();
|
fVideoView->Hide();
|
||||||
} else {
|
} else {
|
||||||
_ResizeVideoView(0, y, maxVideoWidth, maxVideoHeight);
|
_ResizeVideoView(0, y, maxVideoWidth, maxVideoHeight);
|
||||||
@@ -534,28 +527,16 @@ MainWin::MessageReceived(BMessage *msg)
|
|||||||
_ToggleFullscreen();
|
_ToggleFullscreen();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case M_TOGGLE_NO_MENU:
|
case M_TOGGLE_KEEP_ASPECT_RATIO:
|
||||||
_ToggleNoMenu();
|
_ToggleKeepAspectRatio();
|
||||||
break;
|
|
||||||
|
|
||||||
case M_TOGGLE_NO_CONTROLS:
|
|
||||||
_ToggleNoControls();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case M_TOGGLE_NO_BORDER:
|
|
||||||
_ToggleNoBorder();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case M_TOGGLE_ALWAYS_ON_TOP:
|
case M_TOGGLE_ALWAYS_ON_TOP:
|
||||||
_ToggleAlwaysOnTop();
|
_ToggleAlwaysOnTop();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case M_TOGGLE_KEEP_ASPECT_RATIO:
|
case M_TOGGLE_NO_INTERFACE:
|
||||||
_ToggleKeepAspectRatio();
|
_ToggleNoInterface();
|
||||||
break;
|
|
||||||
|
|
||||||
case M_TOGGLE_NO_BORDER_NO_MENU_NO_CONTROLS:
|
|
||||||
_ToggleNoBorderNoMenu();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case M_VIEW_SIZE:
|
case M_VIEW_SIZE:
|
||||||
@@ -952,12 +933,9 @@ MainWin::_CreateMenu()
|
|||||||
item->SetMarked(fKeepAspectRatio);
|
item->SetMarked(fKeepAspectRatio);
|
||||||
fVideoMenu->AddItem(item);
|
fVideoMenu->AddItem(item);
|
||||||
|
|
||||||
fSettingsMenu->AddItem(new BMenuItem("No Menu",
|
fNoInterfaceMenuItem = new BMenuItem("No Interface",
|
||||||
new BMessage(M_TOGGLE_NO_MENU), 'M'));
|
new BMessage(M_TOGGLE_NO_INTERFACE), 'B');
|
||||||
fSettingsMenu->AddItem(new BMenuItem("No Border",
|
fSettingsMenu->AddItem(fNoInterfaceMenuItem);
|
||||||
new BMessage(M_TOGGLE_NO_BORDER), 'B'));
|
|
||||||
fSettingsMenu->AddItem(new BMenuItem("No Controls",
|
|
||||||
new BMessage(M_TOGGLE_NO_CONTROLS), 'C'));
|
|
||||||
fSettingsMenu->AddItem(new BMenuItem("Always on Top",
|
fSettingsMenu->AddItem(new BMenuItem("Always on Top",
|
||||||
new BMessage(M_TOGGLE_ALWAYS_ON_TOP), 'T'));
|
new BMessage(M_TOGGLE_ALWAYS_ON_TOP), 'T'));
|
||||||
fSettingsMenu->AddSeparatorItem();
|
fSettingsMenu->AddSeparatorItem();
|
||||||
@@ -1027,15 +1005,25 @@ MainWin::_SetupTrackMenus(BMenu* audioTrackMenu, BMenu* videoTrackMenu)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
MainWin::_GetMinimumWindowSize(int& width, int& height) const
|
||||||
|
{
|
||||||
|
width = MIN_WIDTH;
|
||||||
|
height = 0;
|
||||||
|
if (!fNoInterface) {
|
||||||
|
width = max_c(width, fMenuBarWidth);
|
||||||
|
width = max_c(width, fControlsWidth);
|
||||||
|
height = fMenuBarHeight + fControlsHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MainWin::_SetWindowSizeLimits()
|
MainWin::_SetWindowSizeLimits()
|
||||||
{
|
{
|
||||||
int minWidth = fNoControls ? MIN_WIDTH : fControlsWidth;
|
int minWidth;
|
||||||
if (!fNoMenu)
|
int minHeight;
|
||||||
minWidth = max_c(minWidth, fMenuBarWidth);
|
_GetMinimumWindowSize(minWidth, minHeight);
|
||||||
int minHeight = (fNoMenu ? 0 : fMenuBarHeight)
|
|
||||||
+ (fNoControls ? 0 : fControlsHeight);
|
|
||||||
|
|
||||||
SetSizeLimits(minWidth - 1, 32000, minHeight - 1, fHasVideo ?
|
SetSizeLimits(minWidth - 1, 32000, minHeight - 1, fHasVideo ?
|
||||||
32000 : minHeight - 1);
|
32000 : minHeight - 1);
|
||||||
}
|
}
|
||||||
@@ -1052,13 +1040,13 @@ MainWin::_ResizeWindow(int percent)
|
|||||||
videoHeight = (videoHeight * percent) / 100;
|
videoHeight = (videoHeight * percent) / 100;
|
||||||
|
|
||||||
// Calculate and set the initial window size
|
// Calculate and set the initial window size
|
||||||
int width = max_c(fControlsWidth, videoWidth);
|
int width;
|
||||||
int height = (fNoControls ? 0 : fControlsHeight) + videoHeight;
|
int height;
|
||||||
if (!fNoMenu) {
|
_GetMinimumWindowSize(width, height);
|
||||||
width = max_c(width, fMenuBarWidth);
|
|
||||||
height += fMenuBarHeight;
|
width = max_c(width, videoWidth);
|
||||||
}
|
height = height + videoHeight;
|
||||||
_SetWindowSizeLimits();
|
// _SetWindowSizeLimits();
|
||||||
ResizeTo(width - 1, height - 1);
|
ResizeTo(width - 1, height - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1130,7 +1118,7 @@ MainWin::_MouseDown(BMessage *msg, BView* originalHandler)
|
|||||||
BRect r(screen_where.x - 1, screen_where.y - 1, screen_where.x + 1,
|
BRect r(screen_where.x - 1, screen_where.y - 1, screen_where.x + 1,
|
||||||
screen_where.y + 1);
|
screen_where.y + 1);
|
||||||
if (r.Contains(fMouseDownMousePos)) {
|
if (r.Contains(fMouseDownMousePos)) {
|
||||||
PostMessage(M_TOGGLE_NO_BORDER_NO_MENU_NO_CONTROLS);
|
PostMessage(M_TOGGLE_NO_INTERFACE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1233,6 +1221,11 @@ MainWin::_ShowContextMenu(const BPoint &screen_point)
|
|||||||
item->SetMarked(fKeepAspectRatio);
|
item->SetMarked(fKeepAspectRatio);
|
||||||
item->SetEnabled(fHasVideo);
|
item->SetEnabled(fHasVideo);
|
||||||
|
|
||||||
|
menu->AddItem(item = new BMenuItem("No Interface",
|
||||||
|
new BMessage(M_TOGGLE_NO_INTERFACE), 'B'));
|
||||||
|
item->SetMarked(fNoInterface);
|
||||||
|
item->SetEnabled(fHasVideo);
|
||||||
|
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
|
|
||||||
// Add track selector menus
|
// Add track selector menus
|
||||||
@@ -1402,24 +1395,6 @@ MainWin::_KeyDown(BMessage *msg)
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
MainWin::_ToggleNoBorderNoMenu()
|
|
||||||
{
|
|
||||||
if (!fNoMenu && !fNoBorder && !fNoControls) {
|
|
||||||
PostMessage(M_TOGGLE_NO_MENU);
|
|
||||||
PostMessage(M_TOGGLE_NO_BORDER);
|
|
||||||
PostMessage(M_TOGGLE_NO_CONTROLS);
|
|
||||||
} else {
|
|
||||||
if (!fNoMenu)
|
|
||||||
PostMessage(M_TOGGLE_NO_MENU);
|
|
||||||
if (!fNoBorder)
|
|
||||||
PostMessage(M_TOGGLE_NO_BORDER);
|
|
||||||
if (!fNoControls)
|
|
||||||
PostMessage(M_TOGGLE_NO_CONTROLS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MainWin::_ToggleFullscreen()
|
MainWin::_ToggleFullscreen()
|
||||||
{
|
{
|
||||||
@@ -1464,65 +1439,12 @@ MainWin::_ToggleFullscreen()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MainWin::_ToggleNoControls()
|
MainWin::_ToggleKeepAspectRatio()
|
||||||
{
|
{
|
||||||
printf("_ToggleNoControls enter\n");
|
fKeepAspectRatio = !fKeepAspectRatio;
|
||||||
|
FrameResized(Bounds().Width(), Bounds().Height());
|
||||||
|
|
||||||
if (fIsFullscreen) {
|
_MarkItem(fVideoMenu, M_TOGGLE_KEEP_ASPECT_RATIO, fKeepAspectRatio);
|
||||||
// fullscreen is always without menu
|
|
||||||
printf("_ToggleNoControls leave, doing nothing, we are fullscreen\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
fNoControls = !fNoControls;
|
|
||||||
_SetWindowSizeLimits();
|
|
||||||
|
|
||||||
if (fNoControls) {
|
|
||||||
ResizeBy(0, - fControlsHeight);
|
|
||||||
} else {
|
|
||||||
ResizeBy(0, fControlsHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
_MarkItem(fSettingsMenu, M_TOGGLE_NO_CONTROLS, fNoControls);
|
|
||||||
|
|
||||||
printf("_ToggleNoControls leave\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
MainWin::_ToggleNoMenu()
|
|
||||||
{
|
|
||||||
printf("_ToggleNoMenu enter\n");
|
|
||||||
|
|
||||||
if (fIsFullscreen) {
|
|
||||||
// fullscreen is always without menu
|
|
||||||
printf("_ToggleNoMenu leave, doing nothing, we are fullscreen\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
fNoMenu = !fNoMenu;
|
|
||||||
_SetWindowSizeLimits();
|
|
||||||
|
|
||||||
if (fNoMenu) {
|
|
||||||
MoveBy(0, fMenuBarHeight);
|
|
||||||
ResizeBy(0, - fMenuBarHeight);
|
|
||||||
} else {
|
|
||||||
MoveBy(0, - fMenuBarHeight);
|
|
||||||
ResizeBy(0, fMenuBarHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
_MarkItem(fSettingsMenu, M_TOGGLE_NO_MENU, fNoMenu);
|
|
||||||
|
|
||||||
printf("_ToggleNoMenu leave\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
MainWin::_ToggleNoBorder()
|
|
||||||
{
|
|
||||||
fNoBorder = !fNoBorder;
|
|
||||||
SetLook(fNoBorder ? B_BORDERED_WINDOW_LOOK : B_TITLED_WINDOW_LOOK);
|
|
||||||
|
|
||||||
_MarkItem(fSettingsMenu, M_TOGGLE_NO_BORDER, fNoBorder);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1537,12 +1459,34 @@ MainWin::_ToggleAlwaysOnTop()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MainWin::_ToggleKeepAspectRatio()
|
MainWin::_ToggleNoInterface()
|
||||||
{
|
{
|
||||||
fKeepAspectRatio = !fKeepAspectRatio;
|
printf("_ToggleNoInterface enter\n");
|
||||||
FrameResized(Bounds().Width(), Bounds().Height());
|
|
||||||
|
|
||||||
_MarkItem(fVideoMenu, M_TOGGLE_KEEP_ASPECT_RATIO, fKeepAspectRatio);
|
if (fIsFullscreen || !fHasVideo) {
|
||||||
|
// Fullscreen playback is always without interface and
|
||||||
|
// audio playback is always with interface. So we ignore these
|
||||||
|
// two states here.
|
||||||
|
printf("_ToggleNoControls leave, doing nothing, we are fullscreen\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fNoInterface = !fNoInterface;
|
||||||
|
_SetWindowSizeLimits();
|
||||||
|
|
||||||
|
if (fNoInterface) {
|
||||||
|
MoveBy(0, fMenuBarHeight);
|
||||||
|
ResizeBy(0, -(fControlsHeight + fMenuBarHeight));
|
||||||
|
SetLook(B_BORDERED_WINDOW_LOOK);
|
||||||
|
} else {
|
||||||
|
MoveBy(0, -fMenuBarHeight);
|
||||||
|
ResizeBy(0, fControlsHeight + fMenuBarHeight);
|
||||||
|
SetLook(B_TITLED_WINDOW_LOOK);
|
||||||
|
}
|
||||||
|
|
||||||
|
_MarkItem(fSettingsMenu, M_TOGGLE_NO_INTERFACE, fNoInterface);
|
||||||
|
|
||||||
|
printf("_ToggleNoInterface leave\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1569,6 +1513,8 @@ MainWin::_UpdateControlsEnabledStatus()
|
|||||||
enabledButtons |= SKIP_FORWARD_ENABLED;
|
enabledButtons |= SKIP_FORWARD_ENABLED;
|
||||||
|
|
||||||
fControls->SetEnabled(enabledButtons);
|
fControls->SetEnabled(enabledButtons);
|
||||||
|
|
||||||
|
fNoInterfaceMenuItem->SetEnabled(fHasVideo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,9 @@ private:
|
|||||||
void _SetupVideoAspectItems(BMenu* menu);
|
void _SetupVideoAspectItems(BMenu* menu);
|
||||||
void _SetupTrackMenus(BMenu* audioTrackMenu,
|
void _SetupTrackMenus(BMenu* audioTrackMenu,
|
||||||
BMenu* videoTrackMenu);
|
BMenu* videoTrackMenu);
|
||||||
|
|
||||||
|
void _GetMinimumWindowSize(int& width,
|
||||||
|
int& height) const;
|
||||||
void _SetWindowSizeLimits();
|
void _SetWindowSizeLimits();
|
||||||
void _ResizeWindow(int percent);
|
void _ResizeWindow(int percent);
|
||||||
void _ResizeVideoView(int x, int y, int width,
|
void _ResizeVideoView(int x, int y, int width,
|
||||||
@@ -85,10 +88,7 @@ private:
|
|||||||
void _ToggleFullscreen();
|
void _ToggleFullscreen();
|
||||||
void _ToggleKeepAspectRatio();
|
void _ToggleKeepAspectRatio();
|
||||||
void _ToggleAlwaysOnTop();
|
void _ToggleAlwaysOnTop();
|
||||||
void _ToggleNoBorder();
|
void _ToggleNoInterface();
|
||||||
void _ToggleNoMenu();
|
|
||||||
void _ToggleNoControls();
|
|
||||||
void _ToggleNoBorderNoMenu();
|
|
||||||
|
|
||||||
void _UpdateControlsEnabledStatus();
|
void _UpdateControlsEnabledStatus();
|
||||||
void _UpdatePlaylistMenu();
|
void _UpdatePlaylistMenu();
|
||||||
@@ -115,6 +115,7 @@ private:
|
|||||||
BMenu* fAudioTrackMenu;
|
BMenu* fAudioTrackMenu;
|
||||||
BMenu* fVideoTrackMenu;
|
BMenu* fVideoTrackMenu;
|
||||||
BMenu* fSettingsMenu;
|
BMenu* fSettingsMenu;
|
||||||
|
BMenuItem* fNoInterfaceMenuItem;
|
||||||
BMenu* fPlaylistMenu;
|
BMenu* fPlaylistMenu;
|
||||||
|
|
||||||
bool fHasFile;
|
bool fHasFile;
|
||||||
@@ -128,9 +129,7 @@ private:
|
|||||||
volatile bool fIsFullscreen;
|
volatile bool fIsFullscreen;
|
||||||
volatile bool fKeepAspectRatio;
|
volatile bool fKeepAspectRatio;
|
||||||
volatile bool fAlwaysOnTop;
|
volatile bool fAlwaysOnTop;
|
||||||
volatile bool fNoMenu;
|
volatile bool fNoInterface;
|
||||||
volatile bool fNoBorder;
|
|
||||||
volatile bool fNoControls;
|
|
||||||
int fSourceWidth;
|
int fSourceWidth;
|
||||||
int fSourceHeight;
|
int fSourceHeight;
|
||||||
float fWidthScale;
|
float fWidthScale;
|
||||||
|
|||||||
Reference in New Issue
Block a user