mirror of
https://gitee.com/anod/open_agb_firm.git
synced 2025-05-08 06:44:12 +08:00
重复代码打宏+字面常量去掉符号
This commit is contained in:
parent
f36fed18f7
commit
7b137f39e4
@ -50,14 +50,14 @@ const char *acf_put_text(int x, int y, int width, int height, int maxwidth, u8 c
|
||||
|
||||
//---------------------------------------------------
|
||||
|
||||
#define CONTAINER_LEFTTOP_X 20u
|
||||
#define CONTAINER_LEFTTOP_Y 15u
|
||||
#define CONTAINER_RECT_WIDTH 282u
|
||||
#define CONTAINER_MAX_LINES 13u
|
||||
#define WINDOW_WIDTH 320u
|
||||
#define WINDOW_HEIGHT 240u
|
||||
#define CONTAINER_LEFTTOP_X 20
|
||||
#define CONTAINER_LEFTTOP_Y 15
|
||||
#define CONTAINER_RECT_WIDTH 282
|
||||
#define CONTAINER_MAX_LINES 13
|
||||
#define WINDOW_WIDTH 320
|
||||
#define WINDOW_HEIGHT 240
|
||||
|
||||
#define FONT_HEIGHT 15u
|
||||
#define FONT_HEIGHT 15
|
||||
|
||||
static void screen_clean()
|
||||
{
|
||||
@ -195,6 +195,16 @@ static void draw_options( int start_row, int start_idx, int option_cnt, int sele
|
||||
}
|
||||
|
||||
#define SELECTED_ROW(top, len, sel) ((top) < (len) ? (len)-(top)+(sel) : (sel)+(len)-(top))
|
||||
#define REFRESH_PAGE {\
|
||||
if( idx_top < title_len )\
|
||||
{\
|
||||
void *title_data[2] = {(void*)title, (void*)title_offset};\
|
||||
container_paint( title_paint, title_data, title_len-idx_top, idx_top );\
|
||||
draw_options( title_len - idx_top, 0, cnt, item_sel, provider, data );\
|
||||
}\
|
||||
else draw_options( 0, idx_top - title_len, cnt, item_sel, provider, data );\
|
||||
}
|
||||
|
||||
atp_error_t atp_select( atp_text_t title, atp_counter_t cnt, atp_itemprovider_t provider, atp_keyhandler_t handler, atp_callerdata_t data, atp_itemval_t *res )
|
||||
{
|
||||
uint8_t title_offset[TITLE_MAX];
|
||||
@ -252,13 +262,7 @@ atp_error_t atp_select( atp_text_t title, atp_counter_t cnt, atp_itemprovider_t
|
||||
switch( opt )
|
||||
{
|
||||
case ATP_PAGE_REFRESH:
|
||||
if( idx_top < title_len )
|
||||
{
|
||||
void *title_data[2] = {(void*)title, (void*)title_offset};
|
||||
container_paint( title_paint, title_data, title_len-idx_top, idx_top );
|
||||
draw_options( title_len - idx_top, 0, cnt, item_sel, provider, data );
|
||||
}
|
||||
else draw_options( 0, idx_top - title_len, cnt, item_sel, provider, data );
|
||||
REFRESH_PAGE;
|
||||
break;
|
||||
case ATP_PAGE_UPDATE:
|
||||
draw_one_option( item_sel, item_sel, SELECTED_ROW(idx_top, title_len, item_sel), provider, data );
|
||||
@ -292,13 +296,7 @@ atp_error_t atp_select( atp_text_t title, atp_counter_t cnt, atp_itemprovider_t
|
||||
// 更新view
|
||||
if( full_refresh )
|
||||
{// 重新绘制全部
|
||||
if( idx_top < title_len )
|
||||
{
|
||||
void *title_data[2] = {(void*)title, (void*)title_offset};
|
||||
container_paint( title_paint, title_data, title_len-idx_top, idx_top );
|
||||
draw_options( title_len - idx_top, 0, cnt, sel, provider, data );
|
||||
}
|
||||
else draw_options( 0, idx_top - title_len, cnt, sel, provider, data );
|
||||
REFRESH_PAGE;
|
||||
}
|
||||
else
|
||||
{// 重新绘制item_sel和sel
|
||||
|
Loading…
x
Reference in New Issue
Block a user