Subversion Repositories Kolibri OS

Rev

Rev 1373 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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