]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/controls/ctrl_list.cpp
Qt4 - Typo correction.
[vlc] / modules / gui / skins2 / controls / ctrl_list.cpp
index 1538cbfef43749f7b0690961a562a41f6d0d6481..7bf3feb83e762ecfe3ce8206dada6be4041472be 100644 (file)
@@ -5,7 +5,7 @@
  * $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>
@@ -39,7 +39,7 @@
 #   include "solaris_specific.h" // for lrint
 #endif
 
-#define SCROLL_STEP 0.05
+#define SCROLL_STEP 0.05f
 #define LINE_INTERVAL 1  // Number of pixels inserted between 2 lines
 
 
@@ -72,14 +72,14 @@ CtrlList::~CtrlList()
 }
 
 
-void CtrlList::onUpdate( Subject<VarList> &rList )
+void CtrlList::onUpdate( Subject<VarList> &rList, void *arg  )
 {
     autoScroll();
     m_pLastSelected = NULL;
 }
 
 
-void CtrlList::onUpdate( Subject<VarPercent> &rPercent )
+void CtrlList::onUpdate( Subject<VarPercent> &rPercent, void *arg  )
 {
     // Get the size of the control
     const Position *pPos = getPosition();
@@ -332,13 +332,14 @@ void CtrlList::handleEvent( EvtGeneric &rEvent )
         int direction = ((EvtScroll&)rEvent).getDirection();
 
         double percentage = m_rList.getPositionVar().get();
+        double step = 2.0 / (double)m_rList.size();
         if( direction == EvtScroll::kUp )
         {
-            percentage += SCROLL_STEP;
+            percentage += step;
         }
         else
         {
-            percentage -= SCROLL_STEP;
+            percentage -= step;
         }
         m_rList.getPositionVar().set( percentage );
     }
@@ -481,8 +482,8 @@ void CtrlList::makeImage()
     int yPos = 0;
     for( it = m_rList[m_lastPos]; it != m_rList.end() && yPos < height; it++ )
     {
-        UString *pStr = (UString*)((*it).m_cString.get());
-        uint32_t color = ( (*it).m_playing ? m_playColor : m_fgColor );
+        UString *pStr = (UString*)(it->m_cString.get());
+        uint32_t color = ( it->m_playing ? m_playColor : m_fgColor );
 
         // Draw the text
         GenericBitmap *pText = m_rFont.drawString( *pStr, color, width );