Rev 431 | Rev 479 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
425 | victor | 1 | $Revision: 465 $ |
431 | serge | 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
3 | ;; ;; |
||
4 | ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
||
5 | ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; |
||
6 | ;; Distributed under terms of the GNU General Public License ;; |
||
7 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
8 | |||
41 | mikedld | 9 | get_titlebar_height: ; edi = window draw_data pointer |
415 | heavyiron | 10 | mov al,[edi+WDATA.fl_wstyle] |
11 | and al,0x0F |
||
12 | cmp al,0x03 |
||
13 | jne @f |
||
14 | mov eax,[_skinh] |
||
15 | ret |
||
16 | @@: mov eax,21 |
||
17 | ret |
||
41 | mikedld | 18 | |
19 | get_rolledup_height: ; edi = window draw_data pointer |
||
415 | heavyiron | 20 | mov al,[edi+WDATA.fl_wstyle] |
21 | and al,0x0F |
||
22 | cmp al,0x03 |
||
23 | jne @f |
||
24 | mov eax,[_skinh] |
||
25 | add eax,3 |
||
26 | ret |
||
27 | @@: or al,al |
||
28 | jnz @f |
||
29 | mov eax,21 |
||
30 | ret |
||
31 | @@: mov eax,21+2 |
||
32 | ret |
||
41 | mikedld | 33 | |
34 | |||
1 | ha | 35 | setwindowdefaults: |
415 | heavyiron | 36 | pushad |
1 | ha | 37 | |
415 | heavyiron | 38 | xor eax,eax |
39 | mov ecx,WIN_STACK |
||
1 | ha | 40 | @@: |
415 | heavyiron | 41 | inc eax |
42 | add ecx,2 |
||
43 | mov [ecx+0x000],ax ; process no |
||
44 | mov [ecx+0x400],ax ; positions in stack |
||
45 | cmp ecx,WIN_POS-2 ; the more high, the more surface |
||
46 | jnz @b |
||
1 | ha | 47 | |
415 | heavyiron | 48 | popad |
49 | ret |
||
1 | ha | 50 | |
51 | |||
52 | |||
53 | ; eax = cx |
||
54 | ; ebx = cy |
||
55 | ; ecx = ex |
||
56 | ; edx = ey |
||
57 | ; идея: перебрать все окна, начиная с самого нижнего, |
||
112 | poddubny | 58 | ; и для попавших в заданную область |
59 | ; частей окон вызвать setscreen |
||
1 | ha | 60 | align 4 |
61 | calculatescreen: |
||
415 | heavyiron | 62 | pushad |
63 | pushfd |
||
64 | cli |
||
1 | ha | 65 | |
415 | heavyiron | 66 | push edx ecx ebx eax |
1 | ha | 67 | |
415 | heavyiron | 68 | mov esi, 1 |
69 | call setscreen |
||
112 | poddubny | 70 | |
415 | heavyiron | 71 | mov ebp, [TASK_COUNT] ; number of processes |
72 | cmp ebp, 1 |
||
73 | jbe .finish |
||
74 | align 4 |
||
1 | ha | 75 | .new_wnd: |
415 | heavyiron | 76 | movzx edi, word [WIN_POS + esi * 2] |
77 | shl edi, 5 |
||
102 | poddubny | 78 | |
415 | heavyiron | 79 | cmp [CURRENT_TASK+edi+TASKDATA.state], byte 9 |
80 | je .not_wnd |
||
102 | poddubny | 81 | |
415 | heavyiron | 82 | add edi, window_data |
83 | test [edi+WDATA.fl_wstate], WSTATE_MINIMIZED |
||
84 | jnz .not_wnd |
||
112 | poddubny | 85 | |
415 | heavyiron | 86 | mov eax,[edi+WDATA.box.left] |
87 | cmp eax, [esp+RECT.right] |
||
88 | ja .out_of_bounds |
||
89 | mov ebx,[edi+WDATA.box.top] |
||
90 | cmp ebx, [esp+RECT.bottom] |
||
91 | ja .out_of_bounds |
||
92 | mov ecx,[edi+WDATA.box.width] |
||
93 | add ecx, eax |
||
94 | cmp ecx, [esp+RECT.left] |
||
95 | jb .out_of_bounds |
||
96 | mov edx,[edi+WDATA.box.height] |
||
97 | add edx, ebx |
||
98 | cmp edx, [esp+RECT.top] |
||
99 | jb .out_of_bounds |
||
112 | poddubny | 100 | |
117 | mario79 | 101 | cmp eax, [esp+RECT.left] |
415 | heavyiron | 102 | jae @f |
103 | mov eax, [esp+RECT.left] |
||
112 | poddubny | 104 | @@: |
117 | mario79 | 105 | cmp ebx, [esp+RECT.top] |
415 | heavyiron | 106 | jae @f |
107 | mov ebx, [esp+RECT.top] |
||
112 | poddubny | 108 | @@: |
117 | mario79 | 109 | cmp ecx, [esp+RECT.right] |
415 | heavyiron | 110 | jbe @f |
111 | mov ecx, [esp+RECT.right] |
||
112 | poddubny | 112 | @@: |
117 | mario79 | 113 | cmp edx, [esp+RECT.bottom] |
415 | heavyiron | 114 | jbe @f |
115 | mov edx, [esp+RECT.bottom] |
||
112 | poddubny | 116 | @@: |
117 | |||
415 | heavyiron | 118 | push esi |
119 | movzx esi, word [WIN_POS + esi * 2] |
||
120 | call setscreen |
||
121 | pop esi |
||
112 | poddubny | 122 | |
1 | ha | 123 | .not_wnd: |
112 | poddubny | 124 | .out_of_bounds: |
415 | heavyiron | 125 | inc esi |
126 | dec ebp |
||
127 | jnz .new_wnd |
||
1 | ha | 128 | .finish: |
112 | poddubny | 129 | |
117 | mario79 | 130 | pop eax ebx ecx edx |
112 | poddubny | 131 | |
415 | heavyiron | 132 | popfd |
133 | popad |
||
1 | ha | 134 | ret |
135 | |||
136 | |||
137 | |||
138 | virtual at esp |
||
415 | heavyiron | 139 | ff_x dd ? |
140 | ff_y dd ? |
||
112 | poddubny | 141 | ff_width dd ? |
1 | ha | 142 | ff_xsz dd ? |
143 | ff_ysz dd ? |
||
144 | ff_scale dd ? |
||
145 | end virtual |
||
146 | |||
147 | align 4 |
||
148 | ; резервирует место под окно заданного процесса |
||
149 | setscreen: |
||
150 | ; eax x start |
||
151 | ; ebx y start |
||
152 | ; ecx x end |
||
153 | ; edx y end |
||
154 | ; esi process number |
||
155 | pushad |
||
142 | diamond | 156 | ; \begin{diamond}[29.08.2006] |
415 | heavyiron | 157 | cmp esi, 1 |
158 | jz @f |
||
159 | mov edi, esi |
||
160 | shl edi, 5 |
||
161 | cmp [edi+window_data+WDATA.box.width], 0 |
||
162 | jnz @f |
||
163 | cmp [edi+window_data+WDATA.box.height], 0 |
||
164 | jz .ret |
||
142 | diamond | 165 | @@: |
166 | ; \end{diamond}[29.08.2006] |
||
415 | heavyiron | 167 | mov edi, esi ;;;word [esi*2+WIN_POS] |
168 | shl edi, 8 |
||
169 | add edi, SLOT_BASE ; address of random shaped window area |
||
170 | cmp [edi+APPDATA.wnd_shape], dword 0 |
||
171 | jne .free_form |
||
1 | ha | 172 | |
415 | heavyiron | 173 | ; get x&y size |
174 | sub ecx, eax |
||
175 | sub edx, ebx |
||
176 | inc ecx |
||
177 | inc edx |
||
1 | ha | 178 | |
415 | heavyiron | 179 | ; get WinMap start |
180 | mov edi, [ScreenWidth] ; screen_sx |
||
181 | inc edi |
||
182 | imul edi, ebx |
||
183 | add edi, eax |
||
184 | add edi, WinMapAddress |
||
1 | ha | 185 | |
186 | .new_y: |
||
415 | heavyiron | 187 | push ecx ; sx |
188 | push edx |
||
1 | ha | 189 | |
415 | heavyiron | 190 | mov edx, esi |
191 | align 4 |
||
1 | ha | 192 | .new_x: |
415 | heavyiron | 193 | mov byte [edi], dl |
194 | inc edi |
||
195 | dec ecx |
||
196 | jnz .new_x |
||
1 | ha | 197 | |
415 | heavyiron | 198 | pop edx |
199 | pop ecx |
||
200 | add edi, [ScreenWidth] |
||
201 | inc edi |
||
202 | sub edi, ecx |
||
203 | dec edx |
||
204 | jnz .new_y |
||
142 | diamond | 205 | .ret: |
1 | ha | 206 | popad |
207 | ret |
||
208 | .read_byte: |
||
209 | ;eax - address |
||
210 | ;esi - slot |
||
415 | heavyiron | 211 | push eax |
212 | push ebx |
||
213 | push ecx |
||
214 | push edx |
||
215 | mov edx,eax |
||
216 | mov eax,esi |
||
217 | lea ebx,[esp+12] |
||
218 | mov ecx,1 |
||
219 | call read_process_memory |
||
220 | pop edx |
||
221 | pop ecx |
||
222 | pop ebx |
||
223 | pop eax |
||
224 | ret |
||
1 | ha | 225 | .free_form: |
226 | |||
415 | heavyiron | 227 | ; for (y=0; y <= x_size; y++) |
228 | ; for (x=0; x <= x_size; x++) |
||
229 | ; if (shape[coord(x,y,scale)]==1) |
||
230 | ; set_pixel(x, y, process_number); |
||
1 | ha | 231 | |
415 | heavyiron | 232 | sub ecx, eax |
233 | sub edx, ebx |
||
234 | inc ecx |
||
235 | inc edx |
||
1 | ha | 236 | |
415 | heavyiron | 237 | push dword [edi+APPDATA.wnd_shape_scale] ; push scale first -> for loop |
1 | ha | 238 | |
415 | heavyiron | 239 | ; get WinMap start -> ebp |
240 | push eax |
||
241 | mov eax, [ScreenWidth] ; screen_sx |
||
242 | inc eax |
||
243 | imul eax, ebx |
||
244 | add eax, [esp] |
||
245 | add eax, WinMapAddress |
||
246 | mov ebp, eax |
||
1 | ha | 247 | |
415 | heavyiron | 248 | mov edi, [edi+APPDATA.wnd_shape] |
249 | pop eax |
||
1 | ha | 250 | |
415 | heavyiron | 251 | ; eax = x_start |
252 | ; ebx = y_start |
||
253 | ; ecx = x_size |
||
254 | ; edx = y_size |
||
255 | ; esi = process_number |
||
256 | ; edi = &shape |
||
257 | ; [scale] |
||
258 | push edx ecx ; for loop - x,y size |
||
112 | poddubny | 259 | |
415 | heavyiron | 260 | mov ecx, esi |
261 | shl ecx, 5 |
||
262 | mov edx, [window_data+ecx+WDATA.box.top] |
||
263 | push [window_data+ecx+WDATA.box.width] ; for loop - width |
||
264 | mov ecx, [window_data+ecx+WDATA.box.left] |
||
265 | sub ebx, edx |
||
266 | sub eax, ecx |
||
267 | push ebx eax ; for loop - x,y |
||
112 | poddubny | 268 | |
415 | heavyiron | 269 | add [ff_xsz], eax |
270 | add [ff_ysz], ebx |
||
112 | poddubny | 271 | |
415 | heavyiron | 272 | mov ebx, [ff_y] |
112 | poddubny | 273 | |
1 | ha | 274 | .ff_new_y: |
415 | heavyiron | 275 | mov edx, [ff_x] |
112 | poddubny | 276 | |
1 | ha | 277 | .ff_new_x: |
415 | heavyiron | 278 | ; -- body -- |
279 | mov ecx, [ff_scale] |
||
280 | mov eax, [ff_width] |
||
281 | inc eax |
||
282 | shr eax, cl |
||
283 | push ebx edx |
||
284 | shr ebx, cl |
||
285 | shr edx, cl |
||
286 | imul eax, ebx |
||
287 | add eax, edx |
||
288 | pop edx ebx |
||
289 | add eax, edi |
||
290 | call .read_byte |
||
291 | test al,al |
||
292 | jz @f |
||
293 | mov eax, esi |
||
294 | mov [ebp], al |
||
1 | ha | 295 | @@: |
415 | heavyiron | 296 | ; -- end body -- |
297 | inc ebp |
||
298 | inc edx |
||
299 | cmp edx, [ff_xsz] |
||
300 | jb .ff_new_x |
||
301 | sub ebp, [ff_xsz] |
||
302 | add ebp, [ff_x] |
||
303 | add ebp, [ScreenWidth] ; screen.x |
||
304 | inc ebp |
||
305 | inc ebx |
||
306 | cmp ebx, [ff_ysz] |
||
307 | jb .ff_new_y |
||
1 | ha | 308 | |
415 | heavyiron | 309 | add esp, 24 |
1 | ha | 310 | popad |
311 | ret |
||
312 | |||
313 | |||
314 | display_settings: |
||
315 | |||
316 | ; eax = 0 ; DISPLAY redraw |
||
317 | ; ebx = 0 ; all |
||
318 | ; |
||
319 | ; eax = 1 ; BUTTON type |
||
320 | ; ebx = 0 ; flat |
||
321 | ; ebx = 1 ; 3D |
||
322 | ; eax = 2 ; set WINDOW colours |
||
323 | ; ebx = pointer to table |
||
324 | ; ecx = number of bytes define |
||
325 | ; eax = 3 ; get WINDOW colours |
||
326 | ; ebx = pointer to table |
||
327 | ; ecx = number of bytes wanted |
||
328 | ; eax = 4 ; get skin height |
||
329 | ; input : nothing |
||
330 | ; output : eax = skin height in pixel |
||
41 | mikedld | 331 | ; eax = 5 ; get screen workarea |
332 | ; input : nothing |
||
333 | ; output : eax = [left]*65536+[right] |
||
334 | ; ebx = [top]*65536+[bottom] |
||
335 | ; eax = 6 ; set screen workarea |
||
336 | ; input : ecx = [left]*65536+[right] |
||
337 | ; edx = [top]*65536+[bottom] |
||
338 | ; output : nothing |
||
52 | mikedld | 339 | ; eax = 7 ; get skin margins |
340 | ; input : nothing |
||
341 | ; output : eax = [left]*65536+[right] |
||
342 | ; ebx = [top]*65536+[bottom] |
||
343 | ; eax = 8 ; set window skin |
||
344 | ; input : ecx = pointer to file info block |
||
345 | ; output : eax = FS error code |
||
1 | ha | 346 | |
347 | |||
348 | pushad |
||
349 | |||
415 | heavyiron | 350 | test eax, eax ; redraw display |
1 | ha | 351 | jnz dspl0 |
352 | test ebx, ebx |
||
353 | jnz dspl0 |
||
354 | cmp [windowtypechanged],dword 1 |
||
355 | jne dspl00 |
||
356 | mov [windowtypechanged],dword 0 |
||
41 | mikedld | 357 | redraw_screen_direct: |
1 | ha | 358 | mov [dlx],dword 0 |
359 | mov [dly],dword 0 |
||
381 | serge | 360 | mov eax,[ScreenWidth] |
1 | ha | 361 | mov [dlxe],eax |
381 | serge | 362 | mov eax,[ScreenHeight] |
1 | ha | 363 | mov [dlye],eax |
364 | mov eax,window_data |
||
365 | call redrawscreen |
||
366 | dspl00: |
||
367 | popad |
||
368 | ret |
||
369 | dspl0: |
||
370 | |||
371 | cmp eax,1 ; button type |
||
372 | jne dspl1 |
||
373 | and ebx,1 |
||
374 | cmp ebx,[buttontype] |
||
375 | je dspl9 |
||
376 | mov [buttontype],ebx |
||
377 | mov [windowtypechanged],dword 1 |
||
378 | dspl9: |
||
379 | popad |
||
380 | ret |
||
381 | dspl1: |
||
382 | |||
383 | cmp eax,2 ; set common window colours |
||
384 | jne no_com_colours |
||
385 | mov [windowtypechanged],dword 1 |
||
379 | serge | 386 | mov esi,[TASK_BASE] |
115 | poddubny | 387 | add esi,TASKDATA.mem_start |
54 | mikedld | 388 | add ebx,[esi] |
389 | mov esi,ebx |
||
1 | ha | 390 | mov edi,common_colours |
391 | and ecx,127 |
||
392 | cld |
||
393 | rep movsb |
||
394 | popad |
||
395 | ret |
||
396 | no_com_colours: |
||
397 | |||
398 | cmp eax,3 ; get common window colours |
||
399 | jne no_get_com |
||
379 | serge | 400 | mov esi,[TASK_BASE] |
115 | poddubny | 401 | add esi,TASKDATA.mem_start |
1 | ha | 402 | add ebx,[esi] |
403 | mov edi,ebx |
||
404 | mov esi,common_colours |
||
405 | and ecx,127 |
||
406 | cld |
||
407 | rep movsb |
||
408 | popad |
||
409 | ret |
||
410 | no_get_com: |
||
411 | |||
412 | cmp eax,4 ; get skin height |
||
413 | jne no_skin_height |
||
414 | popad |
||
415 | mov eax,[_skinh] |
||
416 | mov [esp+36],eax |
||
417 | ret |
||
418 | no_skin_height: |
||
419 | |||
415 | heavyiron | 420 | cmp eax,5 ; get screen workarea |
421 | jne no_get_workarea |
||
422 | popad |
||
423 | mov eax,[screen_workarea.left-2] |
||
424 | mov ax,word[screen_workarea.right] |
||
425 | mov [esp+36],eax |
||
426 | mov eax,[screen_workarea.top-2] |
||
427 | mov ax,word[screen_workarea.bottom] |
||
428 | mov [esp+24],eax |
||
429 | ret |
||
41 | mikedld | 430 | no_get_workarea: |
431 | |||
415 | heavyiron | 432 | cmp eax,6 ; set screen workarea |
433 | jne no_set_workarea |
||
434 | movsx eax,word[esp+16+2] |
||
435 | movsx ebx,word[esp+16] |
||
436 | cmp eax,ebx |
||
437 | jge .lp1 |
||
438 | or eax,eax;[ScreenWidth] |
||
439 | jl @f |
||
440 | mov [screen_workarea.left],eax |
||
441 | @@: cmp ebx,[ScreenWidth] |
||
442 | jg .lp1 |
||
443 | mov [screen_workarea.right],ebx |
||
444 | .lp1: movsx eax,word[esp+24+2] |
||
445 | movsx ebx,word[esp+24] |
||
446 | cmp eax,ebx |
||
447 | jge .lp2 |
||
448 | or eax,eax;[0xFE04] |
||
449 | jl @f |
||
450 | mov [screen_workarea.top],eax |
||
451 | @@: cmp ebx,[ScreenHeight] |
||
452 | jg .lp2 |
||
453 | mov [screen_workarea.bottom],ebx |
||
454 | .lp2: call repos_windows |
||
455 | mov eax, 0 |
||
456 | mov ebx, 0 |
||
457 | mov ecx, [ScreenWidth] |
||
458 | mov edx, [ScreenHeight] |
||
117 | mario79 | 459 | call calculatescreen |
460 | ; jmp redraw_screen_direct |
||
49 | mikedld | 461 | .exit: |
415 | heavyiron | 462 | popad |
463 | ret |
||
49 | mikedld | 464 | no_set_workarea: |
41 | mikedld | 465 | |
415 | heavyiron | 466 | cmp eax,7 ; get skin margins |
467 | jne no_get_skinmargins |
||
468 | popad |
||
469 | mov eax,dword[_skinmargins+0] |
||
470 | mov [esp+36],eax |
||
471 | mov eax,dword[_skinmargins+4] |
||
472 | mov [esp+24],eax |
||
473 | ret |
||
52 | mikedld | 474 | no_get_skinmargins: |
475 | |||
415 | heavyiron | 476 | cmp eax,8 ; set window skin |
477 | jne no_set_skin |
||
478 | mov eax,ebx |
||
479 | mov edi,[TASK_BASE] |
||
480 | add ebx,[edi+TASKDATA.mem_start] ; abs start of info block |
||
481 | pushd [ebx+0] [ebx+4] [ebx+8] [ebx+12] |
||
482 | mov dword[ebx+0],0 ; read |
||
483 | mov dword[ebx+4],0 ; from the beginning |
||
484 | mov dword[ebx+8],64 ; 32 KBytes maximum |
||
485 | mov ecx,skin_data+64*512 |
||
486 | sub ecx,[edi+0x10] |
||
487 | mov dword[ebx+12],ecx ; destination |
||
488 | push eax |
||
489 | pushad |
||
490 | call file_system |
||
491 | popad |
||
492 | pop eax |
||
493 | popd [ebx+12] [ebx+8] [ebx+4] [ebx+0] |
||
494 | cmp eax,ERROR_SUCCESS |
||
495 | je @f |
||
496 | cmp eax,ERROR_END_OF_FILE |
||
497 | jne .exit |
||
498 | @@: cmp [skin_data+64*512+SKIN_HEADER.ident],'SKIN' |
||
499 | mov eax,ERROR_UNKNOWN_FS |
||
500 | jne .exit |
||
501 | mov esi,skin_data+64*512 |
||
502 | mov edi,skin_data |
||
503 | mov ecx,(64*512)/4 |
||
504 | rep movsd |
||
505 | call parse_skin_data |
||
117 | mario79 | 506 | pushad |
415 | heavyiron | 507 | mov eax, 0 |
508 | mov ebx, 0 |
||
509 | mov ecx, [ScreenWidth] |
||
510 | mov edx, [ScreenHeight] |
||
511 | call calculatescreen |
||
117 | mario79 | 512 | popad |
415 | heavyiron | 513 | mov dword[esp+32+36],0 |
514 | jmp redraw_screen_direct |
||
52 | mikedld | 515 | .exit: |
415 | heavyiron | 516 | mov [esp+32+36],eax |
517 | popad |
||
518 | ret |
||
52 | mikedld | 519 | no_set_skin: |
520 | |||
49 | mikedld | 521 | popad |
522 | ret |
||
523 | |||
524 | |||
525 | repos_windows: |
||
415 | heavyiron | 526 | mov ecx,[TASK_COUNT] |
527 | mov edi, OS_BASE+0x20*2 |
||
381 | serge | 528 | mov byte[REDRAW_BACKGROUND],1 |
415 | heavyiron | 529 | dec ecx |
530 | jge @f |
||
531 | ret |
||
532 | @@: mov [edi+WDATA.fl_redraw],1 |
||
533 | test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
||
534 | jz .lp2 |
||
535 | mov eax,[screen_workarea.left] |
||
536 | mov [edi+WDATA.box.left],eax |
||
537 | sub eax,[screen_workarea.right] |
||
538 | neg eax |
||
539 | mov [edi+WDATA.box.width],eax |
||
540 | mov eax,[screen_workarea.top] |
||
541 | mov [edi+WDATA.box.top],eax |
||
542 | test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
||
543 | jnz .lp1 |
||
544 | sub eax,[screen_workarea.bottom] |
||
545 | neg eax |
||
546 | mov [edi+WDATA.box.height],eax |
||
150 | diamond | 547 | .lp1: |
389 | serge | 548 | |
415 | heavyiron | 549 | call set_window_clientbox |
550 | add edi,0x20 |
||
551 | loop @b |
||
552 | ret |
||
553 | .lp2: mov eax,[edi+WDATA.box.left] |
||
554 | add eax,[edi+WDATA.box.width] |
||
381 | serge | 555 | mov ebx,[ScreenWidth] |
117 | mario79 | 556 | ; inc ebx |
557 | cmp eax,ebx |
||
558 | jle .lp4 |
||
415 | heavyiron | 559 | mov eax,[edi+WDATA.box.width] |
117 | mario79 | 560 | sub eax,ebx |
561 | jle .lp3 |
||
415 | heavyiron | 562 | mov [edi+WDATA.box.width],ebx |
563 | .lp3: sub ebx,[edi+WDATA.box.width] |
||
564 | mov [edi+WDATA.box.left],ebx |
||
565 | .lp4: mov eax,[edi+WDATA.box.top] |
||
566 | add eax,[edi+WDATA.box.height] |
||
381 | serge | 567 | mov ebx,[ScreenHeight] |
117 | mario79 | 568 | ; inc ebx |
569 | cmp eax,ebx |
||
570 | jle .lp6 |
||
415 | heavyiron | 571 | mov eax,[edi+WDATA.box.height] |
117 | mario79 | 572 | sub eax,ebx |
573 | jle .lp5 |
||
415 | heavyiron | 574 | mov [edi+WDATA.box.height],ebx |
575 | .lp5: sub ebx,[edi+WDATA.box.height] |
||
576 | mov [edi+WDATA.box.top],ebx |
||
577 | .lp6: jmp .lp1 |
||
41 | mikedld | 578 | |
1 | ha | 579 | uglobal |
580 | common_colours: |
||
581 | times 128 db 0x0 |
||
582 | endg |
||
583 | |||
584 | |||
585 | |||
586 | |||
587 | check_window_position: |
||
588 | |||
415 | heavyiron | 589 | pushad ; window inside screen ? |
1 | ha | 590 | |
115 | poddubny | 591 | movzx eax,word [edi+WDATA.box.left] |
592 | movzx ebx,word [edi+WDATA.box.top] |
||
593 | movzx ecx,word [edi+WDATA.box.width] |
||
594 | movzx edx,word [edi+WDATA.box.height] |
||
1 | ha | 595 | |
415 | heavyiron | 596 | mov esi,ecx ; check x pos |
1 | ha | 597 | add esi,eax |
381 | serge | 598 | cmp esi,[ScreenWidth] |
1 | ha | 599 | jbe x_pos_ok |
115 | poddubny | 600 | mov [edi+WDATA.box.left],dword 0 |
1 | ha | 601 | xor eax, eax |
602 | x_pos_ok: |
||
603 | |||
415 | heavyiron | 604 | mov esi,edx ; check y pos |
1 | ha | 605 | add esi,ebx |
381 | serge | 606 | cmp esi,[ScreenHeight] |
1 | ha | 607 | jbe y_pos_ok |
115 | poddubny | 608 | mov [edi+WDATA.box.top],dword 0 |
1 | ha | 609 | mov ebx,0 |
610 | y_pos_ok: |
||
611 | |||
415 | heavyiron | 612 | mov esi,ecx ; check x size |
1 | ha | 613 | add esi,eax |
381 | serge | 614 | cmp esi,[ScreenWidth] |
1 | ha | 615 | jbe x_size_ok |
381 | serge | 616 | mov ecx,[ScreenWidth] |
115 | poddubny | 617 | mov [edi+WDATA.box.width],ecx |
1 | ha | 618 | x_size_ok: |
619 | |||
415 | heavyiron | 620 | mov esi,edx ; check y size |
1 | ha | 621 | add esi,ebx |
381 | serge | 622 | cmp esi,[ScreenHeight] |
1 | ha | 623 | jbe y_size_ok |
381 | serge | 624 | mov edx,[ScreenHeight] |
115 | poddubny | 625 | mov [edi+WDATA.box.height],edx |
1 | ha | 626 | y_size_ok: |
627 | |||
628 | popad |
||
629 | |||
630 | ret |
||
631 | |||
632 | |||
633 | uglobal |
||
634 | new_window_starting dd 0 |
||
635 | endg |
||
636 | |||
637 | |||
638 | sys_window_mouse: |
||
639 | |||
640 | push eax |
||
641 | |||
115 | poddubny | 642 | mov eax,[timer_ticks] |
1 | ha | 643 | cmp [new_window_starting],eax |
415 | heavyiron | 644 | jb swml1 |
1 | ha | 645 | |
381 | serge | 646 | mov [MOUSE_BACKGROUND],byte 0 ; no mouse background |
647 | mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse |
||
1 | ha | 648 | |
649 | mov [new_window_starting],eax |
||
650 | |||
651 | swml1: |
||
652 | |||
653 | pop eax |
||
654 | |||
655 | ret |
||
656 | |||
657 | |||
658 | |||
659 | |||
114 | mikedld | 660 | drawwindow_I_caption: |
661 | |||
415 | heavyiron | 662 | mov ecx,[edx+WDATA.cl_titlebar] ; grab bar |
663 | push ecx |
||
664 | mov esi,edx |
||
665 | mov edx,[esi+WDATA.box.top] |
||
666 | add edx,1 |
||
667 | mov ebx,[esi+WDATA.box.top] |
||
668 | add ebx,21 |
||
669 | mov eax,[esi+WDATA.box.top] |
||
670 | add eax,[esi+WDATA.box.height] |
||
671 | cmp ebx,eax |
||
672 | jb .wdsizeok |
||
673 | mov ebx,eax |
||
114 | mikedld | 674 | .wdsizeok: |
415 | heavyiron | 675 | push ebx |
114 | mikedld | 676 | .drwi: |
415 | heavyiron | 677 | mov ebx,edx |
678 | shl ebx,16 |
||
679 | add ebx,edx |
||
680 | mov eax,[esi+WDATA.box.left] |
||
681 | inc eax |
||
682 | shl eax,16 |
||
683 | add eax,[esi+WDATA.box.left] |
||
684 | add eax,[esi+WDATA.box.width] |
||
685 | sub eax,1 |
||
686 | push edx |
||
687 | mov edx,0x80000000 |
||
688 | mov ecx,[esi+WDATA.cl_titlebar] |
||
689 | and ecx,edx |
||
690 | cmp ecx,edx |
||
691 | jnz .nofa |
||
692 | mov ecx,[esi+WDATA.cl_titlebar] |
||
693 | sub ecx,0x00040404 |
||
694 | mov [esi+WDATA.cl_titlebar],ecx |
||
695 | and ecx,0x00ffffff |
||
696 | jmp .faj |
||
114 | mikedld | 697 | .nofa: |
415 | heavyiron | 698 | mov ecx,[esi+WDATA.cl_titlebar] |
699 | and ecx,0x00ffffff |
||
114 | mikedld | 700 | .faj: |
415 | heavyiron | 701 | pop edx |
702 | mov edi,0 |
||
703 | call [draw_line] |
||
704 | inc edx |
||
705 | cmp edx,[esp] |
||
706 | jb .drwi |
||
707 | add esp,4 |
||
708 | pop ecx |
||
709 | mov [esi+WDATA.cl_titlebar],ecx |
||
1 | ha | 710 | |
415 | heavyiron | 711 | ret |
114 | mikedld | 712 | |
713 | |||
714 | drawwindow_I: |
||
715 | |||
415 | heavyiron | 716 | pushad |
717 | or [edx+WDATA.fl_wdrawn], 4 |
||
114 | mikedld | 718 | |
415 | heavyiron | 719 | mov esi,[edx+WDATA.cl_frames] ; rectangle |
720 | mov eax,[edx+WDATA.box.left] |
||
721 | shl eax,16 |
||
722 | add eax,[edx+WDATA.box.left] |
||
723 | add eax,[edx+WDATA.box.width] |
||
724 | mov ebx,[edx+WDATA.box.top] |
||
725 | shl ebx,16 |
||
726 | add ebx,[edx+WDATA.box.top] |
||
727 | add ebx,[edx+WDATA.box.height] |
||
728 | call draw_rectangle |
||
114 | mikedld | 729 | |
415 | heavyiron | 730 | and [edx+WDATA.fl_wdrawn], not 4 |
731 | test [edx+WDATA.fl_wdrawn], 2 |
||
732 | jz @f |
||
733 | call drawwindowframes2 |
||
186 | diamond | 734 | @@: |
735 | |||
415 | heavyiron | 736 | call drawwindow_I_caption |
114 | mikedld | 737 | |
415 | heavyiron | 738 | mov edx,[esi+WDATA.box.top] ; inside work area |
739 | add edx,21+5 |
||
740 | mov ebx,[esi+WDATA.box.top] |
||
741 | add ebx,[esi+WDATA.box.height] |
||
742 | cmp edx,ebx |
||
743 | jg noinside |
||
744 | mov eax,1 |
||
745 | mov ebx,21 |
||
746 | mov ecx,[esi+WDATA.box.width] |
||
747 | mov edx,[esi+WDATA.box.height] |
||
748 | mov edi,[esi+WDATA.cl_workarea] |
||
303 | mikedld | 749 | test edi,0x40000000 |
750 | jnz noinside |
||
415 | heavyiron | 751 | call [drawbar] |
1 | ha | 752 | noinside: |
753 | |||
415 | heavyiron | 754 | popad |
1 | ha | 755 | |
415 | heavyiron | 756 | ret |
1 | ha | 757 | |
758 | |||
759 | draw_rectangle: |
||
760 | |||
761 | r_eax equ [esp+28] ; x start |
||
762 | r_ax equ [esp+30] ; x end |
||
763 | r_ebx equ [esp+16] ; y start |
||
764 | r_bx equ [esp+18] ; y end |
||
765 | ;esi ; color |
||
766 | |||
415 | heavyiron | 767 | pushad |
1 | ha | 768 | |
415 | heavyiron | 769 | mov ecx,esi ; yb,xb -> yb,xe |
770 | mov eax, r_eax |
||
771 | rol eax, 16 |
||
772 | mov ebx,r_ebx |
||
773 | shl ebx,16 |
||
774 | mov bx,r_ebx |
||
775 | xor edi, edi |
||
776 | call [draw_line] |
||
1 | ha | 777 | |
415 | heavyiron | 778 | mov ebx,r_bx ; ye,xb -> ye,xe |
779 | shl ebx,16 |
||
780 | mov bx,r_bx |
||
781 | call [draw_line] |
||
1 | ha | 782 | |
415 | heavyiron | 783 | mov ecx,esi ; ya,xa -> ye,xa |
784 | mov eax,r_eax |
||
785 | shl eax,16 |
||
786 | mov ax,r_eax |
||
787 | mov ebx,r_ebx |
||
788 | shl ebx,16 |
||
789 | mov bx,r_bx |
||
790 | mov edi,0 |
||
791 | call [draw_line] |
||
1 | ha | 792 | |
415 | heavyiron | 793 | mov eax,r_ax ; ya,xe -> ye,xe |
794 | shl eax,16 |
||
795 | mov ax,r_ax |
||
796 | call [draw_line] |
||
1 | ha | 797 | |
415 | heavyiron | 798 | popad |
799 | ret |
||
1 | ha | 800 | |
801 | |||
114 | mikedld | 802 | drawwindow_III_caption: |
1 | ha | 803 | |
415 | heavyiron | 804 | mov ecx,[edx+WDATA.cl_titlebar] ; GRAB BAR |
805 | push ecx |
||
806 | mov esi,edx |
||
807 | mov edx,[esi+WDATA.box.top] |
||
808 | add edx,4 |
||
809 | mov ebx,[esi+WDATA.box.top] |
||
810 | add ebx,20 |
||
811 | mov eax,[esi+WDATA.box.top] |
||
812 | add eax,[esi+WDATA.box.height] |
||
813 | cmp ebx,eax |
||
814 | jb .wdsizeok |
||
815 | mov ebx,eax |
||
114 | mikedld | 816 | .wdsizeok: |
415 | heavyiron | 817 | push ebx |
114 | mikedld | 818 | .drwi: |
415 | heavyiron | 819 | mov ebx,edx |
820 | shl ebx,16 |
||
821 | add ebx,edx |
||
822 | mov eax,[esi+WDATA.box.left] |
||
823 | shl eax,16 |
||
824 | add eax,[esi+WDATA.box.left] |
||
825 | add eax,[esi+WDATA.box.width] |
||
826 | add eax,4*65536-4 |
||
827 | mov ecx,[esi+WDATA.cl_titlebar] |
||
828 | test ecx,0x40000000 |
||
829 | jz .nofa |
||
830 | add ecx,0x040404 |
||
114 | mikedld | 831 | .nofa: |
415 | heavyiron | 832 | test ecx,0x80000000 |
833 | jz .nofa2 |
||
834 | sub ecx,0x040404 |
||
114 | mikedld | 835 | .nofa2: |
415 | heavyiron | 836 | mov [esi+WDATA.cl_titlebar],ecx |
837 | and ecx,0xffffff |
||
838 | xor edi, edi |
||
839 | call [draw_line] |
||
840 | inc edx |
||
841 | cmp edx,[esp] |
||
842 | jb .drwi |
||
843 | add esp,4 |
||
844 | pop ecx |
||
845 | mov [esi+WDATA.cl_titlebar],ecx |
||
1 | ha | 846 | |
415 | heavyiron | 847 | ret |
114 | mikedld | 848 | |
849 | |||
850 | drawwindow_III: |
||
851 | |||
415 | heavyiron | 852 | pushad |
114 | mikedld | 853 | |
415 | heavyiron | 854 | mov edi,edx ; RECTANGLE |
855 | mov eax,[edi+WDATA.box.left] |
||
856 | shl eax,16 |
||
117 | mario79 | 857 | mov ax, word [edi+WDATA.box.left] |
858 | add ax, word [edi+WDATA.box.width] |
||
415 | heavyiron | 859 | mov ebx,[edi+WDATA.box.top] |
860 | shl ebx,16 |
||
117 | mario79 | 861 | mov bx, word [edi+WDATA.box.top] |
862 | add bx, word [edi+WDATA.box.height] |
||
415 | heavyiron | 863 | mov esi,[edi+WDATA.cl_frames] |
864 | shr esi,1 |
||
865 | and esi,0x007f7f7f |
||
866 | push esi |
||
867 | or [edi+WDATA.fl_wdrawn], 4 |
||
868 | call draw_rectangle |
||
869 | and [edi+WDATA.fl_wdrawn], not 4 |
||
870 | test [edi+WDATA.fl_wdrawn], 2 |
||
871 | jz @f |
||
872 | call drawwindowframes2 |
||
186 | diamond | 873 | @@: |
415 | heavyiron | 874 | mov ecx,3 |
114 | mikedld | 875 | dw3l: |
415 | heavyiron | 876 | add eax,1*65536-1 |
877 | add ebx,1*65536-1 |
||
878 | mov esi,[edi+WDATA.cl_frames] |
||
879 | call draw_rectangle |
||
880 | dec ecx |
||
881 | jnz dw3l |
||
882 | pop esi |
||
883 | add eax,1*65536-1 |
||
884 | add ebx,1*65536-1 |
||
885 | call draw_rectangle |
||
114 | mikedld | 886 | |
415 | heavyiron | 887 | call drawwindow_III_caption |
114 | mikedld | 888 | |
415 | heavyiron | 889 | mov edx,[esi+WDATA.box.top] ; WORK AREA |
890 | add edx,21+5 |
||
891 | mov ebx,[esi+WDATA.box.top] |
||
892 | add ebx,[esi+WDATA.box.height] |
||
893 | cmp edx,ebx |
||
894 | jg noinside2 |
||
895 | mov eax,5 |
||
896 | mov ebx,20 |
||
897 | mov ecx,[esi+WDATA.box.width] |
||
898 | mov edx,[esi+WDATA.box.height] |
||
899 | sub ecx,4 |
||
900 | sub edx,4 |
||
901 | mov edi,[esi+WDATA.cl_workarea] |
||
303 | mikedld | 902 | test edi,0x40000000 |
903 | jnz noinside2 |
||
415 | heavyiron | 904 | call [drawbar] |
1 | ha | 905 | noinside2: |
906 | |||
415 | heavyiron | 907 | popad |
1 | ha | 908 | |
415 | heavyiron | 909 | ret |
1 | ha | 910 | |
911 | |||
912 | |||
913 | ; activate window |
||
914 | align 4 |
||
915 | windowactivate: |
||
916 | |||
415 | heavyiron | 917 | ; esi = abs mem position in stack 0xC400+ |
1 | ha | 918 | |
415 | heavyiron | 919 | pushad |
102 | poddubny | 920 | |
921 | ; if type of current active window is 3, |
||
922 | ; it must be redrawn |
||
415 | heavyiron | 923 | mov eax, [TASK_COUNT] |
924 | movzx eax, word [WIN_POS + eax*2] |
||
925 | shl eax, 5 |
||
926 | add eax, window_data |
||
927 | mov ebx, [eax + WDATA.cl_workarea] |
||
928 | and ebx, 0x0f000000 |
||
929 | cmp ebx, 0x03000000 |
||
930 | jne @f |
||
931 | mov [eax + WDATA.fl_redraw], byte 1 |
||
102 | poddubny | 932 | @@: |
933 | |||
415 | heavyiron | 934 | push esi |
1 | ha | 935 | movzx eax, word [esi] ; ax <- process no |
380 | serge | 936 | movzx eax, word [WIN_STACK+eax*2] ; ax <- position in window stack |
1 | ha | 937 | |
415 | heavyiron | 938 | xor esi, esi ; drop others |
1 | ha | 939 | waloop: |
415 | heavyiron | 940 | cmp esi, dword [TASK_COUNT] |
941 | jae wacont |
||
942 | inc esi |
||
943 | lea edi, [WIN_STACK + esi*2] |
||
944 | mov bx, [edi] ; position of the current process |
||
945 | cmp bx, ax |
||
946 | jbe @f |
||
947 | dec bx ; upper? => drop! |
||
948 | mov [edi], bx |
||
1 | ha | 949 | @@: |
415 | heavyiron | 950 | jmp waloop |
1 | ha | 951 | wacont: |
415 | heavyiron | 952 | ; set to no 1 |
953 | pop esi ; esi = pointer at 0xC400 |
||
1 | ha | 954 | |
955 | movzx eax, word [esi] |
||
415 | heavyiron | 956 | mov bx, [TASK_COUNT] ; number of processes |
957 | mov [WIN_STACK+eax*2], bx ; this is the last (and the upper) |
||
1 | ha | 958 | |
415 | heavyiron | 959 | ; update on screen -window stack |
960 | xor esi, esi |
||
1 | ha | 961 | waloop2: |
415 | heavyiron | 962 | mov edi, [TASK_COUNT] |
963 | cmp esi, edi |
||
964 | jae wacont2 |
||
965 | inc esi |
||
966 | movzx ebx, word [esi*2 + WIN_STACK] |
||
967 | mov [ebx*2 + WIN_POS], si |
||
968 | jmp waloop2 |
||
1 | ha | 969 | wacont2: |
415 | heavyiron | 970 | mov [KEY_COUNT], byte 0 ; empty keyboard buffer |
971 | mov [BTN_COUNT], byte 0 ; empty button buffer |
||
972 | popad |
||
973 | ret |
||
1 | ha | 974 | |
975 | |||
976 | ; check if window is necessary to draw |
||
977 | |||
978 | checkwindowdraw: |
||
979 | |||
415 | heavyiron | 980 | ; edi = position in window_data+ |
1 | ha | 981 | |
415 | heavyiron | 982 | mov eax, [edi + WDATA.cl_workarea] |
983 | and eax, 0x0f000000 |
||
984 | cmp eax, 0x03000000 |
||
985 | je .return_yes ; window type 3 |
||
102 | poddubny | 986 | |
415 | heavyiron | 987 | mov esi, edi |
988 | sub esi, window_data |
||
989 | shr esi, 5 |
||
1 | ha | 990 | |
415 | heavyiron | 991 | ; esi = process number |
1 | ha | 992 | |
415 | heavyiron | 993 | movzx eax, word [WIN_STACK + esi * 2] ; get value of the curr process |
994 | lea esi, [WIN_POS + eax * 2] ; get address of this process at 0xC400 |
||
1 | ha | 995 | |
415 | heavyiron | 996 | push esi |
1 | ha | 997 | |
998 | .new_check: |
||
999 | |||
415 | heavyiron | 1000 | pop esi |
1001 | add esi, 2 |
||
1002 | push esi |
||
1 | ha | 1003 | |
415 | heavyiron | 1004 | mov eax, [TASK_COUNT] |
1005 | lea eax, word [WIN_POS + eax * 2] ; number of the upper window |
||
1 | ha | 1006 | |
415 | heavyiron | 1007 | cmp esi, eax |
1008 | ja .all_wnds_to_top |
||
1 | ha | 1009 | |
415 | heavyiron | 1010 | movzx eax, word [esi] |
1011 | shl eax, 5 |
||
1012 | cmp [CURRENT_TASK + eax + TASKDATA.state], byte 9 |
||
1013 | je .new_check ; skip dead windows |
||
1 | ha | 1014 | |
415 | heavyiron | 1015 | lea esi, [eax+window_data] |
102 | poddubny | 1016 | |
415 | heavyiron | 1017 | mov ebx, [edi+WDATA.box.top] ; y0 |
1018 | mov edx, [edi+WDATA.box.height] |
||
1019 | add edx, ebx ; y0e |
||
1 | ha | 1020 | |
415 | heavyiron | 1021 | mov ecx, [esi+WDATA.box.top] ; y ; y check |
1022 | cmp ecx, edx |
||
1023 | jae .new_check ; y < y0e |
||
1024 | mov eax, [esi+WDATA.box.height] |
||
1025 | add ecx, eax ; ye |
||
1026 | cmp ebx, ecx ; y0 >= ye |
||
1027 | ja .new_check |
||
1 | ha | 1028 | |
415 | heavyiron | 1029 | mov eax, [edi+WDATA.box.left] ; x0 |
1030 | mov ecx, [edi+WDATA.box.width] |
||
1031 | add ecx, eax ; x0e |
||
1 | ha | 1032 | |
415 | heavyiron | 1033 | mov edx, [esi+WDATA.box.left] ; x ; x check |
1034 | cmp edx, ecx |
||
1035 | jae .new_check ; x < x0e |
||
1036 | mov ecx, [esi+WDATA.box.width] |
||
1037 | add edx, ecx |
||
1038 | cmp eax, edx |
||
1039 | ja .new_check |
||
1 | ha | 1040 | |
415 | heavyiron | 1041 | pop esi |
102 | poddubny | 1042 | .return_yes: |
415 | heavyiron | 1043 | mov ecx,1 ; overlap some window |
1044 | ret |
||
1 | ha | 1045 | |
1046 | .all_wnds_to_top: |
||
1047 | |||
415 | heavyiron | 1048 | pop esi |
1 | ha | 1049 | |
415 | heavyiron | 1050 | xor ecx, ecx ; passed all windows to top |
1051 | ret |
||
1 | ha | 1052 | |
1053 | |||
1054 | |||
1055 | |||
1056 | waredraw: ; if redraw necessary at activate |
||
1057 | |||
415 | heavyiron | 1058 | pushad |
1 | ha | 1059 | |
415 | heavyiron | 1060 | call checkwindowdraw ; draw window on activation ? |
1061 | test ecx, ecx |
||
1062 | jz .do_not_draw |
||
1 | ha | 1063 | |
415 | heavyiron | 1064 | popad |
1065 | mov [MOUSE_DOWN], byte 1 ; do draw mouse |
||
1066 | call windowactivate |
||
1 | ha | 1067 | |
415 | heavyiron | 1068 | ; update screen info |
1069 | pushad |
||
1070 | mov edi, [TASK_COUNT] ; the last process (number) |
||
1071 | movzx esi, word [WIN_POS + edi * 2] |
||
1072 | shl esi, 5 |
||
1073 | add esi, window_data |
||
1 | ha | 1074 | |
415 | heavyiron | 1075 | ; coordinates of the upper window |
1076 | mov eax, [esi + WDATA.box.left] ; cx |
||
1077 | mov ebx, [esi + WDATA.box.top] ; cy |
||
1078 | mov ecx, [esi + WDATA.box.width] ; sx |
||
117 | mario79 | 1079 | mov edx, [esi + WDATA.box.height] ; sy |
1 | ha | 1080 | |
415 | heavyiron | 1081 | add ecx, eax ; ecx = x_end |
1082 | add edx, ebx ; edx = y_end |
||
1 | ha | 1083 | |
415 | heavyiron | 1084 | mov edi, [TASK_COUNT] |
1085 | movzx esi, word [WIN_POS + edi * 2] |
||
1086 | call setscreen |
||
1087 | popad |
||
1 | ha | 1088 | |
117 | mario79 | 1089 | mov [edi + WDATA.fl_redraw], 1 ; redraw flag for app |
415 | heavyiron | 1090 | mov [MOUSE_DOWN],byte 0 ; mouse down checks |
1 | ha | 1091 | |
415 | heavyiron | 1092 | ret |
1 | ha | 1093 | |
1094 | .do_not_draw: |
||
1095 | |||
415 | heavyiron | 1096 | popad |
1 | ha | 1097 | |
415 | heavyiron | 1098 | call windowactivate |
1099 | mov [MOUSE_DOWN],byte 0 ; mouse down checks |
||
1100 | mov [MOUSE_BACKGROUND],byte 0 ; no mouse background |
||
1101 | mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse |
||
1102 | ret |
||
1 | ha | 1103 | |
1104 | |||
105 | poddubny | 1105 | ; eax = window number on screen |
1106 | ; corrupts registers and [dl*] |
||
1107 | minimize_window: |
||
415 | heavyiron | 1108 | movzx eax, word [WIN_POS+eax*2] |
1109 | shl eax, 5 |
||
1110 | add eax, window_data |
||
1111 | test [eax+WDATA.fl_wstate], WSTATE_MINIMIZED |
||
1112 | jnz .skip_redrawings |
||
1113 | pushfd |
||
1114 | cli |
||
1115 | or [eax+WDATA.fl_wstate], WSTATE_MINIMIZED |
||
1116 | mov edi, eax |
||
1117 | ;call calculatescreen |
||
1118 | mov eax, [edi+WDATA.box.left] |
||
1119 | mov [dlx], eax |
||
1120 | mov ecx, eax |
||
1121 | add ecx, [edi+WDATA.box.width] |
||
1122 | mov [dlxe], ecx |
||
1123 | mov ebx, [edi+WDATA.box.top] |
||
1124 | mov [dly], ebx |
||
1125 | mov edx, ebx |
||
1126 | add edx, [edi+WDATA.box.height] |
||
1127 | mov [dlye], edx |
||
1128 | call calculatescreen |
||
1129 | xor esi, esi |
||
1130 | xor eax, eax |
||
1131 | call redrawscreen |
||
1132 | popfd |
||
105 | poddubny | 1133 | .skip_redrawings: |
415 | heavyiron | 1134 | ret |
105 | poddubny | 1135 | |
1136 | ; eax = window number on screen |
||
1137 | ; corrupts registers and [dl*] |
||
1138 | restore_minimized_window: |
||
415 | heavyiron | 1139 | pushfd |
1140 | cli |
||
1141 | movzx esi, word [WIN_POS+eax*2] |
||
1142 | mov edi, esi |
||
1143 | shl edi, 5 |
||
1144 | add edi, window_data |
||
1145 | test [edi+WDATA.fl_wstate], WSTATE_MINIMIZED |
||
1146 | jz .skip_redrawings |
||
1147 | mov [edi+WDATA.fl_redraw], 1 |
||
1148 | and [edi+WDATA.fl_wstate], not WSTATE_MINIMIZED |
||
1149 | cmp eax, [TASK_COUNT] ; the uppermost window |
||
1150 | jnz .no_uppermost |
||
1151 | mov eax, [edi+WDATA.box.left] |
||
1152 | mov ebx, [edi+WDATA.box.top] |
||
1153 | mov ecx, eax |
||
1154 | mov edx, ebx |
||
1155 | add ecx, [edi+WDATA.box.width] |
||
1156 | add edx, [edi+WDATA.box.height] |
||
1157 | call setscreen |
||
1158 | jmp .done |
||
105 | poddubny | 1159 | .no_uppermost: |
415 | heavyiron | 1160 | mov eax, [edi+WDATA.box.left] |
1161 | mov ebx, [edi+WDATA.box.top] |
||
1162 | mov ecx, eax |
||
1163 | mov edx, ebx |
||
1164 | add ecx, [edi+WDATA.box.width] |
||
1165 | add edx, [edi+WDATA.box.height] |
||
1166 | call calculatescreen |
||
105 | poddubny | 1167 | .done: |
415 | heavyiron | 1168 | mov [MOUSE_BACKGROUND],byte 0 ; no mouse under |
105 | poddubny | 1169 | .skip_redrawings: |
415 | heavyiron | 1170 | popfd |
1171 | ret |
||
105 | poddubny | 1172 | |
1173 | |||
1 | ha | 1174 | iglobal |
1175 | window_moving db 'K : Window - move/resize',13,10,0 |
||
415 | heavyiron | 1176 | window_moved db 'K : Window - done',13,10,0 |
1 | ha | 1177 | endg |
1178 | |||
1179 | ; check window touch |
||
1180 | align 4 |
||
1181 | checkwindows: |
||
415 | heavyiron | 1182 | pushad |
1 | ha | 1183 | |
415 | heavyiron | 1184 | cmp [window_minimize], 0 |
1185 | je .no_minimizing |
||
1186 | mov eax, [TASK_COUNT] ; the uppermost window |
||
1187 | mov bl, 0 |
||
1188 | xchg [window_minimize], bl |
||
1189 | cmp bl, 1 |
||
1190 | jne .restore |
||
1191 | call minimize_window |
||
1192 | jmp .continue |
||
105 | poddubny | 1193 | .restore: |
415 | heavyiron | 1194 | call restore_minimized_window |
105 | poddubny | 1195 | .continue: |
1196 | .no_minimizing: |
||
1 | ha | 1197 | |
415 | heavyiron | 1198 | cmp [BTN_DOWN],byte 0 ; mouse buttons pressed ? |
1199 | jne .mouse_buttons_pressed |
||
1200 | ;..................................... start 1/4 : modified by vhanla ................. |
||
1201 | mov [bPressedMouseXY_W],0 |
||
1202 | ;..................................... end 1/4 : modified by vhanla ................... |
||
1203 | popad |
||
1204 | ret |
||
1 | ha | 1205 | .mouse_buttons_pressed: |
415 | heavyiron | 1206 | ;..................................... start 2/4 : modified by vhanla ................. |
1207 | jmp @f |
||
1208 | bPressedMouseXY_W db 0x0 |
||
1209 | @@: |
||
1210 | ;..................................... end 2/4 : modified by vhanla ................... |
||
1211 | mov esi,[TASK_COUNT] |
||
1212 | inc esi |
||
1 | ha | 1213 | |
415 | heavyiron | 1214 | ;..................................... start 3/4 : modified by vhanla ................. |
1215 | push ax |
||
1216 | cmp [bPressedMouseXY_W],0 |
||
1217 | jnz @f |
||
1218 | mov [bPressedMouseXY_W],1 |
||
1219 | mov ax,[MOUSE_X] |
||
1220 | mov [mx],ax |
||
1221 | mov ax,[MOUSE_Y] |
||
1222 | mov [my],ax |
||
1223 | @@: |
||
1224 | pop ax |
||
1225 | ;..................................... end 3/4 : modified by vhanla ................... |
||
1 | ha | 1226 | |
1227 | cwloop: |
||
415 | heavyiron | 1228 | cmp esi,2 |
1229 | jb .exit |
||
105 | poddubny | 1230 | |
415 | heavyiron | 1231 | dec esi |
1232 | movzx edi, word [WIN_POS + esi * 2] ; ebx |
||
1233 | shl edi, 5 |
||
1234 | add edi, window_data |
||
1 | ha | 1235 | ; mov edi, ebx |
117 | mario79 | 1236 | mov ecx, [edi + WDATA.box.left] |
1237 | mov edx, [edi + WDATA.box.top] |
||
1 | ha | 1238 | |
415 | heavyiron | 1239 | mov eax,ecx |
1240 | mov ebx,edx |
||
1241 | test [edi+WDATA.fl_wstate],WSTATE_MINIMIZED |
||
1242 | jnz cwloop |
||
1 | ha | 1243 | |
415 | heavyiron | 1244 | ;..................................... start 4/4 : modified by vhanla ................. |
1245 | movzx eax, word [mx]; movzx eax,word[MOUSE_X] |
||
1246 | movzx ebx, word [my]; movzx ebx,word[MOUSE_Y] |
||
1247 | ;..................................... endt 4/4 : modified by vhanla .................. |
||
1248 | cmp ecx, eax |
||
1249 | jae cwloop |
||
1250 | cmp edx, ebx |
||
1251 | jae cwloop |
||
117 | mario79 | 1252 | add ecx, [edi + WDATA.box.width] |
1253 | add edx, [edi + WDATA.box.height] |
||
415 | heavyiron | 1254 | cmp eax, ecx |
1255 | jae cwloop |
||
1256 | cmp ebx, edx |
||
1257 | jae cwloop |
||
1 | ha | 1258 | |
415 | heavyiron | 1259 | pushad |
1260 | mov eax, esi |
||
1261 | mov ebx, [TASK_COUNT] |
||
1262 | cmp eax, ebx ; is this window active? |
||
1263 | jz .move_resize_window |
||
1 | ha | 1264 | |
415 | heavyiron | 1265 | ; eax = position in windowing stack |
1266 | ; redraw must ? |
||
1267 | lea esi, [WIN_POS + esi * 2] |
||
1268 | call waredraw |
||
1269 | add esp, 32 |
||
1 | ha | 1270 | |
1271 | .exit: |
||
415 | heavyiron | 1272 | popad |
1273 | ret |
||
1 | ha | 1274 | |
1275 | .move_resize_window: ; MOVE OR RESIZE WINDOW |
||
415 | heavyiron | 1276 | popad |
1 | ha | 1277 | |
415 | heavyiron | 1278 | ; Check for user enabled fixed window |
117 | mario79 | 1279 | mov edx, [edi + WDATA.cl_titlebar] |
415 | heavyiron | 1280 | and edx, 0x0f000000 |
1281 | cmp edx, 0x01000000 |
||
1282 | jne .window_move_enabled_for_user |
||
1283 | popad |
||
1284 | ret |
||
1 | ha | 1285 | .window_move_enabled_for_user: |
1286 | |||
117 | mario79 | 1287 | test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
415 | heavyiron | 1288 | jnz .no_resize_2 |
41 | mikedld | 1289 | |
415 | heavyiron | 1290 | mov [do_resize_from_corner],byte 0 ; resize for skinned window |
117 | mario79 | 1291 | mov edx, [edi + WDATA.cl_workarea] |
415 | heavyiron | 1292 | and edx, 0x0f000000 |
1293 | cmp edx, 0x02000000 |
||
1294 | jb .no_resize_2 ; not type 2 wnd |
||
1 | ha | 1295 | |
117 | mario79 | 1296 | mov edx, [edi + WDATA.box.top] |
1297 | add edx, [edi + WDATA.box.height] |
||
415 | heavyiron | 1298 | sub edx, 6 ; edx = y_end - 6 |
1299 | cmp ebx, edx ; ebx = mouse_y |
||
1300 | jb .no_resize_2 |
||
1301 | mov [do_resize_from_corner],byte 1 |
||
1302 | jmp .continue |
||
1 | ha | 1303 | .no_resize_2: |
1304 | |||
415 | heavyiron | 1305 | push eax |
1306 | call get_titlebar_height |
||
117 | mario79 | 1307 | add eax,[edi + WDATA.box.top] |
415 | heavyiron | 1308 | cmp ebx,eax |
1309 | pop eax |
||
1310 | jae .exit |
||
1 | ha | 1311 | |
1312 | .continue: |
||
1313 | |||
415 | heavyiron | 1314 | push esi |
1315 | mov esi, window_moving |
||
1316 | call sys_msg_board_str |
||
1317 | pop esi |
||
1 | ha | 1318 | |
415 | heavyiron | 1319 | mov ecx, [timer_ticks] ; double-click ? |
1320 | mov edx, ecx |
||
1321 | sub edx, [latest_window_touch] |
||
1322 | mov [latest_window_touch], ecx |
||
1323 | mov [latest_window_touch_delta], edx |
||
1 | ha | 1324 | |
415 | heavyiron | 1325 | mov cl, [BTN_DOWN] ; save for shade check |
1326 | mov [do_resize], cl |
||
1 | ha | 1327 | no_emulation_righ_button: |
117 | mario79 | 1328 | mov ecx, [edi + WDATA.box.left] |
1329 | mov edx, [edi + WDATA.box.top] |
||
1 | ha | 1330 | |
415 | heavyiron | 1331 | push eax ecx edx |
1332 | mov [dlx], ecx ; save for drawlimits |
||
1333 | mov [dly], edx |
||
117 | mario79 | 1334 | mov eax, [edi + WDATA.box.width] |
415 | heavyiron | 1335 | add ecx, eax |
117 | mario79 | 1336 | mov eax, [edi + WDATA.box.height] |
415 | heavyiron | 1337 | add edx, eax |
1338 | mov [dlxe], ecx |
||
1339 | mov [dlye], edx |
||
1340 | pop edx ecx eax |
||
1 | ha | 1341 | |
415 | heavyiron | 1342 | sub eax, ecx |
1343 | sub ebx, edx |
||
1 | ha | 1344 | |
415 | heavyiron | 1345 | mov esi, [MOUSE_X] |
1346 | mov [WIN_TEMP_XY], esi |
||
1 | ha | 1347 | |
415 | heavyiron | 1348 | pushad ; wait for putimages to finish |
1 | ha | 1349 | ; mov eax,5 |
1350 | ; call delay_hs |
||
117 | mario79 | 1351 | mov eax,[edi + WDATA.box.left] |
415 | heavyiron | 1352 | mov [npx],eax |
117 | mario79 | 1353 | mov eax,[edi + WDATA.box.top] |
415 | heavyiron | 1354 | mov [npy],eax |
1355 | popad |
||
1 | ha | 1356 | |
415 | heavyiron | 1357 | push eax ; save old coordinates |
117 | mario79 | 1358 | mov ax, word [edi + WDATA.box.left] |
415 | heavyiron | 1359 | mov word [oldc+BOX.left],ax |
117 | mario79 | 1360 | mov ax, word [edi + WDATA.box.top] |
415 | heavyiron | 1361 | mov word [oldc+BOX.top],ax |
117 | mario79 | 1362 | mov ax, word [edi + WDATA.box.width] |
415 | heavyiron | 1363 | mov word [oldc+BOX.width],ax |
1364 | mov word [npxe],ax |
||
117 | mario79 | 1365 | mov ax, word [edi + WDATA.box.height] |
415 | heavyiron | 1366 | mov word [oldc+BOX.height],ax |
1367 | mov word [npye],ax |
||
1368 | pop eax |
||
1 | ha | 1369 | |
415 | heavyiron | 1370 | call drawwindowframes |
1 | ha | 1371 | |
415 | heavyiron | 1372 | mov [reposition],0 |
1373 | mov [MOUSE_DOWN],byte 1 ; no reaction to mouse up/down |
||
1 | ha | 1374 | |
415 | heavyiron | 1375 | ; move window |
1 | ha | 1376 | |
1377 | newchm: |
||
1378 | |||
415 | heavyiron | 1379 | mov [DONT_DRAW_MOUSE],byte 1 |
1 | ha | 1380 | |
415 | heavyiron | 1381 | call checkidle |
1 | ha | 1382 | |
415 | heavyiron | 1383 | call checkVga_N13 |
1 | ha | 1384 | |
415 | heavyiron | 1385 | mov [MOUSE_BACKGROUND],byte 0 |
1 | ha | 1386 | |
415 | heavyiron | 1387 | call [draw_pointer] |
1 | ha | 1388 | |
415 | heavyiron | 1389 | pushad |
1390 | call stack_handler |
||
1391 | popad |
||
1 | ha | 1392 | |
415 | heavyiron | 1393 | mov esi,[WIN_TEMP_XY] |
1394 | cmp esi,[MOUSE_X] |
||
1395 | je cwb |
||
1 | ha | 1396 | |
415 | heavyiron | 1397 | mov cx,[MOUSE_X] |
1398 | mov dx,[MOUSE_Y] |
||
1399 | sub cx,ax |
||
1400 | sub dx,bx |
||
1 | ha | 1401 | |
415 | heavyiron | 1402 | push ax |
1403 | push bx |
||
1 | ha | 1404 | |
415 | heavyiron | 1405 | call drawwindowframes |
1 | ha | 1406 | |
415 | heavyiron | 1407 | mov ax,[ScreenWidth] |
1408 | mov bx,[ScreenHeight] |
||
1 | ha | 1409 | |
415 | heavyiron | 1410 | cmp [do_resize_from_corner],1 |
1411 | je no_new_position |
||
1 | ha | 1412 | |
415 | heavyiron | 1413 | mov word [npx],word 0 ; x repos ? |
1414 | cmp ax,cx |
||
1415 | jb noreposx |
||
1416 | mov [reposition],1 |
||
1417 | sub ax,word [npxe] |
||
1418 | mov word [npx],ax |
||
1419 | cmp ax,cx |
||
1420 | jb noreposx |
||
1421 | mov word [npx],cx |
||
1 | ha | 1422 | noreposx: |
1423 | |||
415 | heavyiron | 1424 | mov word [npy],word 0 ; y repos ? |
1425 | cmp bx,dx |
||
1426 | jb noreposy |
||
1427 | mov [reposition],1 |
||
1428 | sub bx,word [npye] |
||
1429 | mov word [npy],bx |
||
1430 | cmp bx,dx |
||
1431 | jb noreposy |
||
1432 | mov word [npy],dx |
||
1 | ha | 1433 | noreposy: |
1434 | |||
1435 | no_new_position: |
||
1436 | |||
415 | heavyiron | 1437 | cmp [do_resize_from_corner],0 ; resize from right corner |
1438 | je norepos_size |
||
1439 | pushad |
||
1 | ha | 1440 | |
415 | heavyiron | 1441 | mov edx,edi |
1442 | sub edx,window_data |
||
1443 | ;shr edx,5 |
||
1444 | ;shl edx,8 |
||
1445 | ;add edx,0x80000 ; process base at 0x80000+ |
||
380 | serge | 1446 | lea edx, [SLOT_BASE + edx*8] |
1 | ha | 1447 | |
415 | heavyiron | 1448 | movzx eax,word [MOUSE_X] |
117 | mario79 | 1449 | cmp eax,[edi + WDATA.box.left] |
415 | heavyiron | 1450 | jb nnepx |
117 | mario79 | 1451 | sub eax,[edi + WDATA.box.left] |
415 | heavyiron | 1452 | cmp eax,32 ; [edx+0x90+8] |
1453 | jge nnepx2 |
||
1454 | mov eax,32 ; [edx+0x90+8] |
||
1 | ha | 1455 | nnepx2: |
415 | heavyiron | 1456 | mov [npxe],eax |
1 | ha | 1457 | nnepx: |
1458 | |||
415 | heavyiron | 1459 | call get_rolledup_height |
1460 | mov ebx,eax |
||
1461 | movzx eax,word [MOUSE_Y] |
||
117 | mario79 | 1462 | cmp eax,[edi + WDATA.box.top] |
415 | heavyiron | 1463 | jb nnepy |
117 | mario79 | 1464 | sub eax,[edi + WDATA.box.top] |
415 | heavyiron | 1465 | cmp eax,ebx ; [edx+0x90+12] |
1466 | jge nnepy2 |
||
1467 | mov eax,ebx ; [edx+0x90+12] |
||
1 | ha | 1468 | nnepy2: |
415 | heavyiron | 1469 | mov [npye],eax |
1 | ha | 1470 | nnepy: |
1471 | |||
415 | heavyiron | 1472 | mov [reposition],1 |
1 | ha | 1473 | |
415 | heavyiron | 1474 | popad |
1 | ha | 1475 | norepos_size: |
1476 | |||
415 | heavyiron | 1477 | pop bx |
1478 | pop ax |
||
1479 | call drawwindowframes |
||
1 | ha | 1480 | |
415 | heavyiron | 1481 | mov esi,[MOUSE_X] |
1482 | mov [WIN_TEMP_XY],esi |
||
1 | ha | 1483 | |
1484 | cwb: |
||
415 | heavyiron | 1485 | cmp [BTN_DOWN],byte 0 |
1486 | jne newchm |
||
1487 | ; new position done |
||
1488 | mov [DONT_DRAW_MOUSE],byte 1 |
||
1489 | mov cl,0 |
||
1490 | test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
||
1491 | jnz @f |
||
1492 | mov cl,[reposition] |
||
1493 | call drawwindowframes |
||
1 | ha | 1494 | |
415 | heavyiron | 1495 | mov eax,[npx] |
117 | mario79 | 1496 | mov [edi + WDATA.box.left],eax |
415 | heavyiron | 1497 | mov eax,[npy] |
117 | mario79 | 1498 | mov [edi + WDATA.box.top],eax |
415 | heavyiron | 1499 | mov eax,[npxe] |
117 | mario79 | 1500 | mov [edi + WDATA.box.width],eax |
415 | heavyiron | 1501 | mov eax,[npye] |
117 | mario79 | 1502 | mov [edi + WDATA.box.height],eax |
415 | heavyiron | 1503 | call set_window_clientbox |
1 | ha | 1504 | |
415 | heavyiron | 1505 | @@: mov [reposition],cl |
41 | mikedld | 1506 | |
415 | heavyiron | 1507 | cmp [reposition],1 ; save new position and size |
1508 | jne no_bounds_save |
||
1509 | push esi edi ecx |
||
1510 | mov esi,edi |
||
1511 | mov ecx,2 |
||
1512 | test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP or WSTATE_MAXIMIZED |
||
1513 | jnz @f |
||
1514 | add ecx,2 |
||
57 | mikedld | 1515 | @@: sub edi,window_data |
415 | heavyiron | 1516 | shr edi,5 |
1517 | shl edi,8 |
||
1518 | add edi,SLOT_BASE+APPDATA.saved_box |
||
1519 | cld |
||
1520 | rep movsd |
||
1521 | pop ecx edi esi |
||
52 | mikedld | 1522 | no_bounds_save: |
1 | ha | 1523 | |
415 | heavyiron | 1524 | pushad ; WINDOW SHADE/FULLSCREEN |
1 | ha | 1525 | |
415 | heavyiron | 1526 | cmp [reposition],1 |
1527 | je no_window_sizing |
||
1528 | mov edx,edi |
||
1529 | sub edx,window_data |
||
1530 | shr edx,5 |
||
1531 | shl edx,8 |
||
1532 | add edx,SLOT_BASE ; process base at 0x80000+ |
||
1 | ha | 1533 | |
415 | heavyiron | 1534 | cmp [do_resize],2 ; window shade ? |
1535 | jne no_window_shade |
||
1536 | mov [reposition],1 |
||
1 | ha | 1537 | |
415 | heavyiron | 1538 | test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
1539 | jnz wnd_rolldown |
||
41 | mikedld | 1540 | wnd_rollup: |
415 | heavyiron | 1541 | or [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
1542 | call get_rolledup_height |
||
1543 | jmp @f |
||
41 | mikedld | 1544 | wnd_rolldown: |
415 | heavyiron | 1545 | and [edi+WDATA.fl_wstate],not WSTATE_ROLLEDUP |
117 | mario79 | 1546 | mov eax,[edx + APPDATA.saved_box.height] ; 0x90+BOX.height |
415 | heavyiron | 1547 | test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
1548 | jz @f |
||
1549 | mov eax,[screen_workarea.bottom] |
||
1550 | sub eax,[screen_workarea.top] |
||
1551 | @@: mov [edi+WDATA.box.height],eax |
||
1552 | call set_window_clientbox |
||
1 | ha | 1553 | |
1554 | no_window_shade: |
||
1555 | |||
415 | heavyiron | 1556 | cmp [do_resize],1 ; fullscreen/restore ? |
1557 | jne no_fullscreen_restore |
||
1558 | cmp [latest_window_touch_delta],dword 50 |
||
1559 | jg no_fullscreen_restore |
||
1560 | mov [reposition],1 |
||
1561 | test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
||
1562 | jnz restore_from_fullscreen |
||
1563 | or [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
||
1564 | mov eax,[screen_workarea.left] |
||
1565 | mov [edi+WDATA.box.left],eax |
||
1566 | sub eax,[screen_workarea.right] |
||
1567 | neg eax |
||
1568 | mov [edi+WDATA.box.width],eax |
||
1569 | mov eax,[screen_workarea.top] |
||
1570 | mov [edi+WDATA.box.top],eax |
||
1571 | test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
||
1572 | jnz @f |
||
1573 | sub eax,[screen_workarea.bottom] |
||
1574 | neg eax |
||
1575 | mov [edi+WDATA.box.height],eax |
||
41 | mikedld | 1576 | @@: |
415 | heavyiron | 1577 | jmp restore_from_fullscreen.clientbox |
1 | ha | 1578 | restore_from_fullscreen: |
415 | heavyiron | 1579 | and [edi+WDATA.fl_wstate],not WSTATE_MAXIMIZED |
1580 | push [edi+WDATA.box.height] |
||
1581 | push edi ; restore |
||
1582 | lea esi, [edx + APPDATA.saved_box] |
||
1583 | mov ecx,4 |
||
1584 | cld |
||
1585 | rep movsd |
||
1586 | pop edi |
||
1587 | pop eax |
||
1588 | test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
||
1589 | jz @f |
||
1590 | mov [edi+WDATA.box.height],eax |
||
41 | mikedld | 1591 | @@: |
150 | diamond | 1592 | .clientbox: |
415 | heavyiron | 1593 | call set_window_clientbox |
1 | ha | 1594 | |
1595 | no_fullscreen_restore: |
||
1596 | |||
415 | heavyiron | 1597 | mov eax,[edi+WDATA.box.top] ; check Y inside screen |
1598 | add eax,[edi+WDATA.box.height] |
||
1599 | cmp eax,[ScreenHeight] |
||
1600 | jbe no_window_sizing |
||
1601 | mov eax,[edi+WDATA.box.left] ; check X inside screen |
||
1602 | add eax,[edi+WDATA.box.width] |
||
1603 | cmp eax,[ScreenWidth] |
||
1604 | jbe no_window_sizing |
||
1605 | mov eax,[ScreenWidth] |
||
1606 | sub eax,[edi+WDATA.box.width] |
||
1607 | mov [edi+WDATA.box.left],eax |
||
1608 | mov eax,[ScreenHeight] |
||
1609 | sub eax,[edi+WDATA.box.height] |
||
1610 | mov [edi+WDATA.box.top],eax |
||
1611 | call set_window_clientbox |
||
1 | ha | 1612 | no_window_sizing: |
1613 | |||
415 | heavyiron | 1614 | popad |
1 | ha | 1615 | |
415 | heavyiron | 1616 | cmp [reposition],0 |
1617 | je retwm |
||
1 | ha | 1618 | |
415 | heavyiron | 1619 | mov [DONT_DRAW_MOUSE],byte 1 ; no mouse |
1 | ha | 1620 | |
112 | poddubny | 1621 | |
415 | heavyiron | 1622 | push eax ebx ecx edx |
1623 | mov eax,[edi+WDATA.box.left] |
||
1624 | mov ebx,[edi+WDATA.box.top] |
||
1625 | mov ecx,[edi+WDATA.box.width] |
||
1626 | mov edx,[edi+WDATA.box.height] |
||
1627 | add ecx,eax |
||
1628 | add edx,ebx |
||
1629 | call calculatescreen |
||
112 | poddubny | 1630 | |
415 | heavyiron | 1631 | mov eax,[oldc+BOX.left] |
1632 | mov ebx,[oldc+BOX.top] |
||
1633 | mov ecx,[oldc+BOX.width] |
||
1634 | mov edx,[oldc+BOX.height] |
||
1635 | add ecx,eax |
||
1636 | add edx,ebx |
||
1637 | call calculatescreen |
||
1638 | pop edx ecx ebx eax |
||
1 | ha | 1639 | |
415 | heavyiron | 1640 | mov eax,edi |
1641 | call redrawscreen |
||
1 | ha | 1642 | |
112 | poddubny | 1643 | |
415 | heavyiron | 1644 | mov [edi+WDATA.fl_redraw],1 |
112 | poddubny | 1645 | |
415 | heavyiron | 1646 | mov ecx,100 ; wait to avoid mouse residuals |
1 | ha | 1647 | waitre2: |
415 | heavyiron | 1648 | mov [DONT_DRAW_MOUSE],byte 1 |
1649 | call checkidle |
||
1650 | cmp [edi+WDATA.fl_redraw],0 |
||
1651 | jz retwm |
||
1652 | loop waitre2 |
||
1 | ha | 1653 | |
1654 | retwm: |
||
1655 | |||
415 | heavyiron | 1656 | mov [DONT_DRAW_MOUSE],byte 0 ; mouse pointer |
1657 | mov [MOUSE_BACKGROUND],byte 0 ; no mouse under |
||
1658 | mov [MOUSE_DOWN],byte 0 ; react to mouse up/down |
||
1 | ha | 1659 | |
415 | heavyiron | 1660 | mov esi,window_moved |
1661 | call sys_msg_board_str |
||
1 | ha | 1662 | |
415 | heavyiron | 1663 | popad |
1 | ha | 1664 | |
415 | heavyiron | 1665 | ret |
1 | ha | 1666 | |
1667 | |||
1668 | uglobal |
||
415 | heavyiron | 1669 | add_window_data dd 0 |
1 | ha | 1670 | do_resize_from_corner db 0x0 |
415 | heavyiron | 1671 | reposition db 0x0 |
1672 | latest_window_touch dd 0x0 |
||
1 | ha | 1673 | latest_window_touch_delta dd 0x0 |
1674 | |||
1675 | do_resize db 0x0 |
||
1676 | |||
415 | heavyiron | 1677 | oldc dd 0x0,0x0,0x0,0x0 |
1 | ha | 1678 | |
415 | heavyiron | 1679 | dlx dd 0x0 |
1680 | dly dd 0x0 |
||
1681 | dlxe dd 0x0 |
||
1682 | dlye dd 0x0 |
||
1 | ha | 1683 | |
415 | heavyiron | 1684 | npx dd 0x0 |
1685 | npy dd 0x0 |
||
1686 | npxe dd 0x0 |
||
1687 | npye dd 0x0 |
||
1 | ha | 1688 | |
415 | heavyiron | 1689 | mpx dd 0x0 |
1690 | mpy dd 0x0 |
||
1 | ha | 1691 | endg |
1692 | |||
1693 | |||
1694 | ; draw negative window frames |
||
186 | diamond | 1695 | drawwindowframes2: |
415 | heavyiron | 1696 | pushad |
1697 | cli |
||
1698 | jmp drawwindowframes.do |
||
1 | ha | 1699 | drawwindowframes: |
415 | heavyiron | 1700 | pushad |
1701 | cli |
||
1 | ha | 1702 | |
415 | heavyiron | 1703 | test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
1704 | jnz .ret |
||
1705 | mov eax, [npx] |
||
1706 | cmp eax, [edi+WDATA.box.left] |
||
1707 | jnz .nowndframe |
||
1708 | mov eax, [npxe] |
||
1709 | cmp eax, [edi+WDATA.box.width] |
||
1710 | jnz .nowndframe |
||
1711 | mov eax, [npy] |
||
1712 | cmp eax, [edi+WDATA.box.top] |
||
1713 | jnz .nowndframe |
||
1714 | mov eax, [npye] |
||
1715 | cmp eax, [edi+WDATA.box.height] |
||
1716 | jnz .nowndframe |
||
1717 | xor [edi+WDATA.fl_wdrawn], 2 |
||
1718 | test [edi+WDATA.fl_wdrawn], 4 |
||
1719 | jnz .ret |
||
163 | diamond | 1720 | |
186 | diamond | 1721 | .nowndframe: |
1722 | .do: |
||
415 | heavyiron | 1723 | mov edi, 1 |
1724 | mov ecx, 0x01000000 |
||
1725 | mov eax,[npx] |
||
1726 | shl eax,16 |
||
1727 | add eax,[npx] |
||
1728 | add eax,[npxe] |
||
1729 | add eax,65536*1-1 |
||
1730 | mov ebx,[npy] |
||
1731 | shl ebx,16 |
||
1732 | add ebx,[npy] |
||
1733 | call [draw_line] |
||
1 | ha | 1734 | |
415 | heavyiron | 1735 | mov eax,[npx] |
1736 | shl eax,16 |
||
1737 | add eax,[npx] |
||
1738 | add eax,[npxe] |
||
1739 | add eax,65536*1-1 |
||
1740 | mov ebx,[npy] |
||
1741 | add ebx,[npye] |
||
1742 | shl ebx,16 |
||
1743 | add ebx,[npy] |
||
1744 | add ebx,[npye] |
||
1745 | call [draw_line] |
||
1 | ha | 1746 | |
415 | heavyiron | 1747 | mov eax,[npx] |
1748 | shl eax,16 |
||
1749 | add eax,[npx] |
||
1750 | mov ebx,[npy] |
||
1751 | shl ebx,16 |
||
1752 | add ebx,[npy] |
||
1753 | add ebx,[npye] |
||
1754 | call [draw_line] |
||
1 | ha | 1755 | |
415 | heavyiron | 1756 | mov eax,[npx] |
1757 | add eax,[npxe] |
||
1758 | shl eax,16 |
||
1759 | add eax,[npx] |
||
1760 | add eax,[npxe] |
||
1761 | mov ebx,[npy] |
||
1762 | shl ebx,16 |
||
1763 | add ebx,[npy] |
||
1764 | add ebx,[npye] |
||
1765 | call [draw_line] |
||
1 | ha | 1766 | |
186 | diamond | 1767 | .ret: |
415 | heavyiron | 1768 | sti |
1769 | popad |
||
1770 | ret |
||
1 | ha | 1771 | |
1772 | |||
1773 | |||
1774 | random_shaped_window: |
||
1775 | |||
1776 | ; |
||
1777 | ; eax = 0 giving address of data area |
||
1778 | ; ebx address |
||
115 | poddubny | 1779 | ; eax = 1 shape area scale |
1 | ha | 1780 | ; ebx 2^ebx scale |
1781 | |||
1782 | test eax, eax |
||
1783 | jne rsw_no_address |
||
465 | serge | 1784 | mov eax,[current_slot] |
1785 | mov [eax+APPDATA.wnd_shape],ebx |
||
1786 | rsw_no_address: |
||
1 | ha | 1787 | |
1788 | cmp eax,1 |
||
1789 | jne rsw_no_scale |
||
465 | serge | 1790 | mov eax,[current_slot] |
1791 | mov byte [eax+APPDATA.wnd_shape_scale], bl |
||
1792 | rsw_no_scale: |
||
1 | ha | 1793 | |
1794 | ret>>->->=>=> |
||
1795 |