Rev 1959 | Go to most recent revision | Details | 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 | ;***************************************************************************** |
||
28 | ; v.1.0 rс3 12.06.2011 |
||
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 | |||
72 | mcall 68,12,1024 |
||
73 | mov [menu_data_1.procinfo],eax |
||
74 | mov [menu_data_2.procinfo],eax |
||
75 | mov [menu_data_3.procinfo],eax |
||
76 | mov [menu_data_4.procinfo],eax |
||
77 | mov [menu_data_5.procinfo],eax |
||
78 | mov [menu_data_6.procinfo],eax |
||
79 | |||
80 | mov [load_directory_pointer],dir_header |
||
81 | |||
82 | |||
83 | call load_plugins |
||
84 | |||
85 | |||
86 | call load_buttons |
||
87 | |||
88 | ; call init_data_OpenDialog |
||
89 | |||
90 | ;init_OpenDialog OpenDialog_data |
||
91 | push dword OpenDialog_data |
||
92 | call [OpenDialog_Init] |
||
93 | |||
94 | call get_filter_data |
||
95 | |||
96 | ;----------------------------------------------------- |
||
97 | ; check for parameters |
||
98 | cmp dword [temp_area],'BOOT' |
||
99 | jne .no_boot |
||
100 | .background: |
||
101 | call load_image |
||
102 | cmp [error_fs],0 |
||
103 | jnz .exit |
||
104 | call convert |
||
105 | |||
106 | call background |
||
107 | |||
108 | .exit: |
||
109 | call Set_ini |
||
110 | .exit_1: |
||
111 | mov ebx,18 |
||
112 | mov edx,PID1 |
||
113 | mov esi,7 |
||
114 | .kill_successors: |
||
115 | mov ecx,[edx] |
||
116 | add edx,4 |
||
117 | test ecx,ecx |
||
118 | jz @f |
||
119 | mcall 18 |
||
120 | @@: |
||
121 | dec esi |
||
122 | jnz .kill_successors |
||
123 | |||
124 | mcall -1 |
||
125 | ;----------------------------------------------------- |
||
126 | .no_boot: |
||
127 | xor eax,eax |
||
128 | cmp byte [temp_area],al |
||
129 | jnz @f |
||
130 | mov [file_name],eax |
||
131 | jmp .no_param |
||
132 | @@: |
||
133 | |||
134 | |||
135 | mov edi,string ; clear string |
||
136 | mov ecx,256/4 ; length of a string |
||
137 | xor eax,eax ; symbol <0> |
||
138 | rep stosd |
||
139 | |||
140 | |||
141 | mov edi,temp_area ; look for <0> in temp_area |
||
142 | |||
143 | cmp [edi],byte "\" |
||
144 | jne .continue |
||
145 | cmp [edi+1],byte "T" |
||
146 | jne @f |
||
147 | mov [bgrmode],dword 1 |
||
148 | jmp .continue_1 |
||
149 | @@: |
||
150 | cmp [edi+1],byte "S" |
||
151 | jne START.exit |
||
152 | mov [bgrmode],dword 2 |
||
153 | .continue_1: |
||
154 | add edi,4 |
||
155 | .continue: |
||
156 | mov esi,edi |
||
157 | mov ecx,257 ; strlen |
||
158 | repne scasb |
||
159 | lea ecx, [edi-temp_area] |
||
160 | |||
161 | mov edi,string |
||
162 | rep movsb ; copy string from temp_area to "string" (filename) |
||
163 | cmp [temp_area],byte "\" |
||
164 | je START.background |
||
165 | call load_directory |
||
166 | test eax,eax |
||
167 | jnz @f |
||
168 | call load_image |
||
169 | test eax,eax |
||
170 | jnz @f |
||
171 | call convert |
||
172 | jmp .no_param |
||
173 | @@: |
||
174 | mov [load_directory_pointer],dir_header |
||
175 | mov [error_fs],eax |
||
176 | call convert.error |
||
177 | ;----------------------------------------------------- |
||
178 | .no_param: |
||
179 | ; or ecx,-1 ; get information about me |
||
180 | ; call getappinfo |
||
181 | |||
182 | ; mov edx,[process_info+30] ; теперь в edx наш идентификатор |
||
183 | ; mov ecx,eax |
||
184 | |||
185 | ; @@: |
||
186 | ; call getappinfo |
||
187 | ; cmp edx,[process_info+30] |
||
188 | ; je @f ; если наш PID совпал с PID рассматриваемого процесса, мы нашли себя |
||
189 | ; dec ecx ; иначе смотрим следующий процесс |
||
190 | ; jne @b ; возвращаемся, если не все процессы рассмотрены |
||
191 | ; @@: |
||
192 | |||
193 | ; теперь в ecx номер процесса |
||
194 | ; mov [process],ecx |
||
195 | ;--------------------------------------------------------------------- |
||
196 | cmp [wnd_width],635 |
||
197 | jae @f |
||
198 | mov [wnd_width],635 |
||
199 | @@: |
||
200 | cmp [wnd_height],150 |
||
201 | jae @f |
||
202 | mov [wnd_height],150 |
||
203 | @@: |
||
204 | ; call draw_window |
||
205 | red: |
||
206 | ;draw_still: |
||
207 | ; pusha |
||
208 | call get_window_param |
||
209 | test [window_status],10b |
||
210 | jnz red_1 ;still |
||
211 | test [window_status],100b |
||
212 | jnz red_1 |
||
213 | test [window_status],1b |
||
214 | jnz red_1 |
||
215 | mov esi,-1 |
||
216 | mov eax,procinfo |
||
217 | mov eax,[eax+66] |
||
218 | cmp eax,150 |
||
219 | ; cmp [window_high],150 |
||
220 | jae @f |
||
221 | mov esi,150 |
||
222 | mcall 67,-1,ebx,ebx |
||
223 | @@: |
||
224 | mov edx,-1 |
||
225 | mov eax,procinfo |
||
226 | mov eax,[eax+62] |
||
227 | cmp eax,635 |
||
228 | ; cmp [window_width],635 |
||
229 | jae @f ;red_1 |
||
230 | mov edx,635 |
||
231 | mcall 67,-1,ebx, ,ebx |
||
232 | @@: |
||
233 | ; mcall 67,-1,ebx |
||
234 | ; popa |
||
235 | ; xor esi,esi |
||
236 | red_1: |
||
237 | ; xor eax,eax |
||
238 | ; mov [scroll_bar_data_vertical.position],eax |
||
239 | ; mov [scroll_bar_data_horizontal.position],eax |
||
240 | |||
241 | call draw_window |
||
242 | |||
243 | cmp [redraw_wallpaper_flag],0 |
||
244 | je still |
||
245 | mov [redraw_wallpaper_flag],0 |
||
246 | call clear_thread |
||
247 | ; mcall 15,3 |
||
248 | ; jmp red_1 |
||
249 | still: |
||
250 | cmp [RAW1_flag],1 |
||
251 | je animation_handler |
||
252 | mcall 10 |
||
253 | .1: |
||
254 | cmp [open_file_flag],1 |
||
255 | je kopen_1 |
||
256 | cmp [sort_directory_flag],byte 1 |
||
257 | je red_sort_directory |
||
258 | cmp [redraw_flag],byte 1 |
||
259 | je redraw_window |
||
260 | cmp eax,1 ; перерисовать окно ? |
||
261 | je red ; если да - на метку red |
||
262 | cmp eax,2 ; нажата клавиша ? |
||
263 | je key ; если да - на key |
||
264 | cmp eax,3 ; нажата кнопка ? |
||
265 | je button ; если да - на button |
||
266 | cmp eax,6 |
||
267 | je mouse |
||
268 | ; cmp [redraw_wallpaper_flag],1 |
||
269 | ; jne still |
||
270 | ; mov [redraw_wallpaper_flag],0 |
||
271 | ; mcall 15,3 |
||
272 | jmp still ; если другое событие - в начало цикла |
||
273 | |||
274 | red_sort_directory: |
||
275 | mov [sort_directory_flag],byte 0 |
||
276 | jmp red_1 |
||
277 | |||
278 | redraw_window: |
||