Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
1951 mario79 1
;*****************************************************************************
4878 leency 2
;*****************************************************************************
1951 mario79 3
; zSea - advanced image viewer for KolibriOS
4878 leency 4
; Copyright (c) 2008-2014, Marat Zakiyanov aka Mario79, aka Mario
1951 mario79 5
; All rights reserved.
6
;
7
; Redistribution and use in source and binary forms, with or without
8
; modification, are permitted provided that the following conditions are met:
9
;	 * Redistributions of source code must retain the above copyright
10
;	   notice, this list of conditions and the following disclaimer.
11
;	 * Redistributions in binary form must reproduce the above copyright
12
;	   notice, this list of conditions and the following disclaimer in the
13
;	   documentation and/or other materials provided with the distribution.
14
;	 * Neither the name of the  nor the
15
;	   names of its contributors may be used to endorse or promote products
16
;	   derived from this software without specific prior written permission.
17
;
18
; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY
19
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
; DISCLAIMED. IN NO EVENT SHALL  BE LIABLE FOR ANY
22
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
;*****************************************************************************
4878 leency 29
;	v.1.0 rс5 22.04.2014
1951 mario79 30
;******************************************************************************
31
	use32
32
	org 0x0
33
	db 'MENUET01'	; 8 byte id
34
	dd 0x01		; header version
35
	dd START	; start of code
36
	dd IM_END	; size of image
37
	dd I_END	; memory for app
38
	dd stacktop	; esp
3829 mario79 39
	dd ext_dest_cmdline	; I_Param
1951 mario79 40
	dd path		; APPLICATION PACH
41
 
42
include 'lang.inc'
43
;include 'macros.inc'
44
;include 'editbox_ex.mac'
45
;include 'proc32.inc'
46
include '../../macros.inc'
47
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
48
include '../../proc32.inc'
3425 mario79 49
;include 'debug.inc'
1951 mario79 50
;include 'load_lib.mac'
51
include '../../develop/libraries/box_lib/load_lib.mac'
52
        @use_library    ;use load lib macros
53
;******************************************************************************
3829 mario79 54
ext_dest_cmdline:
55
	dd 0xffffffff
56
	dd temp_area
57
;------------------------------------------------------------------------------
1951 mario79 58
START:				; start of execution
59
	mcall	68, 11
60
	mcall	66, 1,1
61
	mcall 40, 0x27
62
 
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
 
2116 mario79 75
	mcall	48,4
76
	mov	[skin_height],eax
77
 
1951 mario79 78
	mcall	68,12,1024
79
	mov	[menu_data_1.procinfo],eax
80
	mov	[menu_data_2.procinfo],eax
81
	mov	[menu_data_3.procinfo],eax
82
	mov	[menu_data_4.procinfo],eax
83
	mov	[menu_data_5.procinfo],eax
84
	mov	[menu_data_6.procinfo],eax
85
 
86
	mov	[load_directory_pointer],dir_header
87
 
88
 
89
	call	load_plugins
90
 
3184 IgorA 91
	;init_checkboxes2 check1,...
92
	push	check1
93
	call	[init_checkbox]
94
	push	check2
95
	call	[init_checkbox]
1951 mario79 96
 
97
	call	load_buttons
98
 
99
;	call	init_data_OpenDialog
100
 
101
;init_OpenDialog	OpenDialog_data
102
	push    dword OpenDialog_data
103
	call    [OpenDialog_Init]
104
 
3423 mario79 105
;init_ColorDialog	ColorDialog_data
106
	push    dword ColorDialog_data
107
	call    [ColorDialog_Init]
108
 
1951 mario79 109
	call	get_filter_data
110
 
111
;-----------------------------------------------------
112
; check for parameters
113
	cmp	dword [temp_area],'BOOT'
114
	jne	.no_boot
115
.background:
116
	call	load_image
117
	cmp	[error_fs],0
118
	jnz	.exit
119
	call	convert
120
 
121
	call	background
122
 
123
.exit:
124
	call Set_ini
125
.exit_1:
126
	mov	ebx,18
127
	mov	edx,PID1
128
	mov	esi,7
129
.kill_successors:
130
	mov	ecx,[edx]
131
	add	edx,4
132
	test	ecx,ecx
133
	jz	@f
134
	mcall 18
135
@@:
136
	dec	esi
137
	jnz	.kill_successors
138
 
139
	mcall -1
140
;-----------------------------------------------------
141
 .no_boot:
142
	xor	eax,eax
143
	cmp	byte [temp_area],al
144
	jnz	@f
145
	mov	[file_name],eax
146
	jmp .no_param
147
@@:
148
 
149
 
150
	mov	edi,string	; clear string
3829 mario79 151
	mov	ecx,4096/4	;256/4	;	length of a string
1951 mario79 152
	xor	eax,eax	;	symbol <0>
153
	rep	stosd
154
 
155
 
156
	mov	edi,temp_area	; look for <0> in temp_area
157
 
158
	cmp	[edi],byte "\"
159
	jne	.continue
160
	cmp	[edi+1],byte "T"
161
	jne	@f
162
	mov	[bgrmode],dword 1
163
	jmp	.continue_1
164
@@:
165
	cmp	[edi+1],byte "S"
166
	jne	START.exit
167
	mov	[bgrmode],dword 2
168
.continue_1:
169
	add	edi,4
170
.continue:
171
	mov	esi,edi
3829 mario79 172
	mov	ecx,4095 ;257	;	strlen
1951 mario79 173
	repne scasb
174
	lea		ecx, [edi-temp_area]
175
 
176
	mov	edi,string
177
	rep	movsb		; copy string from temp_area to "string" (filename)
178
	cmp	[temp_area],byte "\"
179
	je	START.background
180
	call	load_directory
181
	test	eax,eax
182
	jnz	@f
183
	call	load_image
184
	test	eax,eax
185
	jnz	@f
186
	call	convert
187
	jmp	.no_param
188
@@:
189
	mov	[load_directory_pointer],dir_header
190
	mov	[error_fs],eax
191
	call	convert.error
192
;-----------------------------------------------------
193
 .no_param:
194
;	or	ecx,-1		; get information about me
195
;	call getappinfo
196
 
197
;	mov edx,[process_info+30] ; теперь в edx наш идентификатор
198
;	mov ecx,eax
199
 
200
;	@@:
201
;	call getappinfo
202
;	cmp edx,[process_info+30]
203
;	je	@f	; если наш PID совпал с PID рассматриваемого процесса, мы нашли себя
204
;	dec ecx ; иначе смотрим следующий процесс
205
;	jne @b	; возвращаемся, если не все процессы рассмотрены
206
;	@@:
207
 
208
; теперь в ecx номер процесса
209
;	mov	[process],ecx
210
;---------------------------------------------------------------------
211
	cmp	[wnd_width],635
212
	jae	@f
213
	mov	[wnd_width],635
214
@@:
4878 leency 215
	mcall 48, 5     ; GetClientTop, fix for case when @patel in the top
216
    shr ebx, 16
217
	mov	ecx,ebx
218
	shl ecx,16
219
	add ecx,150	   ; [y start] *65536 + [y size]
220
	cmp	[wnd_height],ecx
1951 mario79 221
	jae	@f
4878 leency 222
	mov	[wnd_height],ecx
1951 mario79 223
@@:
224
;	call draw_window
225
red:
226
;draw_still:
227
;	pusha
228
	call	get_window_param
229
	test	[window_status],10b
230
	jnz	red_1	;still
231
	test	[window_status],100b
232
	jnz	red_1
233
	test	[window_status],1b
234
	jnz	red_1
235
	mov esi,-1
236
	mov eax,procinfo
237
	mov eax,[eax+66]
238
	cmp	eax,150
239
;	cmp	[window_high],150
240
	jae	@f
241
	mov	esi,150
242
	mcall 67,-1,ebx,ebx
243
@@:
244
	mov edx,-1
245
	mov eax,procinfo
246
	mov eax,[eax+62]
247
	cmp	eax,635
248
;	cmp	[window_width],635
249
	jae	@f	;red_1
250
	mov	edx,635
251
	mcall 67,-1,ebx, ,ebx
252
@@:
253
;	mcall 67,-1,ebx
254
;	popa
255
;	xor esi,esi
256
red_1:
257
;	xor	eax,eax
258
;	mov	[scroll_bar_data_vertical.position],eax
259
;	mov	[scroll_bar_data_horizontal.position],eax
260
 
261
	call draw_window
262
 
263
	cmp	[redraw_wallpaper_flag],0
264
	je	still
265
	mov	[redraw_wallpaper_flag],0
266
	call	clear_thread
267
;	mcall 15,3
268
;	jmp  red_1
269
still:
2116 mario79 270
	call	pause_cicle
271
 
1951 mario79 272
	cmp	[RAW1_flag],1
273
	je	animation_handler
2116 mario79 274
 
275
	mcall	48,4
276
	cmp	[skin_height],eax
277
	je	@f
278
	mov	[skin_height],eax
279
	call	convert.img_resolution_ok
280
	jmp	red_1
281
@@:
1951 mario79 282
	mcall	10
283
.1:
284
	cmp	[open_file_flag],1
285
	je	kopen_1
286
	cmp	[sort_directory_flag],byte 1
287
	je	red_sort_directory
288
	cmp	[redraw_flag],byte 1
289
	je	redraw_window
290
	cmp	eax,1	; перерисовать окно ?
291
	je		red	; если да - на метку red
292
	cmp	eax,2	; нажата клавиша ?
293
	je		key	; если да - на key
294
	cmp	eax,3	; нажата кнопка ?
295
	je		button		; если да - на button
296
	cmp	eax,6
297
	je	mouse
298
;	cmp [redraw_wallpaper_flag],1
299
;	jne still
300
;	mov	[redraw_wallpaper_flag],0
301
;	mcall	15,3
302
	jmp	still	; если другое событие - в начало цикла
303
 
304
red_sort_directory:
305
	mov	[sort_directory_flag],byte 0
306
	jmp	red_1
307
 
308
redraw_window:
309
	mov	[redraw_flag],byte 0
310
	jmp	red_1
2116 mario79 311
 
1951 mario79 312
;---------------------------------------------------------------------
313
;	red:
314
;	test	dword [status], 4
315
;	jz	draw_still
316
;	mov	al,18
317
;	mov	ebx,3
318
;	mov	ecx,[process]
319
;	mcall	18,3,[active_process]
320
;	and	byte [status], not 4
321
;	jmp	still
322
;---------------------------------------------------------------------
323
button:			; button
324
	mov	eax,17		; get id
325
	mcall
326
	cmp	ah,1			; button id=1 ?
327
	je	START.exit
328
;	jne	.noclose
329
;
330
;	mov	eax,-1		; close this program
331
;	mcall
332
.noclose:
333
	cmp	ah,2
334
	je	slide_show.3	;still
335
	jmp	slide_show
336
;---------------------------------------------------------------------
2116 mario79 337
pause_cicle:
338
	pusha
339
.start:
340
	mcall	9,procinfo,-1
341
	mov	eax,[procinfo+70] ;status of window
342
	test	eax,100b
343
	jne	@f
344
	popa
345
	ret
346
@@:
347
	mcall	10
348
	dec	eax
349
	jz	.redraw
350
	dec	eax
351
	jz	.key
352
	dec	eax
353
	jnz	.start
354
.button:
355
	mcall	-1
356
.key:
357
	mcall	2
358
	jmp	.start
359
.redraw:
360
	call	draw_window
361
	jmp	.start
362
;---------------------------------------------------------------------
2000 mario79 363
get_filter_data:
364
	mov	edi,Filter+4
365
	xor	eax,eax
366
	mov	ecx,10
367
	cld
368
@@:
369
	mov	esi,10
370
	sub	esi,ecx
371
	lea     esi,[esi+esi*2] ; x 3
372
	shl	esi,3  ; x 8
373
	add	esi,dword Convert_plugin_0.Assoc
374
	mov	esi,[esi]
375
	add	esi,4
376
 
377
	test	esi,esi
378
	jz	@f
379
	call	.start
380
	dec	ecx
381
	jnz	@r
382
@@:
383
	mov	[edi],byte 0
384
	mov	eax,Filter
385
	sub	edi,eax
386
	mov	[eax],edi
387
 
388
	ret
389
.start:
390
@@:
391
	lodsb
392
	stosb
393
	test	eax,eax
394
	jnz	@r
395
	cmp	[esi],ah
396
	jne	@r
397
	ret
398
;---------------------------------------------------------------------
1951 mario79 399
kopen_1:
400
 
401
	mov	[open_file_flag],0
402
	call	load_directory
403
	test	eax,eax
404
	jz	kopen
405
.err:
406
	mov	[load_directory_pointer],dir_header
407
	mov	[error_fs],eax
408
	call	convert.error
409
	jmp	still	;red_1
410
 
411
kopen:
412
	cmp	[string],byte 0
413
	je	still
414
 
415
	mov	ecx,-1
416
	call	getappinfo
417
 
418
	call	load_image
419
 
420
	test	eax,eax
421
	jnz	kopen_1.err
422
	call	convert
423
 
424
.1:
425
	call	get_window_param
426
	test	[window_status],1b
427
	jz	red	;draw_still
428
	mov	[no_draw_window],1
429
 
430
;	push	edx
431
;	mov	edx,size_after_convert_2
432
;	call	write_memory_size
433
;	pop	edx
434
 
435
	call	draw_other
436
 
437
	mov	[no_draw_window],0
438
;	jmp	draw_still
439
	jmp	still
440
;---------------------------------------------------------------------
441
getappinfo:
442
	mov	eax,9
443
	mov	ebx,process_info
444
	mcall
445
	ret
446
;---------------------------------------------------------------------
447
get_window_param:
448
	mcall	9, procinfo, -1
449
	mov	eax,[ebx+34]
450
	mov	[window_start_x],eax
451
	mov	eax,[ebx+38]
452
	mov	[window_start_y],eax
453
	mov	eax,[ebx+66]   ;46]
454
	inc	eax
455
	mov	[window_high],eax
456
	mov	eax,[ebx+62]   ;42]
457
	inc	eax
458
	mov	[window_width],eax
459
	mov	eax,[ebx+70]
460
	mov	[window_status],eax
461
;	mcall	48,4
462
;	mov	[skin_high],eax
463
	ret
464
;---------------------------------------------------------------------
465
;write_memory_size:
466
;	pusha
467
;	mcall	9, procinfo, -1
468
;	mov	eax,[ebx+26]
469
;	mov	[edx],eax
470
;	popa
471
;	ret
472
;---------------------------------------------------------------------
2000 mario79 473
include	'backgrnd.inc'
1951 mario79 474
include	'draw_win.inc'
475
include	'full_win.inc'
476
include	'mouse.inc'
477
include	'key.inc'
478
include	'menu_key.inc'
479
include	'clr_bcgr.inc'
480
include	'w_error.inc'
481
include	'load.inc'
482
include	'animat.inc'
483
include	'draw_img.inc'
484
include	'convert.inc'
485
include	'zoom.inc'
486
include	'w_about.inc'
487
include	'win_file.inc'
488
include	'win_info.inc'
489
include	'win_bcgr.inc'
490
include	'win_sort.inc'
491
include	'win_opti.inc'
492
include	'libini.inc'
3184 IgorA 493
include	'../../dll.inc'
1951 mario79 494
include	'data.inc'
495
;---------------------------------------------------------------------
496
IM_END:
497
include	'dat_area.inc'
498
I_END: