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