-florian66-

users_select

May 9th, 2015
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.68 KB | None | 0 0
  1. unsigned char* user_select(unsigned char* ch)
  2. {
  3.   unsigned int key;
  4.  
  5.   int i,j,k,t;
  6.   int p=0, offset=0;
  7.   char x;
  8.   char **files = memory_alloc(20);
  9.   char *name_file=NULL;
  10.  
  11.  while(1)
  12.     {
  13.     x = memory_find("\\\\fls0\\*.cff",files,20);
  14.  
  15.    
  16.     Bdisp_AllClr_VRAM();
  17.  
  18.     for(t=0;t<(x>5?5:x);t++)
  19.         {
  20.         PrintMini(1,1,(const unsigned char *)"your files : ",0);  
  21.         PrintMini(2,10*t+9,(const unsigned char *)*(files+offset+t),0);
  22.         }
  23.        
  24.     if(x>0) Bdisp_AreaReverseVRAM(1,10*p+7,100,10*p+15);
  25.     else PrintMini(36,29,(const unsigned char *)"no files found",0);
  26.        
  27.     Mini("new", 0);
  28.     Mini("exit", 5);
  29.  
  30.        
  31.     GetKey(&key);
  32.  
  33.     switch(key)
  34.         {
  35.         if(x>0)
  36.             {
  37.             case KEY_CTRL_EXE :
  38.                 {
  39.                 sprintf(ch,"\\\\fls0\\%s",*(files+(offset+p)));
  40.                 return ch;
  41.                 }
  42.                
  43.             case KEY_CTRL_UP :
  44.                 {
  45.                 if(offset || p)
  46.                     {
  47.                     if(p==4) p--;
  48.                         else if(offset)  
  49.                         offset--;
  50.                         else p--;
  51.                         }
  52.                     break;
  53.                     }
  54.                    
  55.             case KEY_CTRL_DOWN :
  56.                     {
  57.                     if(offset+p+1<x)
  58.                         {
  59.                         if(p==0) p++;
  60.                         else if(offset+5<x) offset++;
  61.                         else p++;
  62.                         }
  63.                     break;
  64.                     }
  65.             }
  66.            
  67.             case KEY_CTRL_F1 :
  68.                 {
  69.                 Bdisp_AllClr_DDVRAM();
  70.                 PrintXY(2,1,"File name :",0);
  71.                 EI_init();
  72.    
  73.                 EI_manage_config(EI_SET_COLUMN, 1);
  74.                 EI_manage_config(EI_SET_ROW, 3);
  75.                 EI_manage_config(EI_SET_START_MODE, EI_ALPHA_LOCKED);
  76.                
  77.                 name_file=EI_input_string(25,(const char*)"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
  78.                 sprintf(ch,"\\\\fls0\\%s.cff",name_file);
  79.                 memory_createfile(ch,100);
  80.                 break;
  81.                 }
  82.            
  83.             case KEY_CTRL_F6 :  
  84.                 {
  85.                 memory_free(files,20);
  86.                 return NULL;
  87.                 }  
  88.         }
  89.     }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment