Skip to content
This repository
Browse code

CGUISliderControl: rename m_iValue, m_fValue and m_iPercent as they a…

…re arrays now
  • Loading branch information...
commit ad6ef9bee829ee3704b913d0e6988d85b6975325 1 parent c9d0d05
Sascha Montellese authored October 10, 2012
118  xbmc/guilib/GUISliderControl.cpp
@@ -40,18 +40,18 @@ CGUISliderControl::CGUISliderControl(int parentID, int controlID, float posX, fl
40 40
   m_iType = iType;
41 41
   m_rangeSelection = false;
42 42
   m_currentSelector = RangeSelectorLower; // use lower selector by default
43  
-  m_iPercent[0] = 0;
44  
-  m_iPercent[1] = 100;
  43
+  m_percentValues[0] = 0;
  44
+  m_percentValues[1] = 100;
45 45
   m_iStart = 0;
46 46
   m_iEnd = 100;
47 47
   m_iInterval = 1;
48 48
   m_fStart = 0.0f;
49 49
   m_fEnd = 1.0f;
50 50
   m_fInterval = 0.1f;
51  
-  m_iValue[0] = m_iStart;
52  
-  m_iValue[1] = m_iEnd;
53  
-  m_fValue[0] = m_fStart;
54  
-  m_fValue[1] = m_fEnd;
  51
+  m_intValues[0] = m_iStart;
  52
+  m_intValues[1] = m_iEnd;
  53
+  m_floatValues[0] = m_fStart;
  54
+  m_floatValues[1] = m_fEnd;
55 55
   ControlType = GUICONTROL_SLIDER;
56 56
   m_iInfoCode = 0;
57 57
   m_dragging = false;
@@ -190,15 +190,15 @@ void CGUISliderControl::Move(int iNumSteps)
190 190
   {
191 191
   case SPIN_CONTROL_TYPE_FLOAT:
192 192
     {
193  
-      float &value = m_fValue[m_currentSelector];
  193
+      float &value = m_floatValues[m_currentSelector];
194 194
       value += m_fInterval * iNumSteps;
195 195
       if (value < m_fStart) value = m_fStart;
196 196
       if (value > m_fEnd) value = m_fEnd;
197  
-      if (m_fValue[0] > m_fValue[1])
  197
+      if (m_floatValues[0] > m_floatValues[1])
198 198
       {
199  
-        float valueLower = m_fValue[0];
200  
-        m_fValue[0] = m_fValue[1];
201  
-        m_fValue[1] = valueLower;
  199
+        float valueLower = m_floatValues[0];
  200
+        m_floatValues[0] = m_floatValues[1];
  201
+        m_floatValues[1] = valueLower;
202 202
         rangeSwap = true;
203 203
       }
204 204
       break;
@@ -206,15 +206,15 @@ void CGUISliderControl::Move(int iNumSteps)
206 206
 
207 207
   case SPIN_CONTROL_TYPE_INT:
208 208
     {
209  
-      int &value = m_iValue[m_currentSelector];
  209
+      int &value = m_intValues[m_currentSelector];
210 210
       value += m_iInterval * iNumSteps;
211 211
       if (value < m_iStart) value = m_iStart;
212 212
       if (value > m_iEnd) value = m_iEnd;
213  
-      if (m_iValue[0] > m_iValue[1])
  213
+      if (m_intValues[0] > m_intValues[1])
214 214
       {
215  
-        int valueLower = m_iValue[0];
216  
-        m_iValue[0] = m_iValue[1];
217  
-        m_iValue[1] = valueLower;
  215
+        int valueLower = m_intValues[0];
  216
+        m_intValues[0] = m_intValues[1];
  217
+        m_intValues[1] = valueLower;
218 218
         rangeSwap = true;
219 219
       }
220 220
       break;
@@ -222,15 +222,15 @@ void CGUISliderControl::Move(int iNumSteps)
222 222
 
223 223
   default:
224 224
     {
225  
-      int &value = m_iPercent[m_currentSelector];
  225
+      int &value = m_percentValues[m_currentSelector];
226 226
       value += m_iInterval * iNumSteps;
227 227
       if (value < 0) value = 0;
228 228
       if (value > 100) value = 100;
229  
-      if (m_iPercent[0] > m_iPercent[1])
  229
+      if (m_percentValues[0] > m_percentValues[1])
230 230
       {
231  
-        int valueLower = m_iPercent[0];
232  
-        m_iPercent[0] = m_iPercent[1];
233  
-        m_iPercent[1] = valueLower;
  231
+        int valueLower = m_percentValues[0];
  232
+        m_percentValues[0] = m_percentValues[1];
  233
+        m_percentValues[1] = valueLower;
234 234
         rangeSwap = true;
235 235
       }
236 236
       break;
@@ -289,24 +289,24 @@ void CGUISliderControl::SetPercentage(int iPercent, RangeSelector selector /* =
289 289
   if (iPercent > 100) iPercent = 100;
290 290
   else if (iPercent < 0) iPercent = 0;
291 291
 
292  
-  int iPercentLower = selector == RangeSelectorLower ? iPercent : m_iPercent[0];
293  
-  int iPercentUpper = selector == RangeSelectorUpper ? iPercent : m_iPercent[1];
  292
+  int iPercentLower = selector == RangeSelectorLower ? iPercent : m_percentValues[0];
  293
+  int iPercentUpper = selector == RangeSelectorUpper ? iPercent : m_percentValues[1];
294 294
 
295 295
   if (!m_rangeSelection || iPercentLower <= iPercentUpper)
296 296
   {
297  
-    m_iPercent[0] = iPercentLower;
298  
-    m_iPercent[1] = iPercentUpper;
  297
+    m_percentValues[0] = iPercentLower;
  298
+    m_percentValues[1] = iPercentUpper;
299 299
   }
300 300
   else
301 301
   {
302  
-    m_iPercent[0] = iPercentUpper;
303  
-    m_iPercent[1] = iPercentLower;
  302
+    m_percentValues[0] = iPercentUpper;
  303
+    m_percentValues[1] = iPercentLower;
304 304
   }
305 305
 }
306 306
 
307 307
 int CGUISliderControl::GetPercentage(RangeSelector selector /* = RangeSelectorLower */) const
308 308
 {
309  
-  return m_iPercent[selector];
  309
+  return m_percentValues[selector];
310 310
 }
311 311
 
312 312
 void CGUISliderControl::SetIntValue(int iValue, RangeSelector selector /* = RangeSelectorLower */)
@@ -318,18 +318,18 @@ void CGUISliderControl::SetIntValue(int iValue, RangeSelector selector /* = Rang
318 318
     if (iValue > m_iEnd) iValue = m_iEnd;
319 319
     else if (iValue < m_iStart) iValue = m_iStart;
320 320
 
321  
-    int iValueLower = selector == RangeSelectorLower ? iValue : m_iValue[0];
322  
-    int iValueUpper = selector == RangeSelectorUpper ? iValue : m_iValue[1];
  321
+    int iValueLower = selector == RangeSelectorLower ? iValue : m_intValues[0];
  322
+    int iValueUpper = selector == RangeSelectorUpper ? iValue : m_intValues[1];
323 323
 
324 324
     if (!m_rangeSelection || iValueLower <= iValueUpper)
325 325
     {
326  
-      m_iValue[0] = iValueLower;
327  
-      m_iValue[1] = iValueUpper;
  326
+      m_intValues[0] = iValueLower;
  327
+      m_intValues[1] = iValueUpper;
328 328
     }
329 329
     else
330 330
     {
331  
-      m_iValue[0] = iValueUpper;
332  
-      m_iValue[1] = iValueLower;
  331
+      m_intValues[0] = iValueUpper;
  332
+      m_intValues[1] = iValueLower;
333 333
     }
334 334
   }
335 335
   else
@@ -339,11 +339,11 @@ void CGUISliderControl::SetIntValue(int iValue, RangeSelector selector /* = Rang
339 339
 int CGUISliderControl::GetIntValue(RangeSelector selector /* = RangeSelectorLower */) const
340 340
 {
341 341
   if (m_iType == SPIN_CONTROL_TYPE_FLOAT)
342  
-    return (int)m_fValue[selector];
  342
+    return (int)m_floatValues[selector];
343 343
   else if (m_iType == SPIN_CONTROL_TYPE_INT)
344  
-    return m_iValue[selector];
  344
+    return m_intValues[selector];
345 345
   else
346  
-    return m_iPercent[selector];
  346
+    return m_percentValues[selector];
347 347
 }
348 348
 
349 349
 void CGUISliderControl::SetFloatValue(float fValue, RangeSelector selector /* = RangeSelectorLower */)
@@ -353,18 +353,18 @@ void CGUISliderControl::SetFloatValue(float fValue, RangeSelector selector /* =
353 353
     if (fValue > m_fEnd) fValue = m_fEnd;
354 354
     else if (fValue < m_fStart) fValue = m_fStart;
355 355
 
356  
-    float fValueLower = selector == RangeSelectorLower ? fValue : m_fValue[0];
357  
-    float fValueUpper = selector == RangeSelectorUpper ? fValue : m_fValue[1];
  356
+    float fValueLower = selector == RangeSelectorLower ? fValue : m_floatValues[0];
  357
+    float fValueUpper = selector == RangeSelectorUpper ? fValue : m_floatValues[1];
358 358
 
359 359
     if (!m_rangeSelection || fValueLower <= fValueUpper)
360 360
     {
361  
-      m_fValue[0] = fValueLower;
362  
-      m_fValue[1] = fValueUpper;
  361
+      m_floatValues[0] = fValueLower;
  362
+      m_floatValues[1] = fValueUpper;
363 363
     }
364 364
     else
365 365
     {
366  
-      m_fValue[0] = fValueUpper;
367  
-      m_fValue[1] = fValueLower;
  366
+      m_floatValues[0] = fValueUpper;
  367
+      m_floatValues[1] = fValueLower;
368 368
     }
369 369
   }
370 370
   else if (m_iType == SPIN_CONTROL_TYPE_INT)
@@ -376,11 +376,11 @@ void CGUISliderControl::SetFloatValue(float fValue, RangeSelector selector /* =
376 376
 float CGUISliderControl::GetFloatValue(RangeSelector selector /* = RangeSelectorLower */) const
377 377
 {
378 378
   if (m_iType == SPIN_CONTROL_TYPE_FLOAT)
379  
-    return m_fValue[selector];
  379
+    return m_floatValues[selector];
380 380
   else if (m_iType == SPIN_CONTROL_TYPE_INT)
381  
-    return (float)m_iValue[selector];
  381
+    return (float)m_intValues[selector];
382 382
   else
383  
-    return (float)m_iPercent[selector];
  383
+    return (float)m_percentValues[selector];
384 384
 }
385 385
 
386 386
 void CGUISliderControl::SetIntInterval(int iInterval)
@@ -405,8 +405,8 @@ void CGUISliderControl::SetRange(int iStart, int iEnd)
405 405
     SetFloatRange((float)iStart,(float)iEnd);
406 406
   else
407 407
   {
408  
-    m_iValue[0] = m_iStart = iStart;
409  
-    m_iValue[1] = m_iEnd = iEnd;
  408
+    m_intValues[0] = m_iStart = iStart;
  409
+    m_intValues[1] = m_iEnd = iEnd;
410 410
   }
411 411
 }
412 412
 
@@ -416,8 +416,8 @@ void CGUISliderControl::SetFloatRange(float fStart, float fEnd)
416 416
     SetRange((int)fStart, (int)fEnd);
417 417
   else
418 418
   {
419  
-    m_fValue[0] = m_fStart = fStart;
420  
-    m_fValue[1] = m_fEnd = fEnd;
  419
+    m_floatValues[0] = m_fStart = fStart;
  420
+    m_floatValues[1] = m_fEnd = fEnd;
421 421
   }
422 422
 }
423 423
 
@@ -481,7 +481,7 @@ void CGUISliderControl::SetFromPosition(const CPoint &point)
481 481
   case SPIN_CONTROL_TYPE_FLOAT:
482 482
     {
483 483
       float fValue = m_fStart + (m_fEnd - m_fStart) * fPercent;
484  
-      if (m_rangeSelection && fValue >= m_fValue[1])
  484
+      if (m_rangeSelection && fValue >= m_floatValues[1])
485 485
         selector = RangeSelectorUpper;
486 486
 
487 487
       SetFloatValue(fValue, selector);
@@ -491,7 +491,7 @@ void CGUISliderControl::SetFromPosition(const CPoint &point)
491 491
   case SPIN_CONTROL_TYPE_INT:
492 492
     {
493 493
       int iValue = (int)(m_iStart + (float)(m_iEnd - m_iStart) * fPercent + 0.49f);
494  
-      if (m_rangeSelection && iValue >= m_iValue[1])
  494
+      if (m_rangeSelection && iValue >= m_intValues[1])
495 495
         selector = RangeSelectorUpper;
496 496
 
497 497
       SetIntValue(iValue, selector);
@@ -501,7 +501,7 @@ void CGUISliderControl::SetFromPosition(const CPoint &point)
501 501
   default:
502 502
     {
503 503
       int iValue = (int)(fPercent * 100 + 0.49f);
504  
-      if (m_rangeSelection && iValue >= m_iPercent[1])
  504
+      if (m_rangeSelection && iValue >= m_percentValues[1])
505 505
         selector = RangeSelectorUpper;
506 506
 
507 507
       SetPercentage(iValue, selector);
@@ -583,23 +583,23 @@ CStdString CGUISliderControl::GetDescription() const
583 583
   if (m_iType == SPIN_CONTROL_TYPE_FLOAT)
584 584
   {
585 585
     if (m_rangeSelection)
586  
-      description.Format("[%2.2f, %2.2f]", m_fValue[0], m_fValue[1]);
  586
+      description.Format("[%2.2f, %2.2f]", m_floatValues[0], m_floatValues[1]);
587 587
     else
588  
-      description.Format("%2.2f", m_fValue[0]);
  588
+      description.Format("%2.2f", m_floatValues[0]);
589 589
   }
590 590
   else if (m_iType == SPIN_CONTROL_TYPE_INT)
591 591
   {
592 592
     if (m_rangeSelection)
593  
-      description.Format("[%i, %i]", m_iValue[0], m_iValue[1]);
  593
+      description.Format("[%i, %i]", m_intValues[0], m_intValues[1]);
594 594
     else
595  
-      description.Format("%i", m_iValue[0]);
  595
+      description.Format("%i", m_intValues[0]);
596 596
   }
597 597
   else
598 598
   {
599 599
     if (m_rangeSelection)
600  
-      description.Format("[%i%%, %i%%]", m_iPercent[0], m_iPercent[1]);
  600
+      description.Format("[%i%%, %i%%]", m_percentValues[0], m_percentValues[1]);
601 601
     else
602  
-      description.Format("%i%%", m_iPercent[0]);
  602
+      description.Format("%i%%", m_percentValues[0]);
603 603
   }
604 604
   return description;
605 605
 }
6  xbmc/guilib/GUISliderControl.h
@@ -112,14 +112,14 @@ class CGUISliderControl :
112 112
   bool m_rangeSelection;
113 113
   RangeSelector m_currentSelector;
114 114
 
115  
-  int m_iPercent[2];
  115
+  int m_percentValues[2];
116 116
 
117  
-  int m_iValue[2];
  117
+  int m_intValues[2];
118 118
   int m_iStart;
119 119
   int m_iInterval;
120 120
   int m_iEnd;
121 121
 
122  
-  float m_fValue[2];
  122
+  float m_floatValues[2];
123 123
   float m_fStart;
124 124
   float m_fInterval;
125 125
   float m_fEnd;

0 notes on commit ad6ef9b

Please sign in to comment.
Something went wrong with that request. Please try again.