Subversion Repositories Kolibri OS

Rev

Rev 2584 | Rev 2688 | 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. ;    mov   ecx,[temp_esi]
  184.         test    [window_status],100b    ; window is rolled up
  185.         jnz     .exit
  186.  
  187.         test    [window_status],10b     ; window is minimized to panel
  188.         jnz     .exit
  189.  
  190.     mcall 71, 1 , header_text
  191.     ; create_dir_name
  192.     ; start_parameter
  193.     ; file_name
  194.     ; [temp_edi]
  195.     ; header
  196.     ; delete_file_data.name
  197.     ; start_file_data.name
  198.     ; start_parameter
  199.      ; start_file_data.name
  200.       ; read_icon_file.name
  201.                 ; read_file_features.name ;path ;header
  202.  
  203.     cmp   [window_high],180
  204.     jb    .exit
  205.     cmp   [window_width],495
  206.     jb    .exit
  207.  
  208. ;    pusha
  209. ;    mcall 4,<15,25>,0,read_folder.name,100
  210. ;    popa
  211.     call  draw_fbutton
  212.  
  213. ;    mov   [left_panel_clear_all],1
  214.  
  215.     call  draw_left_panel
  216.  
  217. ;    mov   [right_panel_clear_all],1
  218.  
  219.     call  draw_right_panel
  220.     call  draw_device_button
  221.     call  draw_left_select_disk_button
  222.     call  draw_left_sort_button
  223.     call  draw_right_select_disk_button
  224.     call  draw_right_sort_button
  225.     call  draw_menu_bar
  226.     call  draw_buttons_panel
  227.     call  draw_ATAPI_tray_control
  228.    
  229. ;    mcall 47,0x80000,[left_scroll_compens],<300, 5>,0xffffff
  230. ;    call  mouse.draw_data
  231. ;    mcall 18, 7
  232. ;    mov   [temp_eax],eax
  233. ;    mcall 47,0x80000,[active_process],<300, 5>,0xffffff
  234. ;    mcall 47,0x80000,[left_marked_counter],<300, 5>,0xffffff
  235. ;    mcall 47,0x80000,[right_marked_counter],<400, 5>,0xffffff
  236. ;    mcall 47,0x80000,[sorting_low_limit],<100, 5>,0xffffff
  237. ;    mcall 47,0x80000,[sort_counter],<200, 5>,0xffffff
  238. ;    mcall 47,0x80000,[sorting_high_limit],<300, 5>,0xffffff
  239. ;    mcall 47,0x80000,[dir_temp_counter],<400, 5>,0xffffff
  240.  
  241. ;    mcall 47,0x80000,[timer_tick],<500, 5>,0xffffff
  242. ;    mcall 47,0x80000,[temp_eax],<400, 5>,0xffffff
  243. ;    mcall 47,0x80000,[temp_ebx],<400, 5>,0xffffff
  244. ;    mcall 47,0x80000,[temp_ecx],<500, 5>,0xffffff
  245. ;    mcall 47,0x80000,[temp_ebx],<500, 5>,0xffffff
  246. ;    mcall 47,0x80000,[ini_file_start],<100, 5>,0xffffff
  247. ;    mcall 47,0x80000,[left_folder_data],<200, 5>,0xffffff
  248. ;    mcall 47,0x80000,[right_folder_data],<300, 5>,0xffffff
  249. ;    mcall 47,0x80000,[appl_memory],<500, 5>,0xffffff
  250. ;    mcall 47,0x80000,[temp_znak],<500, 5>,0xffffff
  251.  
  252. ;    mcall 47,0x80000,[sort_counter],<200, 5>,0xffffff
  253. ;    mcall 47,0x80000,[temp_edi],<250, 5>,0xffffff
  254. ;    mcall 47,0x80000,[temp_esi],<300, 5>,0xffffff
  255. ;    mcall 47,0x80000,[temp_ecx],<350, 5>,0xffffff
  256. ;    mcall 47,0x80000,[temp_znak],<400, 5>,0xffffff
  257.  
  258. ;    movzx ecx,[left_start_draw_cursor_line]
  259. ;    mcall 47,0x40000, ,<300, 5>,0xffffff
  260. ;    mcall 47,0x40000,[left_start_draw_line],<400, 5>,0xffffff
  261.  
  262. ;    mcall 47,0x40000,[window_width],<100, 5>,0xffffff
  263. ;    mcall 47,0x40000,[window_high],<130, 5>,0xffffff
  264.  
  265. ;    mcall 47,0x80100,[left_panel_x],<200, 5>,0xffffff
  266. ;    mcall 47,0x80100,[left_panel_y],<250, 5>,0xffffff
  267. ;    mov   edx,[temp_counter_dword_1]
  268. ;    mcall 4,<150,3>,0x80000000
  269. ;    mov   edx,[temp_counter_dword]
  270. ;    mcall 4,<5,3>,0x80000000
  271. .exit:
  272.     mcall 12, 2
  273.     ret
  274. ;temp_eax dd 0
  275. ;temp_ebx dd 0
  276. ;temp_ecx dd 0
  277. ;temp_edx dd 0
  278. ;temp_esi dd 0
  279. ;temp_edi dd 0
  280. ;temp_ebp dd 0
  281. ;temp_esp dd 0
  282. ;temp_znak dd 0
  283. ;temp_counter_dword_1 dd 0
  284. ;extension_size_1 dd 0
  285. ;timer_tick dd 0
  286. ;---------------------------------------------------------------------
  287. prepare_load_data:
  288.     mov   esi,path
  289.     mov   edi,file_name
  290.     call  copy_path
  291.     call  get_file_size
  292.     test  eax,eax
  293.     ret
  294. ;---------------------------------------------------------------------
  295. prepare_load_data_1:
  296.     mov   [read_file.return],eax
  297.     mov   ebp,eax
  298. prepare_load_data_4:
  299.     call  load_file
  300.     test  eax,eax
  301.     ret
  302. ;---------------------------------------------------------------------
  303. prepare_load_data_2:
  304.     call  add_application_memory
  305. prepare_load_data_3:
  306.     call  add_application_memory
  307.     mov   eax,[file_features_temp_area+32]
  308.     mov   [read_file.size],eax
  309.     ret
  310. ;---------------------------------------------------------------------
  311. load_icon_and_convert_to_img:
  312.     mov   ebx,icons_file_name
  313.     call  prepare_load_data
  314.     jnz   icon_error
  315.     call  prepare_load_data_2
  316.     add   eax,mem
  317.     call  prepare_load_data_1
  318.     jnz   icon_error
  319.     call  convert_bmp_to_img
  320.     call  sub_application_memory
  321.     ret
  322. ;---------------------------------------------------------------------
  323. load_buttons_and_convert_to_img:
  324.     mov   ebx,buttons_file_name
  325.     call  prepare_load_data
  326.     jnz   buttons_error
  327.     mov   eax,[appl_memory]
  328.     mov   [buttons_img_start],eax
  329.     call  prepare_load_data_2
  330.     add   eax,[buttons_img_start]
  331.     call  prepare_load_data_1
  332.     jnz   buttons_error
  333.     call  convert_bmp_to_img
  334.     call  sub_application_memory
  335.     ret
  336. ;---------------------------------------------------------------------
  337. load_initiation_file:
  338.     mov   ebx,ini_file_name
  339.     call  prepare_load_data
  340.     jnz   initiation_error
  341.     call  prepare_load_data_3
  342.     mov   eax,[appl_memory]
  343.     mov   [left_folder_data],eax
  344.     sub   eax,[read_file.size]
  345.     mov   [read_file.return],eax
  346.     mov   [ini_file_start],eax
  347.     call  load_file
  348.     test  eax,eax
  349.     jnz   initiation_error
  350.     mov   ebp,icons_associations
  351.     call  search_star_and_end_tags
  352. ;    cmp   ebp,-1
  353. ;    je    .end
  354.     mov   eax,[end_tag]
  355.     mov   [icons_end_tag],eax
  356.     ret
  357. ;---------------------------------------------------------------------
  358. add_memory_for_folders:
  359.     mov   ecx,[appl_memory]
  360.     add   ecx,304*32+32
  361.     mov   [right_folder_data],ecx
  362.     add   ecx,304*32+32
  363.     mov   [appl_memory],ecx
  364.     mcall 64,1
  365.     ret
  366. ;---------------------------------------------------------------------
  367. copy_path:
  368.     xor   eax,eax
  369. @@:
  370.     cld
  371.     lodsb
  372.     stosb
  373.     test  eax,eax
  374.     jnz   @b
  375.     mov   esi,edi
  376. ;    dec   esi
  377. @@:
  378.     std
  379.     lodsb
  380.     cmp   al,'/'
  381.     jnz   @b
  382.     mov   edi,esi
  383.     add   edi,2
  384.     mov   esi,ebx
  385. @@:
  386.     cld
  387.     lodsb
  388.     stosb
  389.     test  eax,eax
  390.     jnz   @b
  391.     ret
  392. ;---------------------------------------------------------------------
  393. copy_path_1:
  394.     xor   eax,eax
  395. @@:
  396.     cld
  397.     lodsb
  398.     stosb
  399.     test  eax,eax
  400.     jnz   @b
  401.     mov   esi,ebx
  402.     mov   [edi-1],byte '/'
  403. @@:
  404.     cld
  405.     lodsb
  406.     stosb
  407.     test  eax,eax
  408.     jnz   @b
  409.     ret
  410. ;---------------------------------------------------------------------
  411. add_application_memory:
  412.     mov   ecx,[file_features_temp_area+32]
  413. .1:
  414.     add   ecx,[appl_memory]
  415.     mov   [appl_memory],ecx
  416.     mcall 64,1
  417.     ret
  418. ;---------------------------------------------------------------------
  419. sub_application_memory:
  420.     mov   ecx,[appl_memory]
  421.     sub   ecx,[file_features_temp_area+32]
  422. .1:
  423.     mov   [appl_memory],ecx
  424.     mcall 64,1
  425.     ret
  426. ;---------------------------------------------------------------------
  427. include   'key.inc'
  428. ;---------------------------------------------------------------------
  429. include   'markfile.inc'
  430. ;---------------------------------------------------------------------
  431. include   'button.inc'
  432. ;---------------------------------------------------------------------
  433. include   'mouse.inc'
  434. ;---------------------------------------------------------------------
  435. include   'openfile.inc'
  436. ;---------------------------------------------------------------------
  437. include   'draw.inc'
  438. ;---------------------------------------------------------------------
  439. include   'menu_bar.inc'
  440. ;---------------------------------------------------------------------
  441. include   'menu_drv.inc'
  442. ;---------------------------------------------------------------------
  443. include   'delete.inc'
  444. ;---------------------------------------------------------------------
  445. include   'copy.inc'
  446. ;---------------------------------------------------------------------
  447. include   'creatdir.inc'
  448. ;---------------------------------------------------------------------
  449. include   'confirm.inc'
  450. ;---------------------------------------------------------------------
  451. include   'err_wind.inc'
  452. ;---------------------------------------------------------------------
  453. include   'detect.inc'
  454. ;---------------------------------------------------------------------
  455. include   'conv_bmp.inc'
  456. ;---------------------------------------------------------------------
  457. include   'tran_ini.inc'
  458. ;---------------------------------------------------------------------
  459. include   'help.inc'
  460. ;---------------------------------------------------------------------
  461. include   'convchar.inc'
  462. ;---------------------------------------------------------------------
  463. include   'sort.inc'
  464. ;---------------------------------------------------------------------
  465. include   'exit.inc'
  466. ;---------------------------------------------------------------------
  467. include   'progrbar.inc'
  468. ;---------------------------------------------------------------------
  469. include   'scroll.inc'
  470. ;---------------------------------------------------------------------
  471. include   'file_inf.inc'
  472. ;---------------------------------------------------------------------
  473. include   'text.inc'
  474. ;---------------------------------------------------------------------
  475. I_END:
  476. ;---------------------------------------------------------------------
  477. include   'data.inc'
  478. ;---------------------------------------------------------------------
  479. mem:
  480.