Subversion Repositories Kolibri OS

Rev

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