Subversion Repositories Kolibri OS

Rev

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