1
0
Fork 0
forked from len0rd/rockbox

fix deleteAnimation in calculator plugin.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22088 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Teruaki Kawashima 2009-07-30 14:02:46 +00:00
parent 65140a2cd5
commit aafbc559bb

View file

@ -101,13 +101,6 @@ PLUGIN_HEADER
#define X_4_POS (X_3_POS + REC_WIDTH) /* x4 = 88 */ #define X_4_POS (X_3_POS + REC_WIDTH) /* x4 = 88 */
#define X_5_POS (X_4_POS + REC_WIDTH) /* x5 = 110, column 111 left blank */ #define X_5_POS (X_4_POS + REC_WIDTH) /* x5 = 110, column 111 left blank */
#define TEXT_1_POS (Y_1_POS-10) /* y1 = 2 */ /* blank height = 12 */
#define TEXT_2_POS (Y_2_POS-8) /* y2 = 15 */ /* blank height = 9 */
#define TEXT_3_POS (Y_3_POS-8) /* y3 = 25 */
#define TEXT_4_POS (Y_4_POS-8) /* y4 = 35 */
#define TEXT_5_POS (Y_5_POS-8) /* y5 = 45 */
#define TEXT_6_POS (Y_6_POS-8) /* y6 = 55 */
#define SIGN(x) ((x)<0?-1:1) #define SIGN(x) ((x)<0?-1:1)
#define ABS(x) ((x)<0?-(x):(x)) #define ABS(x) ((x)<0?-(x):(x))
@ -373,7 +366,8 @@ PLUGIN_HEADER
#endif #endif
#include "lib/touchscreen.h" #include "lib/touchscreen.h"
static struct ts_raster calc_raster = { X_0_POS, Y_1_POS, BUTTON_COLS*REC_WIDTH, BUTTON_ROWS*REC_HEIGHT, REC_WIDTH, REC_HEIGHT }; static struct ts_raster calc_raster = { X_0_POS, Y_1_POS,
BUTTON_COLS*REC_WIDTH, BUTTON_ROWS*REC_HEIGHT, REC_WIDTH, REC_HEIGHT };
#endif #endif
enum { enum {
@ -652,8 +646,8 @@ void cal_initial (void)
{ {
int w,h; int w,h;
rb->lcd_getstringsize("A",&w,&h); rb->lcd_getstringsize("2nd",&w,&h);
if (h >= REC_HEIGHT) if (w > REC_WIDTH || h > REC_HEIGHT)
rb->lcd_setfont(FONT_SYSFIXED); rb->lcd_setfont(FONT_SYSFIXED);
rb->lcd_clear_display(); rb->lcd_clear_display();
@ -1011,23 +1005,22 @@ pos is the position that needs animation. pos = [1~18]
----------------------------------------------------------------------- */ ----------------------------------------------------------------------- */
void deleteAnimation(int pos) void deleteAnimation(int pos)
{ {
int k; int k, w, h, x;
if (pos<1 || pos >18) if (pos<1 || pos >18)
return; return;
pos--;
rb->lcd_fillrect(1+pos*6, TEXT_1_POS, 6, 8);
rb->lcd_update_rect(1+pos*6, TEXT_1_POS, 6, 8);
for (k=1;k<=4;k++){ rb->lcd_getstringsize("0", &w, &h);
rb->sleep(HZ/32); x = (pos==1? 4: LCD_WIDTH - 4 - w);
for (k=0;k<4;k++){
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
rb->lcd_fillrect(1+pos*6, TEXT_1_POS, 6, 8); rb->lcd_fillrect(x, Y_1_POS - h -1, w, h);
rb->lcd_set_drawmode(DRMODE_SOLID); rb->lcd_set_drawmode(DRMODE_SOLID);
rb->lcd_fillrect(1+pos*6+1+k, TEXT_1_POS+k, rb->lcd_fillrect(x + (w*k)/8, Y_1_POS - h -1 + (h*k)/8,
(5-2*k)>0?(5-2*k):1, (7-2*k)>0?(7-2*k):1 ); (w*(4-k))/4, (h*(4-k))/4);
rb->lcd_update_rect(1+pos*6, TEXT_1_POS, 6, 8); rb->lcd_update_rect(x, Y_1_POS - h -1, w, h);
rb->sleep(HZ/32);
} }
} }
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------