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