Subversion Repositories Kolibri OS

Rev

Rev 5803 | Rev 5960 | 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,system.color.work_text,caption);
  66.         if (id) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0); //arrow button
  67.         WriteText(165,y+5,0x80,system.color.work_text,arrow); //arrow
  68.         DrawBar(17,y+17,160,1,system.color.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.         dword temp_file_count, tempbuf;
  82.  
  83.         disc_num=0;
  84.         if (devbuf) free(devbuf);
  85.         devbuf = malloc(10000); //áóôåð ãäå-òî íà 10 äåâàéñîâ â ëåâîé ïàíåëè
  86.         ReadDir(19, devbuf, "/");
  87.         dev_num = EBX;
  88.         for (i1=0; i1<dev_num; i1++)
  89.         {
  90.                 sprintf(#dev_name,"/%s/",i1*304+ devbuf+72);
  91.                 Open_Dir(#dev_name, ONLY_OPEN);
  92.                 dev_disc_num = files.count;
  93.                 //if (files.count<=0) copystr(#dev_name,#disk_list[disc_num].Item); else
  94.                 for (j1=0; j1<dev_disc_num; j1++;)
  95.                 {
  96.                         l=sprintf(#sys_discs,"%s%s/",#dev_name,j1*304+ buf+72);
  97.                         strlcpy(#disk_list[disc_num].Item, #sys_discs,l);
  98.                         disc_num++;
  99.                 }
  100.                 if (!strncmp(#sys_discs, "/rd/1/",6))
  101.                 {
  102.                         GetDir(#tempbuf, #temp_file_count, "/kolibrios/", DIRS_ONLYREAL);
  103.                         if (temp_file_count)
  104.                         {
  105.                                 strlcpy(#disk_list[disc_num].Item, "/kolibrios/",11);
  106.                                 kolibrios_drive = true;
  107.                                 disc_num++;    
  108.                         }
  109.                         else kolibrios_drive = false;
  110.                         free(tempbuf);
  111.                 }
  112.                 else if (!strncmp(#sys_discs, "/fd/1/",6)) CMD_ENABLE_SAVE_IMG = true;
  113.         }
  114. }
  115.  
  116.  
  117. void DrawSystemDiscs()
  118. {    
  119.         char dev_name[15], disc_name[100], i, dev_icon, is_active, name_len;
  120.         int pos_y, pos_x=2;
  121.        
  122.         for (i=disc_num; i<30; i++) DeleteButton(100+i);
  123.         for (i=0;i<disc_num;i++)
  124.         {
  125.                 strcpy(#dev_name, #disk_list[i].Item);
  126.                 dev_name[strlen(#dev_name)-1]=NULL;
  127.                 switch(dev_name[1])
  128.                 {
  129.                         case 'k':
  130.                                 dev_icon=0;
  131.                                 strcpy(#disc_name, T_PROG);
  132.                                 break;
  133.                         case 'r':
  134.                                 dev_icon=0;
  135.                                 strcpy(#disc_name, T_SYS);
  136.                                 break;
  137.                         case 'c':
  138.                                 dev_icon=1;
  139.                                 strcpy(#disc_name, T_CD);
  140.                                 break;
  141.                         case 'f':
  142.                                 dev_icon=2;
  143.                                 strcpy(#disc_name, T_FD);
  144.                                 break;
  145.                         case 'h':
  146.                         case 'b':
  147.                                 dev_icon=3;
  148.                                 strcpy(#disc_name, T_HD);
  149.                                 break;
  150.                         case 's':
  151.                                 dev_icon=3;
  152.                                 strcpy(#disc_name, T_SATA);
  153.                                 break;
  154.                         case 'u':
  155.                                 dev_icon=5;
  156.                                 strcpy(#disc_name, T_USB);
  157.                                 break;
  158.                         case 't':
  159.                                 dev_icon=4;
  160.                                 strcpy(#disc_name, T_RAM);
  161.                                 break;
  162.                         default:
  163.                                 dev_icon=3;
  164.                                 strcpy(#disc_name, T_UNC);                             
  165.                 }
  166.                 if (strstr(#path, #dev_name)) is_active=true; else is_active=false;
  167.                 if (!two_panels)
  168.                 {
  169.                         pos_y = i*16+74;
  170.                         DrawBar(17,pos_y,6,17,0xFFFFFF);
  171.                         DrawBar(17+6+18,pos_y,160-6-18,17,0xFFFFFF);
  172.                         DefineButton(17,pos_y,159,16,100+i+BT_HIDE,0xFFFFFF);
  173.                         if (show_dev_name)
  174.                         {
  175.                                 strcat(#disc_name, #dev_name);
  176.                                 if (is_active) WriteText(46+1,pos_y+5,0x80,0x555555,#disc_name);
  177.                                 WriteText(46,pos_y+5,0x80,0,#disc_name);
  178.                         }
  179.                         else
  180.                         {
  181.                                 if (is_active) WriteText(46+1,pos_y+5,0x80,0x555555,#dev_name);
  182.                                 WriteText(46,pos_y+5,0x80,0,#dev_name);
  183.                         }
  184.                         _PutImage(23,pos_y, 18,17, is_active*6+dev_icon*17*18*3+#devices);
  185.                 }
  186.                 else
  187.                 {
  188.                         pos_y = 43;
  189.                         name_len = strlen(#dev_name)-1*8;
  190.                         DrawBar(pos_x, pos_y, name_len + 31, 17, 0xFFFFFF);
  191.                         DefineButton(pos_x+2, pos_y, name_len + 27, 16, 100+i+BT_HIDE,0xFFFFFF);
  192.                         _PutImage(pos_x + 5, pos_y, 18,17, is_active*6+dev_icon*17*18*3+#devices);
  193.                         WriteText(pos_x + 24, pos_y+1, 10110000b, 0, #dev_name+1);
  194.                         pos_x += name_len + 31;
  195.                 }
  196.         }
  197.         if (two_panels)
  198.         {
  199.                 DrawBar(pos_x, pos_y, Form.cwidth - pos_x - 2, 17, 0xFFFFFF);
  200.                 DrawBar(2, pos_y-2, Form.cwidth - 4, 2, 0xFFFFFF);
  201.                 DrawBar(2, pos_y+17, Form.cwidth - 4, 2, 0xFFFFFF);
  202.                 DefineButton(Form.cwidth - 23, pos_y, 17,16, 60+BT_HIDE, 0xCCCccc);
  203.                 _PutImage(Form.cwidth - 21, pos_y+2, 14,13, 2*14*13*3+#factions);
  204.         }
  205. }
  206.  
  207.  
  208. void ActionsDraw()
  209. {
  210.         int actions_y=disc_num*16+108, lineh=16;
  211.         Tip(actions_y-18, T_ACTIONS, 77, ""); //çàãîëîâîê
  212.         for (i=0; actions[i*3]!=0; i++, actions_y+=lineh)
  213.         {
  214.                 DrawBar(17,actions_y,160,lineh,0xFFFFFF); //áåëîå
  215.                 DefineButton(17,actions_y,159,lineh,actions[i*3]+BT_HIDE,0xE4DFE1);
  216.                 WriteText(45,actions_y+4,0x80,0,actions[i*3+1]);
  217.                 WriteText(-strlen(actions[i*3+2])*6+170,actions_y+4,0x80,0x999999,actions[i*3+2]);
  218.                 _PutImage(23,actions_y+2, 14,13, i*14*13*3+#factions);
  219.         }
  220. }
  221.  
  222.  
  223. void DrawLeftPanelBg()
  224. {
  225.         int actions_y=disc_num*16;
  226.         int start_y = actions_y+156;
  227.         int onTop1;
  228.         DrawBar(2,41,190,15,col_lpanel);                      //ñèíèé ïðÿìîóãîëüíèê - íàä äåâàéñàìè
  229.         DrawBar(17,actions_y+75,160,15,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ïîä äåâàéñàìè
  230.         PutShadow(17,actions_y+75,160,1,1,3);
  231.         PutShadow(18,actions_y+75+1,158,1,1,1);
  232.         DrawBar(2,56,15,actions_y+103,col_lpanel);                //ñèíèé ïðÿìîóãîëüíèê - ñëåâà      
  233.         DrawBar(177,56,15,actions_y+103,col_lpanel);            //ñèíèé ïðÿìîóãîëüíèê - ñïðàâà
  234.         onTop1 = Form.cheight-start_y-2;
  235.         if (onTop1 < 268)
  236.         {
  237.                 PutPaletteImage(#blue_hl, 190, onTop1, 2, start_y, 8, #blue_hl_pal);
  238.         }
  239.         else
  240.         {
  241.                 DrawBar(2,start_y,190, onTop1-268, col_lpanel);
  242.                 PutPaletteImage(#blue_hl, 190, 268, 2, Form.cheight-270, 8, #blue_hl_pal);
  243.         }
  244.         PutShadow(17,start_y,160,1,1,3);
  245.         PutShadow(18,start_y+1,158,1,1,1);
  246. }
  247.  
  248.  
  249. void DrawDeviceAndActionsLeftPanel()
  250. {
  251.         Tip(56, T_DEVICES, 55, "=");
  252.         DrawSystemDiscs();
  253.         ActionsDraw();
  254.         DrawLeftPanelBg();
  255. }
  256.  
  257.  
  258. void ClickOnDisk(char diskN)
  259. {
  260.         strcpy(#path, #disk_list[diskN].Item);
  261.         files.KeyHome();
  262.         Open_Dir(#path,WITH_REDRAW);   
  263. }