Subversion Repositories Kolibri OS

Rev

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