Subversion Repositories Kolibri OS

Rev

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