Subversion Repositories Kolibri OS

Rev

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

  1. //Leency 2008-2013
  2.  
  3. #ifdef LANG_RUS
  4. char *actions[] = {
  5.         57, "®¢ë© ä ©«", "F7",
  6.         56, "®¢ ï ¯ ¯ª ", "F6",
  7.         60, " áâனª¨", "F10",
  8.         0,0,0
  9. };
  10. ?define T_DEVICES "“áâனá⢠"
  11. ?define T_ACTIONS "„¥©á⢨ï"
  12.  
  13. #else
  14. char *actions[] = {
  15.         57, "New file", "F7",
  16.         56, "New folder", "F6",
  17.         60, "Options", "F10",
  18.         0,0,0
  19. };
  20.  
  21. ?define T_DEVICES "Devices"
  22. ?define T_ACTIONS "Actions"
  23. #endif
  24.  
  25.  
  26. void Tip(int y, dword caption, id, arrow)
  27. {
  28.         int i;
  29.         DrawBar(17,y,160,1,0xEFEDEE);
  30.         DrawFilledBar(17, y+1, 160, 16);
  31.         WriteText(25,y+5,0x80,0,caption);
  32.         IF (id<>0) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0); //êíîïà äëÿ ñòðåëêè
  33.         WriteText(165,y+5,0x80,0,arrow); //ñòðåëêà âíèç
  34.         DrawBar(17,y+17,160,1,col_border);              //ïîä÷¸ðêèâàíèå
  35. }
  36.  
  37.  
  38. path_string disk_list[30];
  39. int disc_num;
  40. dword devbuf;
  41.  
  42. void SystemDiscsGet()
  43. {
  44.         unsigned char dev_name[10], sys_discs[10];
  45.         unsigned int i1, j1, dev_num, dev_disc_num;
  46.        
  47.         disc_num=0;
  48.         if (devbuf) free(devbuf);
  49.         devbuf = malloc(10000); //áóôåð ãäå-òî íà 10 äåâàéñîâ â ëåâîé ïàíåëè
  50.         ReadDir(19, devbuf, "/");
  51.         dev_num = EBX;
  52.         for (i1=0; i1<dev_num; i1++)
  53.         {
  54.                 strcpy(#dev_name, "/");                                 // /
  55.                 strcat(#dev_name, i1*304+ devbuf+72); // /rd
  56.                 strcat(#dev_name, "/");               // /rd/
  57.                 Open_Dir(#dev_name, ONLY_OPEN);
  58.                 dev_disc_num = files.count;
  59.                 //if (files.count<=0) copystr(#dev_name,#disk_list[disc_num].Item); else
  60.                 for (j1=0; j1<dev_disc_num; j1++;)
  61.                 {
  62.                         strcpy(#sys_discs, #dev_name);                              // /rd/
  63.                         strcat(#sys_discs, j1*304+ buf+72);      // /rd/1
  64.                         strcat(#sys_discs, "/");                 // /rd/1/
  65.                         strcpy(#disk_list[disc_num].Item, #sys_discs);
  66.                         disc_num++;
  67.                 }
  68.         }
  69. }
  70.  
  71.  
  72. void SystemDiscsDraw()
  73. {    
  74.         char dev_name[10], disc_name[100];
  75.         int i, dev_icon;
  76.        
  77.         Tip(56, T_DEVICES, 55, "=");
  78.         for (i=0; i<20; i++) DeleteButton(100+i);
  79.         for (i=0;i<disc_num;i++)
  80.         {
  81.                 DrawBar(17,i*16+74,160,17,0xFFFFFF);
  82.                 DefineButton(17,i*16+74,159,16,100+i+BT_HIDE,0xFFFFFF);
  83.                 strcpy(#dev_name, #disk_list[i].Item);
  84.                 dev_name[strlen(#dev_name)-1]=NULL;
  85.                 switch(dev_name[1])
  86.                 {
  87.                         case 'r':
  88.                                 dev_icon=0;
  89.                                 strcpy(#disc_name, "SYS disk ");
  90.                                 break;
  91.                         case 'c':
  92.                                 dev_icon=1;
  93.                                 strcpy(#disc_name, "CD-ROM ");
  94.                                 break;
  95.                         case 'f':
  96.                                 dev_icon=2;
  97.                                 strcpy(#disc_name, "Floppy disk ");
  98.                                 break;
  99.                         case 'h':
  100.                         case 'b':
  101.                                 dev_icon=3;
  102.                                 strcpy(#disc_name, "Hard disk ");
  103.                                 break;
  104.                         case 's':
  105.                                 dev_icon=3;
  106.                                 strcpy(#disc_name, "SATA disk ");
  107.                                 break;
  108.                         case 'u':
  109.                                 dev_icon=5;
  110.                                 strcpy(#disc_name, "USB flash ");
  111.                                 break;
  112.                         case 't':
  113.                                 dev_icon=4;
  114.                                 strcpy(#disc_name, "RAM disk ");                               
  115.                                 DefineButton(17+143,i*16+74,16,16,i+130+BT_HIDE+BT_NOFRAME,0xFFFFFF);
  116.                                 WriteText(45+121,i*16+79,0x80,0xD63535,"-");
  117.                                 WriteText(45+121,i*16+79+1,0x80,0xBC2424,"-");
  118.                                 break;
  119.                         default:
  120.                                 dev_icon=3; //ïî-óìîë÷àíèþ óñòðîéñòâî âûãëÿäèò êàê æåñòÿê íî ýòî íåïðàâèëüíî
  121.                                 strcpy(#disc_name, "Unknown ");                        
  122.                 }
  123.                 strcat(#disc_name, #dev_name);
  124.                 if (show_dev_name) WriteText(45,i*16+79,0x80,0,#disc_name);
  125.                         else WriteText(45,i*16+79,0x80,0,#dev_name);
  126.                 _PutImage(21,i*16+76, 14,13, dev_icon*14*13*3+#devices);
  127.         }
  128. }
  129.  
  130. void ActionsDraw()
  131. {
  132.         int actions_y=disc_num*16+108, lineh=16;
  133.         Tip(actions_y-18, T_ACTIONS, 77, ""); //çàãîëîâîê
  134.         for (i=0; actions[i*3]!=0; i++, actions_y+=lineh)
  135.         {
  136.                 DrawBar(17,actions_y,160,lineh,0xFFFFFF); //áåëîå
  137.                 DefineButton(17,actions_y,159,lineh,actions[i*3]+BT_HIDE,0xE4DFE1);
  138.                 WriteText(45,actions_y+4,0x80,0,actions[i*3+1]);
  139.                 WriteText(-strlen(actions[i*3+2])*6+170,actions_y+4,0x80,0x999999,actions[i*3+2]);
  140.                 _PutImage(21,actions_y+2, 14,13, i*14*13*3+#factions);
  141.         }
  142. }
  143.  
  144.  
  145. void LeftPanelBgDraw()
  146. {
  147.         int actions_y=disc_num*16;
  148.         int start_y = actions_y+156;
  149.         DrawBar(2,41,190,15,col_lpanel);                      //ñèíèé ïðÿìîóãîëüíèê - íàä äåâàéñàìè
  150.         DrawBar(17,actions_y+75,160,15,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ïîä äåâàéñàìè
  151.         PutShadow(17,actions_y+75,160,1,1,4);
  152.         PutShadow(18,actions_y+75+1,158,1,1,1);
  153.         DrawBar(2,56,15,actions_y+103,col_lpanel);                //ñèíèé ïðÿìîóãîëüíèê - ñëåâà      
  154.         DrawBar(177,56,15,actions_y+103,col_lpanel);            //ñèíèé ïðÿìîóãîëüíèê - ñïðàâà
  155.         if (onTop(start_y, 6) < 268)
  156.                 PutPaletteImage(#blue_hl, 190, onTop(start_y, 6), 2, start_y, 8, #blue_hl_pal);
  157.         else
  158.         {
  159.                 DrawBar(2,start_y,190,onTop(start_y,6+268),col_lpanel);
  160.                 PutPaletteImage(#blue_hl, 190, 268, 2, onTop(268,6), 8, #blue_hl_pal);
  161.         }
  162.         PutShadow(17,start_y,160,1,1,4);
  163.         PutShadow(18,start_y+1,158,1,1,1);
  164. }
  165.  
  166.  
  167. void DrawLeftPanel()
  168. {
  169.         SystemDiscsDraw();
  170.         ActionsDraw();
  171.         LeftPanelBgDraw();
  172. }
  173.  
  174.