Subversion Repositories Kolibri OS

Rev

Rev 6757 | Rev 7096 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. _ini icons = { "/sys/File managers/icons.ini", "icons16" };
  2.  
  3. void DrawIconByExtension(dword file_path, extension, xx, yy, fairing_color)
  4. {
  5.         char BYTE_HEAD_FILE[4];
  6.         char ext[512];
  7.         int i;
  8.         dword icon_n=0;
  9.  
  10.         if (extension)
  11.         {
  12.                 strcpy(#ext, extension);
  13.                 strlwr(#ext);
  14.                 icon_n = icons.GetInt(#ext, 2);
  15.         }
  16.         else if (file_path)
  17.         {
  18.                         ReadFile(0,4,#BYTE_HEAD_FILE,file_path);
  19.                         IF(DSDWORD[#BYTE_HEAD_FILE]=='KCPK')||(DSDWORD[#BYTE_HEAD_FILE]=='UNEM') icon_n = icons.GetInt("kex", 2);
  20.         }
  21.         if (fairing_color==col_selec)
  22.         {
  23.                 img_draw stdcall(icons16_selected.image, xx, yy, 16, 16, 0, icon_n*16);
  24.                 IconFairing(icon_n, xx, yy, fairing_color);
  25.         }
  26.         else
  27.         {
  28.                 img_draw stdcall(icons16_default.image, xx, yy, 16, 16, 0, icon_n*16);
  29.         }
  30. }
  31.  
  32.  
  33. void IconFairing(dword filenum, x,y, color)
  34. {
  35.         switch(filenum)
  36.         {
  37.                 case 0: //folder
  38.                 case 22: //<up>
  39.                         DrawBar(x+7,y,8,2,color);
  40.                         IF (filenum==22) PutPixel(x+10,y+1,0x1A7B17); //green arrow part
  41.                         DrawBar(x,y+13,15,2,color);
  42.                         PutPixel(x,y,color);
  43.                         PutPixel(x+6,y,color);
  44.                         PutPixel(x+14,y+2,color);
  45.                         PutPixel(x,y+12,color);
  46.                         PutPixel(x+14,y+12,color);
  47.                         return;
  48.                 case 13: //html
  49.                         DrawBar(x,y,1,7,color);
  50.                         DrawBar(x+1,y,1,6,color);
  51.                         DrawBar(x,y+10,1,5,color);
  52.                         DrawBar(x+1,y+11,1,4,color);
  53.                         return;
  54.                 case 12: //font
  55.                         DrawBar(x+1,y+1,1,13,color);
  56.                         DrawBar(x+2,y+1,1,11,color);
  57.                         DrawBar(x+3,y+1,1,10,color);
  58.                         DrawBar(x+4,y+1,1,9,color);
  59.                         DrawBar(x+5,y+1,1,7,color);
  60.                         DrawBar(x+6,y+1,1,5,color);
  61.                         DrawBar(x+7,y+1,1,4,color);
  62.                         DrawBar(x+8,y+1,1,2,color);
  63.                         DrawBar(x+14,y+1,1,13,color);
  64.                         DrawBar(x+13,y+1,1,11,color);
  65.                         PutPixel(x+9,y+6,color);
  66.                         DrawBar(x+8,y+10,2,1,color);
  67.                         DrawBar(x+7,y+11,2,3,color);
  68.                         return;
  69.                 case 23: //nes
  70.                         DrawBar(x,y+11,1,2,color);
  71.                         DrawBar(x+15,y+11,1,2,color);
  72.                         DrawBar(x,y+13,16,1,color);
  73.                         return;
  74.         }
  75. }
  76.