#include #include "nSonic.h" #include "dirlist.h" #include "console.h" #include "screen.h" #include "tools.h" #include "charmaps.h" #include "touchpad.h" #define ICON_HEIGHT 16 #define ICON_WIDTH 16 #define MAX_ICONLGN ((SCREEN_HEIGHT-HEAD_HEIGHT2)/ICON_HEIGHT) char ofoldimg[ICON_HEIGHT*ICON_WIDTH*3]={0xA5,0x96,0x7B,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x94,0x82,0x6B,0x20,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0xA5,0x96,0x7B,0x94,0x86,0x6B,0xE6,0xCE,0xB5,0xEF,0xDB,0xBD,0xE6,0xD7,0xBD,0xE6,0xD7,0xBD,0xE6,0xD7,0xBD,0xE6,0xD7,0xBD,0xE6,0xD7,0xBD,0xE6,0xD7,0xBD,0xE6,0xD7,0xBD,0xE6,0xD7,0xBD,0xEF,0xDF,0xC5,0xA5,0x8E,0x73,0x00,0x00,0x00,0x00,0x00,0x00,0xA5,0x96,0x7B,0x9C,0x86,0x6B,0xDE,0xCE,0xB5,0xDE,0xD7,0xBD,0xDE,0xD2,0xBD,0xDE,0xD2,0xBD,0xDE,0xD2,0xBD,0xDE,0xD2,0xBD,0xE6,0xD7,0xBD,0xE6,0xDB,0xC5,0xEF,0xDB,0xBD,0xDE,0xD7,0xBD,0xE6,0xDB,0xC5,0xA5,0x8E,0x73,0x00,0x00,0x00,0x00,0x00,0x00,0xA5,0x96,0x7B,0x9C,0x86,0x6B,0xDE,0xC6,0xAD,0xDE,0xCE,0xB5,0xDE,0xCA,0xB5,0xDE,0xCA,0xB5,0xDE,0xCA,0xB5,0xDE,0xCE,0xBD,0xF7,0xE7,0xDE,0x10,0x9E,0x52,0xC5,0xDB,0xC5,0xE6,0x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73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x94,0x82,0x6B,0x20,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0xA5,0x92,0x7B,0xEF,0xE7,0xD6,0xFF,0xF3,0xDE,0xFF,0xF7,0xE6,0xA5,0x96,0x7B,0x94,0x82,0x6B,0x21,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA5,0x96,0x84,0x9C,0x8A,0x73,0x94,0x86,0x6B,0x21,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; char cfoldimg[ICON_HEIGHT*ICON_WIDTH*3]={0xA5,0x96,0x7B,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x94,0x82,0x6B,0x20,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0xA5,0x96,0x7B,0x94,0x86,0x6B,0xE6,0xCE,0xB5,0xEF,0xDB,0xBD,0xE6,0xD7,0xBD,0xE6,0xD7,0xBD,0xE6,0xD7,0xBD,0xE6,0xD7,0xBD,0xE6,0xD7,0xBD,0xE6,0xD7,0xBD,0xE6,0xD7,0xBD,0xE6,0xD7,0xBD,0xEF,0xDF,0xC5,0xA5,0x8E,0x73,0x00,0x00,0x00,0x00,0x00,0x00,0xA5,0x96,0x7B,0x9C,0x86,0x6B,0xDE,0xCE,0xB5,0xDE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0xDE,0xCE,0xBD,0xEF,0xDB,0xC5,0xE6,0xD7,0xC5,0xE6,0xD7,0xC5,0xE6,0xD7,0xC5,0xE6,0xD7,0xC5,0xE6,0xD7,0xC5,0xE6,0xD7,0xC5,0xE6,0xD7,0xC5,0xE6,0xD7,0xC5,0xE6,0xD7,0xC5,0xE6,0xD7,0xC5,0xEF,0xDF,0xCE,0xA5,0x8E,0x7B,0x00,0x00,0x00,0xA5,0x92,0x7B,0xE6,0xDB,0xCE,0xF7,0xE7,0xD6,0xEF,0xE3,0xD6,0xEF,0xE3,0xD6,0xEF,0xE3,0xD6,0xF7,0xEB,0xDE,0xA5,0x96,0x7B,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x94,0x82,0x6B,0x20,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0xA5,0x92,0x7B,0xEF,0xE7,0xD6,0xFF,0xF3,0xDE,0xFF,0xF7,0xE6,0xA5,0x96,0x7B,0x94,0x82,0x6B,0x21,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA5,0x96,0x84,0x9C,0x8A,0x73,0x94,0x86,0x6B,0x21,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; char efoldimg[ICON_HEIGHT*ICON_WIDTH*3]={0xA5,0x96,0x7B,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9C,0x8A,0x73,0x9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00,0x00,0x00,0x00,0x00,0x00,0xA5,0x96,0x84,0x9C,0x8A,0x73,0x94,0x86,0x6B,0x21,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; extern unsigned char sscreen[SCREEN_WIDTH*SCREEN_HEIGHT*2]; extern unsigned short int* offscreen; extern unsigned short int* screen; int chooseFile(char* path, char* initpath, char* rootpath, int* bline) { int j,i,li,s, refresh, shouldwait, t, cancelled=0, parent=0, validated=0, child=0, numfiles,oldnumfiles=0,once=1,maxfiles=0; int touchedzone=0; char ext[5], dext[9]; initTP(); strcpy(path,initpath); char* p = strrchr(path,'/'); if(p) *(p+1)=0; dirinfo* filenames=0; int fileselected=0; while(!fileselected && !cancelled) { numfiles = dirlist(path, &filenames,1,maxfiles); maxfiles=max(maxfiles,numfiles); refresh=1; li=-1; s=0; i=s; if(once) { if(*bline) { i=min(*bline,numfiles-1); while(i-s>=MAX_ICONLGN) { s+=MAX_ICONLGN; if(s>numfiles-MAX_ICONLGN+1) s=numfiles-MAX_ICONLGN; } } once=0; } shouldwait=0; validated=0; child=0; while (!validated && !cancelled) { parent=0; if( refresh ) { int size=320*240*2; memcpy(offscreen,sscreen,size); if(strlen(path)>0) { drwBufStr(offscreen,ICON_WIDTH,HEAD_HEIGHT1+ICON_HEIGHT-CHAR_HEIGHT-1,path,0,1); dispBufImgRGB(offscreen,0,HEAD_HEIGHT1,ofoldimg,ICON_HEIGHT,ICON_WIDTH,1); } if(numfiles>0) { setCurColorRGB(40,148,184); drawBufFullBox(offscreen,0,HEAD_HEIGHT2+ICON_HEIGHT*(i-s),SCREEN_WIDTH-SCROLL_WIDTH-1,HEAD_HEIGHT2+ICON_HEIGHT*(i-s+1)); setCurColorRGB(0,0,0); } for (j = s; j < numfiles && j-s<=MAX_ICONLGN; j++) { t = strlen(filenames[j].filename); *ext=0; if(t>=4) strcpy(ext,filenames[j].filename+t-4); *dext=0; if(t>=4) strcpy(dext,filenames[j].filename+t-8); if(filenames[j].content) dispBufImgRGB(offscreen,ICON_WIDTH-4,HEAD_HEIGHT2+(j-s)*ICON_HEIGHT,cfoldimg,ICON_HEIGHT,ICON_WIDTH,1); else dispBufImgRGB(offscreen,ICON_WIDTH-4,HEAD_HEIGHT2+(j-s)*ICON_HEIGHT,efoldimg,ICON_HEIGHT,ICON_WIDTH,1); if(i==j) setCurColorRGB(255,255,255); drwBufStr(offscreen,2*ICON_WIDTH-3,HEAD_HEIGHT2+ICON_HEIGHT*(j-s)+ICON_HEIGHT-CHAR_HEIGHT,filenames[j].filename,0,1); if(i==j) setCurColorRGB(0,0,0); } if(MAX_ICONLGN>=numfiles) clearScroll(offscreen); else { int h=SCREEN_HEIGHT-HEAD_HEIGHT2-1-2*14-2; int y0=SCREEN_HEIGHT-h-17; int y1=SCREEN_HEIGHT-16; int h1=h*s/numfiles; int h2=h*(numfiles-min(s+MAX_ICONLGN,numfiles))/numfiles; if(h1) { setCurColorRGB(255,255,255); drawBufFullBox(offscreen,SCREEN_WIDTH-SCROLL_WIDTH+3,y0,SCREEN_WIDTH-4,y0+h1-1); setCurColorRGB(0,0,0); } if(h2) { setCurColorRGB(255,255,255); drawBufFullBox(offscreen,SCREEN_WIDTH-SCROLL_WIDTH+3,y1,SCREEN_WIDTH-4,y1-h2+1); setCurColorRGB(0,0,0); } } if(is_cx2) memcpy(screen,offscreen,SCREEN_WIDTH*SCREEN_HEIGHT*2); else { unsigned short int* t=getScreen(); setScreen(offscreen); // offscreen buffer becomes onscreen buffer offscreen=t; } refresh=0; wait(250); if(once) { while(any_key_pressed()); once=0; } } readTP(); touchedzone=getTouchedZone5(); if( numfiles>0 ) { if (isKeyPressed(KEY_NSPIRE_UP) || isKeyPressed(KEY_NSPIRE_8) || touchedzone==8) { i--; if (i < 0) i = numfiles-1; } if (isKeyPressed(KEY_NSPIRE_DOWN) || isKeyPressed(KEY_NSPIRE_2) || touchedzone==2) { i++; if (i >= numfiles) i = 0; } if (i!=li) { refresh=1; while(i=MAX_ICONLGN) { s+=MAX_ICONLGN; // refresh=1; if(s>numfiles-MAX_ICONLGN+1) s=numfiles-MAX_ICONLGN; } /* if(!refresh) { if(li>=0) drwBufBox(offscreen,38,ICON_HEIGHT*(li-s+2),SCREEN_WIDTH-1,ICON_HEIGHT*(li-s+3)-1,0); drwBufBox(offscreen,38,ICON_HEIGHT*(i-s+2),SCREEN_WIDTH-1,ICON_HEIGHT*(i-s+3)-1,0xFFFF); wait(250); }*/ li=i; } } if(isKeyPressed(KEY_NSPIRE_ESC) || (numfiles<=0 && (isKeyPressed(KEY_NSPIRE_ENTER) || isKeyPressed(KEY_NSPIRE_RET) || isKeyPressed(KEY_NSPIRE_CLICK) || isKeyPressed(KEY_NSPIRE_5) || isKeyPressed(KEY_NSPIRE_6) || isKeyPressed(KEY_NSPIRE_RIGHT) || touchedzone==6))) cancelled=1; if((isKeyPressed(KEY_NSPIRE_LEFT) && !isKeyPressed(KEY_NSPIRE_UP) && !isKeyPressed(KEY_NSPIRE_DOWN)) || isKeyPressed(KEY_NSPIRE_4) || touchedzone==4) { parent=1; validated=1; } if(((numfiles>0 && (isKeyPressed(KEY_NSPIRE_ENTER) || isKeyPressed(KEY_NSPIRE_RET) || isKeyPressed(KEY_NSPIRE_CLICK) || isKeyPressed(KEY_NSPIRE_5) || isKeyPressed(KEY_NSPIRE_6) || (isKeyPressed(KEY_NSPIRE_RIGHT) && !isKeyPressed(KEY_NSPIRE_UP) && !isKeyPressed(KEY_NSPIRE_DOWN)))) || touchedzone==6)) { validated=1; if(isKeyPressed(KEY_NSPIRE_6) || (isKeyPressed(KEY_NSPIRE_RIGHT)) || touchedzone==6) { child=1; } } if(numfiles>0 && (isKeyPressed(KEY_NSPIRE_SHIFT))) validated=-1; wait(10); } if(!cancelled) { char* selected = filenames[i].filename; if(strcmp(selected,".") || parent) { if(!strcmp(selected,"..") || parent) { t=strlen(path); if(t>strlen(rootpath)) { path[t-1]=0; if(t>strlen(rootpath)+1) { p = strrchr(path,'/'); if(p) *(p+1)=0; } else { if(strlen(path)>0) strcat(path,"/"); } } shouldwait=1; } else { strcat(path,selected); if(!filenames[i].content || !child) { fileselected=1; } else shouldwait=1; if(strlen(path)>1) strcat(path,"/"); } if(shouldwait) { wait(250); shouldwait=0; } } *bline=i; } else { char* selected = path; } } if(filenames) free(filenames); endTP(); while(any_key_pressed()); return validated*(i+1); }