修改块的括号换行

This commit is contained in:
anod 2022-10-02 19:32:45 +08:00
parent 1c128acd11
commit 18cd261aac
2 changed files with 31 additions and 18 deletions

View File

@ -20,7 +20,8 @@ static void set_screen_color( acf_callerdata_t data, acf_position_t tx, acf_posi
int x = tx + draw_data[0];
int y = ty + draw_data[1];
if( 0 <= x && x < draw_data[2] && 0 <= y && y < draw_data[3] ){
if( 0 <= x && x < draw_data[2] && 0 <= y && y < draw_data[3] )
{
frame[ x*draw_data[3] + (draw_data[3]-1-y) ] = (u16)draw_data[4];
}
}
@ -87,7 +88,8 @@ static void paint_one_line( atp_lineinfo_t provider, acf_callerdata_t data, int
atp_color_t color = ATP_COLOR_WHITE;
atp_placement_t align = ATP_PLACEMENT_LEFT;
atp_error_t err = provider( data, idx, &text, NULL, &color, &align );
if( !err ){
if( !err )
{
acf_put_text(
CONTAINER_LEFTTOP_X,
CONTAINER_LEFTTOP_Y + row*FONT_HEIGHT,
@ -105,7 +107,8 @@ static void container_paint( atp_lineinfo_t provider, atp_callerdata_t data, atp
{
int end = top + CONTAINER_MAX_LINES;
if( end > (int)nlines ) end = nlines;
for( int n = top; n < end; ++n ){
for( int n = top; n < end; ++n )
{
paint_one_line( provider, data, n, n-top );
}
}
@ -116,16 +119,20 @@ atp_error_t atp_show( atp_counter_t cnt, atp_lineinfo_t provider, atp_callerdata
screen_clean();
container_paint( provider, data, cnt, idx_top );
while( 1 ){
while( 1 )
{
int top = idx_top;
u32 kDown = waitKey();
if( kDown == KEY_B || kDown == KEY_A ) return ATP_SUCCESS;
else if( cnt > CONTAINER_MAX_LINES ){ // may scroll
if( kDown == KEY_UP || kDown == KEY_DUP ){
else if( cnt > CONTAINER_MAX_LINES )
{ // may scroll
if( kDown == KEY_UP || kDown == KEY_DUP )
{
top = idx_top - 1;
}
else if( kDown == KEY_DOWN || kDown == KEY_DDOWN ){
else if( kDown == KEY_DOWN || kDown == KEY_DDOWN )
{
top = idx_top + 1;
}
@ -134,7 +141,8 @@ atp_error_t atp_show( atp_counter_t cnt, atp_lineinfo_t provider, atp_callerdata
}
else if( kDown == 0 ) return ATP_POWER_OFF;
if( top != idx_top ){
if( top != idx_top )
{
idx_top = top;
screen_clean();
container_paint(provider, data, cnt, idx_top);
@ -144,11 +152,13 @@ atp_error_t atp_show( atp_counter_t cnt, atp_lineinfo_t provider, atp_callerdata
atp_error_t atp_tips( atp_text_t tipsA, atp_text_t tipsB )
{
if( tipsA != NULL ){
if( tipsA != NULL )
{
strncpy( ta, tipsA, TIPS_MAX-1 );
ta[TIPS_MAX-1] = 0;
}
if( tipsB != NULL ){
if( tipsB != NULL )
{
strncpy( tb, tipsB, TIPS_MAX-1 );
tb[TIPS_MAX-1] = 0;
}

View File

@ -92,7 +92,8 @@ static const char *page[] = {
static atp_error_t test_show( atp_callerdata_t , atp_counter_t idx, atp_text_t *ptext, atp_itemval_t *, atp_color_t *, atp_placement_t * )
{
if( idx < sizeof(page) ){
if( idx < sizeof(page) )
{
*ptext = page[idx];
return ATP_SUCCESS;
}
@ -209,7 +210,8 @@ Result browseFiles(const char *const basePath, char selected[512])
s32 oldCursorPos = 0;
while(1)
{
if( dList->num > 0 ){
if( dList->num > 0 )
{
//ee_printf(*dList->ptrs[oldCursorPos] == ENT_TYPE_FILE ? "\x1b[%lu;H\x1b[37m %.51s" : "\x1b[%lu;H\x1b[36m %.51s", oldCursorPos - windowPos, &dList->ptrs[oldCursorPos][1]); // Clear old cursor.
//ee_printf("\x1b[%lu;H\x1b[33m>%.51s", cursorPos - windowPos, &dList->ptrs[cursorPos][1]); // Draw cursor.
if( oldCursorPos != cursorPos && windowPos <= (u32)oldCursorPos && (u32)oldCursorPos < windowPos + SCREEN_ROWS )
@ -295,13 +297,14 @@ Result browseFiles(const char *const basePath, char selected[512])
showDirList(dList, 0);
}
if( kDown & KEY_X ){
atp_tips(curDir, NULL);
if( kDown & KEY_X )
{
atp_tips(curDir, NULL);
if( atp_show( 22, test_show, NULL ) == ATP_POWER_OFF )
{
res = RES_NOT_FOUND;
goto end;
}
{
res = RES_NOT_FOUND;
goto end;
}
}
}