]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/controls/ctrl_radialslider.cpp
Uniformize source files encoding
[vlc] / modules / gui / skins2 / controls / ctrl_radialslider.cpp
index b028ba24710689df2dd8d4c2097a2e370425d058..817c66d09f468eaf17458e8ea909b0d296674971 100644 (file)
@@ -1,11 +1,11 @@
 /*****************************************************************************
  * ctrl_radialslider.cpp
  *****************************************************************************
- * Copyright (C) 2003 VideoLAN
+ * Copyright (C) 2003 the VideoLAN team
  * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
- *          Olivier Teulière <ipkiss@via.ecp.fr>
+ *          Olivier Teulière <ipkiss@via.ecp.fr>
  *
  * 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
@@ -19,7 +19,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 #include <math.h>
@@ -40,8 +40,8 @@ CtrlRadialSlider::CtrlRadialSlider( intf_thread_t *pIntf,
                                     VarBool *pVisible ):
     CtrlGeneric( pIntf, rHelp, pVisible ), m_fsm( pIntf ), m_numImg( numImg ),
     m_rVariable( rVariable ), m_minAngle( minAngle ), m_maxAngle( maxAngle ),
-    m_cmdUpDown( this, &transUpDown ), m_cmdDownUp( this, &transDownUp ),
-    m_cmdMove( this, &transMove ), m_position( 0 ), m_lastPos( 0 )
+    m_cmdUpDown( this ), m_cmdDownUp( this ),
+    m_cmdMove( this )
 {
     // Build the images of the sequence
     OSFactory *pOsFactory = OSFactory::instance( getIntf() );
@@ -98,42 +98,37 @@ void CtrlRadialSlider::draw( OSGraphics &rImage, int xDest, int yDest )
 }
 
 
-void CtrlRadialSlider::onUpdate( Subject<VarPercent> &rVariable )
+void CtrlRadialSlider::onUpdate( Subject<VarPercent,void*> &rVariable,
+                                 void *arg  )
 {
     m_position = (int)( m_rVariable.get() * m_numImg );
     notifyLayout( m_width, m_height );
 }
 
 
-void CtrlRadialSlider::transUpDown( SkinObject *pCtrl )
+void CtrlRadialSlider::CmdUpDown::execute()
 {
-    CtrlRadialSlider *pThis = (CtrlRadialSlider*)pCtrl;
-
-    EvtMouse *pEvtMouse = (EvtMouse*)pThis->m_pEvt;
+    EvtMouse *pEvtMouse = (EvtMouse*)m_pParent->m_pEvt;
 
     // Change the position of the cursor, in non-blocking mode
-    pThis->setCursor( pEvtMouse->getXPos(), pEvtMouse->getYPos(), false );
+    m_pParent->setCursor( pEvtMouse->getXPos(), pEvtMouse->getYPos(), false );
 
-    pThis->captureMouse();
+    m_pParent->captureMouse();
 }
 
 
-void CtrlRadialSlider::transDownUp( SkinObject *pCtrl )
+void CtrlRadialSlider::CmdDownUp::execute()
 {
-    CtrlRadialSlider *pThis = (CtrlRadialSlider*)pCtrl;
-
-    pThis->releaseMouse();
+    m_pParent->releaseMouse();
 }
 
 
-void CtrlRadialSlider::transMove( SkinObject *pCtrl )
+void CtrlRadialSlider::CmdMove::execute()
 {
-    CtrlRadialSlider *pThis = (CtrlRadialSlider*)pCtrl;
-
-    EvtMouse *pEvtMouse = (EvtMouse*)pThis->m_pEvt;
+    EvtMouse *pEvtMouse = (EvtMouse*)m_pParent->m_pEvt;
 
     // Change the position of the cursor, in blocking mode
-    pThis->setCursor( pEvtMouse->getXPos(), pEvtMouse->getYPos(), true );
+    m_pParent->setCursor( pEvtMouse->getXPos(), pEvtMouse->getYPos(), true );
 }
 
 
@@ -151,7 +146,7 @@ void CtrlRadialSlider::setCursor( int posX, int posY, bool blocking )
     int y = posY - pPos->getTop() - m_width / 2;
 
     // Compute the polar coordinates. angle is -(-j,OM)
-    float r = sqrt(x*x + y*y);
+    float r = sqrt((float)(x*x + y*y));
     if( r == 0 )
     {
         return;