Subversion Repositories Kolibri OS

Rev

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

  1. ;*****************************************************************************
  2. ; KFM - Kolibri File Manager
  3. ; Copyright (c) 2006 - 2013, 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.47i 24/12/2013
  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   eax,[ebx+30]
  65. ;    mov   [PID],eax
  66. ;    xor   ecx,ecx
  67. ;@@:
  68. ;    inc   ecx
  69. ;    mcall 9, procinfo
  70. ;    mov   eax,[PID]
  71. ;    cmp   eax,[ebx+30]
  72. ;    jne   @r
  73. ;    mov  [active_process],ecx
  74.         mcall   9,procinfo,-1
  75.         mov     ecx,[ebx+30]    ; PID
  76.         mcall   18,21
  77.         mov     [active_process],eax    ; WINDOW SLOT
  78.     mov   [appl_memory],mem
  79.     mov   ax,[select_disk_char]
  80.     mov   [read_folder_name],ax
  81.     mov   [read_folder_1_name],ax
  82.     call  load_icon_and_convert_to_img
  83.     call  load_buttons_and_convert_to_img
  84.     call  load_initiation_file
  85.     call  add_memory_for_folders
  86.     call  device_detect
  87.     call  device_detect_f70
  88.     call  select_starting_directories
  89.     mcall 66, 1, 1
  90. ;    call  draw_window
  91. ;    xor   eax,eax
  92.     mov   eax,1
  93.     mov   [left_sort_flag],eax
  94.     mov   [right_sort_flag],eax
  95.  
  96.     call  proc_read_left_folder
  97.     test  eax,eax
  98.     jz    @f
  99.  
  100.     cmp   eax,6
  101.     jne   read_folder_error
  102. @@:
  103.     call  proc_read_right_folder
  104.     test  eax,eax
  105.     jz    @f
  106.  
  107.     cmp   eax,6
  108.     je    @f
  109. ; if /hd read error for start then use /rd
  110.     mov   esi,retrieved_devices_table+1
  111.     call  copy_folder_name_1
  112.     call  proc_read_right_folder
  113.     test  eax,eax
  114.     jz    @f
  115.  
  116.     cmp   eax,6
  117.     jne   read_folder_1_error
  118. @@:
  119.         mcall 40, 0x27
  120.         jmp   red_1
  121. ;---------------------------------------------------------------------
  122. red:
  123.     call  get_window_param
  124.     test  [window_status],10b
  125.     jnz   red_1   ;still
  126.     test  [window_status],100b
  127.     jnz   red_1
  128.     cmp   [window_high],180
  129.     ja    @f
  130.     mov   esi,180
  131.     mcall 67,-1,ebx,ebx
  132. @@:
  133.     cmp   [window_width],495
  134.     ja    red_1
  135.     mov   edx,495
  136.     mcall 67,-1,ebx, ,ebx
  137. red_1:
  138.     call  draw_window
  139. ;---------------------------------------------------------------------
  140. still:
  141.     mcall 10
  142.  
  143.     call  check_active_process_for_clear_all_flags
  144.  
  145.     cmp   eax,1
  146.     je    red
  147.     cmp   eax,2
  148.     je    key
  149.     cmp   eax,3
  150.     je    button
  151.     cmp   eax,6
  152.     je    mouse
  153.     jmp   still
  154. ;---------------------------------------------------------------------
  155. check_active_process_for_clear_all_flags:
  156.         push    eax
  157.         mcall   18,7
  158.         cmp     [active_process],eax
  159.         je      .exit
  160.        
  161.         xor     eax,eax
  162.         cmp     [shift_flag],al
  163.         jne     .clear_all_flags
  164.        
  165.         cmp     [ctrl_flag],al
  166.         jne     .clear_all_flags
  167.        
  168.         cmp     [ctrl_flag],al
  169.         je      .exit
  170. ;--------------------------------------
  171. .clear_all_flags:
  172.         mov     [shift_flag],al
  173.         mov     [ctrl_flag],al
  174.         mov     [alt_flag],al
  175.         call    erase_fbutton
  176.         call    draw_fbutton
  177. ;--------------------------------------    
  178. .exit:
  179.         pop     eax
  180.         ret
  181. ;---------------------------------------------------------------------
  182. get_window_param:
  183.     mcall 9, procinfo, -1
  184.     mov   eax,[ebx+46]
  185.     mov   [window_high],eax
  186.     mov   eax,[ebx+42]
  187.     mov   [window_width],eax
  188.     mov   eax,[ebx+70]
  189.     mov   [window_status],eax
  190.     mcall 48,4
  191.     mov   [skin_high],eax
  192.     ret
  193. ;---------------------------------------------------------------------
  194. draw_window:
  195.     mcall 12, 1
  196. ;    mcall 0, <20,620>, <20,460>, 0x03cccccc   ; 0x805080D0, 0x005080D0
  197.         xor     esi,esi
  198.     mcall 0, <20,620>, <20,460>, 0x43cccccc   ; 0x805080D0, 0x005080D0
  199.     call  get_window_param
  200.  
  201.     mcall 71, 1, header_text
  202.  
  203.         ;    mov   ecx,[temp_esi]
  204.         test    [window_status],100b    ; window is rolled up
  205.         jnz     .exit
  206.  
  207.         test    [window_status],10b     ; window is minimized to panel
  208.         jnz     .exit
  209.  
  210.     ; create_dir_name
  211.     ; start_parameter
  212.     ; file_name
  213.     ; [temp_edi]
  214.     ; header
  215.     ; delete_file_data.name
  216.     ; start_file_data.name
  217.     ; start_parameter
  218.      ; start_file_data.name
  219.       ; read_icon_file.name
  220.                 ; read_file_features.name ;path ;header
  221.  
  222.     cmp   [window_high],180
  223.     jb    .exit
  224.     cmp   [window_width],495
  225.     jb    .exit
  226.  
  227. ;    pusha
  228. ;    mcall 4,<15,25>,0,read_folder.name,100
  229. ;    popa
  230.     call  draw_fbutton
  231.  
  232. ;    mov   [left_panel_clear_all],1
  233.  
  234.     call  draw_left_panel
  235.  
  236. ;    mov   [right_panel_clear_all],1
  237.  
  238.     call  draw_right_panel
  239.     call  draw_device_button
  240.     call  draw_left_select_disk_button
  241.     call  draw_left_sort_button
  242.     call  draw_right_select_disk_button
  243.     call  draw_right_sort_button
  244.     call  draw_menu_bar
  245.     call  draw_buttons_panel
  246.     call  draw_ATAPI_tray_control
  247.    
  248. ;    mcall 47,0x80000,[left_scroll_compens],<300, 5>,0xffffff
  249. ;    call  mouse.draw_data
  250. ;    mcall 18, 7
  251. ;    mov   [temp_eax],eax
  252. ;    mcall 47,0x80000,[active_process],<300, 5>,0xffffff
  253. ;    mcall 47,0x80000,[left_marked_counter],<300, 5>,0xffffff
  254. ;    mcall 47,0x80000,[right_marked_counter],<400, 5>,0xffffff
  255. ;    mcall 47,0x80000,[sorting_low_limit],<100, 5>,0xffffff
  256. ;    mcall 47,0x80000,[sort_counter],<200, 5>,0xffffff
  257. ;    mcall 47,0x80000,[sorting_high_limit],<300, 5>,0xffffff
  258. ;    mcall 47,0x80000,[dir_temp_counter],<400, 5>,0xffffff
  259.  
  260. ;    mcall 47,0x80000,[timer_tick],<500, 5>,0xffffff
  261. ;    mcall 47,0x80000,[temp_eax],<400, 5>,0xffffff
  262. ;    mcall 47,0x80000,[temp_ebx],<400, 5>,0xffffff
  263. ;    mcall 47,0x80000,[temp_ecx],<500, 5>,0xffffff
  264. ;    mcall 47,0x80000,[temp_ebx],<500, 5>,0xffffff
  265. ;    mcall 47,0x80000,[ini_file_start],<100, 5>,0xffffff
  266. ;    mcall 47,0x80000,[left_folder_data],<200, 5>,0xffffff
  267. ;    mcall 47,0x80000,[right_folder_data],<300, 5>,0xffffff
  268. ;    mcall 47,0x80000,[appl_memory],<500, 5>,0xffffff
  269. ;    mcall 47,0x80000,[temp_znak],<500, 5>,0xffffff
  270.  
  271. ;    mcall 47,0x80000,[sort_counter],<200, 5>,0xffffff
  272. ;    mcall 47,0x80000,[temp_edi],<250, 5>,0xffffff
  273. ;    mcall 47,0x80000,[temp_esi],<300, 5>,0xffffff
  274. ;    mcall 47,0x80000,[temp_ecx],<350, 5>,0xffffff
  275. ;    mcall 47,0x80000,[temp_znak],<400, 5>,0xffffff
  276.  
  277. ;    movzx ecx,[left_start_draw_cursor_line]
  278. ;    mcall 47,0x40000, ,<300, 5>,0xffffff
  279. ;    mcall 47,0x40000,[left_start_draw_line],<400, 5>,0xffffff
  280.  
  281. ;    mcall 47,0x40000,[window_width],<100, 5>,0xffffff
  282. ;    mcall 47,0x40000,[window_high],<130, 5>,0xffffff
  283.  
  284. ;    mcall 47,0x80100,[left_panel_x],<200, 5>,0xffffff
  285. ;    mcall 47,0x80100,[left_panel_y],<250, 5>,0xffffff
  286. ;    mov   edx,[temp_counter_dword_1]
  287. ;    mcall 4,<150,3>,0x80000000
  288. ;    mov   edx,[temp_counter_dword]
  289. ;    mcall 4,<5,3>,0x80000000
  290. .exit:
  291.     mcall 12, 2
  292.     ret
  293. ;temp_eax dd 0
  294. ;temp_ebx dd 0
  295. ;temp_ecx dd 0
  296. ;temp_edx dd 0
  297. ;temp_esi dd 0
  298. ;temp_edi dd 0
  299. ;temp_ebp dd 0
  300. ;temp_esp dd 0
  301. ;temp_znak dd 0
  302. ;temp_counter_dword_1 dd 0
  303. ;extension_size_1 dd 0
  304. ;timer_tick dd 0
  305. ;---------------------------------------------------------------------
  306. prepare_load_data:
  307.     mov   esi,path
  308.     mov   edi,file_name
  309.     call  copy_path
  310.     call  get_file_size
  311.     test  eax,eax
  312.     ret
  313. ;---------------------------------------------------------------------
  314. prepare_load_data_1:
  315.     mov   [read_file.return],eax
  316.     mov   ebp,eax
  317. prepare_load_data_4:
  318.     call  load_file
  319.     test  eax,eax
  320.     ret
  321. ;---------------------------------------------------------------------
  322. prepare_load_data_2:
  323.     call  add_application_memory
  324. prepare_load_data_3:
  325.     call  add_application_memory
  326.     mov   eax,[file_features_temp_area+32]
  327.     mov   [read_file.size],eax
  328.     ret
  329. ;---------------------------------------------------------------------
  330. load_icon_and_convert_to_img:
  331.     mov   ebx,icons_file_name
  332.     call  prepare_load_data
  333.     jnz   icon_error
  334.     call  prepare_load_data_2
  335.     add   eax,mem
  336.     call  prepare_load_data_1
  337.     jnz   icon_error
  338.     call  convert_bmp_to_img
  339.     call  sub_application_memory
  340.     ret
  341. ;---------------------------------------------------------------------
  342. load_buttons_and_convert_to_img:
  343.     mov   ebx,buttons_file_name
  344.     call  prepare_load_data
  345.     jnz   buttons_error
  346.     mov   eax,[appl_memory]
  347.     mov   [buttons_img_start],eax
  348.     call  prepare_load_data_2
  349.     add   eax,[buttons_img_start]
  350.     call  prepare_load_data_1
  351.     jnz   buttons_error
  352.     call  convert_bmp_to_img
  353.     call  sub_application_memory
  354.     ret
  355. ;---------------------------------------------------------------------
  356. load_initiation_file:
  357.     mov   ebx,ini_file_name
  358.     call  prepare_load_data
  359.     jnz   initiation_error
  360.     call  prepare_load_data_3
  361.     mov   eax,[appl_memory]
  362.     mov   [left_folder_data],eax
  363.     sub   eax,[read_file.size]
  364.     mov   [read_file.return],eax
  365.     mov   [ini_file_start],eax
  366.     call  load_file
  367.     test  eax,eax
  368.     jnz   initiation_error
  369.     mov   ebp,icons_associations
  370.     call  search_star_and_end_tags
  371. ;    cmp   ebp,-1
  372. ;    je    .end
  373.     mov   eax,[end_tag]
  374.     mov   [icons_end_tag],eax
  375.     ret
  376. ;---------------------------------------------------------------------
  377. add_memory_for_folders:
  378.     mov   ecx,[appl_memory]
  379.     add   ecx,304*32+32
  380.     mov   [right_folder_data],ecx
  381.     add   ecx,304*32+32
  382.     mov   [appl_memory],ecx
  383.     mcall 64,1
  384.  
  385.     mov   eax,[left_folder_data]
  386.     mov   [read_folder.return],eax
  387.     mov   eax,[right_folder_data]
  388.     mov   [read_folder_1.return],eax
  389.     ret
  390. ;---------------------------------------------------------------------
  391. copy_path:
  392.     xor   eax,eax
  393. @@:
  394.     cld
  395.     lodsb
  396.     stosb
  397.     test  eax,eax
  398.     jnz   @b
  399.     mov   esi,edi
  400. ;    dec   esi
  401. @@:
  402.     std
  403.     lodsb
  404.     cmp   al,'/'
  405.     jnz   @b
  406.     mov   edi,esi
  407.     add   edi,2
  408.     mov   esi,ebx
  409. @@:
  410.     cld
  411.     lodsb
  412.     stosb
  413.     test  eax,eax
  414.     jnz   @b
  415.     ret
  416. ;---------------------------------------------------------------------
  417. copy_path_1:
  418.     xor   eax,eax
  419. @@:
  420.     cld
  421.     lodsb
  422.     stosb
  423.     test  eax,eax
  424.     jnz   @b
  425.     mov   esi,ebx
  426.     mov   [edi-1],byte '/'
  427. @@:
  428.     cld
  429.     lodsb
  430.     stosb
  431.     test  eax,eax
  432.     jnz   @b
  433.     ret
  434. ;---------------------------------------------------------------------
  435. add_application_memory:
  436.     mov   ecx,[file_features_temp_area+32]
  437. .1:
  438.     add   ecx,[appl_memory]
  439.     mov   [appl_memory],ecx
  440.     mcall 64,1
  441.     ret
  442. ;---------------------------------------------------------------------
  443. sub_application_memory:
  444.     mov   ecx,[appl_memory]
  445.     sub   ecx,[file_features_temp_area+32]
  446. .1:
  447.     mov   [appl_memory],ecx
  448.     mcall 64,1
  449.     ret
  450. ;---------------------------------------------------------------------
  451. include   'key.inc'
  452. ;---------------------------------------------------------------------
  453. include   'markfile.inc'
  454. ;---------------------------------------------------------------------
  455. include   'button.inc'
  456. ;---------------------------------------------------------------------
  457. include   'mouse.inc'
  458. ;---------------------------------------------------------------------
  459. include   'openfile.inc'
  460. ;---------------------------------------------------------------------
  461. include   'draw.inc'
  462. ;---------------------------------------------------------------------
  463. include   'menu_bar.inc'
  464. ;---------------------------------------------------------------------
  465. include   'menu_drv.inc'
  466. ;---------------------------------------------------------------------
  467. include   'delete.inc'
  468. ;---------------------------------------------------------------------
  469. include   'copy.inc'
  470. ;---------------------------------------------------------------------
  471. include   'creatdir.inc'
  472. ;---------------------------------------------------------------------
  473. include   'confirm.inc'
  474. ;---------------------------------------------------------------------
  475. include   'err_wind.inc'
  476. ;---------------------------------------------------------------------
  477. include   'detect.inc'
  478. ;---------------------------------------------------------------------
  479. include   'conv_bmp.inc'
  480. ;---------------------------------------------------------------------
  481. include   'tran_ini.inc'
  482. ;---------------------------------------------------------------------
  483. include   'help.inc'
  484. ;---------------------------------------------------------------------
  485. include   'convchar.inc'
  486. ;---------------------------------------------------------------------
  487. include   'sort.inc'
  488. ;---------------------------------------------------------------------
  489. include   'exit.inc'
  490. ;---------------------------------------------------------------------
  491. include   'progrbar.inc'
  492. ;---------------------------------------------------------------------
  493. include   'scroll.inc'
  494. ;---------------------------------------------------------------------
  495. include   'file_inf.inc'
  496. ;---------------------------------------------------------------------
  497. include   'text.inc'
  498. ;---------------------------------------------------------------------
  499. I_END:
  500. ;include_debug_strings
  501. ;---------------------------------------------------------------------
  502. include   'data.inc'
  503. ;---------------------------------------------------------------------
  504. mem:
  505.