Subversion Repositories Kolibri OS

Rev

Rev 5526 | Rev 5576 | 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); //arrow button
  40.         WriteText(165,y+5,0x80,sc.work_text,arrow); //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 GetSystemDiscs()
  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.  
  88. void DrawSystemDiscs()
  89. {    
  90.         char dev_name[15], disc_name[100];
  91.         int i, dev_icon;
  92.        
  93.         Tip(56, T_DEVICES, 55, "=");
  94.         for (i=0; i<20; i++) DeleteButton(100+i);
  95.         for (i=0;i<disc_num;i++)
  96.         {
  97.                 DrawBar(17,i*16+74,160,17,0xFFFFFF);
  98.                 DefineButton(17,i*16+74,159,16,100+i+BT_HIDE,0xFFFFFF);
  99.                 strcpy(#dev_name, #disk_list[i].Item);
  100.                 dev_name[strlen(#dev_name)-1]=NULL;
  101.                 switch(dev_name[1])
  102.                 {
  103.                         case 'k':
  104.                                 dev_icon=0;
  105.                                 strcpy(#disc_name, "Programs ");
  106.                                 break;
  107.                         case 'r':
  108.                                 dev_icon=0;
  109.                                 strcpy(#disc_name, "System ");
  110.                                 break;
  111.                         case 'c':
  112.                                 dev_icon=1;
  113.                                 strcpy(#disc_name, "CD-ROM ");
  114.                                 break;
  115.                         case 'f':
  116.                                 dev_icon=2;
  117.                                 strcpy(#disc_name, "Floppy disk ");
  118.                                 break;
  119.                         case 'h':
  120.                         case 'b':
  121.                                 dev_icon=3;
  122.                                 strcpy(#disc_name, "Hard disk ");
  123.                                 break;
  124.                         case 's':
  125.                                 dev_icon=3;
  126.                                 strcpy(#disc_name, "SATA disk ");
  127.                                 break;
  128.                         case 'u':
  129.                                 dev_icon=5;
  130.                                 strcpy(#disc_name, "USB flash ");
  131.                                 break;
  132.                         case 't':
  133.                                 dev_icon=4;
  134.                                 strcpy(#disc_name, "RAM disk ");
  135.                                 break;
  136.                         default:
  137.                                 dev_icon=3; //ïî-óìîë÷àíèþ óñòðîéñòâî âûãëÿäèò êàê æåñòÿê íî ýòî íåïðàâèëüíî
  138.                                 strcpy(#disc_name, "Unknown ");                        
  139.                 }
  140.                 strcat(#disc_name, #dev_name);
  141.                 if (show_dev_name) WriteText(45,i*16+79,0x80,0,#disc_name); else WriteText(45,i*16+79,0x80,0,#dev_name);
  142.                 _PutImage(23,i*16+76, 14,13, dev_icon*14*13*3+#devices);
  143.         }
  144. }
  145.  
  146. void ActionsDraw()
  147. {
  148.         int actions_y=disc_num*16+108, lineh=16;
  149.         Tip(actions_y-18, T_ACTIONS, 77, ""); //çàãîëîâîê
  150.         for (i=0; actions[i*3]!=0; i++, actions_y+=lineh)
  151.         {
  152.                 DrawBar(17,actions_y,160,lineh,0xFFFFFF); //áåëîå
  153.                 DefineButton(17,actions_y,159,lineh,actions[i*3]+BT_HIDE,0xE4DFE1);
  154.                 WriteText(45,actions_y+4,0x80,0,actions[i*3+1]);
  155.                 WriteText(-strlen(actions[i*3+2])*6+170,actions_y+4,0x80,0x999999,actions[i*3+2]);
  156.                 _PutImage(23,actions_y+2, 14,13, i*14*13*3+#factions);
  157.         }
  158. }
  159.  
  160.  
  161. void DrawLeftPanelBg()
  162. {
  163.         int actions_y=disc_num*16;
  164.         int start_y = actions_y+156;
  165.         DrawBar(2,41,190,15,col_lpanel);                      //ñèíèé ïðÿìîóãîëüíèê - íàä äåâàéñàìè
  166.         DrawBar(17,actions_y+75,160,15,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ïîä äåâàéñàìè
  167.         PutShadow(17,actions_y+75,160,1,1,3);
  168.         PutShadow(18,actions_y+75+1,158,1,1,1);
  169.         DrawBar(2,56,15,actions_y+103,col_lpanel);                //ñèíèé ïðÿìîóãîëüíèê - ñëåâà      
  170.         DrawBar(177,56,15,actions_y+103,col_lpanel);            //ñèíèé ïðÿìîóãîëüíèê - ñïðàâà
  171.         if (onTop(start_y, 6) < 268)
  172.                 PutPaletteImage(#blue_hl, 190, onTop(start_y, 6), 2, start_y, 8, #blue_hl_pal);
  173.         else
  174.         {
  175.                 DrawBar(2,start_y,190,onTop(start_y,6+268),col_lpanel);
  176.                 PutPaletteImage(#blue_hl, 190, 268, 2, onTop(268,6), 8, #blue_hl_pal);
  177.         }
  178.         PutShadow(17,start_y,160,1,1,3);
  179.         PutShadow(18,start_y+1,158,1,1,1);
  180. }
  181.  
  182.  
  183. void DrawLeftPanel()
  184. {
  185.         DrawSystemDiscs();
  186.         ActionsDraw();
  187.         DrawLeftPanelBg();
  188. }
  189.