X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fskins2%2Fcontrols%2Fctrl_radialslider.cpp;h=a1bbec3c00e02dc8d6632327e31c4b064548c718;hb=35bbdac8fd599bf00a5024efc7aae67b99faaef1;hp=6c8b6be6f3253921f0149baa4061fad102d623e7;hpb=2cb472dba008f7d877ffe6bae9c5575253365282;p=vlc diff --git a/modules/gui/skins2/controls/ctrl_radialslider.cpp b/modules/gui/skins2/controls/ctrl_radialslider.cpp index 6c8b6be6f3..a1bbec3c00 100644 --- a/modules/gui/skins2/controls/ctrl_radialslider.cpp +++ b/modules/gui/skins2/controls/ctrl_radialslider.cpp @@ -5,7 +5,7 @@ * $Id$ * * Authors: Cyril Deguet - * Olivier Teulière + * Olivier Teulière * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -41,12 +41,11 @@ CtrlRadialSlider::CtrlRadialSlider( intf_thread_t *pIntf, CtrlGeneric( pIntf, rHelp, pVisible ), m_fsm( pIntf ), m_numImg( numImg ), m_rVariable( rVariable ), m_minAngle( minAngle ), m_maxAngle( maxAngle ), m_cmdUpDown( this ), m_cmdDownUp( this ), - m_cmdMove( this ) + m_cmdMove( this ), m_position( 0 ) { // Build the images of the sequence - OSFactory *pOsFactory = OSFactory::instance( getIntf() ); - m_pImgSeq = pOsFactory->createOSGraphics( rBmpSeq.getWidth(), - rBmpSeq.getHeight() ); + m_pImgSeq = OSFactory::instance( getIntf() )->createOSGraphics( + rBmpSeq.getWidth(), rBmpSeq.getHeight() ); m_pImgSeq->drawBitmap( rBmpSeq, 0, 0 ); m_width = rBmpSeq.getWidth(); @@ -72,7 +71,7 @@ CtrlRadialSlider::CtrlRadialSlider( intf_thread_t *pIntf, CtrlRadialSlider::~CtrlRadialSlider() { m_rVariable.delObserver( this ); - SKINS_DELETE( m_pImgSeq ); + delete m_pImgSeq; } @@ -98,10 +97,10 @@ void CtrlRadialSlider::draw( OSGraphics &rImage, int xDest, int yDest ) } -void CtrlRadialSlider::onUpdate( Subject &rVariable, +void CtrlRadialSlider::onUpdate( Subject &rVariable, void *arg ) { - m_position = (int)( m_rVariable.get() * m_numImg ); + m_position = (int)( m_rVariable.get() * ( m_numImg - 1 ) ); notifyLayout( m_width, m_height ); } @@ -125,7 +124,7 @@ void CtrlRadialSlider::CmdDownUp::execute() void CtrlRadialSlider::CmdMove::execute() { - EvtMouse *pEvtMouse = (EvtMouse*)m_pParent->m_pEvt; + EvtMouse *pEvtMouse = static_cast(m_pParent->m_pEvt); // Change the position of the cursor, in blocking mode m_pParent->setCursor( pEvtMouse->getXPos(), pEvtMouse->getYPos(), true ); @@ -143,7 +142,7 @@ void CtrlRadialSlider::setCursor( int posX, int posY, bool blocking ) // Compute the position relative to the center int x = posX - pPos->getLeft() - m_width / 2; - int y = posY - pPos->getTop() - m_width / 2; + int y = posY - pPos->getTop() - m_height / 2; // Compute the polar coordinates. angle is -(-j,OM) float r = sqrt((float)(x*x + y*y));