Subversion Repositories Kolibri OS

Rev

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

  1. #ifdef LANG_RUS
  2.         ?define WINDOW_TITLE_PROPERTIES "‘¢®©á⢠"
  3.         ?define BTN_CLOSE "‡ ªàëâì"
  4.         ?define PR_T_NAME "ˆ¬ï:"
  5.         ?define PR_T_DEST " á¯®«®¦¥­¨¥:"
  6.         ?define PR_T_SIZE " §¬¥à:"
  7.         ?define SET_3 "‘®§¤ ­"
  8.         ?define SET_4 "Žâªàëâ"
  9.         ?define SET_5 "ˆ§¬¥­¥­"
  10.         ?define SET_6 "” ©«®¢: "
  11.         ?define SET_7 "  ¯®ª: "
  12.         ?define PR_T_CONTAINS "‘®¤¥à¦¨â: "
  13.         ?define FLAGS " €ââਡãâë "
  14.         ?define PR_T_HIDDEN "‘ªàëâë©"
  15.         ?define PR_T_SYSTEM "‘¨á⥬­ë©"
  16.         ?define PR_T_ONLY_READ "’®«ìª® ç⥭¨¥"
  17. #elif LANG_EST
  18.         ?define WINDOW_TITLE_PROPERTIES "‘¢®©á⢠"
  19.         ?define BTN_CLOSE "‡ ªàëâì"
  20.         ?define PR_T_NAME "ˆ¬ï:"
  21.         ?define PR_T_DEST " á¯®«®¦¥­¨¥:"
  22.         ?define PR_T_SIZE " §¬¥à:"
  23.         ?define SET_3 "‘®§¤ ­"
  24.         ?define SET_4 "Žâªàëâ"
  25.         ?define SET_5 "ˆ§¬¥­¥­"
  26.         ?define SET_6 "” ©«®¢: "
  27.         ?define SET_7 "  ¯®ª: "
  28.         ?define PR_T_CONTAINS "‘®¤¥à¦¨â: "
  29.         ?define FLAGS " €ââਡãâë "
  30.         ?define PR_T_HIDDEN "‘ªàëâë©"
  31.         ?define PR_T_SYSTEM "‘¨á⥬­ë©"
  32.         ?define PR_T_ONLY_READ "’®«ìª® ç⥭¨¥"
  33. #else
  34.         ?define WINDOW_TITLE_PROPERTIES "Properties"
  35.         ?define BTN_CLOSE "Close"
  36.         ?define PR_T_NAME "Name:"
  37.         ?define PR_T_DEST "Destination:"
  38.         ?define PR_T_SIZE "Size:"
  39.         ?define SET_3 "Created"
  40.         ?define SET_4 "Opened"
  41.         ?define SET_5 "Modified"
  42.         ?define SET_6 "Files: "
  43.         ?define SET_7 " Folders: "
  44.         ?define PR_T_CONTAINS "Contains: "
  45.         ?define FLAGS " Attributes "
  46.         ?define PR_T_HIDDEN "Hidden"
  47.         ?define PR_T_SYSTEM "System"
  48.         ?define PR_T_ONLY_READ "Read-only"
  49. #endif
  50.  
  51. dword mouse_ddd2;
  52. char path_to_file[4096]="\0";
  53. char file_name2[4096]="\0";
  54. edit_box file_name_ed = {195,50,25,0xffffff,0x94AECE,0x000000,0xffffff,2,4098,#file_name2,#mouse_ddd2, 1000000000000000b,2,2};
  55. edit_box path_to_file_ed = {145,100,46,0xffffff,0x94AECE,0x000000,0xffffff,2,4098,#path_to_file,#mouse_ddd2, 1000000000000000b,2,2};
  56. frame flags_frame = { 0, 280, 10, 83, 106, 0x000111, 0xFFFfff, 1, FLAGS, 0, 0, 6, 0x000111, 0xCCCccc };
  57.  
  58. byte HIDDEN_chb,
  59.      SYSTEM_chb,
  60.      ONLY_READ_chb;
  61.  
  62. int file_count, dir_count, size_dir;
  63. char folder_info[200];
  64. BDVK file_info_general;
  65. BDVK file_info_dirsize;
  66.  
  67. void GetSizeDir(dword way)
  68. {
  69.         dword dirbuf, fcount, i, filename;
  70.         char cur_file[4096];
  71.         if (isdir(way))
  72.         {
  73.                 GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL);
  74.                 for (i=0; i<fcount; i++)
  75.                 {
  76.                         filename = i*304+dirbuf+72;
  77.                         strcpy(#cur_file, way);
  78.                         chrcat(#cur_file, '/');
  79.                         strcat(#cur_file, filename);
  80.                         if ( TestBit(ESDWORD[filename-40], 4) )
  81.                         {
  82.                                 dir_count++;
  83.                                 GetSizeDir(#cur_file);
  84.                         }
  85.                         else
  86.                         {
  87.                                 GetFileInfo(#cur_file, #file_info_dirsize);
  88.                                 size_dir = size_dir + file_info_dirsize.sizelo;
  89.                                 file_count++;
  90.                         }
  91.                 }
  92.         }
  93. }
  94.  
  95. void properties_dialog()
  96. {
  97.         byte id;
  98.         byte key;
  99.         dword file_name_off;
  100.         dword element_size;
  101.         char element_size_label[32];
  102.         proc_info settings_form;
  103.        
  104.         strcpy(#folder_info, "\0");
  105.         file_count = 0;
  106.         dir_count = 0; 
  107.         size_dir = 0;
  108.         GetFileInfo(#file_path, #file_info_general);
  109.         strcpy(#file_name2, #file_name);
  110.         file_name_ed.size = strlen(#file_name2);
  111.         strcpy(#path_to_file, #path);
  112.         path_to_file_ed.size = strlen(#path_to_file);
  113.  
  114.         if (itdir) GetSizeDir(#file_path);
  115.        
  116.         SetEventMask(0x27);
  117.         loop() switch(WaitEvent())
  118.         {
  119.                 case evButton:
  120.                                 id=GetButtonID();
  121.                                 IF (id==1) || (id==10) ExitProcess();
  122.                                 break;
  123.                                
  124.                 case evMouse:
  125.                                 edit_box_mouse stdcall (#file_name_ed);
  126.                                 edit_box_mouse stdcall (#path_to_file_ed);
  127.                                 break;
  128.                        
  129.                 case evKey:
  130.                                 key = GetKey();
  131.                                 IF (key==27) ExitProcess();
  132.                                 EAX=key<<8;
  133.                                 edit_box_key stdcall(#file_name_ed);
  134.                                 edit_box_key stdcall(#path_to_file_ed);
  135.                                 break;
  136.                                
  137.                 case evReDraw:
  138.                                 DefineAndDrawWindow(Form.left + 150,150,270,240+GetSkinHeight(),0x34,sc.work,WINDOW_TITLE_PROPERTIES);
  139.                                 GetProcessInfo(#settings_form, SelfInfo);
  140.                                 DrawFlatButton(settings_form.cwidth - 70 - 13, settings_form.cheight - 34, 70, 22, 10, 0xE4DFE1, BTN_CLOSE);
  141.                                 DrawBar(10, 10, 32, 32, 0xFFFfff);
  142.                                 if (! TestBit(file_info_general.attr, 4) )
  143.                                         Put_icon(#file_name2+strrchr(#file_name2,'.'), 18, 20, 0xFFFfff, 0);
  144.                                 else
  145.                                         Put_icon("<DIR>", 18, 20, 0xFFFfff, 0);
  146.  
  147.                                 WriteText(50, 13, 0x80, 0x000000, PR_T_NAME);                          
  148.                                 edit_box_draw stdcall (#file_name_ed);
  149.  
  150.                                 WriteText(10, 50, 0x80, 0x000000, PR_T_DEST);
  151.                                 edit_box_draw stdcall (#path_to_file_ed);
  152.  
  153.                                 /*WriteText(10, 63, 0x80, 0x000000, SET_3);
  154.                                 if (!itdir)
  155.                                 {
  156.                                         WriteText(10, 78, 0x80, 0x000000, SET_4);
  157.                                         WriteText(10, 93, 0x80, 0x000000, SET_5);                                      
  158.                                 }*/
  159.                                 WriteText(10, 65, 0x80, 0x000000, PR_T_SIZE);
  160.                                 if (!itdir)
  161.                                 {
  162.                                         element_size = file_info_general.sizelo;
  163.                                 }
  164.                                 else
  165.                                 {
  166.                                         WriteText(10, 80, 0x80, 0x000000, PR_T_CONTAINS);                              
  167.                                         strcpy(#folder_info, SET_6);
  168.                                         strcat(#folder_info, itoa(file_count));
  169.                                         strcat(#folder_info, SET_7);
  170.                                         strcat(#folder_info, itoa(dir_count));
  171.                                         WriteText(100, 80, 0x80, 0x000000, #folder_info);
  172.                                         element_size = size_dir;
  173.                                 }
  174.  
  175.                                 EAX = ConvertSize(element_size);
  176.                                 strcpy(#element_size_label, EAX);
  177.                                 strcat(#element_size_label, " (");
  178.                                 strcat(#element_size_label, itoa(element_size));
  179.                                 strcat(#element_size_label, " b)");
  180.                                 WriteText(100, 65, 0x80, 0x000000, #element_size_label);
  181.  
  182.                                 flags_frame.size_x = - flags_frame.start_x * 2 + settings_form.cwidth - 2;
  183.                                 flags_frame.font_color = sc.work_text;
  184.                                 flags_frame.font_backgr_color = sc.work;
  185.                                 flags_frame.ext_col = sc.work_graph;
  186.                                 frame_draw stdcall (#flags_frame);
  187.  
  188.                                 DrawPropertiesCheckBoxes();
  189.         }
  190. }
  191.  
  192. void DrawPropertiesCheckBoxes()
  193. {
  194.         ONLY_READ_chb = TestBit(file_info_general.attr, 0);
  195.         HIDDEN_chb = TestBit(file_info_general.attr, 1);
  196.         SYSTEM_chb = TestBit(file_info_general.attr, 2);
  197.         CheckBox2(22, 120, 20, PR_T_ONLY_READ,  ONLY_READ_chb);
  198.         CheckBox2(22, 142, 21, PR_T_HIDDEN,  HIDDEN_chb);
  199.         CheckBox2(22, 164, 22, PR_T_SYSTEM,  SYSTEM_chb);
  200. }