Subversion Repositories Kolibri OS

Rev

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