Subversion Repositories Kolibri OS

Rev

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