Subversion Repositories Kolibri OS

Rev

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
6435 serge 39
    dd 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
;------------------------------------------------------------------------------
1951 mario79 55
START:				; start of execution
56
	mcall	68, 11
57
	mcall	66, 1,1
58
	mcall 40, 0x27
59
 
60
	mcall 9, procinfo, -1
61
	mov	eax,[ebx+30]
62
	mov	[PID],eax
63
	xor	ecx,ecx
64
@@:
65
	inc	ecx
66
	mcall 9, procinfo
67
	mov	eax,[PID]
68
	cmp	eax,[ebx+30]
69
	jne	@r
70
	mov	[active_process],ecx
71
 
2116 mario79 72
	mcall	48,4
73
	mov	[skin_height],eax
6435 serge 74
 
1951 mario79 75
	mcall	68,12,1024
76
	mov	[menu_data_1.procinfo],eax
77
	mov	[menu_data_2.procinfo],eax
78
	mov	[menu_data_3.procinfo],eax
79
	mov	[menu_data_4.procinfo],eax
80
	mov	[menu_data_5.procinfo],eax
81
	mov	[menu_data_6.procinfo],eax
82
 
83
	mov	[load_directory_pointer],dir_header
84
 
85
 
86
	call	load_plugins
87
 
3184 IgorA 88
	;init_checkboxes2 check1,...
89
	push	check1
90
	call	[init_checkbox]
91
	push	check2
92
	call	[init_checkbox]
1951 mario79 93
 
94
	call	load_buttons
95
 
96
;	call	init_data_OpenDialog
97
 
98
;init_OpenDialog	OpenDialog_data
99
	push    dword OpenDialog_data
100
	call    [OpenDialog_Init]
101
 
3423 mario79 102
;init_ColorDialog	ColorDialog_data
103
	push    dword ColorDialog_data
104
	call    [ColorDialog_Init]
6435 serge 105
 
1951 mario79 106
	call	get_filter_data
107
 
108
;-----------------------------------------------------
109
; check for parameters
6435 serge 110
    mov     esi, [28]
111
    cmp dword [esi],'BOOT'
1951 mario79 112
	jne	.no_boot
113
.background:
114
	call	load_image
115
	cmp	[error_fs],0
116
	jnz	.exit
117
	call	convert
118
 
119
	call	background
120
 
121
.exit:
122
	call Set_ini
123
.exit_1:
124
	mov	ebx,18
125
	mov	edx,PID1
126
	mov	esi,7
127
.kill_successors:
128
	mov	ecx,[edx]
129
	add	edx,4
130
	test	ecx,ecx
131
	jz	@f
132
	mcall 18
133
@@:
134
	dec	esi
135
	jnz	.kill_successors
6435 serge 136
 
1951 mario79 137
	mcall -1
138
;-----------------------------------------------------
139
 .no_boot:
140
	xor	eax,eax
6435 serge 141
    cmp [esi],al
1951 mario79 142
	jnz	@f
143
	mov	[file_name],eax
144
	jmp .no_param
145
@@:
146
 
147
 
148
	mov	edi,string	; clear string
3829 mario79 149
	mov	ecx,4096/4	;256/4	;	length of a string
1951 mario79 150
	xor	eax,eax	;	symbol <0>
151
	rep	stosd
152
 
153
 
6435 serge 154
    mov edi, [28]  ; look for <0> in temp_area
1951 mario79 155
 
156
	cmp	[edi],byte "\"
157
	jne	.continue
158
	cmp	[edi+1],byte "T"
159
	jne	@f
160
	mov	[bgrmode],dword 1
161
	jmp	.continue_1
162
@@:
163
	cmp	[edi+1],byte "S"
164
	jne	START.exit
165
	mov	[bgrmode],dword 2
166
.continue_1:
167
	add	edi,4
168
.continue:
169
	mov	esi,edi
3829 mario79 170
	mov	ecx,4095 ;257	;	strlen
1951 mario79 171
	repne scasb
6435 serge 172
    mov     ecx, edi
173
    sub     ecx, [28]
1951 mario79 174
 
175
	mov	edi,string
176
	rep	movsb		; copy string from temp_area to "string" (filename)
6435 serge 177
    mov ecx, [28]
178
    cmp [ecx],byte "\"
1951 mario79 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
;---------------------------------------------------------------------
6637 leency 211
	cmp	[wnd_width],778
1951 mario79 212
	jae	@f
6637 leency 213
	mov	[wnd_width],778
1951 mario79 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
6637 leency 219
	add ecx,523	   ; [y start] *65536 + [y size]
4878 leency 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
6435 serge 262
 
1951 mario79 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
6435 serge 271
 
1951 mario79 272
	cmp	[RAW1_flag],1
273
	je	animation_handler
6435 serge 274
 
2116 mario79 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
6435 serge 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
6435 serge 353
	jnz	.start
2116 mario79 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: