Changeset 1286


Ignore:
Timestamp:
08/08/11 19:52:07 (23 months ago)
Author:
pixeldoc2000
Message:

gui_space.c optimized some if/else

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/gui_space.c

    r1234 r1286  
    2121    coord x; 
    2222    register coord xx, yy; 
    23      
     23 
    2424    xx = conf.space_hor_pos.x; 
    2525    yy = conf.space_hor_pos.y; 
     
    3030    if (conf.space_warn_type == 0) { 
    3131        cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color); 
    32     } 
    33     if (conf.space_warn_type == 1) { 
    34         cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color); 
    35     } 
    36     if (conf.space_warn_type == 2) { 
     32    } else if (conf.space_warn_type == 1) { 
     33        cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color); 
     34    } else if (conf.space_warn_type == 2) { 
    3735        cl = conf.space_color; 
    3836    } 
     
    4442            xx = screen_width-size; 
    4543        } 
    46     } 
    47     if (conf.space_bar_size == 1) { 
     44    } else if (conf.space_bar_size == 1) { 
    4845        size = screen_width/2-4; 
    4946        if (xx>(screen_width-size)) { 
    5047            xx = screen_width-size; 
    5148        } 
    52     } 
    53     if (conf.space_bar_size == 2) { 
     49    } else if (conf.space_bar_size == 2) { 
    5450        size = screen_width-4; 
    5551        if (xx>(screen_width-size)) { 
     
    7874    coord y; 
    7975    register coord xx, yy; 
    80      
     76 
    8177    xx = conf.space_ver_pos.x; 
    8278    yy = conf.space_ver_pos.y; 
     
    8783    if (conf.space_warn_type == 0) { 
    8884        cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color); 
    89     } 
    90     if (conf.space_warn_type == 1) { 
    91         cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color); 
    92     } 
    93     if (conf.space_warn_type == 2) { 
     85    } else if (conf.space_warn_type == 1) { 
     86        cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color); 
     87    } else if (conf.space_warn_type == 2) { 
    9488        cl = conf.space_color; 
    9589    } 
     
    10296            yy = screen_height-size; 
    10397        } 
    104     } 
    105     if (conf.space_bar_size == 1) { 
     98    } else if (conf.space_bar_size == 1) { 
    10699        size = screen_height/2-4; 
    107100        if (yy>(screen_height-size)) { 
    108101            yy = screen_height-size; 
    109102        } 
    110     } 
    111     if (conf.space_bar_size == 2) { 
     103    } else if (conf.space_bar_size == 2) { 
    112104        size = screen_height-4; 
    113105        if (yy>(screen_height-size)) { 
     
    135127    coord x; 
    136128    register coord xx, yy; 
    137      
     129 
    138130    xx = conf.space_icon_pos.x; 
    139131    yy = conf.space_icon_pos.y; 
     
    143135    if (conf.space_warn_type == 0) { 
    144136        cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color); 
    145     } 
    146     if (conf.space_warn_type == 1) { 
    147         cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color); 
    148     } 
    149     if (conf.space_warn_type == 2) { 
     137    } else if (conf.space_warn_type == 1) { 
     138        cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color); 
     139    } else if (conf.space_warn_type == 2) { 
    150140        cl = conf.space_color; 
    151141    } 
     
    193183    if (conf.space_warn_type == 0) { 
    194184        cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color); 
    195     } 
    196     if (conf.space_warn_type == 1) { 
    197         cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color); 
    198     } 
    199     if (conf.space_warn_type == 2) { 
     185    } else if (conf.space_warn_type == 1) { 
     186        cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color); 
     187    } else if (conf.space_warn_type == 2) { 
    200188        cl = conf.space_color; 
    201189    } 
     
    211199    if (conf.space_warn_type == 0) { 
    212200        cl = (perc<=conf.space_perc_warn)?conf.osd_color_warn:(conf.space_color); 
    213     } 
    214     if (conf.space_warn_type == 1) { 
    215         cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color); 
    216     } 
    217     if (conf.space_warn_type == 2) { 
     201    } else if (conf.space_warn_type == 1) { 
     202        cl = (GetFreeCardSpaceKb()/1024<=conf.space_mb_warn)?conf.osd_color_warn:(conf.space_color); 
     203    } else if (conf.space_warn_type == 2) { 
    218204        cl = conf.space_color; 
    219205    } 
     
    238224    if (conf.space_bar_show==1) { 
    239225        gui_space_draw_spacebar_horizontal(); 
    240     } 
    241     if (conf.space_bar_show==2) { 
     226    } else if (conf.space_bar_show==2) { 
    242227        gui_space_draw_spacebar_vertical(); 
    243228    } 
Note: See TracChangeset for help on using the changeset viewer.