Subversion Repositories Kolibri OS

Rev

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