* _CurrentVideoSizeInPercent() returned wrong values,
but it didn't result in wrong behavior before. Implemented more keyboard actions from ticket #2495: * +/- zoom the video now (by +/- 10% of current scale). * ZXCVB (raw keys hardcoded, i.e. the keys along the bottom of the keyboard) act as playback buttons: skip previous (Z), play (X), pause (C), stop (V), skip next (B). * Renamed "No interface" menu item to "Hide interface" and changed the shortcut to Cmd-H. This item is only available with video streams, though. * 'M' will mute/unmute the audio. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38599 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1403,8 +1403,8 @@ MainWin::_CreateMenu()
|
|||||||
|
|
||||||
fFileMenu->AddSeparatorItem();
|
fFileMenu->AddSeparatorItem();
|
||||||
|
|
||||||
fNoInterfaceMenuItem = new BMenuItem("No interface",
|
fNoInterfaceMenuItem = new BMenuItem("Hide interface",
|
||||||
new BMessage(M_TOGGLE_NO_INTERFACE), 'B');
|
new BMessage(M_TOGGLE_NO_INTERFACE), 'H');
|
||||||
fFileMenu->AddItem(fNoInterfaceMenuItem);
|
fFileMenu->AddItem(fNoInterfaceMenuItem);
|
||||||
fFileMenu->AddItem(new BMenuItem("Always on top",
|
fFileMenu->AddItem(new BMenuItem("Always on top",
|
||||||
new BMessage(M_TOGGLE_ALWAYS_ON_TOP), 'A'));
|
new BMessage(M_TOGGLE_ALWAYS_ON_TOP), 'A'));
|
||||||
@@ -1632,8 +1632,8 @@ MainWin::_CurrentVideoSizeInPercent() const
|
|||||||
int viewWidth = fVideoView->Bounds().IntegerWidth() + 1;
|
int viewWidth = fVideoView->Bounds().IntegerWidth() + 1;
|
||||||
int viewHeight = fVideoView->Bounds().IntegerHeight() + 1;
|
int viewHeight = fVideoView->Bounds().IntegerHeight() + 1;
|
||||||
|
|
||||||
int widthPercent = videoWidth * 100 / viewWidth;
|
int widthPercent = viewWidth * 100 / videoWidth;
|
||||||
int heightPercent = videoHeight * 100 / viewHeight;
|
int heightPercent = viewHeight * 100 / videoHeight;
|
||||||
|
|
||||||
if (widthPercent > heightPercent)
|
if (widthPercent > heightPercent)
|
||||||
return widthPercent;
|
return widthPercent;
|
||||||
@@ -1641,6 +1641,27 @@ MainWin::_CurrentVideoSizeInPercent() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
MainWin::_ZoomVideoView(int percentDiff)
|
||||||
|
{
|
||||||
|
if (!fHasVideo)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int percent = _CurrentVideoSizeInPercent();
|
||||||
|
int newSize = percent * (100 + percentDiff) / 100;
|
||||||
|
|
||||||
|
if (newSize < 25)
|
||||||
|
newSize = 25;
|
||||||
|
if (newSize > 400)
|
||||||
|
newSize = 400;
|
||||||
|
if (newSize != percent) {
|
||||||
|
BMessage message(M_VIEW_SIZE);
|
||||||
|
message.AddInt32("size", newSize);
|
||||||
|
PostMessage(&message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MainWin::_ResizeWindow(int percent, bool useNoVideoWidth, bool stayOnScreen)
|
MainWin::_ResizeWindow(int percent, bool useNoVideoWidth, bool stayOnScreen)
|
||||||
{
|
{
|
||||||
@@ -1723,9 +1744,6 @@ MainWin::_ResizeWindow(int percent, bool useNoVideoWidth, bool stayOnScreen)
|
|||||||
void
|
void
|
||||||
MainWin::_ResizeVideoView(int x, int y, int width, int height)
|
MainWin::_ResizeVideoView(int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
printf("_ResizeVideoView: %d,%d, width %d, height %d\n", x, y,
|
|
||||||
width, height);
|
|
||||||
|
|
||||||
// Keep aspect ratio, place video view inside
|
// Keep aspect ratio, place video view inside
|
||||||
// the background area (may create black bars).
|
// the background area (may create black bars).
|
||||||
int videoWidth;
|
int videoWidth;
|
||||||
@@ -1928,8 +1946,6 @@ MainWin::_ShowContextMenu(const BPoint& screenPoint)
|
|||||||
bool
|
bool
|
||||||
MainWin::_KeyDown(BMessage* msg)
|
MainWin::_KeyDown(BMessage* msg)
|
||||||
{
|
{
|
||||||
// TODO: use the shortcut mechanism instead!
|
|
||||||
|
|
||||||
uint32 key = msg->FindInt32("key");
|
uint32 key = msg->FindInt32("key");
|
||||||
uint32 rawChar = msg->FindInt32("raw_char");
|
uint32 rawChar = msg->FindInt32("raw_char");
|
||||||
uint32 modifier = msg->FindInt32("modifiers");
|
uint32 modifier = msg->FindInt32("modifiers");
|
||||||
@@ -1947,6 +1963,10 @@ MainWin::_KeyDown(BMessage* msg)
|
|||||||
fController->TogglePlaying();
|
fController->TogglePlaying();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
case 'm':
|
||||||
|
fController->ToggleMute();
|
||||||
|
return true;
|
||||||
|
|
||||||
case B_ESCAPE:
|
case B_ESCAPE:
|
||||||
if (!fIsFullscreen)
|
if (!fIsFullscreen)
|
||||||
break;
|
break;
|
||||||
@@ -2017,6 +2037,20 @@ MainWin::_KeyDown(BMessage* msg)
|
|||||||
PostMessage(M_SKIP_PREV);
|
PostMessage(M_SKIP_PREV);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
case '+':
|
||||||
|
if ((modifier & B_COMMAND_KEY) == 0) {
|
||||||
|
_ZoomVideoView(10);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '-':
|
||||||
|
if ((modifier & B_COMMAND_KEY) == 0) {
|
||||||
|
_ZoomVideoView(-10);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case B_DELETE:
|
case B_DELETE:
|
||||||
case 'd': // d for delete
|
case 'd': // d for delete
|
||||||
case 't': // t for Trash
|
case 't': // t for Trash
|
||||||
@@ -2034,14 +2068,14 @@ MainWin::_KeyDown(BMessage* msg)
|
|||||||
switch (key) {
|
switch (key) {
|
||||||
case 0x3a: // numeric keypad +
|
case 0x3a: // numeric keypad +
|
||||||
if ((modifier & B_COMMAND_KEY) == 0) {
|
if ((modifier & B_COMMAND_KEY) == 0) {
|
||||||
PostMessage(M_VOLUME_UP);
|
_ZoomVideoView(10);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x25: // numeric keypad -
|
case 0x25: // numeric keypad -
|
||||||
if ((modifier & B_COMMAND_KEY) == 0) {
|
if ((modifier & B_COMMAND_KEY) == 0) {
|
||||||
PostMessage(M_VOLUME_DOWN);
|
_ZoomVideoView(-10);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -2063,6 +2097,24 @@ MainWin::_KeyDown(BMessage* msg)
|
|||||||
case 0x48: // numeric keypad left arrow
|
case 0x48: // numeric keypad left arrow
|
||||||
PostMessage(M_SKIP_PREV);
|
PostMessage(M_SKIP_PREV);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
// Playback controls along the bottom of the keyboard:
|
||||||
|
// Z X C V B for US International
|
||||||
|
case 0x4c:
|
||||||
|
PostMessage(M_SKIP_PREV);
|
||||||
|
return true;
|
||||||
|
case 0x4d:
|
||||||
|
fController->Play();
|
||||||
|
return true;
|
||||||
|
case 0x4e:
|
||||||
|
fController->Pause();
|
||||||
|
return true;
|
||||||
|
case 0x4f:
|
||||||
|
fController->Stop();
|
||||||
|
return true;
|
||||||
|
case 0x50:
|
||||||
|
PostMessage(M_SKIP_NEXT);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ private:
|
|||||||
void _GetUnscaledVideoSize(int& videoWidth,
|
void _GetUnscaledVideoSize(int& videoWidth,
|
||||||
int& videoHeight) const;
|
int& videoHeight) const;
|
||||||
int _CurrentVideoSizeInPercent() const;
|
int _CurrentVideoSizeInPercent() const;
|
||||||
|
void _ZoomVideoView(int percentDiff);
|
||||||
void _ResizeWindow(int percent,
|
void _ResizeWindow(int percent,
|
||||||
bool useNoVideoWidth = false,
|
bool useNoVideoWidth = false,
|
||||||
bool stayOnScreen = false);
|
bool stayOnScreen = false);
|
||||||
|
|||||||
Reference in New Issue
Block a user