Ignore:
Timestamp:
10/02/11 02:11:23 (20 months ago)
Author:
philmoz
Message:

Add colored icons from CHDK-DE (thx waterwingz).
Modified from CHDK-DE version to define the icon colors in gui_draw.h instead of gui_batt.c and gui_space.c.
Enabled for G10, G12, SX30 & IXUS310 - define CAM_USE_COLORED_ICONS in platform_camera.h to activate (may also need to fix icon color definitions in gui_draw.h for your camera as well).
Also adds custom color palette handling for G12, SX30 & IXUS310.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/gui_space.c

    r1299 r1352  
    9898 
    9999    space_color(); 
     100     
     101#if CAM_USE_COLORED_ICONS 
     102 
     103    draw_get_icon_colors(); 
     104 
     105    color cl1 = icon_green[1]; 
     106    color cl2 = icon_green[0]; 
     107    if (((conf.space_warn_type == 0) && (perc <= conf.space_perc_warn)) || 
     108        ((conf.space_warn_type == 1) && (GetFreeCardSpaceKb() <= conf.space_mb_warn*1024))) 
     109    { 
     110        cl1 = icon_red[1]; 
     111        cl2 = icon_red[0]; 
     112    }  
     113   
     114    //icon 
     115    draw_hline(xx,    yy,    30,  icon_grey[2]); 
     116    draw_vline(xx,    yy,    12,  icon_grey[2]); 
     117    draw_vline(xx+31, yy,    18,  icon_grey[0]); 
     118    draw_line(xx+1,   yy+13, xx+5, yy+17, icon_grey[0]); 
     119    draw_hline(xx+6,  yy+18, 24,  icon_grey[0]); 
     120            
     121    draw_filled_rect(xx+1,  yy+1,   xx+30,   yy+13,  MAKE_COLOR(icon_grey[1], icon_grey[1])); 
     122    draw_filled_rect(xx+5,  yy+14,  xx+30,   yy+17,  MAKE_COLOR(icon_grey[1], icon_grey[1])); 
     123    draw_filled_rect(xx+3,  yy+14,  xx+6,    yy+15,  MAKE_COLOR(icon_grey[1], icon_grey[1])); 
     124     
     125    draw_filled_rect(xx+2,  yy+2,   xx+6,    yy+4,   MAKE_COLOR(icon_yellow[0], icon_yellow[0])); 
     126    draw_filled_rect(xx+2,  yy+6,   xx+6,    yy+7,   MAKE_COLOR(icon_yellow[0], icon_yellow[0])); 
     127    draw_filled_rect(xx+2,  yy+9,   xx+6,    yy+10,  MAKE_COLOR(icon_yellow[0], icon_yellow[0])); 
     128    draw_filled_rect(xx+2,  yy+12,  xx+6,    yy+13,  MAKE_COLOR(icon_yellow[0], icon_yellow[0])); 
     129    draw_filled_rect(xx+5,  yy+15,  xx+9,    yy+16,  MAKE_COLOR(icon_yellow[0], icon_yellow[0]));    
     130     
     131    draw_hline(xx+8,  yy,    2, COLOR_TRANSPARENT); 
     132    draw_hline(xx+11, yy,    3, icon_grey[0]); 
     133    draw_hline(xx+11, yy+18, 2, COLOR_TRANSPARENT); 
     134 
     135    //fill icon 
     136    draw_rect(xx+9,         yy+4,   xx+28,   yy+13,  cl1); 
     137    draw_filled_rect(xx+27-(17*perc/100),      yy+5,       xx+27,     yy+12,   MAKE_COLOR(cl2, cl2)); 
     138 
     139#else 
    100140 
    101141#define LE  23 
     
    103143 
    104144    draw_hline(xx+5,     yy,      LE-5,     COLOR_BLACK);          // outer top 
    105     draw_hline(xx+6,     yy+1,    LE-7,     MAKE_COLOR(cl, cl));   // inner top 
     145    draw_hline(xx+6,     yy+1,    LE-7,     cl);                   // inner top 
    106146    draw_vline(xx,       yy+5,    WI-5,     COLOR_BLACK);          // outer left 
    107     draw_vline(xx+1,     yy+6,    WI-7,     MAKE_COLOR(cl, cl));   // inner left 
     147    draw_vline(xx+1,     yy+6,    WI-7,     cl);                   // inner left 
    108148    draw_hline(xx,       yy+WI,   LE,       COLOR_BLACK);          // outer bottom 
    109     draw_hline(xx+1,     yy+WI-1, LE-2,     MAKE_COLOR(cl, cl));   // inner bottom 
     149    draw_hline(xx+1,     yy+WI-1, LE-2,     cl);                   // inner bottom 
    110150    draw_vline(xx+LE,    yy,      WI,       COLOR_BLACK);          // outer right 
    111     draw_vline(xx+LE-1,  yy+1,    WI-2,     MAKE_COLOR(cl, cl));   // inner right 
    112     draw_line(xx+5,      yy,      xx,       yy+5,     COLOR_BLACK);          // edge 
    113     draw_line(xx+5,      yy+1,    xx+1,     yy+5,     MAKE_COLOR(cl, cl));   // edge 
    114     draw_line(xx+6,      yy+1,    xx+1,     yy+6,     MAKE_COLOR(cl, cl));   // edge 
     151    draw_vline(xx+LE-1,  yy+1,    WI-2,     cl);                   // inner right 
     152    draw_line(xx+5,      yy,      xx,       yy+5,  COLOR_BLACK);   // edge 
     153    draw_line(xx+5,      yy+1,    xx+1,     yy+5,  cl);            // edge 
     154    draw_line(xx+6,      yy+1,    xx+1,     yy+6,  cl);            // edge 
    115155 
    116156    // memory fill 
    117157    x = LE - (perc*(LE-3)/100) - 2; 
    118158    if (x>5) draw_hline(xx+6,      yy+2,     x-6,     COLOR_BLACK); 
    119     if (x>2) draw_hline(xx+x+1,    yy+2,     LE-x-3,  MAKE_COLOR(cl, cl)); 
    120     else     draw_hline(xx+4,      yy+2,     LE-6,    MAKE_COLOR(cl, cl)); 
    121     for(i=3; i<7; i++) {                                                               //          /--------------| 
    122         if (x>7-i) draw_pixel(xx+8-i,     yy+i,     COLOR_BLACK);                      //        /  1st for loop  | 
    123         if (x>7-i) draw_pixel(xx+x,       yy+i,     COLOR_BLACK);                      //      /__________________| 
    124         draw_hline(xx+x+1, yy+i, LE-x-3, MAKE_COLOR(cl, cl));                          //     |                   | 
    125     }                                                                                  //     |     2nd for loop  | 
    126     for(i=7; i<WI-2; i++) {                                                            //     |                   | 
    127         if (x>1) draw_pixel(xx+2,         yy+i,    COLOR_BLACK);                      //     |-------------------| 
    128         if (x>1) draw_pixel(xx+x,         yy+i,    COLOR_BLACK); 
    129         draw_hline(xx+x+1, yy+i, LE-x-3, MAKE_COLOR(cl, cl)); 
     159    if (x>2) draw_hline(xx+x+1,    yy+2,     LE-x-3,  cl); 
     160    else     draw_hline(xx+4,      yy+2,     LE-6,    cl); 
     161    for(i=3; i<7; i++) {                                                   //          /--------------| 
     162        if (x>7-i) draw_pixel(xx+8-i,     yy+i,     COLOR_BLACK);          //        /  1st for loop  | 
     163        if (x>7-i) draw_pixel(xx+x,       yy+i,     COLOR_BLACK);          //      /__________________| 
     164        draw_hline(xx+x+1, yy+i, LE-x-3, cl);                              //     |                   | 
     165    }                                                                      //     |     2nd for loop  | 
     166    for(i=7; i<WI-2; i++) {                                                //     |                   | 
     167        if (x>1) draw_pixel(xx+2, yy+i, COLOR_BLACK);                      //     |-------------------| 
     168        if (x>1) draw_pixel(xx+x, yy+i, COLOR_BLACK); 
     169        draw_hline(xx+x+1, yy+i, LE-x-3, cl); 
    130170    } 
    131171    if (x>1) draw_hline(xx+2,      yy+WI-2,    x-2,     COLOR_BLACK); 
    132     draw_hline(xx+x+1,             yy+WI-2,    LE-x-3,  MAKE_COLOR(cl, cl)); 
     172    draw_hline(xx+x+1,             yy+WI-2,    LE-x-3,  cl); 
     173 
     174#endif 
    133175} 
    134176 
Note: See TracChangeset for help on using the changeset viewer.