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