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