Subversion Repositories Kolibri OS

Rev

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

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