Subversion Repositories Kolibri OS

Rev

Rev 1243 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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