Subversion Repositories Kolibri OS

Rev

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