/** * A function to draw the graphic for a child menu entry to the screen. * * \param[in] position Position (0-5) of the menu item to draw. */ void draw_child( unsigned int position ) { unsigned int x_base = ( position * 21 ) + 2; unsigned int x_end = ( ( position + 1 ) * 21 ) - 1; Bdisp_DrawLineVRAM( x_base, 56, x_end , 56); Bdisp_DrawLineVRAM( x_base, 56, x_base, 63); }
void dAreaClear (int left,int top,int right,int bottom,int sel) { DISPBOX box; box.left = left;box.top = top;box.right = right;box.bottom = bottom; if (sel != 1) Bdisp_AreaClr_VRAM (&box); if (sel != 0){ Bdisp_DrawLineVRAM (box.left,box.top,box.right,box.top); Bdisp_DrawLineVRAM (box.left,box.bottom,box.right,box.bottom); Bdisp_DrawLineVRAM (box.left,box.top,box.left,box.bottom); Bdisp_DrawLineVRAM (box.right,box.top,box.right,box.bottom); } }
/* 输出屏幕底部的菜单(最多5个字符) */ void PrintIcon (int index, char* text, int sel) { index*=21; if (sel) { PrintMini(index+1+2*(5-strlen(text)), 59, (unsigned char*)text, 0); Bdisp_DrawLineVRAM(index,58,index+19,58); Bdisp_DrawLineVRAM(index,58,index,63); } else{ PrintMini(index+2*(5-strlen(text)), 59, (unsigned char*)text, 0); Bdisp_AreaReverseVRAM(index,58,index+19,63); } }
/** * A function to draw the graphic for a filled child menu entry to the screen. * * \param[in] position Position (0-5) of the menu item to draw. */ void draw_child_filled( unsigned int position ) { unsigned int x_base = ( position * 21 ) + 2; unsigned int x_end = ( ( position + 1 ) * 21 ) - 1; unsigned int i; for( i = 56; i < 64; i++ ) { Bdisp_DrawLineVRAM( x_base, i, x_end, i ); } }
int PrintTablesPM(short x,short y,char * str,short sel,short lbl) { int len; const int width = 28; len = strlen(str); x *= width; y *= 8; x += 16; if (sel) { Bdisp_AreaReverseVRAM(x,y,x+width-1,y+7); PrintMini(x+1+(lbl ? (width-5*len)/2:0),y+1,str,MINI_REV); } else { Bdisp_DrawLineVRAM(x+width-1,y,x+width-1,y+7); Bdisp_DrawLineVRAM(x,y+7,x+width-1,y+7); PrintMini(x+1+(lbl ? (width-5*len)/2:0),y+1,str,MINI_OVER); } }
/** * A function to draw the graphic for a parent menu entry to the screen. * * \param[in] position Position (0-5) of the menu item to draw. */ void draw_parent( unsigned int position ) { unsigned int x_base = ( position * 21 ) + 2; unsigned int x_end = ( ( position + 1 ) * 21 ) - 1; Bdisp_DrawLineVRAM( x_base, 56, x_end , 56 ); Bdisp_DrawLineVRAM( x_base, 57, x_end , 57 ); Bdisp_DrawLineVRAM( x_base, 58, x_end , 58 ); Bdisp_DrawLineVRAM( x_base, 59, x_end , 59 ); Bdisp_DrawLineVRAM( x_base, 60, x_end , 60 ); Bdisp_DrawLineVRAM( x_base, 61, x_end - 1, 61 ); Bdisp_DrawLineVRAM( x_base, 62, x_end - 2, 62 ); Bdisp_DrawLineVRAM( x_base, 63, x_end - 3, 63 ); }
void Mini(char* chaine, int n ) // fonc defini le numero de la fonction { int i; short j; for(i=56 ; i<64 ; i++) Bdisp_DrawLineVRAM(n*21+2, i, n*21+20, i); while(chaine[j]) j++; // on calcul la longeur de la chaine if(j<4) i=4; else i=3; PrintMini(n*21+i, 58, chaine, 18); //ML_display_vram(); }
int memory_user_select(char **files, int n, int extension, int exit) { const unsigned char icons[7][32] = { { 0x0,0x3c,0xf,0xc4,0xf0,0x4,0x80,0x4,0x80,0x2,0x80,0x2,0x40,0x2,0x40,0x2,0x40,0x2,0x40,0x2,0x40,0x1,0x40,0x1,0x20,0x1,0x20,0xf,0x23,0xf0,0x3c,0x0 }, { 0x0,0x3c,0xf,0xc4,0xf0,0x4,0x80,0x74,0x87,0x82,0x98,0x2,0x40,0x2,0x40,0x3a,0x43,0xc2,0x5c,0x2,0x40,0x39,0x43,0xc1,0x2c,0x1,0x20,0xf,0x23,0xf0,0x3c,0x0 }, { 0x0,0x3c,0xf,0xc4,0xf0,0x74,0x87,0x94,0xb8,0x12,0xa0,0xa,0x63,0x8a,0x52,0x8a,0x54,0x4a,0x54,0x66,0x54,0x25,0x48,0x1d,0x29,0xe1,0x2e,0xf,0x23,0xf0,0x3c,0x0 }, { 0x0,0x3c,0xf,0xc4,0xf0,0x4,0x87,0xc4,0x88,0x22,0x8c,0x62,0x4b,0xa2,0x44,0x42,0x42,0x82,0x42,0x82,0x42,0x81,0x44,0x41,0x2f,0xe1,0x20,0xf,0x23,0xf0,0x3c,0x0 }, { 0x0,0x3c,0xf,0xc4,0xf0,0x4,0x87,0xe4,0x88,0x12,0x88,0x12,0x48,0x12,0x47,0xe2,0x44,0x22,0x44,0x22,0x44,0x21,0x44,0x21,0x23,0xc1,0x20,0xf,0x23,0xf0,0x3c,0x0 }, { 0x0,0x3c,0xf,0xc4,0xf0,0x4,0x80,0x64,0x87,0xb2,0x98,0x52,0x51,0xb2,0x57,0x52,0x51,0xd2,0x4b,0xa,0x48,0x19,0x49,0xe1,0x2e,0x1,0x20,0xf,0x23,0xf0,0x3c,0x0 }, { 0x0,0x3c,0xf,0xc4,0xf0,0x4,0x80,0xe4,0x9c,0xa2,0x90,0xa2,0x58,0xe2,0x50,0x2,0x40,0x12,0x4a,0x2a,0x4a,0x39,0x4e,0x29,0x22,0x1,0x20,0xf,0x23,0xf0,0x3c,0x0 } }; char *exts[19] = { ".txt", ".c", ".h", ".cpp", ".hpp", ".bmp",".jpg",".png",".gif", ".sav", ".g1m",".g2m",".g1r",".g2r", ".g1e",".g2e",".g1a", ".hex",".bin" }; unsigned char indexs[19] = { 1,1,1,1,1, 2,2,2,2, 3, 4,4,4,4, 5,5,5, 6,6 }; unsigned char *icoind = malloc(n); unsigned int key; int i,j,k,t; int p=0, offset=0; if(!icoind) { memory_error("user_sele.()","malloc()",1); return -2; } for(i=0;i<n;i++) { for(t=-1,j=0;*(*(files+i)+j);j++) if(*(*(files+i)+j) == '.') t = j; icoind[i] = (t==-1?1:0); for(k=0;k<19;k++) if(!strcmp(*(files+i)+t,exts[k])) { icoind[i]=indexs[k]; break; } if(!extension && t+1) *(*(files+i)+t) = 0; } while(1) { Bdisp_AllClr_VRAM(); for(t=0;t<(n>3?3:n);t++) { if(icoind[offset+i]!=255) for(i=0;i<32;i++) { k = icons[icoind[offset+t]][i]; for(j=0;j<8;j++) { if(k&1) Bdisp_SetPoint_VRAM(11-j+8*(i&1),20*t+4+(i>>1),1); k >>= 1; } } PrintXY(24,20*t+9,(const unsigned char *)*(files+offset+t),0); } Bdisp_DrawLineVRAM(2,20*p+3,2,20*p+20); Bdisp_DrawLineVRAM(3,20*p+2,99,20*p+2); Bdisp_DrawLineVRAM(3,20*p+21,99,20*p+21); Bdisp_DrawLineVRAM(100,20*p+3,100,20*p+20); if(offset>0) PrintXY(114,6,(const unsigned char *)"\346\234",0); if(offset+3<n) PrintXY(114,51,(const unsigned char *)"\346\235",0); while(1) { GetKey(&key); if(key==30002 && exit) { free(icoind); return -1; } if(key==30004) break; if(key==30018 && (offset||p)) { if(p==2) p--; else if(offset) offset--; else p--; break; } if(key==30023 && (offset+p+1<n)) { if(p==0) p++; else if(offset+3<n) offset++; else p++; break; } } if(key==30004) break; } free(icoind); return offset+p; }