diff options
author | Robert Bieber <robby@bieberphoto.com> | 2010-07-08 05:30:00 +0000 |
---|---|---|
committer | Robert Bieber <robby@bieberphoto.com> | 2010-07-08 05:30:00 +0000 |
commit | eb93e3b3d26ce31407a302f49c70770ad3f98274 (patch) | |
tree | f4e6e8fc5f64676832f4b256b0790de4f6514800 | |
parent | 13e97cd5f5330e5c7f52f243ddee5cdce61edfa6 (diff) | |
download | rockbox-eb93e3b3d26ce31407a302f49c70770ad3f98274.tar.gz rockbox-eb93e3b3d26ce31407a302f49c70770ad3f98274.zip |
Theme Editor: Removed papause from line scrolling
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27345 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | utils/themeeditor/graphics/rbviewport.cpp | 48 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbviewport.h | 1 |
2 files changed, 15 insertions, 34 deletions
diff --git a/utils/themeeditor/graphics/rbviewport.cpp b/utils/themeeditor/graphics/rbviewport.cpp index 3a239c7f35..4422f19b86 100644 --- a/utils/themeeditor/graphics/rbviewport.cpp +++ b/utils/themeeditor/graphics/rbviewport.cpp | |||
@@ -30,8 +30,6 @@ | |||
30 | #include "tag_table.h" | 30 | #include "tag_table.h" |
31 | #include "skin_parser.h" | 31 | #include "skin_parser.h" |
32 | 32 | ||
33 | /* Pause at beginning/end of scroll */ | ||
34 | const double RBViewport::scrollPause = 0.5; | ||
35 | /* Pixels/second of text scrolling */ | 33 | /* Pixels/second of text scrolling */ |
36 | const double RBViewport::scrollRate = 30; | 34 | const double RBViewport::scrollRate = 30; |
37 | 35 | ||
@@ -302,23 +300,18 @@ void RBViewport::alignLeft() | |||
302 | if(difference > 0) | 300 | if(difference > 0) |
303 | { | 301 | { |
304 | /* Subtracting out complete cycles */ | 302 | /* Subtracting out complete cycles */ |
305 | double totalTime = 2 * scrollPause + difference / scrollRate; | 303 | double totalTime = 2 * difference / scrollRate; |
306 | scrollTime -= totalTime * std::floor(scrollTime / totalTime); | 304 | scrollTime -= totalTime * std::floor(scrollTime / totalTime); |
307 | 305 | ||
308 | /* Calculating the offset */ | 306 | /* Calculating the offset */ |
309 | if(scrollTime < scrollPause) | 307 | if(scrollTime < static_cast<double>(difference) / scrollRate) |
310 | { | 308 | { |
311 | return; | 309 | leftGraphic->setOffset(scrollRate * scrollTime); |
312 | } | ||
313 | else if(scrollTime < scrollPause + difference / scrollRate) | ||
314 | { | ||
315 | scrollTime -= scrollPause; | ||
316 | int offset = scrollRate * scrollTime; | ||
317 | leftGraphic->setOffset(offset); | ||
318 | } | 310 | } |
319 | else | 311 | else |
320 | { | 312 | { |
321 | leftGraphic->setOffset(difference); | 313 | scrollTime -= static_cast<double>(difference) / scrollRate; |
314 | leftGraphic->setOffset(difference - scrollRate * scrollTime); | ||
322 | } | 315 | } |
323 | } | 316 | } |
324 | } | 317 | } |
@@ -352,23 +345,18 @@ void RBViewport::alignCenter() | |||
352 | if(difference > 0) | 345 | if(difference > 0) |
353 | { | 346 | { |
354 | /* Subtracting out complete cycles */ | 347 | /* Subtracting out complete cycles */ |
355 | double totalTime = 2 * scrollPause + difference / scrollRate; | 348 | double totalTime = 2 * difference / scrollRate; |
356 | scrollTime -= totalTime * std::floor(scrollTime / totalTime); | 349 | scrollTime -= totalTime * std::floor(scrollTime / totalTime); |
357 | 350 | ||
358 | /* Calculating the offset */ | 351 | /* Calculating the offset */ |
359 | if(scrollTime < scrollPause) | 352 | if(scrollTime < static_cast<double>(difference) / scrollRate) |
360 | { | ||
361 | return; | ||
362 | } | ||
363 | else if(scrollTime < scrollPause + difference / scrollRate) | ||
364 | { | 353 | { |
365 | scrollTime -= scrollPause; | 354 | centerGraphic->setOffset(scrollRate * scrollTime); |
366 | int offset = scrollRate * scrollTime; | ||
367 | centerGraphic->setOffset(offset); | ||
368 | } | 355 | } |
369 | else | 356 | else |
370 | { | 357 | { |
371 | centerGraphic->setOffset(difference); | 358 | scrollTime -= static_cast<double>(difference) / scrollRate; |
359 | centerGraphic->setOffset(difference - scrollRate * scrollTime); | ||
372 | } | 360 | } |
373 | } | 361 | } |
374 | 362 | ||
@@ -397,25 +385,19 @@ void RBViewport::alignRight() | |||
397 | if(difference > 0) | 385 | if(difference > 0) |
398 | { | 386 | { |
399 | /* Subtracting out complete cycles */ | 387 | /* Subtracting out complete cycles */ |
400 | double totalTime = 2 * scrollPause + difference / scrollRate; | 388 | double totalTime = 2 * difference / scrollRate; |
401 | scrollTime -= totalTime * std::floor(scrollTime / totalTime); | 389 | scrollTime -= totalTime * std::floor(scrollTime / totalTime); |
402 | 390 | ||
403 | /* Calculating the offset */ | 391 | /* Calculating the offset */ |
404 | if(scrollTime < scrollPause) | 392 | if(scrollTime < static_cast<double>(difference) / scrollRate) |
405 | { | 393 | { |
406 | return; | 394 | rightGraphic->setOffset(scrollRate * scrollTime); |
407 | } | ||
408 | else if(scrollTime < scrollPause + difference / scrollRate) | ||
409 | { | ||
410 | scrollTime -= scrollPause; | ||
411 | int offset = scrollRate * scrollTime; | ||
412 | rightGraphic->setOffset(offset); | ||
413 | } | 395 | } |
414 | else | 396 | else |
415 | { | 397 | { |
416 | rightGraphic->setOffset(difference); | 398 | scrollTime -= static_cast<double>(difference) / scrollRate; |
399 | rightGraphic->setOffset(difference - scrollRate * scrollTime); | ||
417 | } | 400 | } |
418 | } | 401 | } |
419 | |||
420 | } | 402 | } |
421 | 403 | ||
diff --git a/utils/themeeditor/graphics/rbviewport.h b/utils/themeeditor/graphics/rbviewport.h index eeeb7191ef..a9b706d95f 100644 --- a/utils/themeeditor/graphics/rbviewport.h +++ b/utils/themeeditor/graphics/rbviewport.h | |||
@@ -41,7 +41,6 @@ public: | |||
41 | }; | 41 | }; |
42 | 42 | ||
43 | static const double scrollRate; | 43 | static const double scrollRate; |
44 | static const double scrollPause; | ||
45 | 44 | ||
46 | RBViewport(skin_element* node, const RBRenderInfo& info); | 45 | RBViewport(skin_element* node, const RBRenderInfo& info); |
47 | virtual ~RBViewport(); | 46 | virtual ~RBViewport(); |