Subversion Repositories Kolibri OS

Rev

Rev 7863 | Rev 9121 | 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_initiation_file
72
    call  add_memory_for_folders
73
    call  device_detect_f70
4314 mario79 74
    call  select_starting_directories
1792 yogev_ezra 75
    mcall 66, 1, 1
76
    mov   eax,1
77
    mov   [left_sort_flag],eax
78
    mov   [right_sort_flag],eax
79
 
80
    call  proc_read_left_folder
81
    test  eax,eax
82
    jz	  @f
4400 mario79 83
 
1792 yogev_ezra 84
    cmp   eax,6
85
    jne   read_folder_error
86
@@:
87
    call  proc_read_right_folder
88
    test  eax,eax
89
    jz	  @f
4400 mario79 90
 
1792 yogev_ezra 91
    cmp   eax,6
5887 pathoswith 92
    je	  @f
4400 mario79 93
; if /hd read error for start then use /rd
94
    mov   esi,retrieved_devices_table+1
95
    call  copy_folder_name_1
96
    call  proc_read_right_folder
97
    test  eax,eax
98
    jz	  @f
99
 
100
    cmp   eax,6
1792 yogev_ezra 101
    jne   read_folder_1_error
102
@@:
103
	mcall 40, 0x27
104
	jmp   red_1
105
;---------------------------------------------------------------------
106
red:
107
    call  get_window_param
108
    test  [window_status],10b
109
    jnz   red_1   ;still
110
    test  [window_status],100b
111
    jnz   red_1
112
    cmp   [window_high],180
113
    ja	  @f
114
    mov   esi,180
115
    mcall 67,-1,ebx,ebx
116
@@:
117
    cmp   [window_width],495
118
    ja	  red_1
119
    mov   edx,495
120
    mcall 67,-1,ebx, ,ebx
121
red_1:
122
    call  draw_window
123
;---------------------------------------------------------------------
124
still:
125
    mcall 10
2616 mario79 126
 
127
    call  check_active_process_for_clear_all_flags
128
 
1792 yogev_ezra 129
    cmp   eax,1
130
    je	  red
131
    cmp   eax,2
132
    je	  key
133
    cmp   eax,3
134
    je	  button
135
    cmp   eax,6
136
    je	  mouse
137
    jmp   still
138
;---------------------------------------------------------------------
2616 mario79 139
check_active_process_for_clear_all_flags:
140
	push	eax
141
	mcall	18,7
142
	cmp	[active_process],eax
143
	je	.exit
144
 
145
	xor	eax,eax
146
	cmp	[shift_flag],al
147
	jne	.clear_all_flags
148
 
149
	cmp	[ctrl_flag],al
150
	jne	.clear_all_flags
151
 
152
	cmp	[ctrl_flag],al
153
	je	.exit
154
;--------------------------------------
155
.clear_all_flags:
156
	mov	[shift_flag],al
157
	mov	[ctrl_flag],al
158
	mov	[alt_flag],al
159
	call	erase_fbutton
160
	call	draw_fbutton
161
;--------------------------------------
162
.exit:
163
	pop	eax
164
	ret
165
;---------------------------------------------------------------------
1792 yogev_ezra 166
get_window_param:
167
    mcall 9, procinfo, -1
168
    mov   eax,[ebx+46]
169
    mov   [window_high],eax
170
    mov   eax,[ebx+42]
171
    mov   [window_width],eax
172
    mov   eax,[ebx+70]
173
    mov   [window_status],eax
174
    mcall 48,4
175
    mov   [skin_high],eax
176
    ret
177
;---------------------------------------------------------------------
178
draw_window:
179
    mcall 12, 1
180
	xor	esi,esi
5887 pathoswith 181
    mcall 0, <20,728>, <20,460>, 0x43cccccc   ; 0x805080D0, 0x005080D0
1792 yogev_ezra 182
    call  get_window_param
2688 leency 183
 
184
    mcall 71, 1, header_text
185
 
2584 mario79 186
	test	[window_status],100b	; window is rolled up
187
	jnz	.exit
188
 
189
	test	[window_status],10b	; window is minimized to panel
190
	jnz	.exit
191
 
1792 yogev_ezra 192
    ; create_dir_name
193
    ; start_parameter
194
    ; file_name
195
    ; [temp_edi]
196
    ; header
197
    ; delete_file_data.name
198
    ; start_file_data.name
199
    ; start_parameter
200
     ; start_file_data.name
201
      ; read_icon_file.name
202
		; read_file_features.name ;path ;header
203
 
204
    cmp   [window_high],180
2584 mario79 205
    jb	  .exit
1792 yogev_ezra 206
    cmp   [window_width],495
2584 mario79 207
    jb	  .exit
1792 yogev_ezra 208
 
209
    call  draw_fbutton
210
    call  draw_left_panel
211
    call  draw_right_panel
212
    call  draw_device_button
213
    call  draw_left_select_disk_button
214
    call  draw_left_sort_button
215
    call  draw_right_select_disk_button
216
    call  draw_right_sort_button
217
    call  draw_menu_bar
218
    call  draw_buttons_panel
2584 mario79 219
.exit:
1792 yogev_ezra 220
    mcall 12, 2
221
    ret
222
;---------------------------------------------------------------------
223
prepare_load_data:
224
    mov   esi,path
225
    mov   edi,file_name
226
    call  copy_path
227
    call  get_file_size
228
    test  eax,eax
229
    ret
230
;---------------------------------------------------------------------
231
prepare_load_data_1:
232
    mov   [read_file.return],eax
233
    mov   ebp,eax
234
prepare_load_data_4:
235
    call  load_file
236
    test  eax,eax
237
    ret
238
;---------------------------------------------------------------------
239
prepare_load_data_2:
240
    call  add_application_memory
241
prepare_load_data_3:
242
    call  add_application_memory
243
    mov   eax,[file_features_temp_area+32]
244
    mov   [read_file.size],eax
245
    ret
246
;---------------------------------------------------------------------
247
load_initiation_file:
248
    mov   ebx,ini_file_name
249
    call  prepare_load_data
250
    jnz   initiation_error
251
    call  prepare_load_data_3
252
    mov   eax,[appl_memory]
253
    mov   [left_folder_data],eax
254
    sub   eax,[read_file.size]
255
    mov   [read_file.return],eax
256
    mov   [ini_file_start],eax
257
    call  load_file
258
    test  eax,eax
259
    jnz   initiation_error
260
    mov   ebp,icons_associations
261
    call  search_star_and_end_tags
262
    mov   eax,[end_tag]
263
    mov   [icons_end_tag],eax
264
    ret
265
;---------------------------------------------------------------------
266
add_memory_for_folders:
267
    mov   ecx,[appl_memory]
268
    add   ecx,304*32+32
269
    mov   [right_folder_data],ecx
270
    add   ecx,304*32+32
271
    mov   [appl_memory],ecx
272
    mcall 64,1
3755 mario79 273
 
274
    mov   eax,[left_folder_data]
275
    mov   [read_folder.return],eax
276
    mov   eax,[right_folder_data]
277
    mov   [read_folder_1.return],eax
1792 yogev_ezra 278
    ret
279
;---------------------------------------------------------------------
280
copy_path:
281
    xor   eax,eax
282
@@:
283
    cld
284
    lodsb
285
    stosb
286
    test  eax,eax
287
    jnz   @b
288
    mov   esi,edi
289
@@:
290
    std
291
    lodsb
292
    cmp   al,'/'
293
    jnz   @b
294
    mov   edi,esi
295
    add   edi,2
296
    mov   esi,ebx
297
@@:
298
    cld
299
    lodsb
300
    stosb
301
    test  eax,eax
302
    jnz   @b
303
    ret
304
;---------------------------------------------------------------------
305
copy_path_1:
306
    xor   eax,eax
307
@@:
308
    cld
309
    lodsb
310
    stosb
311
    test  eax,eax
312
    jnz   @b
313
    mov   esi,ebx
314
    mov   [edi-1],byte '/'
315
@@:
316
    cld
317
    lodsb
318
    stosb
319
    test  eax,eax
320
    jnz   @b
321
    ret
322
;---------------------------------------------------------------------
323
add_application_memory:
324
    mov   ecx,[file_features_temp_area+32]
325
.1:
326
    add   ecx,[appl_memory]
327
    mov   [appl_memory],ecx
328
    mcall 64,1
329
    ret
330
;---------------------------------------------------------------------
331
sub_application_memory:
332
    mov   ecx,[appl_memory]
333
    sub   ecx,[file_features_temp_area+32]
334
.1:
335
    mov   [appl_memory],ecx
336
    mcall 64,1
337
    ret
338
;---------------------------------------------------------------------
7996 leency 339
exit_apl:
340
    mov  [confirmation_type],exit_type
341
    call confirmation_action
342
    cmp  [work_confirmation_yes],1
343
    jne  red
344
    mcall -1
345
;---------------------------------------------------------------------
1792 yogev_ezra 346
include   'key.inc'
347
;---------------------------------------------------------------------
348
include   'markfile.inc'
349
;---------------------------------------------------------------------
350
include   'button.inc'
351
;---------------------------------------------------------------------
352
include   'mouse.inc'
353
;---------------------------------------------------------------------
354
include   'openfile.inc'
355
;---------------------------------------------------------------------
356
include   'draw.inc'
357
;---------------------------------------------------------------------
4631 mario79 358
include   'drw_dbut.inc'
359
;---------------------------------------------------------------------
1792 yogev_ezra 360
include   'menu_bar.inc'
361
;---------------------------------------------------------------------
362
include   'menu_drv.inc'
363
;---------------------------------------------------------------------
364
include   'delete.inc'
365
;---------------------------------------------------------------------
366
include   'copy.inc'
367
;---------------------------------------------------------------------
368
include   'creatdir.inc'
369
;---------------------------------------------------------------------
370
include   'confirm.inc'
371
;---------------------------------------------------------------------
372
include   'err_wind.inc'
373
;---------------------------------------------------------------------
374
include   'detect.inc'
375
;---------------------------------------------------------------------
376
include   'tran_ini.inc'
377
;---------------------------------------------------------------------
378
include   'help.inc'
379
;---------------------------------------------------------------------
380
include   'convchar.inc'
381
;---------------------------------------------------------------------
382
include   'sort.inc'
383
;---------------------------------------------------------------------
384
include   'progrbar.inc'
385
;---------------------------------------------------------------------
386
include   'scroll.inc'
387
;---------------------------------------------------------------------
388
include   'file_inf.inc'
389
;---------------------------------------------------------------------
390
include   'text.inc'
391
;---------------------------------------------------------------------
392
I_END:
4338 mario79 393
;include_debug_strings
1792 yogev_ezra 394
;---------------------------------------------------------------------
395
include   'data.inc'
396
;---------------------------------------------------------------------
397
mem: