* $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
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();
CtrlRadialSlider::~CtrlRadialSlider()
{
m_rVariable.delObserver( this );
- SKINS_DELETE( m_pImgSeq );
+ delete m_pImgSeq;
}
}
-void CtrlRadialSlider::onUpdate( Subject<VarPercent,void*> &rVariable,
+void CtrlRadialSlider::onUpdate( Subject<VarPercent> &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 );
}
void CtrlRadialSlider::CmdMove::execute()
{
- EvtMouse *pEvtMouse = (EvtMouse*)m_pParent->m_pEvt;
+ EvtMouse *pEvtMouse = static_cast<EvtMouse*>(m_pParent->m_pEvt);
// Change the position of the cursor, in blocking mode
m_pParent->setCursor( pEvtMouse->getXPos(), pEvtMouse->getYPos(), true );
// 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));