Subversion Repositories Kolibri OS

Rev

Rev 1248 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. ;*****************************************************************************
  2. ; Open Dialog - for Kolibri OS
  3. ; Copyright (c) 2009, 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.  
  29. use32
  30. org     0x0
  31.  
  32. db      'MENUET01'
  33. dd      0x01
  34. dd      START
  35. dd      IM_END
  36. dd      I_END
  37. dd      stacktop
  38. dd      param
  39. dd      path
  40.  
  41. include '../../../../../macros.inc'
  42. include '../../load_lib.mac'
  43. include '../../trunk/box_lib.mac'
  44. ;include 'macros.inc'
  45. ;include 'load_lib.mac'
  46. @use_library
  47. ;---------------------------------------------------------------------
  48. ;---------------------------------------------------------------------
  49. START:
  50.         mcall   68,11
  51.         mcall   66,1,1
  52.         mcall   40,0x27
  53.         call    get_active_pocess
  54.  
  55.         call    get_communication_area
  56.  
  57.  
  58.         load_libraries  l_libs_start,end_l_libs
  59.         test  eax,eax
  60.         jnz    button.exit
  61. ; initialize sort
  62.         push dword 1
  63.         call dword [sort_init]
  64. ; unpack deflate
  65.         mov   eax,[unpack_DeflateUnpack2]
  66.         mov  [deflate_unpack],eax
  67.  
  68.         call    load_root_directory
  69.         call    load_start_directory
  70.         call    sort_directory
  71.         call    load_icons
  72.         call    convert_icons
  73.         call    load_ini
  74.         call    calc_ini
  75. ;---------------------------------------------------------------------
  76. red:
  77.         call    control_minimal_window_size
  78. red_1:
  79.         call    draw_window
  80. ;---------------------------------------------------------------------
  81. still:
  82.         mcall   10
  83.         cmp     eax,1
  84.         je      red
  85.         cmp     eax,2
  86.         je      key
  87.         cmp     eax,3
  88.         je      button
  89.         cmp     eax,6
  90.         je      mouse
  91.         jmp     still
  92. ;---------------------------------------------------------------------
  93. control_minimal_window_size:
  94.         pusha
  95.         call    get_window_param
  96.         test    [window_status],10b
  97.         jnz     .end ;red_1
  98.         test    [window_status],100b
  99.         jnz     .end ;red_1
  100.         test    [window_status],1b
  101.         jnz     .end ;red_1
  102.         mov     esi,-1
  103.         mov     eax,procinfo
  104.         mov     eax,[eax+66]
  105.         cmp     eax,200
  106.         jae     @f
  107.         mov     esi,200
  108.         mcall 67,-1,ebx,ebx
  109. @@:
  110.         mov     edx,-1
  111.         mov     eax,procinfo
  112.         mov     eax,[eax+62]
  113.         cmp     eax,300
  114.         jae     @f
  115.         mov     edx,300
  116.         mcall 67,-1,ebx, ,ebx
  117. @@:
  118. .end:
  119.         popa
  120.         ret
  121. ;---------------------------------------------------------------------
  122. key:
  123.         mov     al,[focus_pointer]
  124.         test    al,al
  125.         jne     key_ASCII
  126.         mcall   2
  127.         xor     ebx,ebx
  128.         cmp     [extended_key],1
  129.         je      .extended_key
  130.         test    al, al
  131.         jnz     still
  132.         cmp     ah, 0xE0
  133.         jne     @f
  134.         mov     [extended_key],1
  135.         jmp     still
  136. @@:
  137.         cmp     ah,72   ; arrow up
  138.         je      .2
  139.         cmp     ah,80   ; arrow down
  140.         je      .1
  141.         cmp     ah,28   ; Enter
  142.         je      .7
  143.         cmp     ah,1    ; Esc
  144.         je      button.exit
  145.         cmp     ah,14   ; Backspace
  146.         je      button.exit_dir
  147.         cmp     ah,187  ; F1
  148.         je      select_disk
  149.         cmp     ah,188  ; F2
  150.         je      select_sort
  151.         cmp     ah,189  ; F3
  152.         je      select_filter
  153.         cmp     ah,19   ; R
  154.         je      button.reload_dir
  155.         cmp     ah,42
  156.         je      key_shift_up
  157.         cmp     ah,54
  158.         je      key_shift_up
  159.         cmp     ah,170
  160.         je      key_shift_down
  161.         cmp     ah,182
  162.         je      key_shift_down
  163.         cmp     ah,29
  164.         je      key_ctrl_up
  165.         cmp     ah,157
  166.         je      key_ctrl_down
  167.         cmp     ah,56
  168.         je      key_alt_up
  169.         cmp     ah,184
  170.         je      key_alt_down
  171.         cmp     ah,206 ; NumPad+ Up
  172.         je      NumPad_plus_Up
  173.         cmp     ah,202 ; NumPad- Up
  174.         je      NumPad_minus_Up
  175.         cmp     ah,183 ; NumPad* Up
  176.         je      NumPad_invert_Up
  177.         cmp     ah,158
  178.         je      symbol_a_up
  179.         cmp     ah,15 ; Tab down
  180.         je      change_focus_area_press_Tab_key
  181.         cmp     ah,143 ; Tab up
  182.         je      change_focus_area_check_Tab_key
  183.         jmp     still
  184. .extended_key:
  185.         mov     [extended_key],0
  186.         cmp     ah,80   ; arrow down
  187.         je      .1
  188.         cmp     ah,72   ; arrow up
  189.         je      .2
  190.         cmp     ah,81   ; PageDown
  191.         je      .3
  192.         cmp     ah,73   ; PageUp
  193.         je      .4
  194.         cmp     ah,71   ; Home
  195.         je      .5
  196.         cmp     ah,79   ; End
  197.         je      .6
  198.         cmp     ah,28   ; Enter
  199.         je      .7
  200.         cmp     ah,82   ; Insert
  201.         je      .8
  202.        
  203.         cmp     ah,29
  204.         je      key_ctrl_up
  205.         cmp     ah,157
  206.         je      key_ctrl_down
  207.         cmp     ah,56
  208.         je      key_alt_up
  209.         cmp     ah,184
  210.         je      key_alt_down
  211.         jmp     still
  212. ;---------------------------------
  213. .11:
  214.         inc     ebx     ; 11
  215. ;---------------------------------
  216. .10:
  217.         inc     ebx     ; 10
  218. ;---------------------------------
  219. .9:
  220.         inc     ebx     ; 9
  221. ;---------------------------------
  222. .8:
  223.         inc     ebx     ; 8
  224. ;---------------------------------
  225. .7:
  226.         inc     ebx     ; 7
  227. ;---------------------------------
  228. .6:
  229.         inc     ebx     ; 6
  230. ;---------------------------------
  231. .5:
  232.         inc     ebx     ; 5
  233. ;---------------------------------
  234. .4:
  235.         inc     ebx     ; 4
  236. ;---------------------------------
  237. .3:
  238.         inc     ebx     ; 3
  239. ;---------------------------------
  240. .2:
  241.         inc     ebx     ; 2
  242. ;---------------------------------
  243. .1:
  244.         inc     ebx     ; 1
  245. ;---------------------------------
  246.         call    .key_action
  247.        
  248. ;       movzx   ecx,word [file_browser_data_1.start_draw_cursor_line]
  249. ;       mcall   47,0x80000,,<50,0>,0x40000000,0xffffff
  250. ;       movzx   ecx,word [file_browser_data_1.size_y]
  251. ;       mcall   47,0x80000,,<150,0>,0x40000000,0xffffff
  252.  
  253.         mov     eax,file_browser_data_1.mouse_keys_delta
  254.         cmp     [eax],dword 3
  255.         jne     still
  256.         xor     ebx,ebx
  257.         mov     [eax],ebx
  258.         call    load_next_dir
  259.         jmp     still
  260. ;-------------------------------------------------------
  261. .key_action:
  262.         mov     [file_browser_data_1.key_action],ebx
  263.  
  264.         push    dword file_browser_data_1
  265.         call    [FileBrowser_key]
  266.  
  267.         cmp     [file_browser_data_1.draw_scroll_bar],0
  268.         je      @f
  269.         call    draw_scrollbar1
  270.         mov     [file_browser_data_1.draw_scroll_bar],0
  271. @@:
  272.         ret
  273. ;---------------------------------------------------------------------
  274. change_focus_area_Tab_key_ASCII:
  275.         xor     eax,eax
  276.         inc     eax
  277.         mov     [Tab_key_block],al
  278.         jmp     change_focus_area
  279. ;---------------------------------------------------------------------
  280. change_focus_area_press_Tab_key:
  281.         mov     al,[Tab_key_block]
  282.         test    al,al
  283.         jnz     still
  284.         xor     eax,eax
  285.         inc     eax
  286.         mov     [Tab_key],al
  287.         jmp     still
  288. ;---------------------------------------------------------------------
  289. change_focus_area_check_Tab_key:
  290.         xor     eax,eax
  291.         mov     [Tab_key_block],al
  292.         mov     al,[Tab_key]
  293.         test    al,al
  294.         jz      still
  295.         xor     eax,eax
  296.         mov     [Tab_key],al
  297. ;---------------------------------------------------------------------
  298. change_focus_area:
  299.         mov     al,[focus_pointer]
  300.         inc     al
  301.         and     al,1
  302.         mov     [focus_pointer],al
  303. .1:
  304.         mov     edi,edit1
  305.         test    al,al
  306.         jne     @f
  307.         mov     [file_browser_data_1.select_panel_counter],1
  308.         and     [edi+44],dword 0xFFFFFFFD ; ed_focus
  309.         mov [edi+12],dword 0xffffff; color white
  310.         call    draw_draw_file_browser1
  311.     mcall       66, 1, 1
  312.         jmp     still
  313. @@:
  314.         mov     [file_browser_data_1.select_panel_counter],0
  315.         or      [edi+44],dword ed_focus
  316.         mov [edi+12],dword 0xffffb0 ; color yellow
  317.         call    draw_draw_file_browser1
  318.     mcall       66, 1, 0
  319.         jmp     still
  320. ;---------------------------------------------------------------------
  321. key_ASCII:
  322.         mcall   2
  323.         cmp     ah,9
  324.         je      change_focus_area_Tab_key_ASCII
  325.         cmp     ah,13
  326.         je      .load_dir
  327.         cmp     ah,27
  328.         je      button.exit
  329.         push    dword name_editboxes
  330.         call    [edit_box_key]
  331.         jmp     still
  332. .load_dir:
  333.         mov     [file_browser_data_1.select_panel_counter],1
  334.         xor     eax,eax
  335.         mov     [focus_pointer],al
  336.         mcall   66, 1, 1
  337.  
  338.         xor     eax,eax
  339.         mov     esi,dir_pach
  340.         cld
  341. @@:
  342.         lodsb
  343.         test    al,al
  344.         jne     @r
  345.         sub     esi,2
  346.         cmp     [esi],byte '/'
  347.         jne     @f
  348.         xor     eax,eax
  349.         mov     [esi],al
  350. @@:
  351.         call    load_next_dir.1
  352.         jmp     still
  353. ;---------------------------------------------------------------------
  354. select_disk:
  355.         call    check_alt
  356. .1:
  357.         xor     eax,eax
  358.         mov     [menu_data_1.ret_key],eax
  359.  
  360.         push    dword menu_data_1
  361.         call    [menu_bar_activate]
  362.  
  363.         call    clear_control_key_flag
  364.  
  365.         mov     eax,[menu_data_1.ret_key]
  366.         mov     [menu_data_1.ret_key],dword 0
  367.         cmp     eax,1
  368.         je      select_filter.1
  369.  
  370.         cmp     eax,2
  371.         je      select_sort.1
  372.  
  373.         cmp     [menu_data_1.click],dword 1
  374.         jne     still
  375.  
  376.         cmp     [menu_data_1.cursor_out],dword 0
  377.         jne     analyse_out_menu_1
  378.         jmp     still
  379. ;---------------------------------------------------------------------
  380. select_sort:
  381.         call    check_alt
  382. .1:
  383.         xor     eax,eax
  384.         mov     [menu_data_2.ret_key],eax
  385.  
  386.         push    dword menu_data_2
  387.         call    [menu_bar_activate]
  388.  
  389.         call    clear_control_key_flag
  390.  
  391.         mov     eax,[menu_data_2.ret_key]
  392.         mov     [menu_data_2.ret_key],dword 0
  393.         cmp     eax,1
  394.         je      select_disk.1
  395.  
  396.         cmp     eax,2
  397.         je      select_filter.1
  398.  
  399.  
  400.         cmp     [menu_data_2.click],dword 1
  401.         jne     still
  402.  
  403.         cmp     [menu_data_2.cursor_out],dword 0
  404.         jne     analyse_out_menu_2
  405.         jmp     still
  406. ;---------------------------------------------------------------------
  407. select_filter:
  408.         call    check_alt
  409. .1:
  410.         xor     eax,eax
  411.         mov     [menu_data_3.ret_key],eax
  412.  
  413.         push    dword menu_data_3
  414.         call    [menu_bar_activate]
  415.  
  416.         call    clear_control_key_flag
  417.  
  418.         mov     eax,[menu_data_3.ret_key]
  419.         mov     [menu_data_3.ret_key],dword 0
  420.         cmp     eax,1
  421.         je      select_sort.1
  422.  
  423.         cmp     eax,2
  424.         je      select_disk.1
  425.  
  426.  
  427.         cmp     [menu_data_3.click],dword 1
  428.         jne     still
  429.  
  430.         cmp     [menu_data_3.cursor_out],dword 0
  431.         jne     analyse_out_menu_3
  432.         jmp     still
  433. ;---------------------------------------------------------------------
  434. symbol_a_up:
  435. NumPad_plus_Up:
  436.         call    check_ctrl
  437.         jmp     key.9
  438. ;---------------------------------------
  439. NumPad_minus_Up:
  440.         call    check_ctrl
  441.         jmp     key.10
  442. ;---------------------------------------
  443. NumPad_invert_Up:
  444.         call    check_ctrl
  445.         jmp     key.11
  446. ;---------------------------------------        
  447. check_alt:
  448.         xor     eax,eax
  449.         mov     al,[alt_flag]
  450.         test    eax,eax
  451.         jz      @f
  452.         xor     ebx,ebx
  453.         ret
  454. @@:
  455.         add     esp,4
  456.         jmp     still
  457. ;---------------------------------------        
  458. check_ctrl:
  459.         xor     eax,eax
  460.         mov     al,[ctrl_flag]
  461.         test    eax,eax
  462.         jz      @f
  463.         xor     ebx,ebx
  464.         ret
  465. @@:
  466.         add     esp,4
  467.         jmp     still
  468. ;---------------------------------------------------------------------
  469. clear_control_key_flag:
  470.         xor     eax,eax
  471.         mov     [shift_flag],al
  472.         mov     [ctrl_flag],al
  473.         mov     [alt_flag],al
  474.         ret
  475. ;---------------------------------------------------------------------
  476. key_shift_up:
  477.         mov     [shift_flag],1
  478.         jmp     still
  479. ;---------------------------------------------------------------------
  480. key_shift_down:
  481.         mov     [shift_flag],0
  482.         jmp     still
  483. ;---------------------------------------------------------------------
  484. key_ctrl_up:
  485.         mov     [ctrl_flag],1
  486.         jmp     still
  487. ;---------------------------------------------------------------------
  488. key_ctrl_down:
  489.         mov     [ctrl_flag],0
  490.         jmp     still
  491. ;---------------------------------------------------------------------
  492. key_alt_up:
  493.         mov     [alt_flag],1
  494.         jmp     still
  495. ;---------------------------------------------------------------------
  496. key_alt_down:
  497.         mov     [alt_flag],0
  498.         jmp     still
  499. ;---------------------------------------------------------------------
  500. button:
  501.         mcall   17
  502.         cmp     ah,6
  503.         je      .reload_dir_1
  504.         cmp     ah,4
  505.         je      .exit
  506.         cmp     ah,3
  507.         je      .open_dir_or_file
  508.         cmp     ah,2
  509.         je      .exit_dir
  510.         cmp     ah, 1
  511.         jne     still
  512. .exit:
  513.         mov     eax,[communication_area]
  514.         test    eax,eax
  515.         jz      @f
  516.         cmp     [eax],dword 1
  517.         je      @f
  518.         mov     [eax],dword 3
  519. @@:
  520.         mov     eax,[N_error]
  521.         test    eax,eax
  522.         jz      @f
  523.         call    start_error_window_thread
  524. @@:
  525.         mcall   -1
  526. ;---------------------------------------------------------------------
  527. .reload_dir:
  528.         call    check_ctrl
  529. .reload_dir_1:
  530.         call    load_next_dir.1
  531.         jmp     still
  532. ;---------------------------------------------------------------------
  533. .exit_dir:
  534.         call    load_next_dir.exit_dir
  535.         jmp     still
  536. ;---------------------------------------------------------------------
  537. .open_dir_or_file:
  538.         xor     ebx,ebx
  539.         jmp     key.7
  540. ;---------------------------------------------------------------------
  541. thread_start:
  542.         mov     eax,[N_error]
  543.         cmp     al,1
  544.         jne     @f
  545.         mov     [N_error],load_ini_error_type
  546.         mov     [error_path],file_name
  547.         jmp     .error_type
  548. @@:
  549.         cmp     al,2
  550.         jne     @f
  551.         mov     [N_error],load_icons_error_type
  552.         mov     [error_path],file_name
  553.         jmp     .error_type
  554. @@:
  555.         cmp     al,3
  556.         jne     @f
  557.         mov     [N_error],memory_free_error_type
  558.         xor     eax,eax
  559.         mov     [error_path],eax
  560.         mov     [error_type],eax
  561.         jmp     .red
  562. @@:
  563.         cmp     al,4
  564.         jne     @f
  565.         mov     [N_error],memory_get_error_type
  566.         xor     eax,eax
  567.         mov     [error_path],eax
  568.         mov     [error_type],eax
  569.         jmp     .red
  570. @@:
  571.         cmp     al,5
  572.         jne     @f
  573.         mov     [N_error],load_directory_error_type
  574.         mov     [error_path],dir_pach
  575.         jmp     .error_type
  576. @@:
  577.         cmp     al,6
  578.         jne     .button
  579.         mov     [N_error],convert_icons_error_type
  580.         mov     [error_path],file_name
  581.         xor     eax,eax
  582.         mov     [error_type],eax
  583.         jmp     .red
  584. .error_type:
  585.         mov     eax,[error_type]
  586.         shl     eax,2
  587.         add     eax,error_fs_text_pointers
  588.         mov     eax,[eax]
  589.         mov     [error_type],eax
  590. .red:
  591.         call    draw_error_window
  592. .still:
  593.         mcall   10
  594.         cmp     eax,1
  595.         je      .red
  596.         cmp     eax,2
  597.         je      .key
  598.         cmp     eax,3
  599.         je      .button
  600.         jmp     .still
  601. .key:
  602.         mcall   2
  603.         jmp     .still
  604. .button:
  605.         mcall   -1
  606.         jmp     .still
  607. ;---------------------------------------------------------------------
  608. draw_error_window:
  609.         mcall   12, 1
  610.         mcall   0,[error_window_x] ,[error_window_y], 0x03ff0000
  611.         mcall   71,1,title
  612.         mcall   4,<10,30>,0x90ffffff,[N_error]
  613.         mov     eax,[error_path]
  614.         test    eax,eax
  615.         jz      @f
  616.         mcall   4,<10,50>, ,[error_path]
  617. @@:
  618.         mov     eax,[error_type]
  619.         test    eax,eax
  620.         jz      @f
  621.         mcall   4,<10,70>, ,[error_type]
  622. @@:
  623.         mcall   12, 2
  624.         ret
  625. ;---------------------------------------------------------------------
  626. start_error_window_thread:
  627.         mcall   9, procinfo, -1
  628.         mov     eax,[ebx+46]
  629.         shr     eax,1
  630.         add     eax,[ebx+38]
  631.         sub     eax,40
  632.         mov     [error_window_y+2],ax
  633.         mov     eax,[ebx+42]
  634.         shr     eax,1
  635.         add     eax,[ebx+34]
  636.         sub     eax,125
  637.         mov     [error_window_x+2],ax
  638.         mcall   51,1,thread_start,thread_stack
  639.         ret
  640. ;---------------------------------------------------------------------
  641. mouse:
  642.         mcall   18,7
  643.         cmp     [active_process],eax
  644.         jne     still
  645.  
  646.         mcall   37,7
  647.         mov     [mouse_scroll_data],eax
  648.  
  649.         mcall   37,1
  650.         mov     [mouse_position],eax
  651.  
  652.         cmp     [scroll_bar_data_vertical.delta2],0
  653.         jne     .scrollbar
  654.  
  655.         mov     [file_browser_data_1.select_flag],0
  656.  
  657.         push    dword file_browser_data_1
  658.         call    [FileBrowser_mouse]
  659.  
  660.         mov     eax,file_browser_data_1.mouse_keys_delta
  661.         cmp     [eax],dword 3
  662.         jne     .check_focus ;.scrollbar
  663.         mov     [eax],dword 0
  664.         call    load_next_dir
  665.         jmp     still
  666. ;---------------------------------------------------
  667. .check_focus:
  668.         mov     ebx,[file_browser_data_1.select_flag]
  669.         test    ebx,ebx
  670.         jz      .scrollbar  ;@f
  671.         mov     al,[focus_pointer]
  672.         test    al,al
  673.         jz      .scrollbar
  674.         xor     eax,eax
  675.         mov     [focus_pointer],al
  676.         jmp     change_focus_area.1
  677. ;---------------------------------------------------
  678. .scrollbar:
  679.         mov     eax,[scroll_bar_data_vertical.max_area]
  680.         cmp     eax,[scroll_bar_data_vertical.cur_area]
  681.         jbe     .menu_bar ;still
  682.        
  683.         push    dword scroll_bar_data_vertical
  684.         call    [scrollbar_ver_mouse]
  685.        
  686.         cmp     [scroll_bar_data_vertical.redraw],0
  687.         je      .menu_bar ;still
  688.         mov     [scroll_bar_data_vertical.redraw],0
  689. .draw:
  690.         call    draw_draw_file_browser2
  691.         jmp     still
  692.  
  693. ;---------------------------------------------------
  694. .menu_bar:
  695.         cmp     [scroll_bar_data_vertical.delta2],0
  696.         jne     still
  697.  
  698. .menu_bar_1:
  699.         call    .set_mouse_flag
  700. @@:
  701.         push    dword menu_data_1
  702.         call    [menu_bar_mouse]
  703.  
  704.         cmp     [menu_data_1.click],dword 1
  705.         jne     .menu_bar_2
  706.  
  707.         cmp     [menu_data_1.cursor_out],dword 0
  708.         jne     analyse_out_menu_1
  709.         jmp     .menu_bar_1
  710. ;--------------------------------------------
  711. .menu_bar_2:
  712.         push    dword menu_data_2
  713.         call    [menu_bar_mouse]
  714.  
  715.         cmp     [menu_data_2.click],dword 1
  716.         jne     .menu_bar_3
  717.  
  718.         cmp     [menu_data_2.cursor_out],dword 0
  719.         jne     analyse_out_menu_2
  720.         jmp     .menu_bar_1
  721. ;---------------------------------------------------
  722. .menu_bar_3:
  723.         push    dword menu_data_3
  724.         call    [menu_bar_mouse]
  725.  
  726.         cmp     [menu_data_3.click],dword 1
  727.         jne     .check_editboxes
  728.  
  729.         cmp     [menu_data_3.cursor_out],dword 0
  730.         jne     analyse_out_menu_3
  731.         jmp     .menu_bar_1
  732. ;---------------------------------------------------
  733. .check_editboxes:
  734.         mov     eax,[edit1+44]
  735.         and     eax,10b
  736.         push    dword name_editboxes
  737.         call    [edit_box_mouse]
  738.         mov     ebx,[edit1+44]
  739.         and     ebx,10b
  740.         cmp     eax,ebx
  741.         je      .check_scroll_event
  742.         mov     al,[focus_pointer]
  743.         test    al,al
  744.         jnz     .check_scroll_event
  745.         xor     eax,eax
  746.         test    ebx,10b
  747.         jz      @f
  748.         inc     eax
  749. @@:
  750.         mov     [focus_pointer],al
  751.         jmp     change_focus_area.1
  752. ;---------------------------------------------------
  753. .check_scroll_event:
  754.         mov  eax,[mouse_position]
  755.         xor  ebx,ebx
  756.         mov  bx,ax  ; EBX mouse y
  757.         shr  eax,16 ; EAX mouse x
  758.        
  759.         mov  cx,[file_browser_data_1.start_x]
  760.         mov  dx,[file_browser_data_1.start_y]
  761.  
  762.         cmp  ax,cx
  763.         jb   .mouse_next ; min x
  764.  
  765.         cmp  bx,dx
  766.         jb   .mouse_next ; min y
  767.  
  768.         add  cx,[file_browser_data_1.size_x]
  769.         cmp  ax,cx     
  770.         ja   .mouse_next ; max x
  771.  
  772.         add  dx,[file_browser_data_1.size_y]
  773.         cmp  bx,dx
  774.         ja   .mouse_next ; max y
  775.  
  776.         xor     ecx,ecx
  777.         xor     ebx,ebx
  778.         mov     eax,[mouse_scroll_data]
  779.         test    eax,eax
  780.         jz      .mouse_next
  781.         test    ax,0x8000
  782.         jnz     .decr
  783.         shr     eax,16
  784.         test    ax,0x8000
  785.         jnz     .decr_1
  786.  
  787.         mov     cx,[mouse_scroll_data.vertical]
  788.         test    ecx,ecx
  789.         jnz     @f
  790.         mov     cx,[mouse_scroll_data.horizontal]
  791.         test    ecx,ecx
  792.         jz      .mouse_next
  793. @@:
  794.         mov     ebx,1
  795. @@:
  796.         push    ebx ecx
  797.         call    key.key_action
  798.         pop     ecx ebx
  799.         dec     ecx
  800.         jnz     @r
  801.         jmp     still
  802. ;----------------------------------------
  803. .decr:
  804.         mov     bx,[mouse_scroll_data.vertical]
  805.         jmp     @f
  806. .decr_1:
  807.         mov     bx,[mouse_scroll_data.horizontal]
  808. @@:
  809.         mov     ecx,0xffff
  810.         sub     ecx,ebx
  811.         inc     ecx
  812.         mov     ebx,2
  813. @@:
  814.         push    ebx ecx
  815.         call    key.key_action
  816.         pop     ecx ebx
  817.         dec     ecx
  818.         jnz     @r
  819.         jmp     still
  820. ;---------------------------------------------------
  821. .mouse_next:
  822.         jmp     still
  823. ;---------------------------------------------------------------------
  824. .set_mouse_flag:
  825.         xor   eax,eax
  826.         inc   eax
  827.         mov   [menu_data_1.get_mouse_flag],eax
  828.         mov   [menu_data_2.get_mouse_flag],eax
  829.         ret
  830. ;---------------------------------------------------------------------
  831. analyse_out_menu_1:
  832. ; Available disks
  833.         mov     eax,[menu_data_1.cursor_out]
  834.         dec     eax
  835.         imul esi,eax,10
  836.         add     esi,retrieved_devices_table
  837.         mov     edi,dir_pach
  838.         call    copy_dir_name
  839.         call    load_next_dir.1
  840.         jmp     still
  841. ;---------------------------------------------------------------------
  842. analyse_out_menu_2:
  843. ; Sort
  844.         mov     eax,[menu_data_2.cursor_out]
  845.         xor     ebx,ebx
  846.         cmp     eax,dword 1
  847.         je      .1
  848.         cmp     eax,dword 2
  849.         je      .2
  850.         cmp     eax,dword 3
  851.         je      .3
  852.         cmp     eax,dword 4
  853.         je      .4
  854.         jmp     still
  855. .4:
  856.         add     ebx,2
  857. .3:
  858.         add     ebx,2
  859. .2:
  860.         add     ebx,2
  861. .1:
  862.         mov     [sort_type],ebx
  863.         call    sort_directory
  864.         call    draw_draw_file_browser1
  865.         jmp     still
  866. ;---------------------------------------------------------------------
  867. analyse_out_menu_3:
  868. ; Filter
  869.         mov     eax,[menu_data_3.cursor_out]
  870.         cmp     eax,dword 1
  871.         jne     @f
  872.         mov     [filter_flag],0
  873.         call    load_next_dir.1
  874.         jmp     still
  875. @@:
  876.         cmp     eax,dword 2
  877.         jne     still
  878.         mov     [filter_flag],1
  879.         call    load_next_dir.1
  880.         jmp     still  
  881. ;---------------------------------------------------------------------
  882. get_communication_area:
  883.         xor     eax,eax
  884.         mov     al,[param]
  885.         test    eax,eax
  886.         jz      @f
  887.         mcall   68,22,param,,0x01
  888.         mov     [communication_area],eax
  889. @@:
  890.         ret
  891. ;---------------------------------------------------------------------
  892. load_start_directory:
  893.         mov     eax,[communication_area]       
  894.         test    eax,eax
  895.         jz      @f
  896.         mov     ebx,[eax]
  897.         test    eax,eax
  898.         jz      @f
  899.         add     eax,4
  900.         mov     esi,eax
  901.         jmp     .1
  902. @@:
  903.         mov     esi,start_pach
  904. .1:
  905.         mov     edi,dir_pach
  906.         call    copy_dir_name
  907.         call    load_directory
  908.         mov     eax,[N_error]
  909.         test    eax,eax
  910.         jnz     button.exit
  911.         ret
  912. ;---------------------------------------------------------------------
  913. load_next_dir:
  914.         mov     ebx,[file_browser_data_1.selected_BDVK_adress]
  915.         add     ebx,40
  916.         test    [ebx-40],byte 0x10
  917.         jz      file_no_folder
  918.         cmp     [ebx],word '..'
  919.         jne     @f
  920.         cmp     [ebx+2],byte 0
  921.         je      .exit_dir
  922. @@:
  923.         mov     esi,dir_pach
  924.         call    copy_dir_path
  925.  
  926. @@:
  927. .1:
  928.         call    load_directory
  929.         mov     eax,[N_error]
  930.         test    eax,eax
  931.         jz      @f
  932.         call    error_handler
  933.         jmp     .1
  934. @@:
  935.         call    sort_directory
  936.  
  937.         mov     ebx,[scroll_bar_data_vertical.x]
  938.         inc     ebx
  939.         mov     ecx,[scroll_bar_data_vertical.y]
  940.         inc     ecx
  941.         mcall   13,,,0xcccccc
  942.         mov     edi,edit1
  943.         xor     eax,eax
  944.         mov     [edi+44],eax
  945.         mov [edi+12],dword 0xffffff ; color white
  946.         call    draw_draw_file_browser1
  947.         ret
  948. .exit_dir:
  949.         mov     esi,dir_pach
  950.         call    copy_exit_dir
  951.         jmp     .1
  952. ;---------------------------------------------------------------------
  953. error_handler:
  954. .red:
  955.         call    .draw_window
  956. ;------------------------------------
  957. .still:
  958.         mcall   10
  959.         cmp     eax,1
  960.         je      .red
  961.         cmp     eax,2
  962.         je      .key
  963.         cmp     eax,3
  964.         je      .button
  965.         jmp     .still
  966. ;------------------------------------
  967. .draw_window:
  968.         xor     eax,eax
  969.         inc     eax
  970.         mov     [error_window],al
  971.         call    control_minimal_window_size
  972.         call    draw_window
  973.         xor     eax,eax
  974.         mov     [error_window],al
  975.         ret
  976. ;------------------------------------
  977. .key:
  978.         mcall   2
  979.         xor     ebx,ebx
  980.         cmp     [extended_key],1
  981.         je      .extended_key
  982.         test    al, al
  983.         jnz     .still
  984.         cmp     ah, 0xE0
  985.         jne     @f
  986.         mov     [extended_key],1
  987.         jmp     .still
  988. @@:
  989.         cmp     ah,129  ; Esc
  990.         je      .exit
  991.         jmp     .still
  992. .extended_key:
  993.         jmp     .still
  994. ;------------------------------------
  995. .button:
  996.         mcall   17
  997.         cmp     ah,5
  998.         je      .exit
  999.         cmp     ah, 1
  1000.         jne     .still
  1001.         xor     eax,eax
  1002.         mov     [N_error],eax
  1003.         jmp     button.exit
  1004. ;------------------------------------
  1005. .exit:
  1006.         mov     esi,start_pach
  1007.         mov     edi,dir_pach
  1008.         call    copy_dir_name
  1009.         ret
  1010. ;---------------------------------------------------------------------
  1011. file_no_folder:
  1012.         mov     esi,dir_pach
  1013.         mov     edi,file_name
  1014.         call    copy_dir_name
  1015.  
  1016.         mov     esi,file_name
  1017.         call    copy_dir_path
  1018.  
  1019.         mov     eax,[communication_area]
  1020.         test    eax,eax
  1021.         jnz     @f
  1022.         call    control_minimal_window_size
  1023.         call    draw_window
  1024.         ret
  1025. @@:
  1026.         mov     edi,eax
  1027.         add     edi,4
  1028.         mov     esi,file_name  
  1029.         call    copy_dir_name
  1030.         mov     eax,[communication_area]
  1031.         mov     [eax],dword 1
  1032.         jmp     button.exit
  1033. ;---------------------------------------------------------------------
  1034. load_root_directory:
  1035.         mov     esi,root_pach
  1036.         mov     edi,dir_pach
  1037.         call    copy_dir_name
  1038.         call    load_directory
  1039.         mov     eax,[N_error]
  1040.         test    eax,eax
  1041.         jnz     button.exit
  1042.  
  1043.         mov     eax,[dirinfo.return]
  1044.         mov     [root_folder_area],eax
  1045.         mov     eax,[eax+4]
  1046.         mov     [root_folder_block],eax
  1047.  
  1048.         xor     eax,eax
  1049.         mov     [dirinfo.return],eax
  1050.         mov     [file_browser_data_1.folder_data],eax
  1051.         mov     [temp_counter_1],eax ;0
  1052.  
  1053.         mov     [retrieved_devices_table_counter],eax ;0
  1054. .start_temp_counter_1:
  1055.         imul    esi,[temp_counter_1],304
  1056.         add     esi,[root_folder_area]
  1057.         add     esi,32+40
  1058.         mov     edi,dir_pach+1
  1059.         mov     [edi-1],byte '/'
  1060.         call    copy_dir_name
  1061.         call    load_directory
  1062.         mov     eax,[N_error]
  1063.         test    eax,eax
  1064.         jnz     button.exit
  1065.  
  1066.         mov     eax,[dirinfo.return]
  1067.         mov     [root1_folder_area],eax
  1068.         mov     eax,[eax+4]
  1069.         test    eax,eax
  1070.         jz      .continue
  1071.         mov     [root1_folder_block],eax
  1072.        
  1073.         mov     ebp,0
  1074. .start_copy_device_patch:
  1075.         imul    edi,[retrieved_devices_table_counter],10
  1076.         add     edi,retrieved_devices_table
  1077.         mov     [edi],byte '/'
  1078.         inc     edi
  1079.         imul    esi,[temp_counter_1],304
  1080.         add     esi,[root_folder_area]
  1081.         add     esi,32+40
  1082.  
  1083.         call    copy_dir_name
  1084.  
  1085.         imul    esi,ebp,304
  1086.         add     esi,[root1_folder_area]
  1087.         add     esi,32+40
  1088.         mov     [edi-1],byte '/'
  1089.  
  1090.         call    copy_dir_name
  1091.  
  1092.         inc     [retrieved_devices_table_counter]
  1093.         inc     ebp
  1094.         cmp     ebp,[root1_folder_block]
  1095.         jb      .start_copy_device_patch
  1096. .continue:
  1097.         inc     [temp_counter_1]
  1098.         mov     eax,[temp_counter_1]
  1099.         cmp     eax,[root_folder_block]
  1100.         jb      .start_temp_counter_1
  1101.  
  1102.         cmp     [root_folder_area],dword 0
  1103.         je      @f
  1104.         mcall   68, 13, [root_folder_area]
  1105.         test    eax,eax
  1106.         jz      memory_free_error
  1107. @@:
  1108.  
  1109.         xor     ecx,ecx
  1110.         mov     edi,menu_text_area_1_1 ;.1
  1111. @@:
  1112.         imul    esi,ecx,10
  1113.         add     esi,retrieved_devices_table
  1114.         call    copy_dir_name
  1115.         inc     ecx
  1116.         cmp     ecx,[retrieved_devices_table_counter]
  1117.         jb      @b
  1118.         mov     [menu_data_1.text_end],edi
  1119.         xor     eax,eax
  1120.         mov     [edi],eax
  1121.         ret
  1122. ;---------------------------------------------------------------------
  1123. memory_free_error:
  1124.         mov     [N_error],3
  1125.         jmp     button.exit
  1126. ;---------------------------------------------------------------------
  1127. memory_get_error:
  1128.         mov     [N_error],4
  1129.         jmp     button.exit
  1130. ;---------------------------------------------------------------------
  1131. draw_window:
  1132.  
  1133.         mcall   12,1
  1134.  
  1135.         mcall   0,<10,420>,<10,320>,0x63AABBCC,
  1136.  
  1137. ;       mov     ecx,[communication_area]
  1138. ;       add     ecx,4096+4+4
  1139.  
  1140.         mcall   71,1,  title ;;param  ;file_name   ;dir_pach
  1141.  
  1142.         call    get_window_param
  1143.  
  1144.         mov     eax,[window_high]
  1145.         sub     eax,25+45
  1146.         mov     [file_browser_data_1.size_y],ax
  1147.         mov     [scroll_bar_data_vertical.size_y],ax
  1148.        
  1149.         mov     eax,[window_width]
  1150.         sub     eax,10+20
  1151.         mov     [file_browser_data_1.size_x],ax
  1152.         add     ax,10
  1153.         mov     [scroll_bar_data_vertical.start_x],ax
  1154.        
  1155.        
  1156.         mcall   13,[window_width],45,0xcccccc
  1157.  
  1158.         push    ecx
  1159.         rol     ecx,16
  1160.         add     cx,[file_browser_data_1.size_y]
  1161.         add     cx,45
  1162.         ror     ecx,16
  1163.         mov     cx,25
  1164.         mcall
  1165.         pop     ecx
  1166.         add     ecx,45 shl 16
  1167.         mov     cx,[file_browser_data_1.size_y]
  1168.         mov     bx,10
  1169.         mcall
  1170.         mov     bx,[file_browser_data_1.size_x]
  1171.         add     bx,10
  1172.         shl     ebx,16
  1173.         mov     bx,20
  1174.         mcall
  1175.  
  1176.         cmp     [error_window],0
  1177.         je      @f
  1178.         call    draw_for_fs_errors
  1179.         jmp     .1
  1180. @@:
  1181.         call    draw_draw_file_browser1
  1182. .1:
  1183.         push    dword menu_data_1
  1184.         call    [menu_bar_draw]
  1185.         push    dword menu_data_2
  1186.         call    [menu_bar_draw]
  1187.         push    dword menu_data_3
  1188.         call    [menu_bar_draw]
  1189.  
  1190.         mov     ebx,[file_browser_data_1.x]
  1191.         mov     ax,bx
  1192.         shl     eax,16
  1193.         add     ebx,eax
  1194.         mov     eax,50
  1195.         mov     bx,ax
  1196.         shl     eax,16
  1197.         sub     ebx,eax
  1198.         mov     ecx,26 shl 16+15
  1199.  
  1200.         mcall   8,,,2,0xffffff
  1201.  
  1202.         pusha
  1203.         shr     ecx,16
  1204.         mov     bx,cx
  1205.         add     ebx,20 shl 16+ 2
  1206.         mcall   4,,0x90000000,message_ExitDir_button
  1207.         add     ebx,4
  1208.         mcall
  1209.         add     ebx,4
  1210.         mcall
  1211.         popa
  1212.  
  1213.         push    ebx
  1214.         sub     ebx,70 shl 16
  1215.         mov     bx,60
  1216.         mcall   8,,,6
  1217.  
  1218.         shr     ecx,16
  1219.         mov     bx,cx
  1220.         add     ebx,5 shl 16+ 4
  1221.         mcall   4,,0x90000000,message_ReloadDir_button
  1222.         pop     ebx
  1223.  
  1224.         mov     ebx,[file_browser_data_1.x]
  1225.        
  1226.         mov     ax,bx
  1227.         shl     eax,16
  1228.         add     ebx,eax
  1229.         mov     eax,55
  1230.         mov     bx,ax
  1231.         shl     eax,16
  1232.         sub     ebx,eax
  1233.  
  1234.         mov     ecx,[file_browser_data_1.y]
  1235.         mov     ax,cx
  1236.         add     eax,3
  1237.         shl     eax,16
  1238.         add     ecx,eax
  1239.         mov     cx,15
  1240.  
  1241.         mcall   8,,,3
  1242.  
  1243.         pusha
  1244.         shr     ecx,16
  1245.         mov     bx,cx
  1246.         add     ebx,12 shl 16+ 4
  1247.         mcall   4,,0x90000000,message_open_button
  1248.         popa
  1249.  
  1250.  
  1251.         sub     ebx, 65 shl 16
  1252.         mcall   8,,,4
  1253.  
  1254.         shr     ecx,16
  1255.         mov     bx,cx
  1256.         add     ebx,6 shl 16+ 4
  1257.         mcall   4,,0x90000000,message_cancel_button
  1258.  
  1259.  
  1260. ;       mcall   47,0x80000,[file_browser_data_1.ini_file_start],<250, 0>,0x0
  1261. ;       mcall   4, <3, 420>, 0, fb_extension_start, 3
  1262.         mcall   12,2
  1263.  
  1264.         ret
  1265. ;---------------------------------------------------------------------
  1266. draw_for_fs_errors:
  1267.         call    draw_dir_pach
  1268.  
  1269.         mov     ebx,[file_browser_data_1.x]
  1270.         mov     ecx,[file_browser_data_1.y]
  1271.         mcall   13,,,[file_browser_data_1.background_color]
  1272.         push    ebx ecx
  1273.         add     ebx,10 shl 16
  1274.         sub     ebx,20
  1275.         add     ecx,10 shl 16
  1276.         sub     ecx,20
  1277.         mov     edx,0xff0000
  1278.         mcall
  1279.  
  1280.         shr     ecx,16
  1281.         mov     bx,cx
  1282.         add     ebx,5 shl 16+15
  1283.         mcall   4,,0x90ffffff,load_directory_error_type
  1284.  
  1285.         add     ebx,20
  1286.         mcall   4,,,dir_pach   
  1287.  
  1288.         mov     eax,[error_type]
  1289.         shl     eax,2
  1290.         add     eax,error_fs_text_pointers
  1291.         mov     edx,[eax]
  1292.         add     ebx,20
  1293.         mcall   4
  1294.  
  1295.         pop     ecx ebx
  1296.  
  1297.         mov     ebx,[file_browser_data_1.x]
  1298.         mov     ax,bx
  1299.         shr     eax,1
  1300.         shl     eax,16
  1301.         add     ebx,eax
  1302.         mov     eax,50
  1303.         mov     bx,ax
  1304.         shr     eax,1
  1305.         shl     eax,16
  1306.         sub     ebx,eax
  1307.  
  1308.         mov     ecx,[file_browser_data_1.y]
  1309.         mov     ax,cx
  1310.         sub     eax,40
  1311.         shl     eax,16
  1312.         add     ecx,eax
  1313.         mov     cx,15
  1314.  
  1315.         mcall   8,,,5,0xffffff
  1316.  
  1317.         shr     ecx,16
  1318.         mov     bx,cx
  1319.         add     ebx,4 shl 16+ 4
  1320.         mcall   4,,0x90000000,message_cancel_button
  1321.  
  1322.  
  1323.         ret
  1324. ;---------------------------------------------------------------------
  1325. draw_dir_pach:
  1326.         mov     esi,dir_pach
  1327.         cld
  1328. @@:
  1329.         lodsb
  1330.         test    al,al
  1331.         jne     @r
  1332.         sub     esi,dir_pach
  1333.         mov     eax,esi
  1334.         dec     eax
  1335.         mov     edi, edit1
  1336.         mov     [edi+48], eax  ;ed_size
  1337.         mov     [edi+52], eax  ;ed_pos
  1338.  
  1339.         mov     eax,[file_browser_data_1.x]
  1340.         mov     ebx,eax
  1341.         shr     ebx,16
  1342.         and     eax,0xffff
  1343.  
  1344.         mov     [edi],eax
  1345.         mov     [edi+4],ebx
  1346.  
  1347.         push    dword name_editboxes
  1348.         call    [edit_box_draw]
  1349.         ret
  1350.        
  1351. draw_dir_pach_1:
  1352.         mov     ebx,[file_browser_data_1.x]
  1353.         mcall   13,,<7,15>,0xffffb0
  1354.         mov     bx,10
  1355.         add     ebx,4 shl 16
  1356.         mcall   4,,0xC0000000,dir_pach,,0xffffb0
  1357.         ret
  1358. ;---------------------------------------------------------------------
  1359. draw_draw_file_browser1:
  1360.         call    draw_dir_pach
  1361.         xor     eax,eax
  1362.         inc     eax
  1363.         mov     [file_browser_data_1.all_redraw],eax
  1364.         mov     [scroll_bar_data_vertical.all_redraw],eax
  1365.        
  1366.         push    dword file_browser_data_1
  1367.         call    [FileBrowser_draw]
  1368.        
  1369.        
  1370.         call    prepare_scrollbar_data
  1371.  
  1372.         call    draw_scrollbar
  1373.  
  1374.         xor     eax,eax
  1375.         mov     [file_browser_data_1.all_redraw],eax
  1376.         mov     [scroll_bar_data_vertical.all_redraw],eax
  1377.         ret
  1378. ;---------------------------------------------------------------------
  1379. draw_draw_file_browser2:
  1380.         mov     eax,2
  1381.         mov     [file_browser_data_1.all_redraw],eax
  1382.  
  1383.         call    get_scrollbar_data
  1384.  
  1385.         push    dword file_browser_data_1
  1386.         call    [FileBrowser_draw]
  1387.  
  1388.         xor     eax,eax
  1389.         mov     [file_browser_data_1.all_redraw],eax
  1390.         ret
  1391. ;---------------------------------------------------------------------
  1392. draw_scrollbar1:
  1393.         mov     eax,[file_browser_data_1.start_draw_line]
  1394.         mov     [scroll_bar_data_vertical.position],eax
  1395.  
  1396.         call    draw_scrollbar
  1397.  
  1398.         ret
  1399. ;---------------------------------------------------------------------
  1400. draw_scrollbar:
  1401.         mov     eax,[scroll_bar_data_vertical.max_area]
  1402.         cmp     eax,[scroll_bar_data_vertical.cur_area]
  1403.         jbe     @f
  1404.         cmp     [scroll_bar_data_vertical.cur_area],0
  1405.         je      @f
  1406.         push    dword scroll_bar_data_vertical
  1407.         call    [scrollbar_ver_draw]
  1408. @@:
  1409.         ret
  1410. ;---------------------------------------------------------------------
  1411. get_scrollbar_data:
  1412.         mov     eax,[scroll_bar_data_vertical.position]
  1413.         mov     [file_browser_data_1.start_draw_line],eax
  1414.         ret
  1415. ;---------------------------------------------------------------------
  1416. prepare_scrollbar_data:
  1417.         mov     eax,[file_browser_data_1.folder_block]
  1418.         mov     [scroll_bar_data_vertical.max_area],eax
  1419.         mov     eax,[file_browser_data_1.max_panel_line]
  1420.         mov     [scroll_bar_data_vertical.cur_area],eax
  1421.         ret
  1422. ;---------------------------------------------------------------------
  1423. get_active_pocess:
  1424.         mcall   9, procinfo, -1
  1425.         mov     eax,[ebx+30]
  1426.         mov     [PID],eax
  1427.         xor     ecx,ecx
  1428. @@:
  1429.         inc     ecx
  1430.         mcall   9, procinfo
  1431.         mov     eax,[PID]
  1432.         cmp     eax,[ebx+30]
  1433.         jne     @r
  1434.         mov     [active_process],ecx
  1435.         ret
  1436. ;---------------------------------------------------------------------
  1437. get_window_param:
  1438.         mcall   9, procinfo, -1
  1439.         mov     eax,[ebx+66]
  1440.         inc     eax
  1441.         mov     [window_high],eax
  1442.         mov     eax,[ebx+62]
  1443.         inc     eax
  1444.         mov     [window_width],eax
  1445.         mov     eax,[ebx+70]
  1446.         mov     [window_status],eax
  1447.         ret
  1448. ;---------------------------------------------------------------------
  1449. convert_icons:
  1450.         xor     eax,eax
  1451.         mov     [return_code],eax
  1452.         mov     eax,image_file
  1453.         call    [cnv_png_import.Start]
  1454.  
  1455.         mov     ecx,[image_file]
  1456.         mcall   68, 13,
  1457.         test    eax,eax
  1458.         jz      memory_free_error
  1459.  
  1460.         cmp     [return_code],dword 0
  1461.         je      @f
  1462.         mov     [N_error],6
  1463.         jmp     button.exit
  1464. @@:
  1465.  
  1466.         mov     ebx,[raw_pointer]
  1467.         mov     eax,[ebx+4]
  1468. ; set of icon size x
  1469.         mov     [file_browser_data_1.icon_size_x],ax
  1470. ; mov eax,[ebx+8]
  1471. ; set of icon size y
  1472.         mov     [file_browser_data_1.icon_size_y],ax
  1473.         inc     ax
  1474.         mov     [file_browser_data_1.line_size_y],ax
  1475.         mov     eax,[ebx+12]
  1476. ; set of RAW resolution to pixel
  1477.         mov     [file_browser_data_1.resolution_raw],eax
  1478.  
  1479.         mov     eax,[ebx+20]
  1480.         add     eax,ebx
  1481. ; set RAW palette, use else resolution 8bit or less
  1482.         mov     [file_browser_data_1.palette_raw],eax
  1483.  
  1484.         mov     eax,[ebx+28]
  1485.         add     eax,ebx
  1486. ; set RAW area for icon
  1487.         mov     [file_browser_data_1.icon_raw_area],eax
  1488.         ret
  1489. ;---------------------------------------------------------------------
  1490. calc_ini:
  1491.         mov     eax,[image_file]
  1492.         mov     [file_browser_data_1.ini_file_start],eax
  1493.         add     eax,[img_size]
  1494.         mov     [file_browser_data_1.ini_file_end],eax
  1495.         ret
  1496. ;---------------------------------------------------------------------
  1497. load_ini:
  1498.         mov     ebx,ini_file_name
  1499.         mov     esi,path
  1500.         mov     edi,file_name
  1501.         call    copy_file_path
  1502.  
  1503.         mov     [fileinfo.subfunction],dword 5
  1504.         mov     [fileinfo.size],dword 0
  1505.         mov     [fileinfo.return],dword file_info
  1506.         mcall   70, fileinfo
  1507.         test    eax,eax
  1508.         jnz     .error
  1509.  
  1510.         mov     [fileinfo.subfunction],dword 0
  1511.  
  1512.         mov     ecx,[file_info+32]
  1513.         mov     [fileinfo.size],ecx
  1514.         mov     [img_size],ecx
  1515.  
  1516.         mcall   68, 12
  1517.         test    eax,eax
  1518.         jz      memory_get_error
  1519.  
  1520.         mov     [fileinfo.return],eax
  1521.         mov     [image_file],eax
  1522.  
  1523.         mcall   70, fileinfo
  1524.         test    eax,eax
  1525.         jnz     .error
  1526.         ret
  1527. .error:
  1528.         mov     [N_error],1
  1529.         mov     [error_type],eax
  1530.         jmp     button.exit
  1531. ;---------------------------------------------------------------------
  1532. load_icons:
  1533.         mov     ebx,icons_file_name_2
  1534.         mov     esi,path
  1535.         mov     edi,file_name
  1536.         call    copy_file_path
  1537.  
  1538.         mov     [fileinfo.subfunction],dword 5
  1539.         mov     [fileinfo.size],dword 0
  1540.         mov     [fileinfo.return],dword file_info
  1541.         mcall   70, fileinfo
  1542.         test    eax,eax
  1543.         jz      @f
  1544.        
  1545.         mov     ebx,icons_file_name
  1546.         mov     esi,path
  1547.         mov     edi,file_name
  1548.         call    copy_file_path
  1549.  
  1550.         mov     [fileinfo.subfunction],dword 5
  1551.         mov     [fileinfo.size],dword 0
  1552.         mov     [fileinfo.return],dword file_info
  1553.         mcall   70, fileinfo
  1554.         test    eax,eax
  1555.         jnz     .error
  1556. @@:
  1557.         mov     [fileinfo.subfunction],dword 0
  1558.  
  1559.         mov     ecx,[file_info+32]
  1560.         mov     [fileinfo.size],ecx
  1561.         mov     [img_size],ecx
  1562.  
  1563.         mcall   68, 12
  1564.         test    eax,eax
  1565.         jz      memory_get_error
  1566.  
  1567.         mov     [fileinfo.return],eax
  1568.         mov     [image_file],eax
  1569.  
  1570.         mcall   70, fileinfo
  1571.         test    eax,eax
  1572.         jnz     .error
  1573.         ret
  1574. .error:
  1575.         mov     [N_error],2
  1576.         mov     [error_type],eax
  1577.         jmp     button.exit
  1578. ;---------------------------------------------------------------------
  1579. sort_directory:
  1580.         mov     eax,[file_browser_data_1.folder_data]
  1581.         mov     ebx,[eax+4] ; number of files
  1582.         add     eax,32
  1583.         cmp     [eax+40],word '..'
  1584.         jne     @f
  1585.         cmp     [eax+40+2],byte 0
  1586.         jne     @f
  1587.         dec     ebx
  1588.         add     eax,304
  1589. @@:
  1590.         push    dword [sort_type]       ; sort mode
  1591.         push    ebx ; number of files
  1592.         push    eax ;   data files
  1593.         call    [sort_dir]
  1594.         ret
  1595. ;--------------------------------------------------------------------
  1596. load_directory:
  1597.         xor     eax,eax
  1598.         mov     [N_error],eax
  1599.         cmp     [file_browser_data_1.folder_data],eax
  1600.         je      @f
  1601.         mcall   68, 13, [file_browser_data_1.folder_data]
  1602.         test    eax,eax
  1603.         jz      memory_free_error
  1604.  
  1605. @@:
  1606.         mov     [dirinfo.size],dword 0
  1607.         mov     [dirinfo.return],dir_header
  1608.         mcall   70, dirinfo
  1609.         test    eax,eax
  1610.         jz      @f
  1611.         xor     ebx,ebx
  1612.         mov     [file_browser_data_1.folder_data],ebx
  1613.         jmp     .error
  1614. @@:
  1615.        
  1616.         mov     ecx,[dir_header.totl_blocks]
  1617.         mov     [dirinfo.size],ecx
  1618.         imul    ecx,304
  1619.         add     ecx,32
  1620.         mcall   68, 12
  1621.         test    eax,eax
  1622.         jz      memory_get_error
  1623.  
  1624.         mov     [dirinfo.return],eax
  1625.         mov     [file_browser_data_1.folder_data],eax
  1626.  
  1627.         mcall   70, dirinfo
  1628.         test    eax,eax
  1629.         jnz     .error
  1630.  
  1631.         call    delete_point_dir
  1632.         call    files_name_normalize
  1633.         call    check_filter
  1634.         call    prepare_extension_and_mark
  1635.         call    clear_data_fb_and_sb
  1636.  
  1637.         ret
  1638.  
  1639. .error:
  1640.         mov     [N_error],5
  1641.         mov     [error_type],eax
  1642.         ret
  1643. ;---------------------------------------------------------------------
  1644. clear_data_fb_and_sb:
  1645.         xor     eax,eax
  1646.         mov     [file_browser_data_1.start_draw_cursor_line],ax
  1647.         mov     [file_browser_data_1.start_draw_line],eax
  1648.         mov     [scroll_bar_data_vertical.position],eax
  1649.         ret
  1650. ;---------------------------------------------------------------------
  1651. check_filter:
  1652.         xor     eax,eax
  1653.         mov     al,[filter_flag]
  1654.         test    eax,eax
  1655.         jz      @f
  1656.  
  1657.         mov     eax,[communication_area]
  1658.         test    eax,eax
  1659.         jz      @f
  1660.         mov     eax,[eax+4096]
  1661.         test    eax,eax
  1662.         jz      @f
  1663.         call    delete_unsupported_BDFE
  1664. @@:
  1665.         ret
  1666. ;---------------------------------------------------------------------
  1667. delete_unsupported_BDFE:
  1668.         mov     ebx,[file_browser_data_1.folder_data]
  1669.         add     ebx,4
  1670.         xor     ecx,ecx
  1671.         dec     ecx
  1672.        
  1673.         mov     eax,[file_browser_data_1.folder_data]
  1674.         add     eax,32+40
  1675.         sub     eax,304
  1676. .start:
  1677.         inc     ecx
  1678.         add     eax,304
  1679. .1:
  1680.         cmp     [ebx],ecx
  1681.         je      .end
  1682.         cmp     [eax],byte '.'
  1683.         jne     @f
  1684.         cmp     [eax+1],byte 0
  1685.         je      .delete
  1686. @@:
  1687.         test    [eax-40],byte 0x10
  1688.         jnz     .start
  1689.  
  1690.         push    eax ebx
  1691.         mov     esi,eax
  1692.         call    search_expansion
  1693.         test    eax,eax
  1694.         pop     ebx eax
  1695.         jnz     .delete
  1696.        
  1697.         push    eax ebx ecx esi
  1698.         mov     edi,[communication_area]
  1699.         add     edi,4096+4
  1700.         call    compare_expansion
  1701.         test    eax,eax
  1702.         pop     esi ecx ebx eax
  1703.         jz      .start
  1704.        
  1705. ;-------------------------------------------
  1706. .delete:
  1707.         dec     dword [ebx]
  1708.         mov     esi,[ebx]
  1709.         sub     esi,ecx
  1710.  
  1711.         push    ecx
  1712.         mov     ecx,esi
  1713.         imul    ecx,304/4
  1714.         mov     edi,eax
  1715.         sub     edi,40
  1716.         mov     esi,edi
  1717.         add     esi,304
  1718.         cld
  1719.         rep     movsd
  1720.         pop     ecx
  1721.        
  1722.         jmp     .1
  1723. .end:
  1724.         ret
  1725. ;---------------------------------------------------------------------
  1726. search_expansion:
  1727.         mov     edi,esi
  1728.         xor     eax,eax
  1729. @@:
  1730.         cld
  1731.         lodsb
  1732.         test    eax,eax
  1733.         jnz     @b
  1734.         mov     ebx,esi
  1735.         dec     esi
  1736. @@:
  1737.         std
  1738.         lodsb
  1739.         cmp     esi,edi
  1740.         jb      .end_err
  1741.         cmp     al,'.'
  1742.         jne     @b
  1743.        
  1744.         add     esi,2
  1745.         sub     ebx,esi
  1746.         dec     ebx
  1747.         mov     [expansion_length],ebx
  1748.         cld
  1749.         xor     eax,eax
  1750.         ret
  1751.        
  1752. .end_err:
  1753.         cld
  1754.         xor     eax,eax
  1755.         inc     eax
  1756.         ret
  1757. ;---------------------------------------------------------------------
  1758. compare_expansion:
  1759.         mov     ebx,[edi]
  1760.         add     ebx,edi
  1761.         add     edi,3
  1762. .start:
  1763.         cmp     ebx,edi
  1764.         jb      .end_err
  1765.         mov     ecx,[expansion_length]
  1766.         inc     edi
  1767.        
  1768.         push    esi edi
  1769. @@:
  1770.         cld
  1771.         lodsb
  1772.         xchg    esi,edi
  1773.         shl     eax,8
  1774.         lodsb
  1775.         xchg    esi,edi
  1776.         call    char_todown
  1777.         xchg    al,ah
  1778.         call    char_todown
  1779.         cmp     al,ah
  1780.         jne     @f
  1781.         dec     ecx
  1782.         jnz     @b
  1783.         jmp     .end
  1784. @@:
  1785.         pop     edi esi
  1786.         jmp     .start
  1787. .end:
  1788.         pop     edi esi
  1789.         xor     eax,eax
  1790.         ret
  1791.        
  1792. .end_err:
  1793.         xor     eax,eax
  1794.         inc     eax
  1795.         ret
  1796. ;---------------------------------------------------------------------
  1797. prepare_extension_and_mark:
  1798.         mov     esi,[dirinfo.return]
  1799.         mov     ebp,[esi+4]
  1800.         add     esi,32+40
  1801. .start:
  1802.         push    esi
  1803.         call    search_extension_start
  1804.         mov     eax,esi
  1805.         pop     esi
  1806.         sub     eax,esi
  1807.         sub     ebx,esi
  1808.         shl     eax,16
  1809.         mov     ax,bx
  1810.         mov     [esi+300-40],eax
  1811.         mov     [esi+299-40],byte 0
  1812.         add     esi,304
  1813.         dec     ebp
  1814.         jnz     .start
  1815.         ret
  1816. ;---------------------------------------------------------------------
  1817. search_extension_start:
  1818.         mov     edx,esi
  1819.         xor     eax,eax
  1820.         cld
  1821. @@:
  1822.         lodsb
  1823.         test    eax,eax
  1824.         jnz     @b
  1825.         dec     esi
  1826.         dec     edx
  1827.         push    esi
  1828.         std
  1829. @@:
  1830.         lodsb
  1831.         cmp     esi,edx
  1832.         je      .end
  1833.         cmp     al,'.'
  1834.         jnz     @b
  1835.         add     esi,2
  1836.         cld
  1837.         pop     ebx
  1838.         ret
  1839. .end:
  1840.         cld
  1841.         pop     esi
  1842.         mov     ebx,esi
  1843.         ret
  1844. ;---------------------------------------------------------------------
  1845. delete_point_dir:
  1846.         mov     eax,[dirinfo.return]
  1847.         cmp     [eax+32+40],byte '.'
  1848.         jne     @f
  1849.         cmp     [eax+32+40+1],byte 0
  1850.         jne     @f
  1851.         mov     edi,eax
  1852.         add     edi,32
  1853.         mov     esi,edi
  1854.         add     esi,304
  1855.         mov     ecx,[eax+4]
  1856.         dec     ecx
  1857.         mov     [eax+4],ecx
  1858.         imul    ecx,304
  1859.         shr     ecx,2
  1860.         cld
  1861.         rep     movsd
  1862. @@:
  1863.         ret
  1864. ;---------------------------------------------------------------------
  1865. files_name_normalize:
  1866.         mov     esi,[dirinfo.return]
  1867.         mov     ebp,[esi+4]
  1868.         add     esi,32+40
  1869. .start:
  1870.         push    esi
  1871.         mov     al,[esi]
  1872.         call    char_toupper
  1873.         mov     [esi],al
  1874. @@:
  1875.         inc     esi
  1876.         mov     al,[esi]
  1877.         test    al,al
  1878.         jz      @f
  1879.         call    char_todown
  1880.         mov     [esi],al
  1881.         jmp     @b
  1882. @@:
  1883.         pop     esi
  1884.         add     esi,304
  1885.         dec     ebp
  1886.         jnz     .start
  1887.         ret
  1888. ;---------------------------------------------------------------------
  1889. char_toupper:
  1890. ; convert character to uppercase, using cp866 encoding
  1891. ; in: al=symbol
  1892. ; out: al=converted symbol
  1893.         cmp     al,'a'
  1894.         jb      .ret
  1895.         cmp     al,'z'
  1896.         jbe     .az
  1897.         cmp     al,' '
  1898.         jb      .ret
  1899.         cmp     al,'à'
  1900.         jb      .rus1
  1901.         cmp     al,'ï'
  1902.         ja      .ret
  1903. ; 0xE0-0xEF -> 0x90-0x9F
  1904.         sub     al,'à'-''
  1905. .ret:
  1906.         ret
  1907. .rus1:
  1908. ; 0xA0-0xAF -> 0x80-0x8F
  1909. .az:
  1910.         and     al,not 0x20
  1911.         ret
  1912. ;---------------------------------------------------------------------
  1913. char_todown:
  1914. ; convert character to uppercase, using cp866 encoding
  1915. ; in: al=symbol
  1916. ; out: al=converted symbol
  1917.         cmp     al,'A'
  1918.         jb      .ret
  1919.         cmp     al,'Z'
  1920.         jbe     .az
  1921.         cmp     al,'€'
  1922.         jb      .ret
  1923.         cmp     al,''
  1924.         jb      .rus1
  1925.         cmp     al,'Ÿ'
  1926.         ja      .ret
  1927. ; 0x90-0x9F -> 0xE0-0xEF
  1928.         add     al,'à'-''
  1929. .ret:
  1930.         ret
  1931. .rus1:
  1932. ; 0x80-0x8F -> 0xA0-0xAF
  1933. .az:
  1934.         add     al, 0x20
  1935.         ret
  1936. ;---------------------------------------------------------------------
  1937. copy_file_path:
  1938.         xor     eax,eax
  1939.         cld
  1940. @@:
  1941.         lodsb
  1942.         stosb
  1943.         test    eax,eax
  1944.         jnz     @b
  1945.         mov     esi,edi
  1946.         dec     esi
  1947.         std
  1948. @@:
  1949.         lodsb
  1950.         cmp     al,'/'
  1951.         jnz     @b
  1952.         mov     edi,esi
  1953.         add     edi,2
  1954.         mov     esi,ebx
  1955.         cld
  1956. @@:
  1957.         lodsb
  1958.         stosb
  1959.         test    eax,eax
  1960.         jnz     @b
  1961.         ret
  1962. ;---------------------------------------------------------------------
  1963. copy_dir_path:
  1964.         mov     ecx,esi
  1965.         inc     ecx
  1966.         inc     ecx
  1967.         xor     eax,eax
  1968.         cld
  1969. @@:
  1970.         lodsb
  1971.         test    eax,eax
  1972.         jnz     @b
  1973.  
  1974.         cmp     ecx,esi
  1975.         jb      @f
  1976.         dec     esi
  1977. @@:
  1978.         mov     [esi-1],byte '/'
  1979.         mov     edi,esi
  1980.         mov     esi,ebx
  1981. @@:
  1982.         lodsb
  1983.         stosb
  1984.         test    eax,eax
  1985.         jnz     @b
  1986.         ret
  1987. ;---------------------------------------------------------------------
  1988. copy_exit_dir:
  1989.         mov     ebx,esi
  1990.         inc     ebx
  1991.         xor     eax,eax
  1992.         cld
  1993. @@:
  1994.         lodsb
  1995.         test    eax,eax
  1996.         jnz     @b
  1997.         sub     esi,2
  1998.         std
  1999. @@:
  2000.         lodsb
  2001.         cmp     al,'/'
  2002.         jnz     @b
  2003.         xor     eax,eax
  2004.         cmp     ebx,esi
  2005.         jb      @f
  2006.         inc     esi
  2007. @@:
  2008.         mov     [esi+1],al
  2009.         cld
  2010.         ret
  2011. ;---------------------------------------------------------------------
  2012. copy_dir_name:
  2013.         xor     eax,eax
  2014.         cld
  2015. @@:
  2016.         lodsb
  2017.         stosb
  2018.         test    eax,eax
  2019.         jnz     @b
  2020.         ret
  2021. ;---------------------------------------------------------------------
  2022. ;---------------------------------------------------------------------
  2023.  
  2024. ;plugins_directory               db 'plugins/',0
  2025. plugins_directory               db 0
  2026.  
  2027. system_dir_Boxlib       db '/sys/lib/box_lib.obj',0
  2028. system_dir_CnvPNG       db '/sys/lib/cnv_png.obj',0
  2029. system_dir_Sort         db '/sys/lib/sort.obj',0
  2030. system_dir_UNPACK       db '/sys/lib/archiver.obj',0
  2031.  
  2032. ihead_f_i:
  2033. ihead_f_l        db 'System error',0
  2034.  
  2035. er_message_found_lib    db 'box_lib.obj - Not found!',0
  2036. er_message_import       db 'box_lib.obj - Wrong import!',0
  2037.  
  2038. er_message_found_lib2   db 'cnv_png.obj - Not found!',0
  2039. er_message_import2      db 'cnv_png.obj - Wrong import!',0
  2040.  
  2041. err_message_found_lib3  db 'sort.obj - Not found!',0
  2042. err_message_import3     db 'sort.obj - Wrong import!',0
  2043.  
  2044. err_message_found_lib4  db 'archiver.obj - Not found!',0
  2045. err_message_import4     db 'archiver.obj - Wrong import!',0
  2046.  
  2047. align 4
  2048. l_libs_start:
  2049. library01  l_libs system_dir_Boxlib+9, path, file_name, system_dir_Boxlib, \
  2050. er_message_found_lib, ihead_f_l, Box_lib_import, er_message_import, ihead_f_i, plugins_directory
  2051.  
  2052. library02  l_libs system_dir_CnvPNG+9, path, file_name, system_dir_CnvPNG,\
  2053. er_message_found_lib2, ihead_f_l, cnv_png_import, er_message_import2, ihead_f_i, plugins_directory
  2054.  
  2055. library03  l_libs system_dir_Sort+9, path, file_name, system_dir_Sort, \
  2056. err_message_found_lib3, ihead_f_l, Sort_import, err_message_import3, ihead_f_i, plugins_directory
  2057.  
  2058. library04  l_libs system_dir_UNPACK+9, path, file_name, system_dir_UNPACK, \
  2059. err_message_found_lib4, ihead_f_l, UNPACK_import, err_message_import4, ihead_f_i, plugins_directory
  2060.  
  2061. end_l_libs:
  2062.  
  2063. ;---------------------------------------------------------------------
  2064. align 4
  2065. UNPACK_import:
  2066. ;unpack_Version                         dd aUnpack_Version
  2067. ;unpack_PluginLoad                      dd aUnpack_PluginLoad
  2068. ;unpack_OpenFilePlugin          dd aUnpack_OpenFilePlugin
  2069. ;unpack_ClosePlugin                     dd aUnpack_ClosePlugin
  2070. ;unpack_ReadFolder                      dd aUnpack_ReadFolder
  2071. ;unpack_SetFolder                       dd aUnpack_SetFolder
  2072. ;unpack_GetFiles                                dd aUnpack_GetFiles
  2073. ;unpack_GetOpenPluginInfo       dd aUnpack_GetOpenPluginInfo
  2074. ;unpack_Getattr                         dd aUnpack_Getattr
  2075. ;unpack_Open                                    dd aUnpack_Open
  2076. ;unpack_Read                                    dd aUnpack_Read
  2077. ;unpack_Setpos                          dd aUnpack_Setpos
  2078. ;unpack_Close                           dd aUnpack_Close
  2079. ;unpack_DeflateUnpack           dd aUnpack_DeflateUnpack
  2080. unpack_DeflateUnpack2           dd aUnpack_DeflateUnpack2
  2081.         dd      0
  2082.         dd      0
  2083.  
  2084. ;aUnpack_Version        db      'version',0
  2085. ;aUnpack_PluginLoad     db      'plugin_load',0
  2086. ;aUnpack_OpenFilePlugin db      'OpenFilePlugin',0
  2087. ;aUnpack_ClosePlugin    db      'ClosePlugin',0
  2088. ;aUnpack_ReadFolder     db      'ReadFolder',0
  2089. ;aUnpack_SetFolder      db      'SetFolder',0
  2090. ;aUnpack_GetFiles       db      'GetFiles',0
  2091. ;aUnpack_GetOpenPluginInfo db   'GetOpenPluginInfo',0
  2092. ;aUnpack_Getattr        db      'getattr',0
  2093. ;aUnpack_Open           db      'open',0
  2094. ;aUnpack_Read           db      'read',0
  2095. ;aUnpack_Setpos         db      'setpos',0
  2096. ;aUnpack_Close          db      'close',0
  2097. ;aUnpack_DeflateUnpack  db      'deflate_unpack',0
  2098. aUnpack_DeflateUnpack2 db      'deflate_unpack2',0
  2099.  
  2100. ;---------------------------------------------------------------------
  2101. ;---------------------------------------------------------------------
  2102. align 4
  2103. Sort_import:
  2104. sort_init       dd aSort_init
  2105. sort_version    dd aSort_version
  2106. sort_dir        dd aSort_SortDir
  2107. sort_strcmpi    dd aSort_strcmpi
  2108.                 dd 0
  2109.                 dd 0
  2110.  
  2111. aSort_init      db 'START',0
  2112. aSort_version   db 'version',0
  2113. aSort_SortDir   db 'SortDir',0
  2114. aSort_strcmpi   db 'strcmpi',0
  2115.  
  2116. ;---------------------------------------------------------------------
  2117. align 4
  2118. cnv_png_import:
  2119. .Start                  dd aCP_Start
  2120. .Version                dd aCP_Version
  2121. .Check                  dd aCP_Check
  2122. .Assoc                  dd aCP_Assoc
  2123.         dd      0
  2124.         dd      0
  2125. aCP_Start               db 'START',0
  2126. aCP_Version             db 'version',0
  2127. aCP_Check               db 'Check_Header',0
  2128. aCP_Assoc               db 'Associations',0
  2129. ;---------------------------------------------------------------------
  2130. align 4
  2131. Box_lib_import:  
  2132. ;init_lib            dd      a_init
  2133. ;version_lib         dd      a_version
  2134.  
  2135.  
  2136. edit_box_draw   dd      aEdit_box_draw
  2137. edit_box_key    dd      aEdit_box_key
  2138. edit_box_mouse  dd      aEdit_box_mouse
  2139. ;version_ed      dd      aVersion_ed
  2140.  
  2141. check_box_draw  dd      aCheck_box_draw
  2142. check_box_mouse dd      aCheck_box_mouse
  2143. ;version_ch      dd      aVersion_ch
  2144.  
  2145. option_box_draw  dd      aOption_box_draw
  2146. option_box_mouse dd      aOption_box_mouse
  2147. ;version_op       dd      aVersion_op
  2148.  
  2149. scrollbar_ver_draw              dd aScrollbar_ver_draw
  2150. scrollbar_ver_mouse             dd aScrollbar_ver_mouse
  2151. scrollbar_hor_draw              dd aScrollbar_hor_draw
  2152. scrollbar_hor_mouse             dd aScrollbar_hor_mouse
  2153. ;version_scrollbar               dd aVersion_scrollbar
  2154.  
  2155. dinamic_button_draw             dd      aDbutton_draw
  2156. dinamic_button_mouse            dd      aDbutton_mouse
  2157. ;version_dbutton                 dd      aVersion_dbutton
  2158.  
  2159. menu_bar_draw                   dd      aMenu_bar_draw
  2160. menu_bar_mouse                  dd      aMenu_bar_mouse
  2161. menu_bar_activate               dd      aMenu_bar_activate
  2162. ;version_menu_bar                dd      aVersion_menu_bar
  2163.  
  2164. FileBrowser_draw                dd      aFileBrowser_draw
  2165. FileBrowser_mouse               dd      aFileBrowser_mouse
  2166. FileBrowser_key                 dd      aFileBrowser_key
  2167. ;Version_FileBrowser             dd      aVersion_FileBrowser
  2168.                 dd      0
  2169.                 dd      0
  2170.  
  2171. ;a_init          db 'lib_init',0
  2172. ;a_version       db 'version',0
  2173.  
  2174. aEdit_box_draw  db 'edit_box',0
  2175. aEdit_box_key   db 'edit_box_key',0
  2176. aEdit_box_mouse db 'edit_box_mouse',0
  2177. ;aVersion_ed     db 'version_ed',0
  2178.  
  2179. aCheck_box_draw  db 'check_box_draw',0
  2180. aCheck_box_mouse db 'check_box_mouse',0
  2181. ;aVersion_ch      db 'version_ch',0
  2182.  
  2183. aOption_box_draw  db 'option_box_draw',0
  2184. aOption_box_mouse db 'option_box_mouse',0
  2185. ;aVersion_op       db 'version_op',0
  2186.  
  2187. aScrollbar_ver_draw             db 'scrollbar_v_draw',0
  2188. aScrollbar_ver_mouse            db 'scrollbar_v_mouse',0
  2189. aScrollbar_hor_draw             db 'scrollbar_h_draw',0
  2190. aScrollbar_hor_mouse            db 'scrollbar_h_mouse',0
  2191. ;aVersion_scrollbar              db 'version_scrollbar',0
  2192.  
  2193. aDbutton_draw                   db 'dbutton_draw',0
  2194. aDbutton_mouse                  db 'dbutton_mouse',0
  2195. ;aVersion_dbutton                db 'version_dbutton',0
  2196.  
  2197. aMenu_bar_draw                  db 'menu_bar_draw',0
  2198. aMenu_bar_mouse                 db 'menu_bar_mouse',0
  2199. aMenu_bar_activate              db 'menu_bar_activate',0
  2200. ;aVersion_menu_bar               db 'version_menu_bar',0
  2201.  
  2202. aFileBrowser_draw             db 'FileBrowser_draw',0
  2203. aFileBrowser_mouse            db 'FileBrowser_mouse',0
  2204. aFileBrowser_key              db 'FileBrowser_key',0
  2205. ;aVersion_FileBrowser          db 'version_FileBrowser',0
  2206. ;---------------------------------------------------------------------
  2207. ;---------------------------------------------------------------------
  2208. align 4
  2209. window_high     dd 0
  2210. window_width    dd 0
  2211. window_status   dd 0
  2212.  
  2213. active_process  dd 0
  2214. PID             dd 0
  2215. sort_type       dd 2
  2216. root_folder_area        dd 0
  2217. root_folder_block       dd 0
  2218. root1_folder_area       dd 0
  2219. root1_folder_block      dd 0
  2220. temp_counter_1          dd 0
  2221. retrieved_devices_table_counter dd 0
  2222. communication_area      dd 0
  2223. ;---------------------------------------------------------------------
  2224. expansion_length        dd      0
  2225. ;---------------------------------------------------------------------
  2226. N_error                 dd 0
  2227. error_type              dd 0
  2228. error_path              dd 0
  2229. error_window_x: dd 100 shl 16 + 250
  2230. error_window_y: dd 100 shl 16 + 120
  2231. ;---------------------------------------------------------------------
  2232. mouse_scroll_data:
  2233.         .vertical       dw 0
  2234.         .horizontal     dw 0
  2235.  
  2236. mouse_position:
  2237.         .y      dw 0
  2238.         .x      dw 0
  2239. ;---------------------------------------------------------------------
  2240. ; not change this section!!!
  2241. ; start section
  2242. ;---------------------------------------------------------------------
  2243. align 4
  2244. image_file      dd 0
  2245. raw_pointer     dd 0
  2246. return_code     dd 0
  2247. img_size        dd 0
  2248. deflate_unpack  dd 0
  2249. raw_pointer_2   dd 0 ;+20
  2250. ;---------------------------------------------------------------------
  2251. ; end section
  2252. ;---------------------------------------------------------------------
  2253. align 4
  2254. fileinfo:
  2255. .subfunction    dd 5
  2256. .Offset         dd 0
  2257. .Offset_1       dd 0
  2258. .size           dd 0
  2259. .return         dd file_info
  2260.                 db 0
  2261. .name:          dd file_name
  2262. ;---------------------------------------------------------------------
  2263. align 4
  2264. dirinfo:
  2265. .subfunction    dd 1
  2266. .start          dd 0
  2267. .flags          dd 0
  2268. .size           dd 0
  2269. .return         dd 0
  2270.                 db 0
  2271. .name:          dd dir_pach
  2272. ;---------------------------------------------------------------------
  2273. align 4
  2274. dir_header:
  2275. .version        dd 0 ;+0
  2276. .curn_blocks    dd 0 ;+4
  2277. .totl_blocks    dd 0 ;+8
  2278. .other          rb 20
  2279. ;---------------------------------------------------------------------
  2280. load_ini_error_type:
  2281.         db 'Error loading INI file',0
  2282.  
  2283. load_icons_error_type:
  2284.         db 'Error loading of icons file',0
  2285.  
  2286. memory_free_error_type:
  2287.         db 'Error of free memory',0
  2288.  
  2289. memory_get_error_type:
  2290.         db 'Memory allocation error',0
  2291.  
  2292. load_directory_error_type:
  2293.         db 'Error loading directory',0
  2294.  
  2295. convert_icons_error_type:
  2296.         db 'Unsupported or corrupt data for icons file',0
  2297. ;---------------------------------------------------------------------
  2298. align 4
  2299. error_fs_text_pointers:
  2300.   dd  error_fs_text_0
  2301.   dd  error_fs_text_1
  2302.   dd  error_fs_text_2
  2303.   dd  error_fs_text_3
  2304.   dd  error_fs_text_4
  2305.   dd  error_fs_text_5
  2306.   dd  error_fs_text_6
  2307.   dd  error_fs_text_7
  2308.   dd  error_fs_text_8
  2309.   dd  error_fs_text_9
  2310.   dd  error_fs_text_10
  2311.   dd  error_fs_text_11
  2312.  
  2313. error_fs_text_0:        db '0 - Success full',0
  2314. error_fs_text_1:        db '1 - Base and/or partition of a hard disk is not defined',0
  2315. error_fs_text_2:        db '2 - Function is not supported for the given file system',0
  2316. error_fs_text_3:        db '3 - Unknown file system',0
  2317. error_fs_text_4:        db '4 - Reserved, is never returned in the current implementation',0
  2318. error_fs_text_5:        db '5 - File not found',0
  2319. error_fs_text_6:        db '6 - End of file, EOF',0
  2320. error_fs_text_7:        db '7 - Pointer lies outside of application memory',0
  2321. error_fs_text_8:        db '8 - Disk is full',0
  2322. error_fs_text_9:        db '9 - FAT table is destroyed',0
  2323. error_fs_text_10:       db '10 - Access denied',0
  2324. error_fs_text_11:       db '11 - Device error',0
  2325. ;---------------------------------------------------------------------
  2326.  
  2327. extended_key db 0
  2328.  
  2329. shift_flag      db 0
  2330. ctrl_flag       db 0
  2331. alt_flag        db 0
  2332.  
  2333. error_window    db 0
  2334.  
  2335. Tab_key         db 0
  2336. Tab_key_block   db 0
  2337.  
  2338. filter_flag     db 1
  2339.  
  2340. focus_pointer   db 0
  2341. ;---------------------------------------------------------------------
  2342. start_pach:
  2343.         db '/rd/1',0
  2344.  
  2345. root_pach:
  2346.         db '/',0
  2347.  
  2348. icons_file_name_2       db 'buttons/'
  2349. icons_file_name         db 'z_icons.png',0
  2350. ini_file_name           db 'icons.ini',0
  2351. ;---------------------------------------------------------------------
  2352.  
  2353. message:
  2354.         db 'Press any key...',0
  2355.  
  2356. message_cancel_button:
  2357.         db 'Cancel',0
  2358.  
  2359. message_open_button:
  2360.         db 'Open',0
  2361.  
  2362. message_ReloadDir_button:
  2363.         db 'Refresh',0
  2364.  
  2365. message_ExitDir_button:
  2366.         db '^',0
  2367.  
  2368. title:
  2369.         db 'Open Dialog',0
  2370. ;---------------------------------------------------------------------
  2371. align 4
  2372. menu_data_1:
  2373. .type:          dd 0   ;+0
  2374. .x:
  2375. .size_x         dw 80  ;+4
  2376. .start_x        dw 10   ;+6
  2377. .y:
  2378. .size_y         dw 15   ;+8
  2379. .start_y        dw 26  ;+10
  2380. .text_pointer:  dd menu_text_area_1  ;0 ;+12
  2381. .pos_pointer:   dd menu_text_area_1_1 ;0 ;+16
  2382. .text_end       dd menu_text_area_1_1 ;0 ;+20
  2383. .ret_key        dd 0  ;+24
  2384. .mouse_keys     dd 0  ;+28
  2385. .x1:
  2386. .size_x1        dw 80  ;+32
  2387. .start_x1       dw 10   ;+34
  2388. .y1:
  2389. .size_y1        dw 100   ;+36
  2390. .start_y1       dw 41  ;+38
  2391. .bckg_col       dd 0xffffff  ;0xe5e5e5 ;+40
  2392. .frnt_col       dd 0xff ;+44
  2393. .menu_col       dd 0xeef0ff ;0xffffff ;+48
  2394. .select         dd 0 ;+52
  2395. .out_select     dd 0 ;+56
  2396. .buf_adress     dd 0 ;+60
  2397. .procinfo       dd procinfo ;+64
  2398. .click          dd 0 ;+68
  2399. .cursor         dd 0 ;+72
  2400. .cursor_old     dd 0 ;+76
  2401. .interval       dd 16 ;+80
  2402. .cursor_max     dd 0 ;+84
  2403. .extended_key   dd 0 ;+88
  2404. .menu_sel_col   dd 0x00cc00 ;+92
  2405. .bckg_text_col  dd 0 ; +96
  2406. .frnt_text_col  dd 0xffffff ;+100
  2407. .mouse_keys_old dd 0 ;+104
  2408. .font_height    dd 8 ;+108
  2409. .cursor_out     dd 0 ;+112
  2410. .get_mouse_flag dd 0 ;+116
  2411. ;---------------------------------------------------------------------
  2412. menu_text_area_1:
  2413. db 'Select Disk',0
  2414. ;---------------------------------------------------------------------
  2415. align 4
  2416. menu_data_2:
  2417. .type:          dd 0   ;+0
  2418. .x:
  2419. .size_x         dw 30  ;+4
  2420. .start_x        dw 95   ;+6
  2421. .y:
  2422. .size_y         dw 15   ;+8
  2423. .start_y        dw 26  ;+10
  2424. .text_pointer:  dd menu_text_area_2  ;0 ;+12
  2425. .pos_pointer:   dd menu_text_area_2.1 ;0 ;+16
  2426. .text_end       dd menu_text_area_2.end ;0 ;+20
  2427. .ret_key        dd 0  ;+24
  2428. .mouse_keys     dd 0  ;+28
  2429. .x1:
  2430. .size_x1        dw 30  ;+32
  2431. .start_x1       dw 95   ;+34
  2432. .y1:
  2433. .size_y1        dw 100   ;+36
  2434. .start_y1       dw 41  ;+38
  2435. .bckg_col       dd 0xffffff ; 0xe5e5e5 ;+40
  2436. .frnt_col       dd 0xff ;+44
  2437. .menu_col       dd 0xeef0ff  ;0xffffff ;+48
  2438. .select         dd 0 ;+52
  2439. .out_select     dd 0 ;+56
  2440. .buf_adress     dd 0 ;+60
  2441. .procinfo       dd procinfo ;+64
  2442. .click          dd 0 ;+68
  2443. .cursor         dd 0 ;+72
  2444. .cursor_old     dd 0 ;+76
  2445. .interval       dd 16 ;+80
  2446. .cursor_max     dd 0 ;+84
  2447. .extended_key   dd 0 ;+88
  2448. .menu_sel_col   dd 0x00cc00 ;+92
  2449. .bckg_text_col  dd 0 ; +96
  2450. .frnt_text_col  dd 0xffffff ;+100
  2451. .mouse_keys_old dd 0 ;+104
  2452. .font_height    dd 8 ;+108
  2453. .cursor_out     dd 0 ;+112
  2454. .get_mouse_flag dd 0 ;+116
  2455. ;---------------------------------------------------------------------
  2456. menu_text_area_2:
  2457. db 'Sort',0
  2458. .1:
  2459. db 'Name',0
  2460. db 'Type',0
  2461. db 'Date',0
  2462. db 'Size',0
  2463. .end:
  2464. db 0
  2465. ;---------------------------------------------------------------------
  2466. align 4
  2467. menu_data_3:
  2468. .type:          dd 0   ;+0
  2469. .x:
  2470. .size_x         dw 45  ;+4
  2471. .start_x        dw 130   ;+6
  2472. .y:
  2473. .size_y         dw 15   ;+8
  2474. .start_y        dw 26  ;+10
  2475. .text_pointer:  dd menu_text_area_3  ;0 ;+12
  2476. .pos_pointer:   dd menu_text_area_3.1 ;0 ;+16
  2477. .text_end       dd menu_text_area_3.end ;0 ;+20
  2478. .ret_key        dd 0  ;+24
  2479. .mouse_keys     dd 0  ;+28
  2480. .x1:
  2481. .size_x1        dw 95  ;+32
  2482. .start_x1       dw 130   ;+34
  2483. .y1:
  2484. .size_y1        dw 100   ;+36
  2485. .start_y1       dw 41  ;+38
  2486. .bckg_col       dd 0xffffff ; 0xe5e5e5 ;+40
  2487. .frnt_col       dd 0xff ;+44
  2488. .menu_col       dd 0xeef0ff  ;0xffffff ;+48
  2489. .select         dd 0 ;+52
  2490. .out_select     dd 0 ;+56
  2491. .buf_adress     dd 0 ;+60
  2492. .procinfo       dd procinfo ;+64
  2493. .click          dd 0 ;+68
  2494. .cursor         dd 0 ;+72
  2495. .cursor_old     dd 0 ;+76
  2496. .interval       dd 16 ;+80
  2497. .cursor_max     dd 0 ;+84
  2498. .extended_key   dd 0 ;+88
  2499. .menu_sel_col   dd 0x00cc00 ;+92
  2500. .bckg_text_col  dd 0 ; +96
  2501. .frnt_text_col  dd 0xffffff ;+100
  2502. .mouse_keys_old dd 0 ;+104
  2503. .font_height    dd 8 ;+108
  2504. .cursor_out     dd 0 ;+112
  2505. .get_mouse_flag dd 0 ;+116
  2506. ;---------------------------------------------------------------------
  2507. menu_text_area_3:
  2508. db 'Filter',0
  2509. .1:
  2510. db '*.* - show all',0
  2511. db 'Only supported',0
  2512. .end:
  2513. db 0
  2514. ;---------------------------------------------------------------------
  2515.  
  2516. align 4
  2517. scroll_bar_data_vertical:
  2518. .x:
  2519. .size_x         dw 15 ;+0
  2520. .start_x        dw 500 ;+2
  2521. .y:
  2522. .size_y         dw 300 ;+4
  2523. .start_y        dw 45 ;+6
  2524. .btn_high       dd 15 ;+8
  2525. .type           dd 1  ;+12
  2526. .max_area       dd 10  ;+16
  2527. .cur_area       dd 2  ;+20
  2528. .position       dd 0  ;+24
  2529. .bckg_col       dd 0xeeeeee ;+28
  2530. .frnt_col       dd 0xbbddff ;+32 ;0x8aeaa0
  2531. .line_col       dd 0  ;+36
  2532. .redraw         dd 0  ;+40
  2533. .delta          dw 0  ;+44
  2534. .delta2         dw 0  ;+46
  2535. .run_x:
  2536. .r_size_x       dw 0  ;+48
  2537. .r_start_x      dw 0  ;+50
  2538. .run_y:
  2539. .r_size_y       dw 0 ;+52
  2540. .r_start_y      dw 0 ;+54
  2541. .m_pos          dd 0 ;+56
  2542. .m_pos_2        dd 0 ;+60
  2543. .m_keys         dd 0 ;+64
  2544. .run_size       dd 0 ;+68
  2545. .position2      dd 0 ;+72
  2546. .work_size      dd 0 ;+76
  2547. .all_redraw     dd 0 ;+80
  2548. .ar_offset      dd 1 ;+84
  2549. ;---------------------------------------------------------------------
  2550. align 4
  2551. file_browser_data_1:
  2552. .type                           dd 0 ;+0
  2553. .x:
  2554. .size_x                         dw 400 ;+4
  2555. .start_x                        dw 10 ;+6
  2556. .y:
  2557. .size_y                         dw 550 ;+8
  2558. .start_y                        dw 45 ;+10
  2559. .icon_size_y                    dw 16 ; +12
  2560. .icon_size_x                    dw 16 ; +14
  2561. .line_size_x                    dw 0 ; +16
  2562. .line_size_y                    dw 18 ; +18
  2563. .type_size_x                    dw 0 ; +20
  2564. .size_size_x                    dw 0 ; +22
  2565. .date_size_x                    dw 0 ; +24
  2566. .attributes_size_x              dw 0 ; +26
  2567. .icon_assoc_area                dd 0 ; +28
  2568. .icon_raw_area                  dd 0 ; +32
  2569. .resolution_raw                 dd 0 ; +36
  2570. .palette_raw                    dd 0 ; +40
  2571. .directory_path_area            dd 0 ; +44
  2572. .file_name_area                 dd 0 ; +48
  2573. .select_flag                    dd 0 ; +52
  2574. .background_color               dd 0xffffff ; +56
  2575. .select_color                   dd 0xbbddff ; +60
  2576. .seclect_text_color             dd 0 ; +64
  2577. .text_color                     dd 0 ; +68
  2578. .reduct_text_color              dd 0xff0000 ; +72
  2579. .marked_text_color              dd 0 ; +76
  2580. .max_panel_line                 dd 0 ; +80
  2581. .select_panel_counter           dd 1 ; +84
  2582. .folder_block                   dd 0 ; +88
  2583. .start_draw_line                dd 0 ; +92
  2584. .start_draw_cursor_line         dw 0 ; +96 ; pixels
  2585. .folder_data                    dd 0 ; +98
  2586. .temp_counter                   dd 0 ; +102
  2587. .file_name_length               dd 0 ; +106
  2588. .marked_file                    dd 0 ; +110
  2589. .extension_size                 dd 0 ; +114
  2590. .extension_start                dd 0 ; +118
  2591. .type_table                     dd features_table ; +122
  2592. .ini_file_start                 dd 0 ; +126
  2593. .ini_file_end                   dd 0 ; +130
  2594. .draw_scroll_bar                dd 0 ; +134
  2595. .font_size_y                    dw 9 ; +138
  2596. .font_size_x                    dw 6 ; +140
  2597. .mouse_keys                     dd 0 ; +142
  2598. .mouse_keys_old                 dd 0 ; +146
  2599. .mouse_pos                      dd 0 ; +150
  2600. .mouse_keys_delta               dd 0 ; +154
  2601. .mouse_key_delay                dd 50 ; +158
  2602. .mouse_keys_tick                dd 0 ; +162
  2603. .start_draw_cursor_line_2       dw 0 ;+166
  2604. .all_redraw                     dd 0 ;+168
  2605. .selected_BDVK_adress           dd 0 ;+172
  2606. .key_action                     dd 0 ;+176
  2607. .name_temp_area                 dd name_temp_area ;+180
  2608. .max_name_temp_size             dd 0 ;+184
  2609. .display_name_max_length        dd 0 ;+188
  2610. .draw_panel_selection_flag      dd 0 ;+192
  2611. .mouse_pos_old                  dd 0 ;+196
  2612. .marked_counter                 dd 0 ;+200
  2613. ;---------------------------------------------------------------------
  2614. ; for EDITBOX
  2615. align 4
  2616. name_editboxes:
  2617. edit1 edit_box 200,10,7,0xffffff,0xbbddff,0,0,0,4095,dir_pach,mouse_dd,,0
  2618. name_editboxes_end:
  2619.  
  2620. ;mouse_flag: dd 0x0
  2621.  
  2622. mouse_dd        rd 1
  2623. ;---------------------------------------------------------------------
  2624. ;---------------------------------------------------------------------
  2625. features_table:
  2626. .type_table:
  2627.         db '<DIR> '
  2628. ;---------------------------------------------------------------------
  2629. .size_table:
  2630.         db '1023b '
  2631. ;---------------------------------------------------------------------
  2632. .date_table:
  2633.         db '00.00.00 00:00 '
  2634. ;---------------------------------------------------------------------
  2635. .year_table:
  2636.         db '    '
  2637. ;---------------------------------------------------------------------
  2638. IM_END:
  2639. menu_text_area_1_1:
  2640. rb 256
  2641. ;---------------------------------------------------------------------
  2642.         rb 1024
  2643. stacktop:
  2644. ;---------------------------------------------------------------------
  2645. ; window error message
  2646.         rb 1024
  2647. thread_stack:
  2648. ;---------------------------------------------------------------------
  2649. retrieved_devices_table:
  2650.         rb 200
  2651. ;---------------------------------------------------------------------
  2652. name_temp_area:
  2653.         rb 256
  2654. ;---------------------------------------------------------------------
  2655. param:
  2656.         rb 256
  2657. ;---------------------------------------------------------------------
  2658. path:
  2659.         rb 4096
  2660. ;---------------------------------------------------------------------
  2661. file_name:
  2662.         rb 4096
  2663. ;---------------------------------------------------------------------
  2664. dir_pach:
  2665.         rb 4096
  2666. ;---------------------------------------------------------------------
  2667. procinfo:
  2668. process_info:
  2669.         rb 1024
  2670. ;----------------------
  2671. file_info:
  2672.         rb 40
  2673. I_END:
  2674.  
  2675.