Subversion Repositories Kolibri OS

Rev

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

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