Changeset 992


Ignore:
Timestamp:
12/01/10 23:02:55 (2 years ago)
Author:
pixeldoc2000
Message:

some core/*.c cleanup

Location:
trunk/core
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/gui_batt.c

    r515 r992  
    4949    draw_line(conf.batt_icon_pos.x+3-2,    conf.batt_icon_pos.y+1+11,  conf.batt_icon_pos.x+3+25+2, conf.batt_icon_pos.y+1+11,  COLOR_BLACK);  // b 
    5050    draw_line(conf.batt_icon_pos.x+3+25+2, conf.batt_icon_pos.y+1-1,   conf.batt_icon_pos.x+3+25+2, conf.batt_icon_pos.y+1+10,  COLOR_BLACK);  // r 
    51      
     51 
    5252    // battery fill 
    5353    x=conf.batt_icon_pos.x+3+1+25-(perc/4); 
     
    5959 
    6060//------------------------------------------------------------------- 
    61 static void gui_batt_draw_charge(){ 
     61static void gui_batt_draw_charge() { 
    6262    int perc = get_batt_perc(); 
    6363    color cl = (perc<=10)?conf.osd_color_warn:conf.osd_color; 
     
    8484        gui_batt_draw_volts(); 
    8585    } 
    86      
     86 
    8787    if (conf.batt_icon_show) { 
    8888        gui_batt_draw_icon(); 
  • trunk/core/gui_debug.c

    r515 r992  
    1818 
    1919//------------------------------------------------------------------- 
    20 #define SCREEN_COLOR            0xF7 
     20#define SCREEN_COLOR    0xF7 
    2121 
    2222//------------------------------------------------------------------- 
     
    4444    draw_txt_string(10, y+2, buf, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); 
    4545 
    46 //    sprintf(buf, "0x%lf", *((double*)addr)); 
    47 //    draw_txt_string(10, y+3, buf, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); 
     46    //sprintf(buf, "0x%lf", *((double*)addr)); 
     47    //draw_txt_string(10, y+3, buf, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); 
    4848 
    4949    for (i=0; i<30; ++i) { 
     
    9090            gui_debug_draw_values(2, addr); 
    9191            gui_debug_draw_values(8, *((void**)addr)); 
    92              
    9392            conf.mem_view_addr_init = (long)addr; 
    9493 
     
    107106        break; 
    108107    case KEY_UP: 
    109                                 debug_cont_update = !debug_cont_update; 
    110                                 debug_to_draw = 2; 
     108        debug_cont_update = !debug_cont_update; 
     109        debug_to_draw = 2; 
    111110        break; 
    112111    case KEY_LEFT: 
     
    126125        debug_to_draw = 2; 
    127126        break; 
    128     case KEY_ZOOM_IN: // reduce step 
     127    case KEY_ZOOM_IN:    // reduce step 
    129128        switch (step) { 
    130129            case 0x00000010: step = 0x0000004; break; 
     
    132131            default: step>>=4; break; 
    133132        } 
    134                                 debug_to_draw = 2; 
    135                                 break; 
    136                 case KEY_ZOOM_OUT: // increase step 
     133        debug_to_draw = 2; 
     134        break; 
     135    case KEY_ZOOM_OUT:    // increase step 
    137136        switch (step) { 
    138137            case 0x00000004: step = 0x00000010; break; 
     
    140139            default: step<<=4; break; 
    141140        } 
    142                                 debug_to_draw = 2; 
    143                                 break; 
     141        debug_to_draw = 2; 
     142        break; 
    144143    } 
    145144} 
  • trunk/core/gui_space.c

    r703 r992  
    1818} 
    1919 
    20 static void gui_space_draw_spacebar_horizontal () { 
     20static void gui_space_draw_spacebar_horizontal() { 
    2121    coord x; 
    2222    color cl = conf.space_color; 
    2323    int perc = get_space_perc(),height = 2; 
    2424    float size = 0; 
    25     if (conf.space_warn_type == 0){ 
    26     cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color); 
    27     } 
    28     if (conf.space_warn_type == 1){ 
    29     cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color); 
    30     } 
    31     if (conf.space_warn_type == 2){ 
    32     cl = conf.space_color; 
    33     } 
    34        // space icon / bar 
     25    if (conf.space_warn_type == 0) { 
     26        cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color); 
     27    } 
     28    if (conf.space_warn_type == 1) { 
     29        cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color); 
     30    } 
     31    if (conf.space_warn_type == 2) { 
     32        cl = conf.space_color; 
     33    } 
     34    // space icon / bar 
    3535    height = conf.space_bar_width+1; 
    36     if (conf.space_bar_size == 0){ 
    37     size = screen_width/4-4; 
    38            if (conf.space_hor_pos.x>(screen_width-size)){ 
     36    if (conf.space_bar_size == 0) { 
     37        size = screen_width/4-4; 
     38        if (conf.space_hor_pos.x>(screen_width-size)) { 
    3939            conf.space_hor_pos.x = screen_width-size; 
    40         }     
    41     } 
    42     if (conf.space_bar_size == 1){ 
    43     size = screen_width/2-4; 
    44            if (conf.space_hor_pos.x>(screen_width-size)){ 
     40        } 
     41    } 
     42    if (conf.space_bar_size == 1) { 
     43        size = screen_width/2-4; 
     44        if (conf.space_hor_pos.x>(screen_width-size)) { 
    4545            conf.space_hor_pos.x = screen_width-size; 
    4646        } 
    4747    } 
    48      if (conf.space_bar_size == 2){ 
    49     size = screen_width-4; 
    50         if (conf.space_hor_pos.x>(screen_width-size)){ 
     48    if (conf.space_bar_size == 2) { 
     49        size = screen_width-4; 
     50        if (conf.space_hor_pos.x>(screen_width-size)) { 
    5151            conf.space_hor_pos.x = 0; 
    5252        } 
    5353    } 
    54     if (conf.space_hor_pos.y > (screen_height-height-3)){ 
    55             conf.space_hor_pos.y = screen_height-height-3; 
     54    if (conf.space_hor_pos.y > (screen_height-height-3)) { 
     55        conf.space_hor_pos.y = screen_height-height-3; 
    5656    } 
    5757    draw_rect(conf.space_hor_pos.x+1,    conf.space_hor_pos.y+1,     conf.space_hor_pos.x+1+size+2, conf.space_hor_pos.y+1+height+1,  cl); 
     
    6060    draw_line(conf.space_hor_pos.x+1-1,    conf.space_hor_pos.y+1+height+2,  conf.space_hor_pos.x+1+size+3, conf.space_hor_pos.y+1+height+2,  COLOR_BLACK);  // b 
    6161    draw_line(conf.space_hor_pos.x+1+size+3, conf.space_hor_pos.y+1-1,   conf.space_hor_pos.x+1+size+3, conf.space_hor_pos.y+1+height+2,  COLOR_BLACK);  // r 
    62      
     62 
    6363    // space bar fill 
    64          
     64 
    6565    x=conf.space_hor_pos.x+size-(perc/(100/size)); 
    6666    if (x<=conf.space_hor_pos.x+1) x=conf.space_hor_pos.x+1; 
     
    7070} 
    7171 
    72  
    73 static void gui_space_draw_spacebar_vertical () { 
     72static void gui_space_draw_spacebar_vertical() { 
    7473    coord y; 
    7574    color cl = conf.space_color; 
    7675    int perc = get_space_perc(), width = 2; 
    7776    float size = 0; 
    78     if (conf.space_warn_type == 0){ 
    79     cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color); 
    80     } 
    81     if (conf.space_warn_type == 1){ 
    82     cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color); 
    83     } 
    84     if (conf.space_warn_type == 2){ 
    85     cl = conf.space_color; 
    86     } 
    87      
    88        // space icon / bar 
     77    if (conf.space_warn_type == 0) { 
     78        cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color); 
     79    } 
     80    if (conf.space_warn_type == 1) { 
     81        cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color); 
     82    } 
     83    if (conf.space_warn_type == 2) { 
     84        cl = conf.space_color; 
     85    } 
     86 
     87    // space icon / bar 
    8988    width = conf.space_bar_width+1; 
    90     if (conf.space_bar_size == 0){ 
    91     size = screen_height/4-4; 
    92          if (conf.space_ver_pos.y>(screen_height-size)){ 
     89    if (conf.space_bar_size == 0) { 
     90        size = screen_height/4-4; 
     91        if (conf.space_ver_pos.y>(screen_height-size)) { 
    9392            conf.space_ver_pos.y = screen_height-size; 
    9493        } 
    9594    } 
    96     if (conf.space_bar_size == 1){ 
    97     size = screen_height/2-4; 
    98        if (conf.space_ver_pos.y>(screen_height-size)){ 
     95    if (conf.space_bar_size == 1) { 
     96        size = screen_height/2-4; 
     97        if (conf.space_ver_pos.y>(screen_height-size)) { 
    9998            conf.space_ver_pos.y = screen_height-size; 
    10099        } 
    101100    } 
    102      if (conf.space_bar_size == 2){ 
    103     size = screen_height-4; 
    104         if (conf.space_ver_pos.y>(screen_height-size)){ 
     101    if (conf.space_bar_size == 2) { 
     102        size = screen_height-4; 
     103        if (conf.space_ver_pos.y>(screen_height-size)) { 
    105104            conf.space_ver_pos.y = 0; 
    106105        } 
    107106    } 
    108     if (conf.space_ver_pos.x > (screen_width-width-3)){ 
    109             conf.space_ver_pos.x = screen_width-width-3; 
     107    if (conf.space_ver_pos.x > (screen_width-width-3)) { 
     108        conf.space_ver_pos.x = screen_width-width-3; 
    110109    } 
    111110    draw_rect(conf.space_ver_pos.x+1,    conf.space_ver_pos.y+1,     conf.space_ver_pos.x+1+width+1, conf.space_ver_pos.y+1+size+2,  cl); 
    112     draw_line(conf.space_ver_pos.x+1-1,    conf.space_ver_pos.y+1-1, conf.space_ver_pos.x+1-1,    conf.space_ver_pos.y+1+5, COLOR_BLACK);  // l 
    113      
    114     draw_line(conf.space_ver_pos.x+1-1,    conf.space_ver_pos.y+1-1, conf.space_ver_pos.x+1+width+2,    conf.space_ver_pos.y+1-1, COLOR_BLACK);  // t 
     111    draw_line(conf.space_ver_pos.x+1-1,    conf.space_ver_pos.y+1-1, conf.space_ver_pos.x+1-1,    conf.space_ver_pos.y+1+5, COLOR_BLACK);   // l 
     112 
     113    draw_line(conf.space_ver_pos.x+1-1,    conf.space_ver_pos.y+1-1, conf.space_ver_pos.x+1+width+2,    conf.space_ver_pos.y+1-1, COLOR_BLACK);   // t 
    115114    draw_line(conf.space_ver_pos.x+1-1,    conf.space_ver_pos.y+1+size+3, conf.space_ver_pos.x+1+width+2,    conf.space_ver_pos.y+1+size+3, COLOR_BLACK);   // b 
    116      
    117     draw_line(conf.space_ver_pos.x+1+width+2, conf.space_ver_pos.y+1-1,   conf.space_ver_pos.x+1+width+2, conf.space_ver_pos.y+1+size+3,  COLOR_BLACK);  // r 
    118      
     115 
     116    draw_line(conf.space_ver_pos.x+1+width+2, conf.space_ver_pos.y+1-1,   conf.space_ver_pos.x+1+width+2, conf.space_ver_pos.y+1+size+3,  COLOR_BLACK);   // r 
     117 
    119118    // space bar fill 
    120          
    121119    y=conf.space_ver_pos.y+size-(perc/(100/size)); 
    122120    if (y<=conf.space_ver_pos.y+1) y=conf.space_ver_pos.y+1; 
     
    126124} 
    127125 
    128 static void gui_space_draw_icon () { 
     126static void gui_space_draw_icon() { 
    129127    coord x; 
    130128    color cl = conf.space_color; 
    131129    int perc = get_space_perc(); 
    132     if (conf.space_warn_type == 0){ 
    133     cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color); 
    134     } 
    135     if (conf.space_warn_type == 1){ 
    136     cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color); 
    137     } 
    138     if (conf.space_warn_type == 2){ 
    139     cl = conf.space_color; 
     130    if (conf.space_warn_type == 0) { 
     131        cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color); 
     132    } 
     133    if (conf.space_warn_type == 1) { 
     134        cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color); 
     135    } 
     136    if (conf.space_warn_type == 2) { 
     137        cl = conf.space_color; 
    140138    } 
    141139    int i; 
    142     int le = 23;//length 
    143     int wi = 15;//width 
    144   
    145     draw_line(conf.space_icon_pos.x+5,      conf.space_icon_pos.y,       conf.space_icon_pos.x+le,     conf.space_icon_pos.y,       COLOR_BLACK);  // outer top 
    146     draw_line(conf.space_icon_pos.x+6,      conf.space_icon_pos.y+1,     conf.space_icon_pos.x+le-1,   conf.space_icon_pos.y+1,     MAKE_COLOR(cl, cl));  // inner top 
    147     draw_line(conf.space_icon_pos.x,        conf.space_icon_pos.y+5,     conf.space_icon_pos.x,        conf.space_icon_pos.y+wi,    COLOR_BLACK);  // outer left 
    148     draw_line(conf.space_icon_pos.x+1,      conf.space_icon_pos.y+6,     conf.space_icon_pos.x+1,      conf.space_icon_pos.y+wi-1,  MAKE_COLOR(cl, cl));  // inner left 
    149     draw_line(conf.space_icon_pos.x,        conf.space_icon_pos.y+wi,    conf.space_icon_pos.x+le,     conf.space_icon_pos.y+wi,    COLOR_BLACK);  // outer bottom 
    150     draw_line(conf.space_icon_pos.x+1,      conf.space_icon_pos.y+wi-1,  conf.space_icon_pos.x+le-1,   conf.space_icon_pos.y+wi-1,  MAKE_COLOR(cl, cl));  // inner bottom 
    151     draw_line(conf.space_icon_pos.x+le,     conf.space_icon_pos.y,       conf.space_icon_pos.x+le,     conf.space_icon_pos.y+wi,    COLOR_BLACK);  // outer right 
    152     draw_line(conf.space_icon_pos.x+le-1,   conf.space_icon_pos.y+1,     conf.space_icon_pos.x+le-1,   conf.space_icon_pos.y+wi-1,  MAKE_COLOR(cl, cl));  // inner right 
    153     draw_line(conf.space_icon_pos.x+5,      conf.space_icon_pos.y,       conf.space_icon_pos.x,        conf.space_icon_pos.y+5,     COLOR_BLACK);  // edge 
    154     draw_line(conf.space_icon_pos.x+5,      conf.space_icon_pos.y+1,     conf.space_icon_pos.x+1,      conf.space_icon_pos.y+5,     MAKE_COLOR(cl, cl));  // edge 
    155     draw_line(conf.space_icon_pos.x+6,      conf.space_icon_pos.y+1,     conf.space_icon_pos.x+1,      conf.space_icon_pos.y+6,     MAKE_COLOR(cl, cl));  // edge 
    156   
     140    int le = 23;    // length 
     141    int wi = 15;    // width 
     142 
     143    draw_line(conf.space_icon_pos.x+5,      conf.space_icon_pos.y,       conf.space_icon_pos.x+le,     conf.space_icon_pos.y,       COLOR_BLACK);          // outer top 
     144    draw_line(conf.space_icon_pos.x+6,      conf.space_icon_pos.y+1,     conf.space_icon_pos.x+le-1,   conf.space_icon_pos.y+1,     MAKE_COLOR(cl, cl));   // inner top 
     145    draw_line(conf.space_icon_pos.x,        conf.space_icon_pos.y+5,     conf.space_icon_pos.x,        conf.space_icon_pos.y+wi,    COLOR_BLACK);          // outer left 
     146    draw_line(conf.space_icon_pos.x+1,      conf.space_icon_pos.y+6,     conf.space_icon_pos.x+1,      conf.space_icon_pos.y+wi-1,  MAKE_COLOR(cl, cl));   // inner left 
     147    draw_line(conf.space_icon_pos.x,        conf.space_icon_pos.y+wi,    conf.space_icon_pos.x+le,     conf.space_icon_pos.y+wi,    COLOR_BLACK);          // outer bottom 
     148    draw_line(conf.space_icon_pos.x+1,      conf.space_icon_pos.y+wi-1,  conf.space_icon_pos.x+le-1,   conf.space_icon_pos.y+wi-1,  MAKE_COLOR(cl, cl));   // inner bottom 
     149    draw_line(conf.space_icon_pos.x+le,     conf.space_icon_pos.y,       conf.space_icon_pos.x+le,     conf.space_icon_pos.y+wi,    COLOR_BLACK);          // outer right 
     150    draw_line(conf.space_icon_pos.x+le-1,   conf.space_icon_pos.y+1,     conf.space_icon_pos.x+le-1,   conf.space_icon_pos.y+wi-1,  MAKE_COLOR(cl, cl));   // inner right 
     151    draw_line(conf.space_icon_pos.x+5,      conf.space_icon_pos.y,       conf.space_icon_pos.x,        conf.space_icon_pos.y+5,     COLOR_BLACK);          // edge 
     152    draw_line(conf.space_icon_pos.x+5,      conf.space_icon_pos.y+1,     conf.space_icon_pos.x+1,      conf.space_icon_pos.y+5,     MAKE_COLOR(cl, cl));   // edge 
     153    draw_line(conf.space_icon_pos.x+6,      conf.space_icon_pos.y+1,     conf.space_icon_pos.x+1,      conf.space_icon_pos.y+6,     MAKE_COLOR(cl, cl));   // edge 
     154 
    157155    // memory fill 
    158156    x=le-(perc*(le-3)/100)-2; 
     
    160158    if (x>2) draw_line(conf.space_icon_pos.x+x+1,    conf.space_icon_pos.y+2,     conf.space_icon_pos.x+le-2,   conf.space_icon_pos.y+2,     MAKE_COLOR(cl, cl)); 
    161159    else     draw_line(conf.space_icon_pos.x+4,      conf.space_icon_pos.y+2,     conf.space_icon_pos.x+le-2,   conf.space_icon_pos.y+2,     MAKE_COLOR(cl, cl)); 
    162     for(i=3;i<7;i++){                                                                                                                                               //          /--------------| 
    163         if (x>7-i) draw_pixel(conf.space_icon_pos.x+8-i,     conf.space_icon_pos.y+i,     COLOR_BLACK);                                                             //        /  1st for loop  | 
    164         if (x>7-i) draw_pixel(conf.space_icon_pos.x+x,       conf.space_icon_pos.y+i,     COLOR_BLACK);                                                             //      /__________________| 
    165         draw_line(conf.space_icon_pos.x+x+1,                 conf.space_icon_pos.y+i,     conf.space_icon_pos.x+le-2,     conf.space_icon_pos.y+i,     MAKE_COLOR(cl, cl));//     |                   | 
    166     }                                                                                                                                                               //     |     2nd for loop  | 
    167     for(i=7;i<wi-2;i++){                                                                                                                                            //     |                   | 
    168         if (x>1) draw_pixel(conf.space_icon_pos.x+2,         conf.space_icon_pos.y+i,     COLOR_BLACK);                                                             //     |-------------------| 
     160    for(i=3; i<7; i++) {                                                                                                                                                      //          /--------------| 
     161        if (x>7-i) draw_pixel(conf.space_icon_pos.x+8-i,     conf.space_icon_pos.y+i,     COLOR_BLACK);                                                                       //        /  1st for loop  | 
     162        if (x>7-i) draw_pixel(conf.space_icon_pos.x+x,       conf.space_icon_pos.y+i,     COLOR_BLACK);                                                                       //      /__________________| 
     163        draw_line(conf.space_icon_pos.x+x+1,                 conf.space_icon_pos.y+i,     conf.space_icon_pos.x+le-2,     conf.space_icon_pos.y+i,     MAKE_COLOR(cl, cl));   //     |                   | 
     164    }                                                                                                                                                                         //     |     2nd for loop  | 
     165    for(i=7; i<wi-2; i++) {                                                                                                                                                   //     |                   | 
     166        if (x>1) draw_pixel(conf.space_icon_pos.x+2,         conf.space_icon_pos.y+i,     COLOR_BLACK);                                                                       //     |-------------------| 
    169167        if (x>1) draw_pixel(conf.space_icon_pos.x+x,         conf.space_icon_pos.y+i,     COLOR_BLACK); 
    170168        draw_line(conf.space_icon_pos.x+x+1,                 conf.space_icon_pos.y+i,     conf.space_icon_pos.x+le-2,     conf.space_icon_pos.y+i,     MAKE_COLOR(cl, cl)); 
     
    174172} 
    175173 
    176  
    177 //------------------------------------------------------------------- 
    178 static void gui_space_draw_percent(){ 
     174//------------------------------------------------------------------- 
     175static void gui_space_draw_percent() { 
    179176    int perc = get_space_perc(); 
    180177    color cl = conf.space_color; 
    181     if (conf.space_warn_type == 0){ 
    182     cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color); 
    183     } 
    184     if (conf.space_warn_type == 1){ 
    185     cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color); 
    186     } 
    187     if (conf.space_warn_type == 2){ 
    188     cl = conf.space_color; 
     178    if (conf.space_warn_type == 0) { 
     179        cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color); 
     180    } 
     181    if (conf.space_warn_type == 1) { 
     182        cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color); 
     183    } 
     184    if (conf.space_warn_type == 2) { 
     185        cl = conf.space_color; 
    189186    } 
    190187    sprintf(osd_buf, "%3d%%", get_space_perc()); 
     
    197194    int perc = get_space_perc(); 
    198195    color cl = conf.space_color; 
    199     if (conf.space_warn_type == 0){ 
    200         cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color); 
    201     } 
    202     if (conf.space_warn_type == 1){ 
    203         cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color); 
    204     } 
    205     if (conf.space_warn_type == 2){ 
    206         cl = conf.space_color; 
    207     } 
    208   unsigned int freemb=GetFreeCardSpaceKb()/1024; 
    209   if (freemb < 10000) sprintf(osd_buf, "%3d%M",freemb); 
    210   else sprintf(osd_buf, "%3d%G",freemb/1024); // if 10 GiB or more free, print in GiB instead of MiB. 
    211   osd_buf[5]=0; 
    212   draw_string(conf.space_txt_pos.x, conf.space_txt_pos.y, osd_buf, cl); 
    213 } 
    214  
     196    if (conf.space_warn_type == 0) { 
     197        cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color); 
     198    } 
     199    if (conf.space_warn_type == 1) { 
     200        cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color); 
     201    } 
     202    if (conf.space_warn_type == 2) { 
     203        cl = conf.space_color; 
     204    } 
     205    unsigned int freemb=GetFreeCardSpaceKb()/1024; 
     206    if (freemb < 10000) sprintf(osd_buf, "%3d%M",freemb); 
     207    else sprintf(osd_buf, "%3d%G",freemb/1024);   // if 10 GiB or more free, print in GiB instead of MiB 
     208    osd_buf[5]=0; 
     209    draw_string(conf.space_txt_pos.x, conf.space_txt_pos.y, osd_buf, cl); 
     210} 
    215211 
    216212//------------------------------------------------------------------- 
    217213 
    218214void gui_space_draw_osd() { 
    219     if (conf.space_icon_show)   { 
     215    if (conf.space_icon_show) { 
    220216        gui_space_draw_icon(); 
    221217    } 
    222     if (conf.space_perc_show)  { 
     218    if (conf.space_perc_show) { 
    223219        gui_space_draw_percent(); 
    224220    } else if (conf.space_mb_show) { 
    225221        gui_space_draw_mb(); 
    226222    } 
    227   if (conf.space_bar_show==1) { 
     223    if (conf.space_bar_show==1) { 
    228224        gui_space_draw_spacebar_horizontal(); 
    229225    } 
    230   if (conf.space_bar_show==2) { 
     226    if (conf.space_bar_show==2) { 
    231227        gui_space_draw_spacebar_vertical(); 
    232228    } 
  • trunk/core/levent.c

    r826 r992  
    22#include "stdlib.h" 
    33#include "levent.h" 
    4 /* function dealing with "logical events"*/ 
    5 unsigned levent_index_for_name(const char *name) 
    6 { 
    7   unsigned i; 
    8   // TODO could check for id=-1 or id=0, both show up at end of table ? 
    9   for (i=0; levent_table[i].name; i++) { 
    10     // case insensitive might be better 
    11     if (strcmp(levent_table[i].name,name) == 0) { 
    12         return i; 
     4 
     5// functions dealing with "logical events" 
     6 
     7unsigned levent_index_for_name(const char *name) { 
     8    unsigned i; 
     9    // TODO could check for id=-1 or id=0, both show up at end of table ? 
     10    for (i=0; levent_table[i].name; i++) { 
     11        // case insensitive might be better 
     12        if (strcmp(levent_table[i].name,name) == 0) { 
     13            return i; 
     14        } 
    1315    } 
    14   } 
    15   return LEVENT_INVALID_INDEX; 
     16    return LEVENT_INVALID_INDEX; 
    1617} 
    1718 
    18 unsigned levent_index_for_id(unsigned id) 
    19 { 
    20   unsigned i; 
    21   // TODO could check for id=-1 or id=0, both show up at end of table ? 
    22   for (i=0; levent_table[i].name; i++) { 
    23     // case insensitive might be better 
    24     if (id == levent_table[i].id) { 
    25         return i; 
     19unsigned levent_index_for_id(unsigned id) { 
     20    unsigned i; 
     21    // TODO could check for id=-1 or id=0, both show up at end of table ? 
     22    for (i=0; levent_table[i].name; i++) { 
     23        // case insensitive might be better 
     24        if (id == levent_table[i].id) { 
     25            return i; 
     26        } 
    2627    } 
    27   } 
    28   return LEVENT_INVALID_INDEX; 
     28    return LEVENT_INVALID_INDEX; 
    2929} 
    3030 
    31 unsigned levent_count(void) 
    32 { 
    33   static unsigned num_levents = 0; 
    34   if(!num_levents) { 
    35     levent_def *ev; 
    36     // TODO could check for id=-1 or id=0, both show up at end of table ? 
    37     for (ev = levent_table; ev->name; ev++) { 
    38       num_levents++; 
     31unsigned levent_count(void) { 
     32    static unsigned num_levents = 0; 
     33    if(!num_levents) { 
     34        levent_def *ev; 
     35        // TODO could check for id=-1 or id=0, both show up at end of table ? 
     36        for (ev = levent_table; ev->name; ev++) { 
     37            num_levents++; 
     38        } 
    3939    } 
    40   } 
    41   return num_levents; 
     40    return num_levents; 
    4241} 
    4342 
    44 unsigned levent_id_for_name(const char *name) 
    45 { 
    46   unsigned i = levent_index_for_name(name); 
    47   if (i!=LEVENT_INVALID_INDEX) 
    48     return levent_table[i].id; 
    49   else 
    50     return 0; // or -1 ? both appear at the end of the event list 
     43unsigned levent_id_for_name(const char *name) { 
     44    unsigned i = levent_index_for_name(name); 
     45    if (i!=LEVENT_INVALID_INDEX) 
     46        return levent_table[i].id; 
     47    else 
     48        return 0; // or -1 ? both appear at the end of the event list 
    5149} 
    5250 
    53 const char * levent_name_for_id(unsigned id) 
    54 { 
    55   unsigned i = levent_index_for_id(id); 
    56   if (i!=LEVENT_INVALID_INDEX) 
    57     return levent_table[i].name; 
    58   else 
    59     return NULL; 
     51const char * levent_name_for_id(unsigned id) { 
     52    unsigned i = levent_index_for_id(id); 
     53    if (i!=LEVENT_INVALID_INDEX) 
     54        return levent_table[i].name; 
     55    else 
     56        return NULL; 
    6057} 
    6158 
    6259// note, slow linear search every time 
    63 int levent_post_to_ui_by_name(const char *name) 
    64 { 
    65         unsigned id=levent_id_for_name(name); 
    66         if(id) { 
    67                 PostLogicalEventToUI(id,0); 
    68                 return 1; 
    69         } 
    70         return 0; 
     60int levent_post_to_ui_by_name(const char *name) { 
     61    unsigned id=levent_id_for_name(name); 
     62    if(id) { 
     63        PostLogicalEventToUI(id,0); 
     64        return 1; 
     65    } 
     66    return 0; 
    7167} 
    7268 
    7369void levent_set_record(void) { 
    74         levent_post_to_ui_by_name("PressRecButton"); 
    75         levent_post_to_ui_by_name("UnpressRecButton"); 
     70    levent_post_to_ui_by_name("PressRecButton"); 
     71    levent_post_to_ui_by_name("UnpressRecButton"); 
    7672} 
    7773 
    7874void levent_set_play(void) { 
    79         levent_post_to_ui_by_name("PressPBButton"); 
    80         levent_post_to_ui_by_name("UnpressPBButton"); 
     75    levent_post_to_ui_by_name("PressPBButton"); 
     76    levent_post_to_ui_by_name("UnpressPBButton"); 
    8177} 
  • trunk/core/main.c

    r980 r992  
    99#include "motion_detector.h" 
    1010#ifdef OPT_EDGEOVERLAY 
    11         #include "edgeoverlay.h" 
     11    #include "edgeoverlay.h" 
    1212#endif 
    1313static int raw_need_postprocess; 
    1414static volatile int spytask_can_start; 
    1515 
    16 void core_hook_task_create(void *tcb) 
    17 { 
     16void core_hook_task_create(void *tcb) { 
    1817} 
    1918 
    20 void core_hook_task_delete(void *tcb) 
    21 { 
    22 char *name = (char*)(*(long*)((char*)tcb+0x34)); 
    23  if (strcmp(name,"tInitFileM")==0) core_spytask_can_start(); 
     19void core_hook_task_delete(void *tcb) { 
     20    char *name = (char*)(*(long*)((char*)tcb+0x34)); 
     21    if (strcmp(name,"tInitFileM")==0) core_spytask_can_start(); 
    2422} 
    2523 
    26  
    27 long core_get_noise_reduction_value() 
    28 { 
     24long core_get_noise_reduction_value() { 
    2925    return conf.raw_nr; 
    3026} 
    3127 
    32  
    33 void dump_memory() 
    34 { 
     28void dump_memory() { 
    3529    int fd; 
    3630    static int cnt=1; 
    3731    static char fn[32]; 
    3832 
    39  
    4033    started(); 
    41         mkdir("A/DCIM"); 
    42         mkdir("A/DCIM/100CANON"); 
    43         sprintf(fn, "A/DCIM/100CANON/CRW_%04d.JPG", cnt++); 
    44         fd = open(fn, O_WRONLY|O_CREAT, 0777); 
    45         if (fd) { 
    46 #ifdef CAMERA_ixus65_sd630 // Zero is not readable on ixus65! 
    47             write(fd, (int*)0xFFFF0000, 4); 
    48             write(fd, (int*)4, 0x1900-4); 
     34    mkdir("A/DCIM"); 
     35    mkdir("A/DCIM/100CANON"); 
     36    sprintf(fn, "A/DCIM/100CANON/CRW_%04d.JPG", cnt++); 
     37    fd = open(fn, O_WRONLY|O_CREAT, 0777); 
     38    if (fd) { 
     39#ifdef CAMERA_ixus65_sd630    // Zero is not readable on ixus65! 
     40        write(fd, (int*)0xFFFF0000, 4); 
     41        write(fd, (int*)4, 0x1900-4); 
    4942#else 
    50             write(fd, (void*)0, 0x1900); 
     43        write(fd, (void*)0, 0x1900); 
    5144#endif 
    52 // TODO actual memory size is larger than 32 MB on many cameras! 
    53             write(fd, (void*)0x1900, 32*1024*1024-0x1900); 
    54             close(fd); 
    55         } 
     45        // TODO actual memory size is larger than 32 MB on many cameras! 
     46        write(fd, (void*)0x1900, 32*1024*1024-0x1900); 
     47        close(fd); 
     48    } 
    5649    vid_bitmap_refresh(); 
    5750    finished(); 
     
    6053static volatile long raw_data_available; 
    6154 
    62 /* called from another process */ 
    63 void core_rawdata_available() 
    64 { 
     55// called from another process 
     56void core_rawdata_available() { 
    6557    raw_data_available = 1; 
    6658} 
    6759 
    6860void core_spytask_can_start() { 
    69         spytask_can_start = 1; 
     61    spytask_can_start = 1; 
    7062} 
    7163 
    72 void core_spytask() 
    73 { 
     64void core_spytask() { 
    7465    int cnt = 1; 
    7566    int i=0; 
     
    8071 
    8172#ifdef CAM_CHDK_PTP 
    82         init_chdk_ptp_task(); 
     73    init_chdk_ptp_task(); 
    8374#endif 
    8475 
     
    114105    auto_started = 0; 
    115106 
    116     if (conf.script_startup==1) script_autostart();                             // remote autostart 
    117         if (conf.script_startup==2) { 
    118                 conf.script_startup=0; 
    119                 conf_save(); 
    120                 script_autostart(); 
    121         } 
    122     while (1){ 
     107    if (conf.script_startup==1) script_autostart();    // remote autostart 
     108    if (conf.script_startup==2) { 
     109        conf.script_startup=0; 
     110        conf_save(); 
     111        script_autostart(); 
     112    } 
    123113 
    124         if (raw_data_available){ 
     114    while (1) { 
     115        if (raw_data_available) { 
    125116            raw_need_postprocess = raw_savefile(); 
    126             hook_raw_save_complete(); 
    127             raw_data_available = 0; 
    128             continue; 
    129         } 
     117            hook_raw_save_complete(); 
     118            raw_data_available = 0; 
     119            continue; 
     120        } 
    130121 
    131         if (state_shooting_progress != SHOOTING_PROGRESS_PROCESSING) { 
    132             if (((cnt++) & 3) == 0) 
    133                 gui_redraw(); 
     122        if (state_shooting_progress != SHOOTING_PROGRESS_PROCESSING) { 
     123            if (((cnt++) & 3) == 0) 
     124                gui_redraw(); 
    134125 
    135             histogram_process(); 
     126            histogram_process(); 
    136127#ifdef OPT_EDGEOVERLAY 
    137         if(conf.edge_overlay_thresh && conf.edge_overlay_enable) edge_overlay(); 
     128            if(conf.edge_overlay_thresh && conf.edge_overlay_enable) edge_overlay(); 
    138129#endif 
    139         } 
     130        } 
    140131 
    141         if ((state_shooting_progress == SHOOTING_PROGRESS_PROCESSING) && (!shooting_in_progress())) { 
    142             state_shooting_progress = SHOOTING_PROGRESS_DONE; 
     132        if ((state_shooting_progress == SHOOTING_PROGRESS_PROCESSING) && (!shooting_in_progress())) { 
     133            state_shooting_progress = SHOOTING_PROGRESS_DONE; 
    143134            if (raw_need_postprocess) raw_postprocess(); 
    144135        } 
    145136 
    146         msleep(20); 
     137        msleep(20); 
    147138    } 
    148139} 
    149  
    150  
    151  
    152  
Note: See TracChangeset for help on using the changeset viewer.