Subversion Repositories Kolibri OS

Rev

Rev 1666 | Blame | Last modification | View Log | Download | RSS feed

  1. ;*****************************************************************************
  2. ; File Browser control for Kolibri OS
  3. ; Copyright (c) 2009, Marat Zakiyanov aka Mario79, aka Mario
  4. ; All rights reserved.
  5. ;
  6. ; Redistribution and use in source and binary forms, with or without
  7. ; modification, are permitted provided that the following conditions are met:
  8. ;        * Redistributions of source code must retain the above copyright
  9. ;          notice, this list of conditions and the following disclaimer.
  10. ;        * Redistributions in binary form must reproduce the above copyright
  11. ;          notice, this list of conditions and the following disclaimer in the
  12. ;          documentation and/or other materials provided with the distribution.
  13. ;        * Neither the name of the <organization> nor the
  14. ;          names of its contributors may be used to endorse or promote products
  15. ;          derived from this software without specific prior written permission.
  16. ;
  17. ; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY
  18. ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19. ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20. ; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
  21. ; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  22. ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23. ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  24. ; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  26. ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. ;*****************************************************************************
  28. ;*****************************************************************************
  29. macro   file_browser_exit
  30. {
  31. popa        
  32. ret 4
  33. }
  34. ;*****************************************************************************
  35. macro   use_file_browser
  36. {
  37. file_browser:
  38. fb_type                         equ dword [edi]         ;dword
  39. fb_size_x                       equ [edi+4]             ;word
  40. fb_start_x                      equ [edi+6]             ;word
  41. fb_size_y                       equ [edi+8]             ;word
  42. fb_start_y                      equ [edi+10]            ;word
  43. fb_icon_size_y                  equ word [edi+12]       ;word
  44. fb_icon_size_x                  equ word [edi+14]       ;word
  45. fb_line_size_x                  equ word [edi+16]       ;word
  46. fb_line_size_y                  equ word [edi+18]       ;word
  47. fb_type_size_x                  equ word [edi+20]       ;word
  48. fb_size_size_x                  equ word [edi+22]       ;word
  49. fb_date_size_x                  equ word [edi+24]       ;word
  50. fb_attributes_size_x            equ word [edi+26]       ;word
  51. fb_icon_assoc_area              equ dword [edi+28]      ;dword
  52. fb_icon_raw_area                equ dword [edi+32]      ;dword
  53. fb_resolution_raw               equ dword [edi+36]      ;dword
  54. fb_palette_raw                  equ dword [edi+40]      ;dword
  55. fb_directory_path_area          equ dword [edi+44]      ;dword
  56. fb_file_name_area               equ dword [edi+48]      ;dword
  57. fb_select_flag                  equ dword [edi+52]      ;dword
  58. fb_background_color             equ dword [edi+56]      ;dword
  59. fb_select_color                 equ dword [edi+60]      ;dword
  60. fb_seclect_text_color           equ dword [edi+64]      ;dword
  61. fb_text_color                   equ dword [edi+68]      ;dword
  62. fb_reduct_text_color            equ dword [edi+72]      ;dword
  63. fb_marked_text_color            equ dword [edi+76]      ;dword
  64. fb_max_panel_line               equ dword [edi+80]      ;dword
  65. fb_select_panel_counter         equ dword [edi+84]      ;dword
  66. fb_folder_block                 equ dword [edi+88]      ;dword
  67. fb_start_draw_line              equ dword [edi+92]      ;dword
  68. fb_start_draw_cursor_line       equ word [edi+96]       ;word
  69. fb_folder_data                  equ dword [edi+98]      ;dword
  70. fb_temp_counter                 equ dword [edi+102]     ;dword
  71. fb_file_name_length             equ dword [edi+106]     ;dword
  72. fb_marked_file                  equ dword [edi+110]     ;dword
  73. fb_extension_size               equ dword [edi+114]     ;dword
  74. fb_extension_start              equ dword [edi+118]     ;dword
  75. fb_type_table                   equ dword [edi+122]     ;dword
  76. fb_ini_file_start               equ dword [edi+126]     ;dword
  77. fb_ini_file_end                 equ dword [edi+130]     ;dword
  78. fb_draw_scroll_bar              equ dword [edi+134]     ;dword
  79. fb_font_size_y                  equ word [edi+138]      ;dword
  80. fb_font_size_x                  equ word [edi+140]      ;dword
  81. fb_mouse_keys                   equ dword [edi+142]     ;dword
  82. fb_mouse_keys_old               equ dword [edi+146]     ;dword
  83. fb_mouse_pos                    equ dword [edi+150]     ;dword
  84. fb_mouse_keys_delta             equ dword [edi+154]     ;dword
  85. fb_mouse_key_delay              equ dword [edi+158]     ;dword
  86. fb_mouse_keys_tick              equ dword [edi+162]     ;dword
  87. fb_start_draw_cursor_line_2     equ word [edi+166]      ;dword
  88. fb_all_redraw                   equ dword [edi+168]     ;dword
  89. fb_selected_BDVK_adress         equ dword [edi+172]     ;dword
  90. fb_key_action                   equ dword [edi+176]     ;dword
  91. fb_name_temp_area               equ dword [edi+180]     ;dword
  92. fb_max_name_temp_size           equ dword [edi+184]     ;dword
  93. fb_display_name_max_length      equ dword [edi+188]     ;dword
  94. fb_draw_panel_selection_flag    equ dword [edi+192]     ;dword
  95. fb_mouse_pos_old                equ dword [edi+196]     ;dword
  96. fb_marked_counter               equ dword [edi+200]     ;dword
  97. ;---------------------------------------------------------------------
  98. fb_draw_panel:
  99.         pusha
  100.         mov     edi,dword [esp+36]
  101.         call    fb_clear_panel
  102.         call    fb_calc_max_panel_line
  103.         call    fb_calc_folder_sysdata
  104.         call    fb_draw_panel_selection
  105.         call    fb_draw_folder_data
  106. file_browser_exit
  107. ;---------------------------------------------------------------------
  108. fb_draw_panel_1:
  109.         pusha
  110.         mov     eax,fb_select_color
  111.         push    eax
  112.         mov     eax,fb_seclect_text_color
  113.         push    eax
  114.         mov     ax,fb_start_draw_cursor_line
  115.         push    eax
  116.         mov     eax,fb_background_color
  117.         mov     fb_select_color,eax
  118.         mov     eax,fb_text_color
  119.         mov     fb_seclect_text_color,eax
  120.         mov     ax,fb_start_draw_cursor_line_2
  121.         mov     fb_start_draw_cursor_line,ax
  122.         call    fb_draw_panel_selection
  123.         pop     eax
  124.         mov     fb_start_draw_cursor_line,ax
  125.         pop     eax
  126.         mov     fb_seclect_text_color,eax
  127.         pop     eax
  128.         mov     fb_select_color,eax
  129.         call    fb_draw_panel_selection
  130.         call    fb_draw_folder_data
  131.         popa
  132.         ret
  133. ;---------------------------------------------------------------------
  134. fb_clear_panel:
  135.         cmp     fb_all_redraw,1
  136.         jne     @f
  137.         xor     eax,eax
  138.         mov     fb_max_name_temp_size,eax
  139. @@:
  140.         ret
  141. ;---------------------------------------------------------------------
  142. fb_calc_folder_sysdata:
  143.         mov     eax,fb_folder_data
  144.         mov     eax,[eax+4]
  145.         mov     fb_folder_block,eax
  146.         ret
  147. ;---------------------------------------------------------------------
  148. fb_calc_max_panel_line:
  149.         xor     eax,eax
  150.         xor     ebx,ebx
  151.         mov     ax,fb_size_y
  152.         mov     bx,fb_line_size_y
  153.         test    ebx,ebx
  154.         jnz     @f
  155.         inc     ebx
  156. @@:
  157.         xor     edx,edx
  158.         div     ebx
  159.         mov     fb_max_panel_line,eax
  160.         ret
  161. ;---------------------------------------------------------------------
  162. fb_draw_panel_selection:
  163.         cmp     fb_all_redraw,2
  164.         je      .end
  165.         xor     eax,eax
  166.         cmp     fb_select_panel_counter,eax
  167.         je      .end
  168.         mov     eax,fb_folder_block
  169.         sub     eax,fb_start_draw_line
  170.         mov     cx,fb_start_draw_cursor_line
  171.         call    fb_for_all_panel_selection
  172.         mov     eax,fb_folder_block
  173.         dec     eax
  174.         xor     edx,edx
  175.         mov     dx,fb_line_size_y
  176.         imul    eax,edx
  177.         cmp     ax,cx
  178.         jae     @f
  179.         mov     cx,ax
  180. @@:
  181.         mov     fb_start_draw_cursor_line,cx
  182.         mov     ebx,fb_size_x
  183.         add     cx,fb_start_y
  184. .1:
  185.         shl     ecx,16
  186.         mov     cx,fb_line_size_y
  187.         mov     edx,fb_select_color
  188.         xor     eax,eax
  189.         mov     ax,fb_icon_size_x
  190.         add     eax,2
  191.         sub     ebx,eax
  192.         shl     eax,16
  193.         push    eax
  194.         add     ebx,eax
  195.         mcall   13
  196.         pop     ebx
  197.         cmp     fb_all_redraw,0
  198.         je      .end
  199.         mov     bx,fb_start_x
  200.         ror     ebx,16
  201.         mcall   13,,,fb_background_color
  202. .end:
  203.         ret
  204. ;---------------------------------------------------------------------
  205. fb_for_all_panel_selection:
  206. ;       dec     eax
  207.         xor     edx,edx
  208.         mov     dx,fb_line_size_y
  209.         imul    eax,edx
  210.         cmp     ax,cx
  211.         jae     @f
  212.         mov     cx,ax
  213. @@:
  214.         mov     eax,fb_max_panel_line
  215.         dec     eax
  216.         imul    eax,edx
  217.         cmp     ax,cx
  218.         jae     @f
  219.         mov     cx,ax
  220. @@:
  221.         ret
  222. ;---------------------------------------------------------------------
  223. fb_draw_folder_data:
  224.         mov     eax,fb_folder_block
  225.         sub     eax,fb_max_panel_line
  226.         test    eax,0x80000000
  227.         jz      .ok_left
  228.         mov     fb_start_draw_line,0
  229.         jmp     @f
  230. .ok_left:
  231.         cmp     eax,fb_start_draw_line
  232.         jae     @f
  233.         mov     fb_start_draw_line,eax
  234. @@:
  235.         mov     bx,fb_start_x
  236.         add     bx,3
  237.         add     bx,fb_icon_size_x
  238.         shl     ebx,16
  239.         mov     bx,fb_start_y
  240.         mov     edx,fb_start_draw_line
  241.         imul    edx,304
  242.         add     edx,fb_folder_data
  243.         add     edx,32+40
  244.         xor     eax,eax
  245. .start:
  246.         pusha
  247.         mov     eax,edx
  248.         sub     eax,fb_folder_data
  249.         sub     eax,32+40
  250.         xor     edx,edx
  251.         mov     ebx,304
  252.         div     ebx
  253.         cmp     eax,fb_folder_block
  254.         je      .end_1
  255. ;.continue_1:
  256.         popa
  257.         cmp     eax,fb_max_panel_line
  258.         je      .end_2
  259.         mov     fb_marked_file,0
  260.         cmp     [edx+299-40],byte 0
  261.         je      @f
  262.         mov     fb_marked_file,1
  263. @@:
  264.         call    fb_clear_line
  265.         call    fb_draw_type_size_date
  266.         cmp     fb_all_redraw,2
  267.         je      .draw_icon
  268.         cmp     fb_all_redraw,0
  269.         je      @f
  270. .draw_icon:
  271.         call    fb_draw_icon
  272. @@:
  273.         push    eax
  274.         xor     eax,eax
  275.         mov     ax,fb_size_x
  276.         push    ebx edx
  277.         xor     ebx,ebx
  278.         mov     bx,fb_font_size_x
  279.         xor     edx,edx
  280.         div     ebx
  281.         pop     edx ebx
  282.         sub     eax,23+2+2
  283.         mov     esi,fb_file_name_length
  284.         mov     fb_temp_counter,0
  285.         mov     fb_display_name_max_length,eax
  286.         cmp     esi,eax
  287.         jbe     @f
  288.         mov     esi,eax
  289.         mov     fb_temp_counter,1
  290. @@:
  291.         cmp     fb_max_name_temp_size,esi
  292.         jae     @f
  293.         mov     fb_max_name_temp_size,esi
  294.         inc     fb_max_name_temp_size
  295. @@:
  296.         mov     ecx,fb_text_color
  297.         cmp     fb_marked_file,0
  298.         je      @f
  299.         mov     ecx,fb_reduct_text_color        ;0xff0000
  300. @@:
  301.         mov     ax,fb_line_size_y
  302.         sub     ax,fb_font_size_y
  303.  
  304.         push    ebx
  305.         mov     bx,ax
  306.         shr     ax,1
  307.         test    bx,1b
  308.         jz      @f
  309.         inc     ax
  310. @@:
  311.         pop     ebx
  312.  
  313.         push    ebx
  314.         add     bx,ax
  315.         call    .draw_name_temp_area
  316.         xor     eax,eax
  317.         mov     ax,fb_font_size_x
  318.         imul    eax,fb_display_name_max_length
  319.         shl     eax,16
  320.         push    edx
  321.         add     ebx,eax
  322.         mov     esi,2
  323.         mov     ecx,fb_reduct_text_color        ;0xff0000
  324.         mov     edx,dword fb_truncated_filename_char
  325.         cmp     fb_temp_counter,0
  326.         jne     @f
  327.         mov     edx,dword fb_truncated_filename_clear
  328.         mov     ecx,fb_text_color
  329. @@:
  330.         push    edi
  331.  
  332.         and     ecx,0x30ffffff
  333.         add     ecx,0x40000000
  334.         mov     eax,fb_background_color
  335.         cmp     fb_draw_panel_selection_flag,1
  336.         jne     @f
  337.         mov     eax,fb_select_color
  338. @@:
  339.         mov     edi,eax
  340.         mcall   4
  341.         pop     edi
  342.         cmp     fb_temp_counter,0
  343.         je      .continue_1
  344.         push    edi
  345.  
  346.         mov     eax,fb_background_color
  347.         cmp     fb_draw_panel_selection_flag,1
  348.         jne     @f
  349.         mov     eax,fb_select_color
  350. @@:
  351.         mov     edi,eax
  352.  
  353.         add     ebx,1 shl 16
  354.         mcall   4
  355.         pop     edi
  356. .continue_1:
  357.         pop     edx
  358. .continue:
  359.         pop     ebx
  360.         add     bx,fb_line_size_y
  361.         add     edx,304
  362.         pop     eax
  363.         inc     eax
  364.         jmp     .start
  365. ;--------------------------------------
  366. .draw_name_temp_area:
  367.         pusha
  368.         mov     ebx,esi
  369.         mov     eax,dword '    '
  370.         mov     ecx,256/4
  371.         cld
  372.  
  373.         push    edi
  374.         mov     edi,fb_name_temp_area
  375.         rep     stosd
  376.         pop     edi
  377.  
  378.         mov     esi,edx
  379.         mov     ecx,ebx
  380.         cld
  381.         mov     edi,fb_name_temp_area
  382.         rep     movsb
  383.         popa
  384.  
  385.         pusha
  386.         mov     edx,fb_name_temp_area
  387.  
  388.         cmp     fb_all_redraw,2
  389.         jne     .draw_name_temp_area_1
  390.         mov     esi,fb_max_name_temp_size
  391.         and     ecx,0xffffff
  392.         add     ecx,0x40000000
  393.  
  394.         mov     eax,fb_background_color
  395.         cmp     fb_draw_panel_selection_flag,1
  396.         jne     @f
  397.         mov     eax,fb_select_color
  398. @@:
  399.         mov     edi,eax
  400. .draw_name_temp_area_1:
  401.         mcall   4
  402.         popa
  403.  
  404.         ret
  405. ;--------------------------------------
  406. .end_1:
  407.         popa
  408. .end_2:
  409.         cmp     fb_all_redraw,1
  410.         jne     @f
  411.  
  412.         mov     ax,fb_start_y
  413.         add     ax,fb_size_y
  414.         mov     cx,bx
  415.         rol     ecx,16
  416.         mov     cx,ax
  417.         mov     eax,ecx
  418.         shr     eax,16
  419.         sub     cx,ax
  420.         cmp     cx,0
  421.         jbe     @f
  422.         mov     bx,fb_size_x
  423.         ror     ebx,16
  424.         sub     bx,fb_icon_size_x
  425.         sub     bx,3
  426.         rol     ebx,16
  427.         mov     edx,fb_background_color ;0xffffff
  428.         mcall   13
  429. @@:
  430.  
  431. .end:
  432. ;       mov     fb_draw_scroll_bar,dword 1
  433.         ret
  434. ;---------------------------------------------------------------------
  435. fb_clear_line:
  436.         mov     fb_draw_panel_selection_flag,0
  437.         pusha
  438.         shl     ebx,16
  439.         shr     ebx,16
  440. ;       dec     ebx
  441.         cmp     fb_select_panel_counter,0
  442.         je      .continue
  443.         mov     ax,fb_start_draw_cursor_line
  444.         add     ax,fb_start_y
  445.         cmp     bx,ax
  446.         jne     .continue
  447.         mov     fb_draw_panel_selection_flag,1
  448.         jmp     .end
  449. .continue:
  450.         cmp     fb_all_redraw,2
  451.         je      .end
  452.         cmp     fb_all_redraw,0
  453.         je      .end
  454.         mov     ebx,[esp+16]
  455.         mov     cx,bx
  456. ;       dec     cx
  457.         rol     ecx,16
  458.         mov     cx,fb_line_size_y
  459.         mov     bx,fb_size_x
  460.         ror     ebx,16
  461.         sub     bx,fb_icon_size_x
  462.         sub     bx,3
  463.         rol     ebx,16
  464.         mov     edx,fb_background_color
  465.         mcall   13
  466. .end:
  467.         popa
  468.         ret
  469. ;---------------------------------------------------------------------
  470. fb_draw_type_size_date:
  471.         pusha
  472.         mov     eax,fb_type_table
  473.         test    [edx-40],byte 0x10
  474.         jz      .copy_type
  475.         mov     [eax],dword '<DIR'
  476.         mov     [eax+4],word '> '
  477.         mov     fb_file_name_length,0
  478.         mov     fb_extension_size,0
  479.         jmp     .start
  480. .copy_type:
  481.         mov     [eax],dword '   '
  482.         mov     [eax+4],word '  '
  483. .start:
  484.         mov     esi,edx
  485.         xor     eax,eax
  486. @@:
  487.         cld
  488.         lodsb
  489.         test    eax,eax
  490.         jnz     @b
  491.         mov     fb_file_name_length,esi
  492.         sub     fb_file_name_length,edx
  493.         mov     fb_temp_counter,esi
  494.         test    [edx-40],byte   0x10
  495.         jnz     .size
  496. ;@@:
  497.         dec     esi
  498.         dec     edx
  499. @@:
  500.         std
  501.         lodsb
  502.         cmp     esi,edx
  503.         je      .extension_size_0
  504.         cmp     al,'.'
  505.         jnz     @b
  506.         add     esi,2
  507.         mov     fb_extension_start,esi
  508.         mov     ecx,fb_temp_counter
  509.         sub     ecx,esi
  510.         inc     ecx
  511.         mov     fb_extension_size,ecx
  512.         sub     fb_file_name_length,ecx
  513.         cmp     ecx,2
  514.         ja      @f
  515.         inc     fb_file_name_length
  516. @@:
  517.         sub     ecx,2
  518.         cmp     ecx,4
  519.         jbe     @f
  520.         mov     ecx,3
  521.         mov     eax,fb_type_table
  522.         mov     [eax+3],word '..'
  523. @@:
  524.         push    edi
  525.         mov     edi,fb_type_table
  526.         cld
  527.         rep     movsb
  528.         pop     edi
  529.         inc     edx
  530.         jmp     .size
  531. .extension_size_0:
  532.         inc     edx
  533.         mov     fb_extension_size,0
  534. .size:
  535.         mov     eax,fb_type_table
  536.         test    [edx-40],byte 0x10
  537.         jz      .copy_size
  538.         mov     [eax+6],dword '----'
  539.         mov     [eax+6+4],word '- '
  540.         jmp     .date
  541. ;-----------------------------------------
  542. .call_decimal_string:
  543.         mov     ebx,fb_type_table
  544.         add     ebx,6
  545.         call    fb_decimal_string_4
  546.         mov     [ebx],dl
  547.         jmp     .size_convert_end
  548. ;-----------------------------------------
  549. .copy_size:
  550. ;/0x40000000 - Gb
  551. ;/0x100000 - Mb
  552. ;/0x400 Kb
  553.         mov     [eax+6],dword '    '
  554.         mov     [eax+6+4],word '  '
  555.         push    ebx
  556.         push    edx
  557.         mov     eax,[edx-40+32]
  558.         mov     ebx,eax
  559.         shr     eax,30 ; /(1024*1024*1024)
  560.         test    eax,eax
  561.         jz      @f
  562.         mov     dl,byte 'G'
  563.         jmp     .call_decimal_string
  564. @@:
  565.         mov     eax,ebx
  566.         shr     eax,20 ; /(1024*1024)
  567.         test    eax,eax
  568.         jz      @f
  569.         mov     dl,byte 'M'
  570.         jmp     .call_decimal_string
  571. @@:
  572.         mov     eax,ebx
  573.         shr     eax,10 ; /1024
  574.         test    eax,eax
  575.         jz      @f
  576.         mov     dl,byte 'K'
  577.         jmp     .call_decimal_string
  578. @@:
  579.         mov     eax,ebx
  580. ;.size_convert:
  581.         mov     ebx,fb_type_table
  582.         add     ebx,6
  583.         call    fb_decimal_string_4
  584. .size_convert_end:
  585.         mov     eax,fb_type_table
  586.         add     eax,6
  587.         push    edi
  588.         cmp     [eax],byte '0'
  589.         jne     @f
  590.         mov     [eax],byte ' '
  591. @@:
  592.         add     eax,3
  593. @@:
  594.         cmp     [eax+1],byte ' '
  595.         jne     @f
  596.         mov     esi,eax
  597.         mov     edi,esi
  598.         inc     edi
  599.         mov     ecx,5
  600.         std
  601.         rep     movsb
  602.         jmp     @r
  603. @@:
  604.         pop     edi
  605.         pop     edx
  606.         pop     ebx
  607. ;-----------------------------------------
  608. .date:
  609.         xor     eax,eax
  610.         mov     al,[edx-40+28]
  611.         push    ebx
  612.         mov     ebx,fb_type_table
  613.         add     ebx,12
  614.         call    fb_decimal_string_2 ; day
  615.         mov     al,[edx-40+29]
  616.         mov     ebx,fb_type_table
  617.         add     ebx,12+3
  618.         call    fb_decimal_string_2 ; month
  619.         mov     ax,[edx-40+30]
  620.         mov     ebx,fb_type_table
  621.         add     ebx,12+15
  622.         call    fb_decimal_string_4 ; year
  623.         mov     ebx,fb_type_table
  624.         mov     ax,[ebx+12+15+2]
  625.         mov     [ebx+12+6],ax
  626.         pop     ebx
  627. ;-----------------------------------------
  628.         ror     ebx,16
  629.         add     bx,fb_size_x
  630.         sub     ebx,122+12+15
  631.         rol     ebx,16
  632.         mov     ecx,fb_text_color
  633.         cmp     fb_marked_file,0
  634.         je      @f
  635.         mov     ecx,fb_reduct_text_color        ;0xff0000
  636. @@:
  637.         mov     edx,fb_type_table
  638.         mov     esi,20
  639.  
  640.         mov     ax,fb_line_size_y
  641.         sub     ax,fb_font_size_y
  642.  
  643.         push    ebx
  644.         mov     bx,ax
  645.         shr     ax,1
  646.         test    bx,1b
  647.         jz      @f
  648.         inc     ax
  649. @@:
  650.         pop     ebx
  651.         add     bx,ax
  652.         cmp     fb_all_redraw,2
  653.         jne     .draw  ;@f
  654.         and     ecx,0xffffff
  655.         add     ecx,0x40000000
  656.  
  657.         mov     eax,fb_background_color
  658.         cmp     fb_draw_panel_selection_flag,1
  659.         jne     @f
  660.         mov     eax,fb_select_color
  661. @@:
  662.         mov     edi,eax
  663. .draw:
  664.         mcall   4
  665.         popa
  666.         ret
  667. ;---------------------------------------------------------------------
  668. fb_draw_icon:
  669.         pusha
  670.         xor     eax,eax
  671.         mov     ax,fb_icon_size_y
  672.         mov     ebx,fb_resolution_raw
  673.         imul    eax,ebx
  674.         mov     bx,fb_icon_size_x
  675.         imul    eax,ebx
  676.         mov     ebx,eax
  677.         shr     eax,3
  678.         test    ebx,111b
  679.         jz      @f
  680.         inc     eax
  681. @@:
  682.         test    [edx-40],byte 0x10
  683.         jnz     .draw_dir_pic
  684.  
  685.         call    fb_get_icon_number
  686. ;       mov     ebx,2
  687.         imul    ebx,eax ;16*16*3
  688.         jmp     .draw
  689. .draw_dir_pic:
  690.         xor     ebx,ebx
  691.         cmp     [edx],word '..'
  692.         jne     .draw
  693.         mov     ebx,eax ;16*16*3
  694. .draw:
  695.         add     ebx,fb_icon_raw_area
  696.         mov     cx,fb_icon_size_x
  697.         shl     ecx,16
  698.         mov     cx,fb_icon_size_y
  699.        
  700.         mov     edx,[esp+16]
  701.         ror     edx,16
  702.         sub     edx,2
  703.         sub     dx,fb_icon_size_x
  704.         rol     edx,16
  705.  
  706.         mov     ax,fb_line_size_y
  707.         sub     ax,fb_icon_size_y
  708.         shr     ax,1
  709.         add     dx,ax
  710.  
  711.         mov     esi,fb_resolution_raw
  712.  
  713.         xor     ebp,ebp
  714.        
  715.         push    edi
  716.         mov     edi,fb_palette_raw
  717.         mcall   65
  718.         pop     edi
  719.         popa
  720.         ret
  721. ;---------------------------------------------------------------------
  722. ; Convert of a binary number in decimal string form
  723. ; Input:
  724. ;  AX - value
  725. ;  EBX - address of string
  726. ; Output:
  727. ;  string contains the number, marked the end of the code 0
  728. fb_decimal_string_2:
  729.         push    eax ebx ecx edx
  730.         xor     ecx,ecx
  731.         mov     [ebx],byte '0'
  732.         inc     ebx
  733. .p3:
  734.         xor     edx,edx
  735.         push    ebx
  736.         mov     ebx,10
  737.         div     ebx
  738.         pop     ebx
  739.         add     edx,48
  740.         push    edx
  741.         inc     ecx
  742.         cmp     ax,0
  743.         jne     .p3
  744.         cmp     ecx,1
  745.         jbe     .p4
  746.         mov     ecx,2
  747.         dec     ebx
  748. .p4:
  749.         pop     edx
  750.         mov     [ebx],dl
  751.         inc     ebx
  752.         loop    .p4
  753.         pop     edx ecx ebx eax
  754.         ret
  755. ;---------------------------------------------------------------------
  756. fb_decimal_string_4:
  757.         push    eax ecx edx
  758.         xor     ecx,ecx
  759.         mov     [ebx],byte '0'
  760.         inc     ebx
  761. .p3:
  762.         xor     edx,edx
  763.         push    ebx
  764.         mov     ebx,10
  765.         div     ebx
  766.         pop     ebx
  767.         add     edx,48
  768.         push    edx
  769.         inc     ecx
  770.         cmp     eax,0
  771.         jne     .p3
  772.         cmp     ecx,3
  773.         jbe     .p4
  774.         mov     ecx,4
  775.         dec     ebx
  776. .p4:
  777.         pop     edx
  778.         mov     [ebx],dl
  779.         inc     ebx
  780.         loop    .p4
  781.         pop     edx ecx eax
  782.         ret
  783. ;---------------------------------------------------------------------
  784. fb_get_icon_number:
  785.         push    eax
  786.         mov     ebp,fb_extension_size
  787.         test    ebp,ebp
  788.         je      .end
  789.         dec     ebp
  790.         test    ebp,ebp
  791.         je      .end
  792.         dec     ebp
  793.         test    ebp,ebp
  794.         je              .end
  795. @@:
  796.         mov     edx,fb_ini_file_end
  797.         sub     edx,ebp
  798.         mov     eax,fb_ini_file_start
  799.         dec     eax
  800. .search_association:
  801.         cmp     edx,eax
  802.         jbe     .end
  803.         mov     esi,fb_extension_start
  804.         inc     eax
  805.         mov     ecx,eax
  806.         mov     ebx,eax
  807.         cld
  808. .check:
  809.         lodsb
  810.         test    al,al
  811.         jz      @f
  812.         call    fb_char_toupper
  813.         shl     ax,8
  814. .search_start_of_line:
  815.         mov     al,[ebx]
  816.         inc     ebx
  817.         call    fb_char_toupper
  818.         cmp     al,ah
  819.         je      .check
  820.         mov     eax,ecx
  821.         jmp     .search_association
  822. @@:
  823.         mov     esi,ecx
  824.         add     esi,ebp
  825.         lodsb
  826.         cmp     al,byte '='
  827.         jne     .end
  828.         mov     eax,ecx
  829.         cmp     eax,fb_ini_file_start
  830.         je      @f
  831.         dec     eax
  832.         cmp [eax],byte 15
  833.         ja      .end
  834. @@:
  835.         xor     ebx,ebx
  836.         xor     eax,eax
  837.         mov     ecx,9
  838.         call    .calculate
  839.         cmp al,0x30
  840.         jb      .end
  841.         cmp     al,0x39
  842.         ja      .end
  843.         sub     eax,0x30
  844. @@:
  845.         call    .calculate_1
  846.         cmp al,0x30
  847.         jb      @f
  848.         cmp     al,0x39
  849.         ja      @f
  850.         sub     eax,0x30
  851.        
  852.         lea ebx,[ebx+ebx*4]
  853.         shl     ebx,1
  854.        
  855.         dec     ecx
  856.         jnz     @b
  857. @@:
  858.         pop     eax
  859.         ret
  860. .end:
  861.         mov     ebx,2
  862.         pop     eax
  863.         ret
  864. ;---------------------------------------------------------------------
  865. .calculate_1:
  866.         add     ebx,eax
  867. .calculate:
  868.         xor     eax,eax
  869.         cld
  870.         lodsb
  871.         ret
  872. ;---------------------------------------------------------------------
  873. fb_char_toupper:
  874. ; convert character to uppercase, using cp866 encoding
  875. ; in: al=symbol
  876. ; out: al=converted symbol
  877.         cmp     al,'a'
  878.         jb      .ret
  879.         cmp     al, 'z'
  880.         jbe     .az
  881.         cmp     al, ' '
  882.         jb      .ret
  883.         cmp     al, 'à'
  884.         jb      .rus1
  885.         cmp     al, 'ï'
  886.         ja      .ret
  887. ; 0xE0-0xEF -> 0x90-0x9F
  888.         sub     al, 'à'-''
  889. .ret:
  890.         ret
  891. .rus1:
  892. ; 0xA0-0xAF -> 0x80-0x8F
  893. .az:
  894.         and     al, not 0x20
  895.         ret
  896. ;---------------------------------------------------------------------
  897. fb_char_todown:
  898. ; convert character to uppercase, using cp866 encoding
  899. ; in: al=symbol
  900. ; out: al=converted symbol
  901.         cmp     al, 'A'
  902.         jb      .ret
  903.         cmp     al, 'Z'
  904.         jbe     .az
  905.         cmp     al, '€'
  906.         jb      .ret
  907.         cmp     al, ''
  908.         jb      .rus1
  909.         cmp     al, 'Ÿ'
  910.         ja      .ret
  911. ; 0x90-0x9F -> 0xE0-0xEF
  912.         add     al, 'à'-''
  913. .ret:
  914.         ret
  915. .rus1:
  916. ; 0x80-0x8F -> 0xA0-0xAF
  917. .az:
  918.         add     al, 0x20
  919.         ret
  920. ;---------------------------------------------------------------------
  921. fb_truncated_filename_char:
  922.         db      '..'
  923. fb_truncated_filename_clear:
  924.         db      '  '
  925. ;---------------------------------------------------------------------
  926. ;*****************************************************************************
  927. ;*****************************************************************************
  928. ; mouse event
  929. ;*****************************************************************************
  930. ;*****************************************************************************
  931. fb_mouse:
  932.         pusha
  933.         mov     edi,dword [esp+36]
  934. ;-------------------------------------------------------
  935.         mcall   37,2
  936.         mov     ebx,fb_mouse_keys
  937.         mov     fb_mouse_keys_old,ebx
  938.         mov     fb_mouse_keys,eax
  939.        
  940.         mcall   37,1
  941.         mov     ebx,fb_mouse_pos
  942.         mov     fb_mouse_pos_old,ebx
  943.         mov     fb_mouse_pos,eax
  944.        
  945.         test    eax,0x80000000
  946.         jnz     .exit_fb
  947.         test    eax,0x8000
  948.         jnz     .exit_fb
  949.  
  950.         mov     ebx,eax
  951.         shr     ebx,16  ; x position
  952.         shl     eax,16
  953.         shr     eax,16  ; y position
  954.        
  955.         mov     cx,fb_start_x
  956.         cmp     bx,cx
  957.         jb      .exit_fb
  958.        
  959.         add     cx,fb_size_x
  960.         cmp     bx,cx
  961.         ja      .exit_fb
  962.  
  963.         mov     cx,fb_start_y
  964.         cmp     ax,cx
  965.         jb      .exit_fb
  966.        
  967.         add     cx,fb_size_y
  968.         cmp     ax,cx
  969.         ja      .exit_fb
  970.  
  971.         cmp     fb_mouse_keys,0
  972.         jz      @f
  973.         mov     fb_select_flag,1
  974. @@:
  975. ;-------------------------------------------------------        
  976.         cmp     fb_mouse_keys_delta,1
  977.         je      .enter_1
  978.  
  979.         cmp     fb_mouse_keys,0
  980.         jz      .exit_fb
  981. .start:
  982.         sub     ax,fb_start_y
  983.         xor     ebx,ebx
  984.         mov     bx,fb_line_size_y
  985.         xor     edx,edx
  986.         push    eax
  987.         div     ebx
  988.         pop     eax
  989.         sub     eax,edx
  990.         xor     edx,edx
  991.         cmp     fb_select_panel_counter,edx
  992.         jne     @f
  993.         mov     fb_mouse_keys_delta,0
  994.         jmp     .continue
  995. @@:
  996.         xor     edx,edx
  997.         cmp     fb_start_draw_cursor_line,ax
  998.         jne     @f
  999.         cmp     fb_mouse_keys,edx
  1000.         jnz     .continue
  1001. @@:
  1002.         mov     fb_mouse_keys_delta,edx
  1003. .continue:
  1004.         xor     ebx,ebx
  1005.         mov     bx,fb_line_size_y
  1006.         imul    ebx,fb_folder_block
  1007.         cmp     eax,ebx
  1008.         jb      @f
  1009.         xor     edx,edx
  1010.         mov     dx,fb_line_size_y
  1011.         sub     ebx,edx
  1012.         cmp     bx,fb_start_draw_cursor_line
  1013.         je      .enter
  1014.         call    .store_old_cursor_line
  1015.         mov     fb_start_draw_cursor_line,bx
  1016.         jmp     .continue_1
  1017. @@:
  1018.         cmp     ax,fb_start_draw_cursor_line
  1019.         je      .enter
  1020.         call    .store_old_cursor_line
  1021.         mov     fb_start_draw_cursor_line,ax
  1022. .continue_1:
  1023.         test    fb_mouse_keys,10b
  1024.         jne     .mark_mouse
  1025.         jmp     .enter_1
  1026. .continue_2:
  1027.         mov     ax,fb_start_draw_cursor_line
  1028.         cmp     ax,fb_start_draw_cursor_line_2
  1029.         je      .exit_fb
  1030.  
  1031.         call    fb_draw_panel_1
  1032.         jmp     .exit_fb
  1033. .enter:
  1034.         cmp     fb_mouse_keys_delta,2
  1035.         je      .enter_2
  1036.         cmp     fb_mouse_keys_delta,1
  1037.         je      .enter_1
  1038.         mov     eax,fb_mouse_keys_old
  1039.         cmp     fb_mouse_keys,eax
  1040.         jz      .exit_fb
  1041.         test    fb_mouse_keys,10b
  1042.         jne     .mark_mouse
  1043.         xor     edx,edx
  1044.         inc     edx
  1045.         mov     fb_mouse_keys_delta,edx
  1046.         jmp     .exit_fb
  1047. .enter_1:
  1048. ;       mov     eax,fb_mouse_keys_old
  1049. ;       cmp     fb_mouse_keys,eax
  1050. ;       jz      .exit_fb
  1051.         test    fb_mouse_keys,10b
  1052.         jne     .mark_mouse
  1053.         mov     edx,2
  1054.         mov     fb_mouse_keys_delta,edx
  1055.         mcall   26,9
  1056.         add     eax,fb_mouse_key_delay
  1057.         mov     fb_mouse_keys_tick,eax
  1058.         jmp     .continue_2
  1059. .enter_2:
  1060.         mcall   26,9
  1061.         cmp     eax,fb_mouse_keys_tick
  1062.         ja      @f
  1063. ;       mov     eax,fb_mouse_pos_old
  1064. ;       cmp     eax,fb_mouse_pos
  1065. ;       jne     @f
  1066.         mov     eax,fb_mouse_keys_old
  1067.         cmp     fb_mouse_keys,eax
  1068.         jz      @f
  1069.         test    fb_mouse_keys,10b
  1070.         jne     .mark_mouse
  1071.         call    .enter_3
  1072.         jmp     .exit_fb
  1073. @@:
  1074.         xor     eax,eax
  1075.         inc     eax
  1076.         mov     fb_mouse_keys_delta,eax
  1077. ;-------------------------------------------------------
  1078. .exit_fb:
  1079. file_browser_exit
  1080. ;-------------------------------------------------------
  1081. .mark_mouse:
  1082.         call    fb_key.mark_1
  1083.         call    fb_draw_panel_1
  1084.         xor     eax,eax
  1085.         mov     fb_mouse_keys_delta,eax
  1086.         jmp     .exit_fb       
  1087. ;-------------------------------------------------------
  1088. .enter_3:
  1089.         xor     eax,eax
  1090.         mov     fb_mouse_keys,eax
  1091.         mov     fb_mouse_keys_old,eax
  1092.         mov     eax,3
  1093.         mov     fb_mouse_keys_delta,eax
  1094.         xor     eax,eax
  1095.         mov     ax,fb_start_draw_cursor_line
  1096.         xor     ebx,ebx
  1097.         mov     bx,fb_line_size_y
  1098.         xor     edx,edx
  1099.         div     ebx
  1100.         add     eax,fb_start_draw_line
  1101.         imul    eax,304
  1102.         add     eax,32
  1103.         add     eax,fb_folder_data
  1104.         mov     fb_selected_BDVK_adress,eax
  1105.         xor     eax,eax
  1106.         mov     fb_max_name_temp_size,eax
  1107.         ret
  1108. ;-------------------------------------------------------
  1109. .store_old_cursor_line:
  1110.         push    eax
  1111.         mov     ax,fb_start_draw_cursor_line
  1112.         mov     fb_start_draw_cursor_line_2,ax
  1113.         xor     eax,eax
  1114. ;       mov     fb_mouse_keys_delta,eax
  1115.         pop     eax
  1116.         ret
  1117. ;*****************************************************************************
  1118. ;*****************************************************************************
  1119. ; key event
  1120. ; 1 - arrow down
  1121. ; 2 - arrow up
  1122. ; 3 - PageDown
  1123. ; 4 - PageUp
  1124. ; 5 - Home
  1125. ; 6 - End
  1126. ; 7 - Enter
  1127. ; 8 - Insert (Mark)
  1128. ; 9 - Mark All
  1129. ; 10 - Unmark All
  1130. ; 11 - Invert Mark
  1131. ;*****************************************************************************
  1132. ;*****************************************************************************
  1133. fb_key:
  1134.         pusha
  1135.         mov     edi,dword [esp+36]
  1136. ;-------------------------------------------------------
  1137.         mov     eax,fb_key_action
  1138.         shl     eax,2
  1139.         add     eax,dword fb_key_table
  1140.         cmp     eax,fb_key_table.end
  1141.         jae     .exit_fb
  1142.         cmp     [eax],dword 0
  1143.         je      .exit_fb
  1144.         jmp     dword [eax]
  1145. ;-------------------------------------------------------
  1146. .arrow_down:
  1147.         mov     ax,fb_start_draw_cursor_line
  1148.         add     ax,fb_line_size_y
  1149.         add     ax,fb_line_size_y
  1150.         cmp     ax,word fb_size_y
  1151.         ja      @f
  1152. .add_1:
  1153.         call    fb_mouse.store_old_cursor_line
  1154.         mov     ax,fb_start_draw_cursor_line
  1155.         add     ax,fb_line_size_y
  1156.         mov     fb_start_draw_cursor_line,ax
  1157.         call    fb_draw_panel_1
  1158.         jmp     .exit_fb
  1159. @@:
  1160.         mov     eax,fb_folder_block
  1161.         sub     eax,fb_max_panel_line
  1162.         test    eax,0x80000000
  1163.         jnz     .page_down_2
  1164.  
  1165.         call    .prepare_data_down
  1166.         ja      @f
  1167.  
  1168.         cmp     fb_start_draw_line,eax
  1169.         je      .exit_fb
  1170. @@:
  1171.         inc     fb_start_draw_line
  1172.         call    fb_draw_panel_3
  1173.         jmp     .exit_fb
  1174. ;-------------------------------------------------------
  1175. .arrow_up:
  1176.         mov     ax,fb_start_draw_cursor_line
  1177.         add     ax,fb_start_y
  1178.         cmp     fb_start_y,ax
  1179.         je      @f
  1180.         call    fb_mouse.store_old_cursor_line
  1181.         mov     ax,fb_start_draw_cursor_line
  1182.         sub     ax,fb_line_size_y
  1183.         mov     fb_start_draw_cursor_line,ax
  1184.         call    fb_draw_panel_1
  1185.         jmp     .exit_fb
  1186. @@:
  1187.         cmp     fb_start_draw_line,0
  1188.         je      .exit_fb
  1189.         dec     fb_start_draw_line
  1190.         call    fb_draw_panel_3
  1191.         jmp     .exit_fb
  1192. ;-------------------------------------------------------
  1193. .page_down:
  1194.         mov     eax,fb_max_panel_line
  1195.         mov     ebx,fb_folder_block
  1196.         sub     ebx,eax
  1197.         test    ebx,0x80000000
  1198.         jnz     .page_down_2
  1199.         sub     ebx,fb_start_draw_line
  1200.         cmp     ebx,eax
  1201.         ja      .page_down_3
  1202.         mov     ebx,fb_folder_block
  1203.         sub     ebx,eax
  1204.         call    .prepare_data_down
  1205.         ja      @f
  1206.         cmp     ebx,fb_start_draw_line
  1207.         je      .exit_fb
  1208. @@:
  1209.         mov     fb_start_draw_line,ebx
  1210. .page_down_0:
  1211.         dec     eax
  1212.         xor     ebx,ebx
  1213.         mov     bx,fb_line_size_y
  1214.         imul    eax,ebx
  1215. .page_down_1:
  1216.         call    fb_mouse.store_old_cursor_line
  1217.         mov     fb_start_draw_cursor_line,ax
  1218.         call    fb_draw_panel_2
  1219.         jmp     .exit_fb
  1220. .page_down_2:
  1221.         mov     eax,fb_folder_block
  1222.         sub     eax,fb_start_draw_line
  1223.         dec     eax
  1224.         xor     ebx,ebx
  1225.         mov     bx,fb_line_size_y
  1226.         imul    eax,ebx
  1227.         cmp     ax,fb_start_draw_cursor_line
  1228.         jbe     .exit_fb
  1229.         jmp     .page_down_1
  1230. .page_down_3:
  1231.         add     fb_start_draw_line,eax
  1232.         call    fb_draw_panel_2
  1233.         jmp     .exit_fb
  1234. ;-------------------------------------------------------
  1235. .prepare_data_down:
  1236.         mov     ecx,fb_folder_block
  1237.         sub     ecx,fb_start_draw_line
  1238.         dec     ecx
  1239.         xor     edx,edx
  1240.         mov     dx,fb_line_size_y
  1241.         imul    ecx,edx
  1242.         cmp     cx,fb_start_draw_cursor_line
  1243.         ret
  1244. ;-------------------------------------------------------
  1245. .page_up:
  1246.         mov     eax,fb_max_panel_line
  1247.         mov     ebx,fb_start_draw_line
  1248.         sub     ebx,eax
  1249.         test    ebx,0x80000000
  1250.         jz      @f
  1251.         cmp     fb_start_draw_line,0
  1252.         jne     .page_up_1
  1253.         cmp     fb_start_draw_cursor_line,0
  1254.         je      .exit_fb
  1255.         mov     fb_start_draw_cursor_line,0
  1256. .page_up_1:
  1257.         mov     fb_start_draw_line,0
  1258.         call    fb_draw_panel_2
  1259.         jmp     .exit_fb
  1260. @@:
  1261.         sub     fb_start_draw_line,eax
  1262.         call    fb_draw_panel_2
  1263.         jmp     .exit_fb
  1264. ;-------------------------------------------------------
  1265. .home:
  1266.         cmp     fb_start_draw_line,0
  1267.         jne     @f
  1268.         cmp     fb_start_draw_cursor_line,0
  1269.         je      .exit_fb
  1270. @@:
  1271.         mov     fb_start_draw_line,0
  1272.         mov     fb_start_draw_cursor_line,0
  1273.         call    fb_mouse.store_old_cursor_line
  1274.         call    fb_draw_panel_2
  1275.         jmp     .exit_fb
  1276. ;-------------------------------------------------------
  1277. .end:
  1278.         mov     eax,fb_folder_block
  1279.         sub     eax,fb_max_panel_line
  1280.         test    eax,0x80000000
  1281.         jnz     .page_down_2
  1282.         call    .prepare_data_down
  1283.         ja      @f
  1284.         cmp     eax,fb_start_draw_line
  1285.         je      .exit_fb
  1286. @@:
  1287.         mov     fb_start_draw_line,eax
  1288.         mov     eax,fb_max_panel_line
  1289.         jmp     .page_down_0
  1290. ;-------------------------------------------------------
  1291. .enter:
  1292.         call    fb_mouse.enter_3
  1293.         jmp     .exit_fb
  1294. ;-------------------------------------------------------
  1295. .mark:
  1296.         call    .mark_1
  1297.         jmp     .arrow_down    
  1298. ;-------------------------------------------------------
  1299. .mark_1:
  1300.         xor     eax,eax
  1301.         mov     ax,fb_start_draw_cursor_line
  1302.         xor     edx,edx
  1303.         xor     ebx,ebx
  1304.         mov     bx,fb_line_size_y
  1305.         div     ebx
  1306.         mov     esi,fb_start_draw_line
  1307.         add     esi,eax
  1308.         imul    esi,304
  1309.         add     esi,fb_folder_data
  1310.  
  1311.         add     esi,32+299
  1312.         mov     al,[esi]
  1313.         and     al,1
  1314.        
  1315.         test    al,al
  1316.         jnz     @f
  1317.         inc     fb_marked_counter
  1318.         jmp     .mark_2
  1319. @@:
  1320.         dec     fb_marked_counter
  1321. .mark_2:
  1322.         mov     al,[esi]
  1323.         inc     al
  1324.         and     al,1
  1325.         mov     [esi],al
  1326.         ret
  1327. ;-------------------------------------------------------
  1328. .mark_all:
  1329.         mov     fb_temp_counter,0
  1330. .mark_all_1:   
  1331.         mov     ebp,fb_folder_block
  1332. .mark_all_2:
  1333.         mov     ebx,ebp
  1334.         dec     ebx
  1335.         imul    ebx,304
  1336.         add     ebx,fb_folder_data
  1337.         add     ebx,32+40
  1338.         cmp     [ebx],word '..'
  1339.         jne     .mark_all_3
  1340.         cmp     [ebx+2],byte 0
  1341.         je      @f
  1342. .mark_all_3:
  1343.         call    .select_mark_action
  1344. @@:
  1345.         dec     ebp
  1346.         jnz     .mark_all_2
  1347.        
  1348.         call    fb_draw_panel_3
  1349.         cmp     fb_temp_counter,0
  1350.         jne     @f
  1351.         mov     eax,fb_folder_block
  1352.         jmp     .mark_all_4
  1353. @@:
  1354.         cmp     fb_temp_counter,1
  1355.         jne     @f
  1356.         mov     fb_marked_counter,0
  1357.         jmp     .exit_fb
  1358. @@:
  1359.         mov     eax,fb_folder_block
  1360.         sub     eax,fb_marked_counter
  1361. .mark_all_4:
  1362.         dec     eax
  1363.         mov     fb_marked_counter,eax
  1364.         jmp     .exit_fb
  1365. ;-------------------------------------------------------       
  1366. .select_mark_action:
  1367.         add     ebx,299-40
  1368.         cmp     fb_temp_counter,0
  1369.         jne     @f
  1370.         mov     [ebx],byte 1
  1371.         jmp     .select_mark_action_1
  1372. @@:
  1373.         cmp     fb_temp_counter,1
  1374.         jne     @f
  1375.         mov     [ebx],byte 0
  1376.         jmp     .select_mark_action_1
  1377. @@:
  1378.         mov     al,[ebx]
  1379.         inc     al
  1380.         and     al,1
  1381.         mov     [ebx],al
  1382. .select_mark_action_1:
  1383.         ret
  1384. ;-------------------------------------------------------
  1385. .unmark_all:
  1386.         mov     fb_temp_counter,1
  1387.         jmp     .mark_all_1
  1388. ;-------------------------------------------------------
  1389. .invert_mark:
  1390.         mov     fb_temp_counter,2
  1391.         jmp     .mark_all_1
  1392. ;-------------------------------------------------------
  1393. .exit_fb:
  1394. file_browser_exit
  1395. ;-------------------------------------------------------
  1396. fb_key_table:
  1397.         dd      0
  1398.         dd      fb_key.arrow_down       ; 1
  1399.         dd      fb_key.arrow_up         ; 2
  1400.         dd      fb_key.page_down        ; 3
  1401.         dd      fb_key.page_up          ; 4
  1402.         dd      fb_key.home             ; 5
  1403.         dd      fb_key.end              ; 6
  1404.         dd      fb_key.enter            ; 7
  1405.         dd      fb_key.mark             ; 8
  1406.         dd      fb_key.mark_all         ; 9
  1407.         dd      fb_key.unmark_all       ; 10
  1408.         dd      fb_key.invert_mark      ; 11
  1409. .end:
  1410.         dd      0
  1411. ;-------------------------------------------------------
  1412. fb_draw_panel_3:
  1413.         mov     eax,2
  1414.         mov     fb_all_redraw,eax
  1415.         jmp     @f
  1416. fb_draw_panel_2:
  1417.         xor     eax,eax
  1418.         inc     eax
  1419.         mov     fb_all_redraw,eax
  1420.         call    fb_draw_panel_selection
  1421. @@:
  1422.         call    fb_draw_folder_data
  1423.         xor     eax,eax
  1424.         mov     fb_all_redraw,eax
  1425.         inc     eax
  1426.         mov     fb_draw_scroll_bar,eax
  1427.         ret
  1428.  
  1429. }
  1430.