Subversion Repositories Kolibri OS

Rev

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