Subversion Repositories Kolibri OS

Rev

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