Skip to content

Commit

Permalink
add rotateccw action and a new optional parameter value to Player.Rot…
Browse files Browse the repository at this point in the history
…ate in JSON-RPC
  • Loading branch information
Montellese committed Aug 10, 2012
1 parent c25b084 commit f5cf334
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 18 deletions.
3 changes: 2 additions & 1 deletion xbmc/guilib/Key.h
Expand Up @@ -138,7 +138,8 @@
#define ACTION_CALIBRATE_SWAP_ARROWS 47 // select next arrow. Can b used in: settingsScreenCalibration.xml windowid=11
#define ACTION_CALIBRATE_RESET 48 // reset calibration to defaults. Can b used in: settingsScreenCalibration.xml windowid=11/settingsUICalibration.xml windowid=10
#define ACTION_ANALOG_MOVE 49 // analog thumbstick move. Can b used in: slideshow.xml window id=2007/settingsScreenCalibration.xml windowid=11/settingsUICalibration.xml windowid=10
#define ACTION_ROTATE_PICTURE 50 // rotate current picture during slideshow. Can b used in slideshow.xml window id=2007
#define ACTION_ROTATE_PICTURE_CW 50 // rotate current picture clockwise during slideshow. Can be used in slideshow.xml window id=2007
#define ACTION_ROTATE_PICTURE_CCW 51 // rotate current picture counterclockwise during slideshow. Can be used in slideshow.xml window id=2007

#define ACTION_SUBTITLE_DELAY_MIN 52 // Decrease subtitle/movie Delay. Can b used in videoFullScreen.xml window id=2005
#define ACTION_SUBTITLE_DELAY_PLUS 53 // Increase subtitle/movie Delay. Can b used in videoFullScreen.xml window id=2005
Expand Down
3 changes: 2 additions & 1 deletion xbmc/input/ButtonTranslator.cpp
Expand Up @@ -98,7 +98,8 @@ static const ActionMapping actions[] =
{"nextcalibration" , ACTION_CALIBRATE_SWAP_ARROWS},
{"resetcalibration" , ACTION_CALIBRATE_RESET},
{"analogmove" , ACTION_ANALOG_MOVE},
{"rotate" , ACTION_ROTATE_PICTURE},
{"rotate" , ACTION_ROTATE_PICTURE_CW},
{"rotateccw" , ACTION_ROTATE_PICTURE_CCW},
{"close" , ACTION_NAV_BACK}, // backwards compatibility
{"subtitledelayminus", ACTION_SUBTITLE_DELAY_MIN},
{"subtitledelay" , ACTION_SUBTITLE_DELAY},
Expand Down
2 changes: 1 addition & 1 deletion xbmc/interfaces/http-api/XBMChttp.cpp
Expand Up @@ -2151,7 +2151,7 @@ int CXbmcHttp::xbmcAction(int numParas, CStdString paras[], int theAction)
{
CGUIWindowSlideShow *pSlideShow = (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
if (pSlideShow) {
pSlideShow->OnAction(CAction(ACTION_ROTATE_PICTURE));
pSlideShow->OnAction(CAction(ACTION_ROTATE_PICTURE_CW));
return SetResponse(openTag+"OK");
}
else
Expand Down
5 changes: 4 additions & 1 deletion xbmc/interfaces/json-rpc/PlayerOperations.cpp
Expand Up @@ -441,7 +441,10 @@ JSONRPC_STATUS CPlayerOperations::Rotate(const CStdString &method, ITransportLay
switch (GetPlayer(parameterObject["playerid"]))
{
case Picture:
SendSlideshowAction(ACTION_ROTATE_PICTURE);
if (parameterObject["value"].asString().compare("clockwise") == 0)
SendSlideshowAction(ACTION_ROTATE_PICTURE_CW);
else
SendSlideshowAction(ACTION_ROTATE_PICTURE_CCW);
return ACK;

case Video:
Expand Down
3 changes: 2 additions & 1 deletion xbmc/interfaces/json-rpc/ServiceDescription.h
Expand Up @@ -1181,7 +1181,8 @@ namespace JSONRPC
"\"transport\": \"Response\","
"\"permission\": \"ControlPlayback\","
"\"params\": ["
"{ \"name\": \"playerid\", \"$ref\": \"Player.Id\", \"required\": true }"
"{ \"name\": \"playerid\", \"$ref\": \"Player.Id\", \"required\": true },"
"{ \"name\": \"value\", \"type\": \"string\", \"enum\": [ \"clockwise\", \"counterclockwise\" ], \"default\": \"clockwise\" }"
"],"
"\"returns\": \"string\""
"}",
Expand Down
1 change: 1 addition & 0 deletions xbmc/interfaces/json-rpc/methods.json
Expand Up @@ -318,6 +318,7 @@
"permission": "ControlPlayback",
"params": [
{ "name": "playerid", "$ref": "Player.Id", "required": true }
{ "name": "value", "type": "string", "enum": [ "clockwise", "counterclockwise" ], "default": "clockwise" }
],
"returns": "string"
},
Expand Down
21 changes: 10 additions & 11 deletions xbmc/pictures/GUIWindowSlideShow.cpp
Expand Up @@ -558,9 +558,9 @@ EVENT_RESULT CGUIWindowSlideShow::OnMouseEvent(const CPoint &point, const CMouse
// difference in angle is +/-10 degrees
float reminder = fmodf(m_fRotate, 90.0f);
if (reminder < ROTATION_SNAP_RANGE)
RotateRelative(-reminder);
Rotate(-reminder);
else if (reminder > 90.0f - ROTATION_SNAP_RANGE)
RotateRelative(90.0f - reminder);
Rotate(90.0f - reminder);
}

m_fInitialZoom = 0.0f;
Expand All @@ -574,7 +574,7 @@ EVENT_RESULT CGUIWindowSlideShow::OnMouseEvent(const CPoint &point, const CMouse
}
else if (event.m_id == ACTION_GESTURE_ROTATE)
{
RotateRelative(m_fInitialRotate + event.m_offsetX - m_fRotate, true);
Rotate(m_fInitialRotate + event.m_offsetX - m_fRotate, true);
return EVENT_RESULT_HANDLED;
}
return EVENT_RESULT_UNHANDLED;
Expand Down Expand Up @@ -660,8 +660,12 @@ bool CGUIWindowSlideShow::OnAction(const CAction &action)
Zoom(m_iZoomFactor + 1);
break;

case ACTION_ROTATE_PICTURE:
Rotate();
case ACTION_ROTATE_PICTURE_CW:
Rotate(90.0f);
break;

case ACTION_ROTATE_PICTURE_CCW:
Rotate(-90.0f);
break;

case ACTION_ZOOM_LEVEL_NORMAL:
Expand Down Expand Up @@ -819,12 +823,7 @@ void CGUIWindowSlideShow::RenderPause()

}

void CGUIWindowSlideShow::Rotate()
{
RotateRelative(90.0f);
}

void CGUIWindowSlideShow::RotateRelative(float fAngle, bool immediate /* = false */)
void CGUIWindowSlideShow::Rotate(float fAngle, bool immediate /* = false */)
{
if (m_Image[m_iCurrentPic].DrawNextImage())
return;
Expand Down
3 changes: 1 addition & 2 deletions xbmc/pictures/GUIWindowSlideShow.h
Expand Up @@ -102,8 +102,7 @@ class CGUIWindowSlideShow : public CGUIWindow
SortOrder order = SortOrderAscending);
void RenderPause();
void RenderErrorMessage();
void Rotate();
void RotateRelative(float fAngle, bool immediate = false);
void Rotate(float fAngle, bool immediate = false);
void Zoom(int iZoom);
void ZoomRelative(float fZoom, bool immediate = false);
void Move(float fX, float fY);
Expand Down

0 comments on commit f5cf334

Please sign in to comment.