Subversion Repositories Kolibri OS

Rev

Rev 4631 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;*****************************************************************************
  2. ; KFM - Kolibri File Manager
  3. ; Copyright (c) 2006 - 2014, Marat Zakiyanov aka Mario79, aka Mario
  4. ; All rights reserved.
  5. ;
  6. ; Redistribution and use in source and binary forms, with or without
  7. ; modification, are permitted provided that the following conditions are met:
  8. ;        * Redistributions of source code must retain the above copyright
  9. ;          notice, this list of conditions and the following disclaimer.
  10. ;        * Redistributions in binary form must reproduce the above copyright
  11. ;          notice, this list of conditions and the following disclaimer in the
  12. ;          documentation and/or other materials provided with the distribution.
  13. ;        * Neither the name of the <organization> nor the
  14. ;          names of its contributors may be used to endorse or promote products
  15. ;          derived from this software without specific prior written permission.
  16. ;
  17. ; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY
  18. ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19. ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20. ; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
  21. ; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  22. ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23. ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  24. ; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  26. ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. ;*****************************************************************************
  28. ; KFM v0.47j 12/03/2014
  29. ;---------------------------------------------------------------------
  30. use32
  31. org     0x0
  32.  
  33.     db    'MENUET01'
  34.     dd    0x01
  35.     dd    START
  36.     dd    I_END
  37.     dd    mem
  38.     dd    stacktop
  39.     dd    0x0
  40.     dd    path
  41.  
  42. ;include   'lang.inc'
  43. ;include   'kglobals.inc'
  44. ;include   'macros.inc'
  45. include '../../../macros.inc'
  46. include '../../../config.inc'           ;for nightbuild
  47. ;include '../../../debug.inc'           ;for nightbuild
  48.  
  49. ;define __DEBUG__ 1
  50. ;define __DEBUG_LEVEL__ 1
  51. ;include '../../../debug-fdo.inc'
  52.  
  53. include   'editbox.inc'
  54. ;use_edit_box
  55. use_edit_box procinfo
  56. ;include   'ASCGL.INC'
  57. ;---------------------------------------------------------------------
  58. include   'files.inc'
  59. ;---------------------------------------------------------------------
  60. STRLEN = 1024
  61. ;---------------------------------------------------------------------
  62. START:
  63.         mcall   9,procinfo,-1
  64.         mov     ecx,[ebx+30]    ; PID
  65.         mcall   18,21
  66.         mov     [active_process],eax    ; WINDOW SLOT
  67.     mov   [appl_memory],mem
  68.     mov   ax,[select_disk_char]
  69.     mov   [read_folder_name],ax
  70.     mov   [read_folder_1_name],ax
  71.     call  load_icon_and_convert_to_img
  72.     call  load_buttons_and_convert_to_img
  73.     call  load_initiation_file
  74.     call  add_memory_for_folders
  75.     call  device_detect_f70
  76.     call  select_starting_directories
  77.     mcall 66, 1, 1
  78.     mov   eax,1
  79.     mov   [left_sort_flag],eax
  80.     mov   [right_sort_flag],eax
  81.  
  82.     call  proc_read_left_folder
  83.     test  eax,eax
  84.     jz    @f
  85.  
  86.     cmp   eax,6
  87.     jne   read_folder_error
  88. @@:
  89.     call  proc_read_right_folder
  90.     test  eax,eax
  91.     jz    @f
  92.  
  93.     cmp   eax,6
  94.     je    @f
  95. ; if /hd read error for start then use /rd
  96.     mov   esi,retrieved_devices_table+1
  97.     call  copy_folder_name_1
  98.     call  proc_read_right_folder
  99.     test  eax,eax
  100.     jz    @f
  101.  
  102.     cmp   eax,6
  103.     jne   read_folder_1_error
  104. @@:
  105.         mcall 40, 0x27
  106.         jmp   red_1
  107. ;---------------------------------------------------------------------
  108. red:
  109.     call  get_window_param
  110.     test  [window_status],10b
  111.     jnz   red_1   ;still
  112.     test  [window_status],100b
  113.     jnz   red_1
  114.     cmp   [window_high],180
  115.     ja    @f
  116.     mov   esi,180
  117.     mcall 67,-1,ebx,ebx
  118. @@:
  119.     cmp   [window_width],495
  120.     ja    red_1
  121.     mov   edx,495
  122.     mcall 67,-1,ebx, ,ebx
  123. red_1:
  124.     call  draw_window
  125. ;---------------------------------------------------------------------
  126. still:
  127.     mcall 10
  128.  
  129.     call  check_active_process_for_clear_all_flags
  130.  
  131.     cmp   eax,1
  132.     je    red
  133.     cmp   eax,2
  134.     je    key
  135.     cmp   eax,3
  136.     je    button
  137.     cmp   eax,6
  138.     je    mouse
  139.     jmp   still
  140. ;---------------------------------------------------------------------
  141. check_active_process_for_clear_all_flags:
  142.         push    eax
  143.         mcall   18,7
  144.         cmp     [active_process],eax
  145.         je      .exit
  146.        
  147.         xor     eax,eax
  148.         cmp     [shift_flag],al
  149.         jne     .clear_all_flags
  150.        
  151.         cmp     [ctrl_flag],al
  152.         jne     .clear_all_flags
  153.        
  154.         cmp     [ctrl_flag],al
  155.         je      .exit
  156. ;--------------------------------------
  157. .clear_all_flags:
  158.         mov     [shift_flag],al
  159.         mov     [ctrl_flag],al
  160.         mov     [alt_flag],al
  161.         call    erase_fbutton
  162.         call    draw_fbutton
  163. ;--------------------------------------    
  164. .exit:
  165.         pop     eax
  166.         ret
  167. ;---------------------------------------------------------------------
  168. get_window_param:
  169.     mcall 9, procinfo, -1
  170.     mov   eax,[ebx+46]
  171.     mov   [window_high],eax
  172.     mov   eax,[ebx+42]
  173.     mov   [window_width],eax
  174.     mov   eax,[ebx+70]
  175.     mov   [window_status],eax
  176.     mcall 48,4
  177.     mov   [skin_high],eax
  178.     ret
  179. ;---------------------------------------------------------------------
  180. draw_window:
  181.     mcall 12, 1
  182.         xor     esi,esi
  183.     mcall 0, <20,728>, <20,460>, 0x43cccccc   ; 0x805080D0, 0x005080D0
  184.     call  get_window_param
  185.  
  186.     mcall 71, 1, header_text
  187.  
  188.         test    [window_status],100b    ; window is rolled up
  189.         jnz     .exit
  190.  
  191.         test    [window_status],10b     ; window is minimized to panel
  192.         jnz     .exit
  193.  
  194.     ; create_dir_name
  195.     ; start_parameter
  196.     ; file_name
  197.     ; [temp_edi]
  198.     ; header
  199.     ; delete_file_data.name
  200.     ; start_file_data.name
  201.     ; start_parameter
  202.      ; start_file_data.name
  203.       ; read_icon_file.name
  204.                 ; read_file_features.name ;path ;header
  205.  
  206.     cmp   [window_high],180
  207.     jb    .exit
  208.     cmp   [window_width],495
  209.     jb    .exit
  210.  
  211.     call  draw_fbutton
  212.     call  draw_left_panel
  213.     call  draw_right_panel
  214.     call  draw_device_button
  215.     call  draw_left_select_disk_button
  216.     call  draw_left_sort_button
  217.     call  draw_right_select_disk_button
  218.     call  draw_right_sort_button
  219.     call  draw_menu_bar
  220.     call  draw_buttons_panel
  221. .exit:
  222.     mcall 12, 2
  223.     ret
  224. ;---------------------------------------------------------------------
  225. prepare_load_data:
  226.     mov   esi,path
  227.     mov   edi,file_name
  228.     call  copy_path
  229.     call  get_file_size
  230.     test  eax,eax
  231.     ret
  232. ;---------------------------------------------------------------------
  233. prepare_load_data_1:
  234.     mov   [read_file.return],eax
  235.     mov   ebp,eax
  236. prepare_load_data_4:
  237.     call  load_file
  238.     test  eax,eax
  239.     ret
  240. ;---------------------------------------------------------------------
  241. prepare_load_data_2:
  242.     call  add_application_memory
  243. prepare_load_data_3:
  244.     call  add_application_memory
  245.     mov   eax,[file_features_temp_area+32]
  246.     mov   [read_file.size],eax
  247.     ret
  248. ;---------------------------------------------------------------------
  249. load_icon_and_convert_to_img:
  250.     mov   ebx,icons_file_name
  251.     call  prepare_load_data
  252.     jnz   icon_error
  253.     call  prepare_load_data_2
  254.     add   eax,mem
  255.     call  prepare_load_data_1
  256.     jnz   icon_error
  257.     call  convert_bmp_to_img
  258.     call  sub_application_memory
  259.     ret
  260. ;---------------------------------------------------------------------
  261. load_buttons_and_convert_to_img:
  262.     mov   ebx,buttons_file_name
  263.     call  prepare_load_data
  264.     jnz   buttons_error
  265.     mov   eax,[appl_memory]
  266.     mov   [buttons_img_start],eax
  267.     call  prepare_load_data_2
  268.     add   eax,[buttons_img_start]
  269.     call  prepare_load_data_1
  270.     jnz   buttons_error
  271.     call  convert_bmp_to_img
  272.     call  sub_application_memory
  273.     ret
  274. ;---------------------------------------------------------------------
  275. load_initiation_file:
  276.     mov   ebx,ini_file_name
  277.     call  prepare_load_data
  278.     jnz   initiation_error
  279.     call  prepare_load_data_3
  280.     mov   eax,[appl_memory]
  281.     mov   [left_folder_data],eax
  282.     sub   eax,[read_file.size]
  283.     mov   [read_file.return],eax
  284.     mov   [ini_file_start],eax
  285.     call  load_file
  286.     test  eax,eax
  287.     jnz   initiation_error
  288.     mov   ebp,icons_associations
  289.     call  search_star_and_end_tags
  290.     mov   eax,[end_tag]
  291.     mov   [icons_end_tag],eax
  292.     ret
  293. ;---------------------------------------------------------------------
  294. add_memory_for_folders:
  295.     mov   ecx,[appl_memory]
  296.     add   ecx,304*32+32
  297.     mov   [right_folder_data],ecx
  298.     add   ecx,304*32+32
  299.     mov   [appl_memory],ecx
  300.     mcall 64,1
  301.  
  302.     mov   eax,[left_folder_data]
  303.     mov   [read_folder.return],eax
  304.     mov   eax,[right_folder_data]
  305.     mov   [read_folder_1.return],eax
  306.     ret
  307. ;---------------------------------------------------------------------
  308. copy_path:
  309.     xor   eax,eax
  310. @@:
  311.     cld
  312.     lodsb
  313.     stosb
  314.     test  eax,eax
  315.     jnz   @b
  316.     mov   esi,edi
  317. @@:
  318.     std
  319.     lodsb
  320.     cmp   al,'/'
  321.     jnz   @b
  322.     mov   edi,esi
  323.     add   edi,2
  324.     mov   esi,ebx
  325. @@:
  326.     cld
  327.     lodsb
  328.     stosb
  329.     test  eax,eax
  330.     jnz   @b
  331.     ret
  332. ;---------------------------------------------------------------------
  333. copy_path_1:
  334.     xor   eax,eax
  335. @@:
  336.     cld
  337.     lodsb
  338.     stosb
  339.     test  eax,eax
  340.     jnz   @b
  341.     mov   esi,ebx
  342.     mov   [edi-1],byte '/'
  343. @@:
  344.     cld
  345.     lodsb
  346.     stosb
  347.     test  eax,eax
  348.     jnz   @b
  349.     ret
  350. ;---------------------------------------------------------------------
  351. add_application_memory:
  352.     mov   ecx,[file_features_temp_area+32]
  353. .1:
  354.     add   ecx,[appl_memory]
  355.     mov   [appl_memory],ecx
  356.     mcall 64,1
  357.     ret
  358. ;---------------------------------------------------------------------
  359. sub_application_memory:
  360.     mov   ecx,[appl_memory]
  361.     sub   ecx,[file_features_temp_area+32]
  362. .1:
  363.     mov   [appl_memory],ecx
  364.     mcall 64,1
  365.     ret
  366. ;---------------------------------------------------------------------
  367. include   'key.inc'
  368. ;---------------------------------------------------------------------
  369. include   'markfile.inc'
  370. ;---------------------------------------------------------------------
  371. include   'button.inc'
  372. ;---------------------------------------------------------------------
  373. include   'mouse.inc'
  374. ;---------------------------------------------------------------------
  375. include   'openfile.inc'
  376. ;---------------------------------------------------------------------
  377. include   'draw.inc'
  378. ;---------------------------------------------------------------------
  379. include   'drw_dbut.inc'
  380. ;---------------------------------------------------------------------
  381. include   'menu_bar.inc'
  382. ;---------------------------------------------------------------------
  383. include   'menu_drv.inc'
  384. ;---------------------------------------------------------------------
  385. include   'delete.inc'
  386. ;---------------------------------------------------------------------
  387. include   'copy.inc'
  388. ;---------------------------------------------------------------------
  389. include   'creatdir.inc'
  390. ;---------------------------------------------------------------------
  391. include   'confirm.inc'
  392. ;---------------------------------------------------------------------
  393. include   'err_wind.inc'
  394. ;---------------------------------------------------------------------
  395. include   'detect.inc'
  396. ;---------------------------------------------------------------------
  397. include   'conv_bmp.inc'
  398. ;---------------------------------------------------------------------
  399. include   'tran_ini.inc'
  400. ;---------------------------------------------------------------------
  401. include   'help.inc'
  402. ;---------------------------------------------------------------------
  403. include   'convchar.inc'
  404. ;---------------------------------------------------------------------
  405. include   'sort.inc'
  406. ;---------------------------------------------------------------------
  407. include   'exit.inc'
  408. ;---------------------------------------------------------------------
  409. include   'progrbar.inc'
  410. ;---------------------------------------------------------------------
  411. include   'scroll.inc'
  412. ;---------------------------------------------------------------------
  413. include   'file_inf.inc'
  414. ;---------------------------------------------------------------------
  415. include   'text.inc'
  416. ;---------------------------------------------------------------------
  417. I_END:
  418. ;include_debug_strings
  419. ;---------------------------------------------------------------------
  420. include   'data.inc'
  421. ;---------------------------------------------------------------------
  422. mem:
  423.