Subversion Repositories Kolibri OS

Rev

Rev 837 | Rev 860 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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