Subversion Repositories Kolibri OS

Rev

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