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