Subversion Repositories Kolibri OS

Rev

Rev 5887 | Rev 7996 | 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:
5887 pathoswith 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.
1851 mario79 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	ecx,[ebx+30]	; PID
65
	mcall	18,21
66
	mov	[active_process],eax	; WINDOW SLOT
1792 yogev_ezra 67
    mov   [appl_memory],mem
68
    mov   ax,[select_disk_char]
69
    mov   [read_folder_name],ax
70
    mov   [read_folder_1_name],ax
71
    call  load_icon_and_convert_to_img
72
    call  load_initiation_file
73
    call  add_memory_for_folders
74
    call  device_detect_f70
4314 mario79 75
    call  select_starting_directories
1792 yogev_ezra 76
    mcall 66, 1, 1
77
    mov   eax,1
78
    mov   [left_sort_flag],eax
79
    mov   [right_sort_flag],eax
80
 
81
    call  proc_read_left_folder
82
    test  eax,eax
83
    jz	  @f
4400 mario79 84
 
1792 yogev_ezra 85
    cmp   eax,6
86
    jne   read_folder_error
87
@@:
88
    call  proc_read_right_folder
89
    test  eax,eax
90
    jz	  @f
4400 mario79 91
 
1792 yogev_ezra 92
    cmp   eax,6
5887 pathoswith 93
    je	  @f
4400 mario79 94
; if /hd read error for start then use /rd
95
    mov   esi,retrieved_devices_table+1
96
    call  copy_folder_name_1
97
    call  proc_read_right_folder
98
    test  eax,eax
99
    jz	  @f
100
 
101
    cmp   eax,6
1792 yogev_ezra 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
	xor	esi,esi
5887 pathoswith 182
    mcall 0, <20,728>, <20,460>, 0x43cccccc   ; 0x805080D0, 0x005080D0
1792 yogev_ezra 183
    call  get_window_param
2688 leency 184
 
185
    mcall 71, 1, header_text
186
 
2584 mario79 187
	test	[window_status],100b	; window is rolled up
188
	jnz	.exit
189
 
190
	test	[window_status],10b	; window is minimized to panel
191
	jnz	.exit
192
 
1792 yogev_ezra 193
    ; create_dir_name
194
    ; start_parameter
195
    ; file_name
196
    ; [temp_edi]
197
    ; header
198
    ; delete_file_data.name
199
    ; start_file_data.name
200
    ; start_parameter
201
     ; start_file_data.name
202
      ; read_icon_file.name
203
		; read_file_features.name ;path ;header
204
 
205
    cmp   [window_high],180
2584 mario79 206
    jb	  .exit
1792 yogev_ezra 207
    cmp   [window_width],495
2584 mario79 208
    jb	  .exit
1792 yogev_ezra 209
 
210
    call  draw_fbutton
211
    call  draw_left_panel
212
    call  draw_right_panel
213
    call  draw_device_button
214
    call  draw_left_select_disk_button
215
    call  draw_left_sort_button
216
    call  draw_right_select_disk_button
217
    call  draw_right_sort_button
218
    call  draw_menu_bar
219
    call  draw_buttons_panel
2584 mario79 220
.exit:
1792 yogev_ezra 221
    mcall 12, 2
222
    ret
223
;---------------------------------------------------------------------
224
prepare_load_data:
225
    mov   esi,path
226
    mov   edi,file_name
227
    call  copy_path
228
    call  get_file_size
229
    test  eax,eax
230
    ret
231
;---------------------------------------------------------------------
232
prepare_load_data_1:
233
    mov   [read_file.return],eax
234
    mov   ebp,eax
235
prepare_load_data_4:
236
    call  load_file
237
    test  eax,eax
238
    ret
239
;---------------------------------------------------------------------
240
prepare_load_data_2:
241
    call  add_application_memory
242
prepare_load_data_3:
243
    call  add_application_memory
244
    mov   eax,[file_features_temp_area+32]
245
    mov   [read_file.size],eax
246
    ret
247
;---------------------------------------------------------------------
248
load_icon_and_convert_to_img:
249
    mov   ebx,icons_file_name
250
    call  prepare_load_data
251
    jnz   icon_error
252
    call  prepare_load_data_2
253
    add   eax,mem
254
    call  prepare_load_data_1
255
    jnz   icon_error
256
    call  convert_bmp_to_img
257
    call  sub_application_memory
258
    ret
259
;---------------------------------------------------------------------
260
load_initiation_file:
261
    mov   ebx,ini_file_name
262
    call  prepare_load_data
263
    jnz   initiation_error
264
    call  prepare_load_data_3
265
    mov   eax,[appl_memory]
266
    mov   [left_folder_data],eax
267
    sub   eax,[read_file.size]
268
    mov   [read_file.return],eax
269
    mov   [ini_file_start],eax
270
    call  load_file
271
    test  eax,eax
272
    jnz   initiation_error
273
    mov   ebp,icons_associations
274
    call  search_star_and_end_tags
275
    mov   eax,[end_tag]
276
    mov   [icons_end_tag],eax
277
    ret
278
;---------------------------------------------------------------------
279
add_memory_for_folders:
280
    mov   ecx,[appl_memory]
281
    add   ecx,304*32+32
282
    mov   [right_folder_data],ecx
283
    add   ecx,304*32+32
284
    mov   [appl_memory],ecx
285
    mcall 64,1
3755 mario79 286
 
287
    mov   eax,[left_folder_data]
288
    mov   [read_folder.return],eax
289
    mov   eax,[right_folder_data]
290
    mov   [read_folder_1.return],eax
1792 yogev_ezra 291
    ret
292
;---------------------------------------------------------------------
293
copy_path:
294
    xor   eax,eax
295
@@:
296
    cld
297
    lodsb
298
    stosb
299
    test  eax,eax
300
    jnz   @b
301
    mov   esi,edi
302
@@:
303
    std
304
    lodsb
305
    cmp   al,'/'
306
    jnz   @b
307
    mov   edi,esi
308
    add   edi,2
309
    mov   esi,ebx
310
@@:
311
    cld
312
    lodsb
313
    stosb
314
    test  eax,eax
315
    jnz   @b
316
    ret
317
;---------------------------------------------------------------------
318
copy_path_1:
319
    xor   eax,eax
320
@@:
321
    cld
322
    lodsb
323
    stosb
324
    test  eax,eax
325
    jnz   @b
326
    mov   esi,ebx
327
    mov   [edi-1],byte '/'
328
@@:
329
    cld
330
    lodsb
331
    stosb
332
    test  eax,eax
333
    jnz   @b
334
    ret
335
;---------------------------------------------------------------------
336
add_application_memory:
337
    mov   ecx,[file_features_temp_area+32]
338
.1:
339
    add   ecx,[appl_memory]
340
    mov   [appl_memory],ecx
341
    mcall 64,1
342
    ret
343
;---------------------------------------------------------------------
344
sub_application_memory:
345
    mov   ecx,[appl_memory]
346
    sub   ecx,[file_features_temp_area+32]
347
.1:
348
    mov   [appl_memory],ecx
349
    mcall 64,1
350
    ret
351
;---------------------------------------------------------------------
352
include   'key.inc'
353
;---------------------------------------------------------------------
354
include   'markfile.inc'
355
;---------------------------------------------------------------------
356
include   'button.inc'
357
;---------------------------------------------------------------------
358
include   'mouse.inc'
359
;---------------------------------------------------------------------
360
include   'openfile.inc'
361
;---------------------------------------------------------------------
362
include   'draw.inc'
363
;---------------------------------------------------------------------
4631 mario79 364
include   'drw_dbut.inc'
365
;---------------------------------------------------------------------
1792 yogev_ezra 366
include   'menu_bar.inc'
367
;---------------------------------------------------------------------
368
include   'menu_drv.inc'
369
;---------------------------------------------------------------------
370
include   'delete.inc'
371
;---------------------------------------------------------------------
372
include   'copy.inc'
373
;---------------------------------------------------------------------
374
include   'creatdir.inc'
375
;---------------------------------------------------------------------
376
include   'confirm.inc'
377
;---------------------------------------------------------------------
378
include   'err_wind.inc'
379
;---------------------------------------------------------------------
380
include   'detect.inc'
381
;---------------------------------------------------------------------
382
include   'conv_bmp.inc'
383
;---------------------------------------------------------------------
384
include   'tran_ini.inc'
385
;---------------------------------------------------------------------
386
include   'help.inc'
387
;---------------------------------------------------------------------
388
include   'convchar.inc'
389
;---------------------------------------------------------------------
390
include   'sort.inc'
391
;---------------------------------------------------------------------
392
include   'exit.inc'
393
;---------------------------------------------------------------------
394
include   'progrbar.inc'
395
;---------------------------------------------------------------------
396
include   'scroll.inc'
397
;---------------------------------------------------------------------
398
include   'file_inf.inc'
399
;---------------------------------------------------------------------
400
include   'text.inc'
401
;---------------------------------------------------------------------
402
I_END:
4338 mario79 403
;include_debug_strings
1792 yogev_ezra 404
;---------------------------------------------------------------------
405
include   'data.inc'
406
;---------------------------------------------------------------------
407
mem: