Skip to content

Commit

Permalink
Improve the Manual Zoom experience during video playback.
Browse files Browse the repository at this point in the history
Add new ZOOM* actions to the TV Playback context (with no predefined
key bindings), to get away from overloading other key bindings.  The
old overloads are left intact, but the ZOOM actions are preferred.

Double the maximum zoom in/out factors.

Remove the behavior of wrapping back to 1.0 when trying to zoom in or
out beyond the maximum factor.
  • Loading branch information
stichnot committed Jan 23, 2013
1 parent bdf3a01 commit 31de292
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 17 deletions.
12 changes: 12 additions & 0 deletions mythtv/libs/libmythtv/tv_actions.h
Expand Up @@ -121,4 +121,16 @@
#define ACTION_3DTOPANDBOTTOM "3DTOPANDBOTTOM"
#define ACTION_3DTOPANDBOTTOMDISCARD "3DTOPANDBOTTOMDISCARD"

/* Zoom mode */
#define ACTION_ZOOMUP "ZOOMUP"
#define ACTION_ZOOMDOWN "ZOOMDOWN"
#define ACTION_ZOOMLEFT "ZOOMLEFT"
#define ACTION_ZOOMRIGHT "ZOOMRIGHT"
#define ACTION_ZOOMASPECTUP "ZOOMASPECTUP"
#define ACTION_ZOOMASPECTDOWN "ZOOMASPECTDOWN"
#define ACTION_ZOOMIN "ZOOMIN"
#define ACTION_ZOOMOUT "ZOOMOUT"
#define ACTION_ZOOMQUIT "ZOOMQUIT"
#define ACTION_ZOOMCOMMIT "ZOOMCOMMIT"

#endif // TV_ACTIONS_H
47 changes: 46 additions & 1 deletion mythtv/libs/libmythtv/tv_play.cpp
Expand Up @@ -810,6 +810,28 @@ void TV::InitKeys(void)
"Switch title"), "");
REG_KEY("TV Playback", ACTION_SWITCHANGLE, QT_TRANSLATE_NOOP("MythControls",
"Switch angle"), "");
REG_KEY("TV Playback", ACTION_ZOOMUP, QT_TRANSLATE_NOOP("MythControls",
"Zoom mode - shift up"), "");
REG_KEY("TV Playback", ACTION_ZOOMDOWN, QT_TRANSLATE_NOOP("MythControls",
"Zoom mode - shift down"), "");
REG_KEY("TV Playback", ACTION_ZOOMLEFT, QT_TRANSLATE_NOOP("MythControls",
"Zoom mode - shift left"), "");
REG_KEY("TV Playback", ACTION_ZOOMRIGHT, QT_TRANSLATE_NOOP("MythControls",
"Zoom mode - shift right"), "");
REG_KEY("TV Playback", ACTION_ZOOMASPECTUP,
QT_TRANSLATE_NOOP("MythControls",
"Zoom mode - increase aspect ratio"), "");
REG_KEY("TV Playback", ACTION_ZOOMASPECTDOWN,
QT_TRANSLATE_NOOP("MythControls",
"Zoom mode - decrease aspect ratio"), "");
REG_KEY("TV Playback", ACTION_ZOOMIN, QT_TRANSLATE_NOOP("MythControls",
"Zoom mode - zoom in"), "");
REG_KEY("TV Playback", ACTION_ZOOMOUT, QT_TRANSLATE_NOOP("MythControls",
"Zoom mode - zoom out"), "");
REG_KEY("TV Playback", ACTION_ZOOMQUIT, QT_TRANSLATE_NOOP("MythControls",
"Zoom mode - quit and abandon changes"), "");
REG_KEY("TV Playback", ACTION_ZOOMCOMMIT, QT_TRANSLATE_NOOP("MythControls",
"Zoom mode - commit changes"), "");

/* Interactive Television keys */
REG_KEY("TV Playback", ACTION_MENURED, QT_TRANSLATE_NOOP("MythControls",
Expand Down Expand Up @@ -3949,7 +3971,30 @@ bool TV::ManualZoomHandleAction(PlayerContext *actx, const QStringList &actions)

bool end_manual_zoom = false;
bool handled = true;
if (has_action(ACTION_UP, actions) ||
if (has_action(ACTION_ZOOMUP, actions))
actx->player->Zoom(kZoomUp);
else if (has_action(ACTION_ZOOMDOWN, actions))
actx->player->Zoom(kZoomDown);
else if (has_action(ACTION_ZOOMLEFT, actions))
actx->player->Zoom(kZoomLeft);
else if (has_action(ACTION_ZOOMRIGHT, actions))
actx->player->Zoom(kZoomRight);
else if (has_action(ACTION_ZOOMASPECTUP, actions))
actx->player->Zoom(kZoomAspectUp);
else if (has_action(ACTION_ZOOMASPECTDOWN, actions))
actx->player->Zoom(kZoomAspectDown);
else if (has_action(ACTION_ZOOMIN, actions))
actx->player->Zoom(kZoomIn);
else if (has_action(ACTION_ZOOMOUT, actions))
actx->player->Zoom(kZoomOut);
else if (has_action(ACTION_ZOOMQUIT, actions))
{
actx->player->Zoom(kZoomHome);
end_manual_zoom = true;
}
else if (has_action(ACTION_ZOOMCOMMIT, actions))
SetManualZoom(actx, false, tr("Zoom Committed"));
else if (has_action(ACTION_UP, actions) ||
has_action(ACTION_CHANNELUP, actions))
{
actx->player->Zoom(kZoomUp);
Expand Down
20 changes: 4 additions & 16 deletions mythtv/libs/libmythtv/videooutwindow.cpp
Expand Up @@ -47,10 +47,10 @@ static QSize fix_alignment(QSize raw);
static float fix_aspect(float raw);
static float snap(float value, float snapto, float diff);

const float VideoOutWindow::kManualZoomMaxHorizontalZoom = 2.0f;
const float VideoOutWindow::kManualZoomMaxVerticalZoom = 2.0f;
const float VideoOutWindow::kManualZoomMinHorizontalZoom = 0.5f;
const float VideoOutWindow::kManualZoomMinVerticalZoom = 0.5f;
const float VideoOutWindow::kManualZoomMaxHorizontalZoom = 4.0f;
const float VideoOutWindow::kManualZoomMaxVerticalZoom = 4.0f;
const float VideoOutWindow::kManualZoomMinHorizontalZoom = 0.25f;
const float VideoOutWindow::kManualZoomMinVerticalZoom = 0.25f;
const int VideoOutWindow::kManualZoomMaxMove = 50;

VideoOutWindow::VideoOutWindow() :
Expand Down Expand Up @@ -890,12 +890,6 @@ void VideoOutWindow::Zoom(ZoomDirection direction)
mz_scale_h *= 1.025f;
mz_scale_v *= 1.025f;
}
else
{
float ratio = mz_scale_v / mz_scale_h;
mz_scale_h = 1.0f;
mz_scale_v = ratio * mz_scale_h;
}
}
else if (kZoomOut == direction)
{
Expand All @@ -905,12 +899,6 @@ void VideoOutWindow::Zoom(ZoomDirection direction)
mz_scale_h *= 1.0f / 1.025f;
mz_scale_v *= 1.0f / 1.025f;
}
else
{
float ratio = mz_scale_v / mz_scale_h;
mz_scale_h = 1.0f;
mz_scale_v = ratio * mz_scale_h;
}
}
else if (kZoomAspectUp == direction)
{
Expand Down

0 comments on commit 31de292

Please sign in to comment.