Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
1851 mario79 1
;*****************************************************************************
1792 yogev_ezra 2
; KFM - Kolibri File Manager
4631 mario79 3
; Copyright (c) 2006 - 2014, Marat Zakiyanov aka Mario79, aka Mario
1851 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
;*****************************************************************************
4631 mario79 28
; KFM v0.47j 12/03/2014
2346 mario79 29
;---------------------------------------------------------------------
1792 yogev_ezra 30
use32
1851 mario79 31
org	0x0
32
 
1792 yogev_ezra 33
    db	  'MENUET01'
34
    dd	  0x01
35
    dd	  START
36
    dd	  I_END
37
    dd	  mem
38
    dd	  stacktop
39
    dd	  0x0
40
    dd	  path
41
 
42
;include   'lang.inc'
43
;include   'kglobals.inc'
1851 mario79 44
;include   'macros.inc'
45
include '../../../macros.inc'
46
include '../../../config.inc'		;for nightbuild
3840 mario79 47
;include '../../../debug.inc'		;for nightbuild
1851 mario79 48
 
4338 mario79 49
;define __DEBUG__ 1
50
;define __DEBUG_LEVEL__ 1
51
;include '../../../debug-fdo.inc'
52
 
1792 yogev_ezra 53
include   'editbox.inc'
54
;use_edit_box
55
use_edit_box procinfo
56
;include   'ASCGL.INC'
57
;---------------------------------------------------------------------
58
include   'files.inc'
59
;---------------------------------------------------------------------
60
STRLEN = 1024
61
;---------------------------------------------------------------------
62
START:
2148 mario79 63
;    mcall 9, procinfo, -1
64
;    mov   eax,[ebx+30]
65
;    mov   [PID],eax
66
;    xor   ecx,ecx
67
;@@:
68
;    inc   ecx
69
;    mcall 9, procinfo
70
;    mov   eax,[PID]
71
;    cmp   eax,[ebx+30]
72
;    jne   @r
73
;    mov  [active_process],ecx
74
	mcall	9,procinfo,-1
75
	mov	ecx,[ebx+30]	; PID
76
	mcall	18,21
77
	mov	[active_process],eax	; WINDOW SLOT
1792 yogev_ezra 78
    mov   [appl_memory],mem
79
    mov   ax,[select_disk_char]
80
    mov   [read_folder_name],ax
81
    mov   [read_folder_1_name],ax
82
    call  load_icon_and_convert_to_img
83
    call  load_buttons_and_convert_to_img
84
    call  load_initiation_file
85
    call  add_memory_for_folders
86
    call  device_detect_f70
4314 mario79 87
    call  select_starting_directories
1792 yogev_ezra 88
    mcall 66, 1, 1
89
;    call  draw_window
90
;    xor   eax,eax
91
    mov   eax,1
92
    mov   [left_sort_flag],eax
93
    mov   [right_sort_flag],eax
94
 
95
    call  proc_read_left_folder
96
    test  eax,eax
97
    jz	  @f
4400 mario79 98
 
1792 yogev_ezra 99
    cmp   eax,6
100
    jne   read_folder_error
101
@@:
102
    call  proc_read_right_folder
103
    test  eax,eax
104
    jz	  @f
4400 mario79 105
 
1792 yogev_ezra 106
    cmp   eax,6
4400 mario79 107
    je    @f
108
; if /hd read error for start then use /rd
109
    mov   esi,retrieved_devices_table+1
110
    call  copy_folder_name_1
111
    call  proc_read_right_folder
112
    test  eax,eax
113
    jz	  @f
114
 
115
    cmp   eax,6
1792 yogev_ezra 116
    jne   read_folder_1_error
117
@@:
118
	mcall 40, 0x27
119
	jmp   red_1
120
;---------------------------------------------------------------------
121
red:
122
    call  get_window_param
123
    test  [window_status],10b
124
    jnz   red_1   ;still
125
    test  [window_status],100b
126
    jnz   red_1
127
    cmp   [window_high],180
128
    ja	  @f
129
    mov   esi,180
130
    mcall 67,-1,ebx,ebx
131
@@:
132
    cmp   [window_width],495
133
    ja	  red_1
134
    mov   edx,495
135
    mcall 67,-1,ebx, ,ebx
136
red_1:
137
    call  draw_window
138
;---------------------------------------------------------------------
139
still:
140
    mcall 10
2616 mario79 141
 
142
    call  check_active_process_for_clear_all_flags
143
 
1792 yogev_ezra 144
    cmp   eax,1
145
    je	  red
146
    cmp   eax,2
147
    je	  key
148
    cmp   eax,3
149
    je	  button
150
    cmp   eax,6
151
    je	  mouse
152
    jmp   still
153
;---------------------------------------------------------------------
2616 mario79 154
check_active_process_for_clear_all_flags:
155
	push	eax
156
	mcall	18,7
157
	cmp	[active_process],eax
158
	je	.exit
159
 
160
	xor	eax,eax
161
	cmp	[shift_flag],al
162
	jne	.clear_all_flags
163
 
164
	cmp	[ctrl_flag],al
165
	jne	.clear_all_flags
166
 
167
	cmp	[ctrl_flag],al
168
	je	.exit
169
;--------------------------------------
170
.clear_all_flags:
171
	mov	[shift_flag],al
172
	mov	[ctrl_flag],al
173
	mov	[alt_flag],al
174
	call	erase_fbutton
175
	call	draw_fbutton
176
;--------------------------------------
177
.exit:
178
	pop	eax
179
	ret
180
;---------------------------------------------------------------------
1792 yogev_ezra 181
get_window_param:
182
    mcall 9, procinfo, -1
183
    mov   eax,[ebx+46]
184
    mov   [window_high],eax
185
    mov   eax,[ebx+42]
186
    mov   [window_width],eax
187
    mov   eax,[ebx+70]
188
    mov   [window_status],eax
189
    mcall 48,4
190
    mov   [skin_high],eax
191
    ret
192
;---------------------------------------------------------------------
193
draw_window:
194
    mcall 12, 1
195
;    mcall 0, <20,620>, <20,460>, 0x03cccccc   ; 0x805080D0, 0x005080D0
196
	xor	esi,esi
197
    mcall 0, <20,620>, <20,460>, 0x43cccccc   ; 0x805080D0, 0x005080D0
198
    call  get_window_param
2688 leency 199
 
200
    mcall 71, 1, header_text
201
 
202
	;    mov   ecx,[temp_esi]
2584 mario79 203
	test	[window_status],100b	; window is rolled up
204
	jnz	.exit
205
 
206
	test	[window_status],10b	; window is minimized to panel
207
	jnz	.exit
208
 
1792 yogev_ezra 209
    ; create_dir_name
210
    ; start_parameter
211
    ; file_name
212
    ; [temp_edi]
213
    ; header
214
    ; delete_file_data.name
215
    ; start_file_data.name
216
    ; start_parameter
217
     ; start_file_data.name
218
      ; read_icon_file.name
219
		; read_file_features.name ;path ;header
220
 
221
    cmp   [window_high],180
2584 mario79 222
    jb	  .exit
1792 yogev_ezra 223
    cmp   [window_width],495
2584 mario79 224
    jb	  .exit
1792 yogev_ezra 225
 
226
;    pusha
227
;    mcall 4,<15,25>,0,read_folder.name,100
228
;    popa
229
    call  draw_fbutton
230
 
231
;    mov   [left_panel_clear_all],1
232
 
233
    call  draw_left_panel
234
 
235
;    mov   [right_panel_clear_all],1
236
 
237
    call  draw_right_panel
238
    call  draw_device_button
239
    call  draw_left_select_disk_button
240
    call  draw_left_sort_button
241
    call  draw_right_select_disk_button
242
    call  draw_right_sort_button
243
    call  draw_menu_bar
244
    call  draw_buttons_panel
4631 mario79 245
;    call  draw_ATAPI_tray_control
1792 yogev_ezra 246
 
247
;    mcall 47,0x80000,[left_scroll_compens],<300, 5>,0xffffff
248
;    call  mouse.draw_data
249
;    mcall 18, 7
250
;    mov   [temp_eax],eax
251
;    mcall 47,0x80000,[active_process],<300, 5>,0xffffff
252
;    mcall 47,0x80000,[left_marked_counter],<300, 5>,0xffffff
253
;    mcall 47,0x80000,[right_marked_counter],<400, 5>,0xffffff
254
;    mcall 47,0x80000,[sorting_low_limit],<100, 5>,0xffffff
255
;    mcall 47,0x80000,[sort_counter],<200, 5>,0xffffff
256
;    mcall 47,0x80000,[sorting_high_limit],<300, 5>,0xffffff
257
;    mcall 47,0x80000,[dir_temp_counter],<400, 5>,0xffffff
258
 
259
;    mcall 47,0x80000,[timer_tick],<500, 5>,0xffffff
260
;    mcall 47,0x80000,[temp_eax],<400, 5>,0xffffff
261
;    mcall 47,0x80000,[temp_ebx],<400, 5>,0xffffff
262
;    mcall 47,0x80000,[temp_ecx],<500, 5>,0xffffff
263
;    mcall 47,0x80000,[temp_ebx],<500, 5>,0xffffff
264
;    mcall 47,0x80000,[ini_file_start],<100, 5>,0xffffff
265
;    mcall 47,0x80000,[left_folder_data],<200, 5>,0xffffff
266
;    mcall 47,0x80000,[right_folder_data],<300, 5>,0xffffff
267
;    mcall 47,0x80000,[appl_memory],<500, 5>,0xffffff
268
;    mcall 47,0x80000,[temp_znak],<500, 5>,0xffffff
269
 
270
;    mcall 47,0x80000,[sort_counter],<200, 5>,0xffffff
271
;    mcall 47,0x80000,[temp_edi],<250, 5>,0xffffff
272
;    mcall 47,0x80000,[temp_esi],<300, 5>,0xffffff
273
;    mcall 47,0x80000,[temp_ecx],<350, 5>,0xffffff
274
;    mcall 47,0x80000,[temp_znak],<400, 5>,0xffffff
275
 
276
;    movzx ecx,[left_start_draw_cursor_line]
277
;    mcall 47,0x40000, ,<300, 5>,0xffffff
278
;    mcall 47,0x40000,[left_start_draw_line],<400, 5>,0xffffff
279
 
280
;    mcall 47,0x40000,[window_width],<100, 5>,0xffffff
281
;    mcall 47,0x40000,[window_high],<130, 5>,0xffffff
282
 
283
;    mcall 47,0x80100,[left_panel_x],<200, 5>,0xffffff
284
;    mcall 47,0x80100,[left_panel_y],<250, 5>,0xffffff
285
;    mov   edx,[temp_counter_dword_1]
286
;    mcall 4,<150,3>,0x80000000
287
;    mov   edx,[temp_counter_dword]
288
;    mcall 4,<5,3>,0x80000000
2584 mario79 289
.exit:
1792 yogev_ezra 290
    mcall 12, 2
291
    ret
292
;temp_eax dd 0
293
;temp_ebx dd 0
294
;temp_ecx dd 0
295
;temp_edx dd 0
296
;temp_esi dd 0
297
;temp_edi dd 0
298
;temp_ebp dd 0
299
;temp_esp dd 0
300
;temp_znak dd 0
301
;temp_counter_dword_1 dd 0
302
;extension_size_1 dd 0
303
;timer_tick dd 0
304
;---------------------------------------------------------------------
305
prepare_load_data:
306
    mov   esi,path
307
    mov   edi,file_name
308
    call  copy_path
309
    call  get_file_size
310
    test  eax,eax
311
    ret
312
;---------------------------------------------------------------------
313
prepare_load_data_1:
314
    mov   [read_file.return],eax
315
    mov   ebp,eax
316
prepare_load_data_4:
317
    call  load_file
318
    test  eax,eax
319
    ret
320
;---------------------------------------------------------------------
321
prepare_load_data_2:
322
    call  add_application_memory
323
prepare_load_data_3:
324
    call  add_application_memory
325
    mov   eax,[file_features_temp_area+32]
326
    mov   [read_file.size],eax
327
    ret
328
;---------------------------------------------------------------------
329
load_icon_and_convert_to_img:
330
    mov   ebx,icons_file_name
331
    call  prepare_load_data
332
    jnz   icon_error
333
    call  prepare_load_data_2
334
    add   eax,mem
335
    call  prepare_load_data_1
336
    jnz   icon_error
337
    call  convert_bmp_to_img
338
    call  sub_application_memory
339
    ret
340
;---------------------------------------------------------------------
341
load_buttons_and_convert_to_img:
342
    mov   ebx,buttons_file_name
343
    call  prepare_load_data
344
    jnz   buttons_error
345
    mov   eax,[appl_memory]
346
    mov   [buttons_img_start],eax
347
    call  prepare_load_data_2
348
    add   eax,[buttons_img_start]
349
    call  prepare_load_data_1
350
    jnz   buttons_error
351
    call  convert_bmp_to_img
352
    call  sub_application_memory
353
    ret
354
;---------------------------------------------------------------------
355
load_initiation_file:
356
    mov   ebx,ini_file_name
357
    call  prepare_load_data
358
    jnz   initiation_error
359
    call  prepare_load_data_3
360
    mov   eax,[appl_memory]
361
    mov   [left_folder_data],eax
362
    sub   eax,[read_file.size]
363
    mov   [read_file.return],eax
364
    mov   [ini_file_start],eax
365
    call  load_file
366
    test  eax,eax
367
    jnz   initiation_error
368
    mov   ebp,icons_associations
369
    call  search_star_and_end_tags
370
;    cmp   ebp,-1
371
;    je    .end
372
    mov   eax,[end_tag]
373
    mov   [icons_end_tag],eax
374
    ret
375
;---------------------------------------------------------------------
376
add_memory_for_folders:
377
    mov   ecx,[appl_memory]
378
    add   ecx,304*32+32
379
    mov   [right_folder_data],ecx
380
    add   ecx,304*32+32
381
    mov   [appl_memory],ecx
382
    mcall 64,1
3755 mario79 383
 
384
    mov   eax,[left_folder_data]
385
    mov   [read_folder.return],eax
386
    mov   eax,[right_folder_data]
387
    mov   [read_folder_1.return],eax
1792 yogev_ezra 388
    ret
389
;---------------------------------------------------------------------
390
copy_path:
391
    xor   eax,eax
392
@@:
393
    cld
394
    lodsb
395
    stosb
396
    test  eax,eax
397
    jnz   @b
398
    mov   esi,edi
399
;    dec   esi
400
@@:
401
    std
402
    lodsb
403
    cmp   al,'/'
404
    jnz   @b
405
    mov   edi,esi
406
    add   edi,2
407
    mov   esi,ebx
408
@@:
409
    cld
410
    lodsb
411
    stosb
412
    test  eax,eax
413
    jnz   @b
414
    ret
415
;---------------------------------------------------------------------
416
copy_path_1:
417
    xor   eax,eax
418
@@:
419
    cld
420
    lodsb
421
    stosb
422
    test  eax,eax
423
    jnz   @b
424
    mov   esi,ebx
425
    mov   [edi-1],byte '/'
426
@@:
427
    cld
428
    lodsb
429
    stosb
430
    test  eax,eax
431
    jnz   @b
432
    ret
433
;---------------------------------------------------------------------
434
add_application_memory:
435
    mov   ecx,[file_features_temp_area+32]
436
.1:
437
    add   ecx,[appl_memory]
438
    mov   [appl_memory],ecx
439
    mcall 64,1
440
    ret
441
;---------------------------------------------------------------------
442
sub_application_memory:
443
    mov   ecx,[appl_memory]
444
    sub   ecx,[file_features_temp_area+32]
445
.1:
446
    mov   [appl_memory],ecx
447
    mcall 64,1
448
    ret
449
;---------------------------------------------------------------------
450
include   'key.inc'
451
;---------------------------------------------------------------------
452
include   'markfile.inc'
453
;---------------------------------------------------------------------
454
include   'button.inc'
455
;---------------------------------------------------------------------
456
include   'mouse.inc'
457
;---------------------------------------------------------------------
458
include   'openfile.inc'
459
;---------------------------------------------------------------------
460
include   'draw.inc'
461
;---------------------------------------------------------------------
4631 mario79 462
include   'drw_dbut.inc'
463
;---------------------------------------------------------------------
1792 yogev_ezra 464
include   'menu_bar.inc'
465
;---------------------------------------------------------------------
466
include   'menu_drv.inc'
467
;---------------------------------------------------------------------
468
include   'delete.inc'
469
;---------------------------------------------------------------------
470
include   'copy.inc'
471
;---------------------------------------------------------------------
472
include   'creatdir.inc'
473
;---------------------------------------------------------------------
474
include   'confirm.inc'
475
;---------------------------------------------------------------------
476
include   'err_wind.inc'
477
;---------------------------------------------------------------------
478
include   'detect.inc'
479
;---------------------------------------------------------------------
480
include   'conv_bmp.inc'
481
;---------------------------------------------------------------------
482
include   'tran_ini.inc'
483
;---------------------------------------------------------------------
484
include   'help.inc'
485
;---------------------------------------------------------------------
486
include   'convchar.inc'
487
;---------------------------------------------------------------------
488
include   'sort.inc'
489
;---------------------------------------------------------------------
490
include   'exit.inc'
491
;---------------------------------------------------------------------
492
include   'progrbar.inc'
493
;---------------------------------------------------------------------
494
include   'scroll.inc'
495
;---------------------------------------------------------------------
496
include   'file_inf.inc'
497
;---------------------------------------------------------------------
498
include   'text.inc'
499
;---------------------------------------------------------------------
500
I_END:
4338 mario79 501
;include_debug_strings
1792 yogev_ezra 502
;---------------------------------------------------------------------
503
include   'data.inc'
504
;---------------------------------------------------------------------
505
mem: