Subversion Repositories Kolibri OS

Rev

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

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