Subversion Repositories Kolibri OS

Rev

Rev 7149 | Rev 7163 | 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.         //0 = folder
  36.         //22 = forder with up arrow
  37.         if (filenum == 0) || (filenum == 22)
  38.         {
  39.                 DrawBar(x+7,y+1,8,2,color);
  40.                 DrawBar(x,y+14,15,2,color);
  41.                 PutPixel(x,y+1,color);
  42.                 PutPixel(x+6,y+1,color);
  43.                 PutPixel(x+14,y+3,color);
  44.                 PutPixel(x,y+13,color);
  45.                 PutPixel(x+14,y+13,color);
  46.         }
  47.         if (filenum == 22) PutPixel(x+10,y+2,0x1A7B17); //green arrow part
  48. }
  49.