Subversion Repositories Kolibri OS

Rev

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