Subversion Repositories Kolibri OS

Rev

Rev 1589 | 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_truncated_filename_char:
  898.         db      '..'
  899. fb_truncated_filename_clear:
  900.         db      '  '
  901. ;---------------------------------------------------------------------
  902. ;*****************************************************************************
  903. ;*****************************************************************************
  904. ; mouse event
  905. ;*****************************************************************************
  906. ;*****************************************************************************
  907. fb_mouse:
  908.         pusha
  909.         mov     edi,dword [esp+36]
  910. ;-------------------------------------------------------
  911.         mcall   37,2
  912.         mov     ebx,fb_mouse_keys
  913.         mov     fb_mouse_keys_old,ebx
  914.         mov     fb_mouse_keys,eax
  915.        
  916.         mcall   37,1
  917.         mov     ebx,fb_mouse_pos
  918.         mov     fb_mouse_pos_old,ebx
  919.         mov     fb_mouse_pos,eax
  920.        
  921.         test    eax,0x80000000
  922.         jnz     .exit_fb
  923.         test    eax,0x8000
  924.         jnz     .exit_fb
  925.  
  926.         mov     ebx,eax
  927.         shr     ebx,16  ; x position
  928.         shl     eax,16
  929.         shr     eax,16  ; y position
  930.        
  931.         mov     cx,fb_start_x
  932.         cmp     bx,cx
  933.         jb      .exit_fb
  934.        
  935.         add     cx,fb_size_x
  936.         cmp     bx,cx
  937.         ja      .exit_fb
  938.  
  939.         mov     cx,fb_start_y
  940.         cmp     ax,cx
  941.         jb      .exit_fb
  942.        
  943.         add     cx,fb_size_y
  944.         cmp     ax,cx
  945.         ja      .exit_fb
  946.  
  947.         cmp     fb_mouse_keys,0
  948.         jz      @f
  949.         mov     fb_select_flag,1
  950. @@:
  951. ;-------------------------------------------------------        
  952.         cmp     fb_mouse_keys_delta,1
  953.         je      .enter_1
  954.  
  955.         cmp     fb_mouse_keys,0
  956.         jz      .exit_fb
  957. .start:
  958.         sub     ax,fb_start_y
  959.         xor     ebx,ebx
  960.         mov     bx,fb_line_size_y
  961.         xor     edx,edx
  962.         push    eax
  963.         div     ebx
  964.         pop     eax
  965.         sub     eax,edx
  966.         xor     edx,edx
  967.         cmp     fb_select_panel_counter,edx
  968.         jne     @f
  969.         mov     fb_mouse_keys_delta,0
  970.         jmp     .continue
  971. @@:
  972.         xor     edx,edx
  973.         cmp     fb_start_draw_cursor_line,ax
  974.         jne     @f
  975.         cmp     fb_mouse_keys,edx
  976.         jnz     .continue
  977. @@:
  978.         mov     fb_mouse_keys_delta,edx
  979. .continue:
  980.         xor     ebx,ebx
  981.         mov     bx,fb_line_size_y
  982.         imul    ebx,fb_folder_block
  983.         cmp     eax,ebx
  984.         jb      @f
  985.         xor     edx,edx
  986.         mov     dx,fb_line_size_y
  987.         sub     ebx,edx
  988.         cmp     bx,fb_start_draw_cursor_line
  989.         je      .enter
  990.         call    .store_old_cursor_line
  991.         mov     fb_start_draw_cursor_line,bx
  992.         jmp     .continue_1
  993. @@:
  994.         cmp     ax,fb_start_draw_cursor_line
  995.         je      .enter
  996.         call    .store_old_cursor_line
  997.         mov     fb_start_draw_cursor_line,ax
  998. .continue_1:
  999.         test    fb_mouse_keys,10b
  1000.         jne     .mark_mouse
  1001.         jmp     .enter_1
  1002. .continue_2:
  1003.         mov     ax,fb_start_draw_cursor_line
  1004.         cmp     ax,fb_start_draw_cursor_line_2
  1005.         je      .exit_fb
  1006.  
  1007.         call    fb_draw_panel_1
  1008.         jmp     .exit_fb
  1009. .enter:
  1010.         cmp     fb_mouse_keys_delta,2
  1011.         je      .enter_2
  1012.         cmp     fb_mouse_keys_delta,1
  1013.         je      .enter_1
  1014.         mov     eax,fb_mouse_keys_old
  1015.         cmp     fb_mouse_keys,eax
  1016.         jz      .exit_fb
  1017.         test    fb_mouse_keys,10b
  1018.         jne     .mark_mouse
  1019.         xor     edx,edx
  1020.         inc     edx
  1021.         mov     fb_mouse_keys_delta,edx
  1022.         jmp     .exit_fb
  1023. .enter_1:
  1024. ;       mov     eax,fb_mouse_keys_old
  1025. ;       cmp     fb_mouse_keys,eax
  1026. ;       jz      .exit_fb
  1027.         test    fb_mouse_keys,10b
  1028.         jne     .mark_mouse
  1029.         mov     edx,2
  1030.         mov     fb_mouse_keys_delta,edx
  1031.         mcall   26,9
  1032.         add     eax,fb_mouse_key_delay
  1033.         mov     fb_mouse_keys_tick,eax
  1034.         jmp     .continue_2
  1035. .enter_2:
  1036.         mcall   26,9
  1037.         cmp     eax,fb_mouse_keys_tick
  1038.         ja      @f
  1039. ;       mov     eax,fb_mouse_pos_old
  1040. ;       cmp     eax,fb_mouse_pos
  1041. ;       jne     @f
  1042.         mov     eax,fb_mouse_keys_old
  1043.         cmp     fb_mouse_keys,eax
  1044.         jz      @f
  1045.         test    fb_mouse_keys,10b
  1046.         jne     .mark_mouse
  1047.         call    .enter_3
  1048.         jmp     .exit_fb
  1049. @@:
  1050.         xor     eax,eax
  1051.         inc     eax
  1052.         mov     fb_mouse_keys_delta,eax
  1053. ;-------------------------------------------------------
  1054. .exit_fb:
  1055. file_browser_exit
  1056. ;-------------------------------------------------------
  1057. .mark_mouse:
  1058.         call    fb_key.mark_1
  1059.         call    fb_draw_panel_1
  1060.         xor     eax,eax
  1061.         mov     fb_mouse_keys_delta,eax
  1062.         jmp     .exit_fb       
  1063. ;-------------------------------------------------------
  1064. .enter_3:
  1065.         xor     eax,eax
  1066.         mov     fb_mouse_keys,eax
  1067.         mov     fb_mouse_keys_old,eax
  1068.         mov     eax,3
  1069.         mov     fb_mouse_keys_delta,eax
  1070.         xor     eax,eax
  1071.         mov     ax,fb_start_draw_cursor_line
  1072.         xor     ebx,ebx
  1073.         mov     bx,fb_line_size_y
  1074.         xor     edx,edx
  1075.         div     ebx
  1076.         add     eax,fb_start_draw_line
  1077.         imul    eax,304
  1078.         add     eax,32
  1079.         add     eax,fb_folder_data
  1080.         mov     fb_selected_BDVK_adress,eax
  1081.         xor     eax,eax
  1082.         mov     fb_max_name_temp_size,eax
  1083.         ret
  1084. ;-------------------------------------------------------
  1085. .store_old_cursor_line:
  1086.         push    eax
  1087.         mov     ax,fb_start_draw_cursor_line
  1088.         mov     fb_start_draw_cursor_line_2,ax
  1089.         xor     eax,eax
  1090. ;       mov     fb_mouse_keys_delta,eax
  1091.         pop     eax
  1092.         ret
  1093. ;*****************************************************************************
  1094. ;*****************************************************************************
  1095. ; key event
  1096. ; 1 - arrow down
  1097. ; 2 - arrow up
  1098. ; 3 - PageDown
  1099. ; 4 - PageUp
  1100. ; 5 - Home
  1101. ; 6 - End
  1102. ; 7 - Enter
  1103. ; 8 - Insert (Mark)
  1104. ; 9 - Mark All
  1105. ; 10 - Unmark All
  1106. ; 11 - Invert Mark
  1107. ;*****************************************************************************
  1108. ;*****************************************************************************
  1109. fb_key:
  1110.         pusha
  1111.         mov     edi,dword [esp+36]
  1112. ;-------------------------------------------------------
  1113.         mov     eax,fb_key_action
  1114.         shl     eax,2
  1115.         add     eax,dword fb_key_table
  1116.         cmp     eax,fb_key_table.end
  1117.         jae     .exit_fb
  1118.         cmp     [eax],dword 0
  1119.         je      .exit_fb
  1120.         jmp     dword [eax]
  1121. ;-------------------------------------------------------
  1122. .arrow_down:
  1123.         mov     ax,fb_start_draw_cursor_line
  1124.         add     ax,fb_line_size_y
  1125.         add     ax,fb_line_size_y
  1126.         cmp     ax,word fb_size_y
  1127.         ja      @f
  1128. .add_1:
  1129.         call    fb_mouse.store_old_cursor_line
  1130.         mov     ax,fb_start_draw_cursor_line
  1131.         add     ax,fb_line_size_y
  1132.         mov     fb_start_draw_cursor_line,ax
  1133.         call    fb_draw_panel_1
  1134.         jmp     .exit_fb
  1135. @@:
  1136.         mov     eax,fb_folder_block
  1137.         sub     eax,fb_max_panel_line
  1138.         test    eax,0x80000000
  1139.         jnz     .page_down_2
  1140.  
  1141.         call    .prepare_data_down
  1142.         ja      @f
  1143.  
  1144.         cmp     fb_start_draw_line,eax
  1145.         je      .exit_fb
  1146. @@:
  1147.         inc     fb_start_draw_line
  1148.         call    fb_draw_panel_3
  1149.         jmp     .exit_fb
  1150. ;-------------------------------------------------------
  1151. .arrow_up:
  1152.         mov     ax,fb_start_draw_cursor_line
  1153.         add     ax,fb_start_y
  1154.         cmp     fb_start_y,ax
  1155.         je      @f
  1156.         call    fb_mouse.store_old_cursor_line
  1157.         mov     ax,fb_start_draw_cursor_line
  1158.         sub     ax,fb_line_size_y
  1159.         mov     fb_start_draw_cursor_line,ax
  1160.         call    fb_draw_panel_1
  1161.         jmp     .exit_fb
  1162. @@:
  1163.         cmp     fb_start_draw_line,0
  1164.         je      .exit_fb
  1165.         dec     fb_start_draw_line
  1166.         call    fb_draw_panel_3
  1167.         jmp     .exit_fb
  1168. ;-------------------------------------------------------
  1169. .page_down:
  1170.         mov     eax,fb_max_panel_line
  1171.         mov     ebx,fb_folder_block
  1172.         sub     ebx,eax
  1173.         test    ebx,0x80000000
  1174.         jnz     .page_down_2
  1175.         sub     ebx,fb_start_draw_line
  1176.         cmp     ebx,eax
  1177.         ja      .page_down_3
  1178.         mov     ebx,fb_folder_block
  1179.         sub     ebx,eax
  1180.         call    .prepare_data_down
  1181.         ja      @f
  1182.         cmp     ebx,fb_start_draw_line
  1183.         je      .exit_fb
  1184. @@:
  1185.         mov     fb_start_draw_line,ebx
  1186. .page_down_0:
  1187.         dec     eax
  1188.         xor     ebx,ebx
  1189.         mov     bx,fb_line_size_y
  1190.         imul    eax,ebx
  1191. .page_down_1:
  1192.         call    fb_mouse.store_old_cursor_line
  1193.         mov     fb_start_draw_cursor_line,ax
  1194.         call    fb_draw_panel_2
  1195.         jmp     .exit_fb
  1196. .page_down_2:
  1197.         mov     eax,fb_folder_block
  1198.         sub     eax,fb_start_draw_line
  1199.         dec     eax
  1200.         xor     ebx,ebx
  1201.         mov     bx,fb_line_size_y
  1202.         imul    eax,ebx
  1203.         cmp     ax,fb_start_draw_cursor_line
  1204.         jbe     .exit_fb
  1205.         jmp     .page_down_1
  1206. .page_down_3:
  1207.         add     fb_start_draw_line,eax
  1208.         call    fb_draw_panel_2
  1209.         jmp     .exit_fb
  1210. ;-------------------------------------------------------
  1211. .prepare_data_down:
  1212.         mov     ecx,fb_folder_block
  1213.         sub     ecx,fb_start_draw_line
  1214.         dec     ecx
  1215.         xor     edx,edx
  1216.         mov     dx,fb_line_size_y
  1217.         imul    ecx,edx
  1218.         cmp     cx,fb_start_draw_cursor_line
  1219.         ret
  1220. ;-------------------------------------------------------
  1221. .page_up:
  1222.         mov     eax,fb_max_panel_line
  1223.         mov     ebx,fb_start_draw_line
  1224.         sub     ebx,eax
  1225.         test    ebx,0x80000000
  1226.         jz      @f
  1227.         cmp     fb_start_draw_line,0
  1228.         jne     .page_up_1
  1229.         cmp     fb_start_draw_cursor_line,0
  1230.         je      .exit_fb
  1231.         mov     fb_start_draw_cursor_line,0
  1232. .page_up_1:
  1233.         mov     fb_start_draw_line,0
  1234.         call    fb_draw_panel_2
  1235.         jmp     .exit_fb
  1236. @@:
  1237.         sub     fb_start_draw_line,eax
  1238.         call    fb_draw_panel_2
  1239.         jmp     .exit_fb
  1240. ;-------------------------------------------------------
  1241. .home:
  1242.         cmp     fb_start_draw_line,0
  1243.         jne     @f
  1244.         cmp     fb_start_draw_cursor_line,0
  1245.         je      .exit_fb
  1246. @@:
  1247.         mov     fb_start_draw_line,0
  1248.         mov     fb_start_draw_cursor_line,0
  1249.         call    fb_mouse.store_old_cursor_line
  1250.         call    fb_draw_panel_2
  1251.         jmp     .exit_fb
  1252. ;-------------------------------------------------------
  1253. .end:
  1254.         mov     eax,fb_folder_block
  1255.         sub     eax,fb_max_panel_line
  1256.         test    eax,0x80000000
  1257.         jnz     .page_down_2
  1258.         call    .prepare_data_down
  1259.         ja      @f
  1260.         cmp     eax,fb_start_draw_line
  1261.         je      .exit_fb
  1262. @@:
  1263.         mov     fb_start_draw_line,eax
  1264.         mov     eax,fb_max_panel_line
  1265.         jmp     .page_down_0
  1266. ;-------------------------------------------------------
  1267. .enter:
  1268.         call    fb_mouse.enter_3
  1269.         jmp     .exit_fb
  1270. ;-------------------------------------------------------
  1271. .mark:
  1272.         call    .mark_1
  1273.         jmp     .arrow_down    
  1274. ;-------------------------------------------------------
  1275. .mark_1:
  1276.         xor     eax,eax
  1277.         mov     ax,fb_start_draw_cursor_line
  1278.         xor     edx,edx
  1279.         xor     ebx,ebx
  1280.         mov     bx,fb_line_size_y
  1281.         div     ebx
  1282.         mov     esi,fb_start_draw_line
  1283.         add     esi,eax
  1284.         imul    esi,304
  1285.         add     esi,fb_folder_data
  1286.  
  1287.         add     esi,32+299
  1288.         mov     al,[esi]
  1289.         and     al,1
  1290.        
  1291.         test    al,al
  1292.         jnz     @f
  1293.         inc     fb_marked_counter
  1294.         jmp     .mark_2
  1295. @@:
  1296.         dec     fb_marked_counter
  1297. .mark_2:
  1298.         mov     al,[esi]
  1299.         inc     al
  1300.         and     al,1
  1301.         mov     [esi],al
  1302.         ret
  1303. ;-------------------------------------------------------
  1304. .mark_all:
  1305.         mov     fb_temp_counter,0
  1306. .mark_all_1:   
  1307.         mov     ebp,fb_folder_block
  1308. .mark_all_2:
  1309.         mov     ebx,ebp
  1310.         dec     ebx
  1311.         imul    ebx,304
  1312.         add     ebx,fb_folder_data
  1313.         add     ebx,32+40
  1314.         cmp     [ebx],word '..'
  1315.         jne     .mark_all_3
  1316.         cmp     [ebx+2],byte 0
  1317.         je      @f
  1318. .mark_all_3:
  1319.         call    .select_mark_action
  1320. @@:
  1321.         dec     ebp
  1322.         jnz     .mark_all_2
  1323.        
  1324.         call    fb_draw_panel_3
  1325.         cmp     fb_temp_counter,0
  1326.         jne     @f
  1327.         mov     eax,fb_folder_block
  1328.         jmp     .mark_all_4
  1329. @@:
  1330.         cmp     fb_temp_counter,1
  1331.         jne     @f
  1332.         mov     fb_marked_counter,0
  1333.         jmp     .exit_fb
  1334. @@:
  1335.         mov     eax,fb_folder_block
  1336.         sub     eax,fb_marked_counter
  1337. .mark_all_4:
  1338.         dec     eax
  1339.         mov     fb_marked_counter,eax
  1340.         jmp     .exit_fb
  1341. ;-------------------------------------------------------       
  1342. .select_mark_action:
  1343.         add     ebx,299-40
  1344.         cmp     fb_temp_counter,0
  1345.         jne     @f
  1346.         mov     [ebx],byte 1
  1347.         jmp     .select_mark_action_1
  1348. @@:
  1349.         cmp     fb_temp_counter,1
  1350.         jne     @f
  1351.         mov     [ebx],byte 0
  1352.         jmp     .select_mark_action_1
  1353. @@:
  1354.         mov     al,[ebx]
  1355.         inc     al
  1356.         and     al,1
  1357.         mov     [ebx],al
  1358. .select_mark_action_1:
  1359.         ret
  1360. ;-------------------------------------------------------
  1361. .unmark_all:
  1362.         mov     fb_temp_counter,1
  1363.         jmp     .mark_all_1
  1364. ;-------------------------------------------------------
  1365. .invert_mark:
  1366.         mov     fb_temp_counter,2
  1367.         jmp     .mark_all_1
  1368. ;-------------------------------------------------------
  1369. .exit_fb:
  1370. file_browser_exit
  1371. ;-------------------------------------------------------
  1372. fb_key_table:
  1373.         dd      0
  1374.         dd      fb_key.arrow_down       ; 1
  1375.         dd      fb_key.arrow_up         ; 2
  1376.         dd      fb_key.page_down        ; 3
  1377.         dd      fb_key.page_up          ; 4
  1378.         dd      fb_key.home             ; 5
  1379.         dd      fb_key.end              ; 6
  1380.         dd      fb_key.enter            ; 7
  1381.         dd      fb_key.mark             ; 8
  1382.         dd      fb_key.mark_all         ; 9
  1383.         dd      fb_key.unmark_all       ; 10
  1384.         dd      fb_key.invert_mark      ; 11
  1385. .end:
  1386.         dd      0
  1387. ;-------------------------------------------------------
  1388. fb_draw_panel_3:
  1389.         mov     eax,2
  1390.         mov     fb_all_redraw,eax
  1391.         jmp     @f
  1392. fb_draw_panel_2:
  1393.         xor     eax,eax
  1394.         inc     eax
  1395.         mov     fb_all_redraw,eax
  1396.         call    fb_draw_panel_selection
  1397. @@:
  1398.         call    fb_draw_folder_data
  1399.         xor     eax,eax
  1400.         mov     fb_all_redraw,eax
  1401.         inc     eax
  1402.         mov     fb_draw_scroll_bar,eax
  1403.         ret
  1404.  
  1405. }
  1406.