Subversion Repositories Kolibri OS

Rev

Rev 3983 | Rev 4061 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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