Rev 1550 | Rev 2214 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1550 | Rev 1563 | ||
---|---|---|---|
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2010. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2010. All rights reserved. ;; |
4 | ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; |
4 | ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; |
5 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; Distributed under terms of the GNU General Public License ;; |
6 | ;; ;; |
6 | ;; ;; |
7 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
7 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
8 | 8 | ||
9 | $Revision: 1550 $ |
9 | $Revision: 1563 $ |
10 | 10 | ||
11 | ;============================================================================== |
11 | ;============================================================================== |
12 | ;///// public functions /////////////////////////////////////////////////////// |
12 | ;///// public functions /////////////////////////////////////////////////////// |
13 | ;============================================================================== |
13 | ;============================================================================== |
14 | 14 | ||
15 | window.BORDER_SIZE = 5 |
15 | window.BORDER_SIZE = 5 |
16 | 16 | ||
17 | macro FuncTable name, table_name, [label] |
17 | macro FuncTable name, table_name, [label] |
18 | { |
18 | { |
19 | common |
19 | common |
20 | align 4 |
20 | align 4 |
21 | \label name#.#table_name dword |
21 | \label name#.#table_name dword |
22 | forward |
22 | forward |
23 | dd name#.#label |
23 | dd name#.#label |
24 | common |
24 | common |
25 | name#.sizeof.#table_name = $ - name#.#table_name |
25 | name#.sizeof.#table_name = $ - name#.#table_name |
26 | } |
26 | } |
27 | 27 | ||
28 | uglobal |
28 | uglobal |
29 | common_colours rd 32 |
29 | common_colours rd 32 |
30 | draw_limits RECT |
30 | draw_limits RECT |
31 | endg |
31 | endg |
32 | 32 | ||
33 | align 4 |
33 | align 4 |
34 | ;------------------------------------------------------------------------------ |
34 | ;------------------------------------------------------------------------------ |
35 | syscall_draw_window: ;///// system function 0 ///////////////////////////////// |
35 | syscall_draw_window: ;///// system function 0 ///////////////////////////////// |
36 | ;------------------------------------------------------------------------------ |
36 | ;------------------------------------------------------------------------------ |
37 | ;? |
37 | ;? |
38 | ;------------------------------------------------------------------------------ |
38 | ;------------------------------------------------------------------------------ |
39 | mov eax, edx |
39 | mov eax, edx |
40 | shr eax, 24 |
40 | shr eax, 24 |
41 | and al, 0x0f |
41 | and al, 0x0f |
42 | cmp al, 5 |
42 | cmp al, 5 |
43 | jae .exit |
43 | jae .exit |
44 | 44 | ||
45 | push eax |
45 | push eax |
46 | inc [mouse_pause] |
46 | inc [mouse_pause] |
47 | call [_display.disable_mouse] |
47 | call [_display.disable_mouse] |
48 | call window._.sys_set_window |
48 | call window._.sys_set_window |
49 | call [_display.disable_mouse] |
49 | call [_display.disable_mouse] |
50 | pop eax |
50 | pop eax |
51 | 51 | ||
52 | or al, al |
52 | or al, al |
53 | jnz @f |
53 | jnz @f |
54 | 54 | ||
55 | ; type I - original style |
55 | ; type I - original style |
56 | call drawwindow_I |
56 | call drawwindow_I |
57 | jmp window._.draw_window_caption.2 |
57 | jmp window._.draw_window_caption.2 |
58 | 58 | ||
59 | @@: dec al |
59 | @@: dec al |
60 | jnz @f |
60 | jnz @f |
61 | 61 | ||
62 | ; type II - only reserve area, no draw |
62 | ; type II - only reserve area, no draw |
63 | call sys_window_mouse |
63 | call sys_window_mouse |
64 | dec [mouse_pause] |
64 | dec [mouse_pause] |
65 | call [draw_pointer] |
65 | call [draw_pointer] |
66 | jmp .exit |
66 | jmp .exit |
67 | 67 | ||
68 | @@: dec al |
68 | @@: dec al |
69 | jnz @f |
69 | jnz @f |
70 | 70 | ||
71 | ; type III - new style |
71 | ; type III - new style |
72 | call drawwindow_III |
72 | call drawwindow_III |
73 | jmp window._.draw_window_caption.2 |
73 | jmp window._.draw_window_caption.2 |
74 | 74 | ||
75 | ; type IV & V - skinned window (resizable & not) |
75 | ; type IV & V - skinned window (resizable & not) |
76 | @@: mov eax, [TASK_COUNT] |
76 | @@: mov eax, [TASK_COUNT] |
77 | movzx eax, word[WIN_POS + eax * 2] |
77 | movzx eax, word[WIN_POS + eax * 2] |
78 | cmp eax, [CURRENT_TASK] |
78 | cmp eax, [CURRENT_TASK] |
79 | setz al |
79 | setz al |
80 | movzx eax, al |
80 | movzx eax, al |
81 | push eax |
81 | push eax |
82 | call drawwindow_IV |
82 | call drawwindow_IV |
83 | jmp window._.draw_window_caption.2 |
83 | jmp window._.draw_window_caption.2 |
84 | 84 | ||
85 | .exit: |
85 | .exit: |
86 | ret |
86 | ret |
87 | 87 | ||
88 | align 4 |
88 | align 4 |
89 | ;------------------------------------------------------------------------------ |
89 | ;------------------------------------------------------------------------------ |
90 | syscall_display_settings: ;///// system function 48 /////////////////////////// |
90 | syscall_display_settings: ;///// system function 48 /////////////////////////// |
91 | ;------------------------------------------------------------------------------ |
91 | ;------------------------------------------------------------------------------ |
92 | ;; Redraw screen: |
92 | ;; Redraw screen: |
93 | ;< ebx = 0 |
93 | ;< ebx = 0 |
94 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
94 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
95 | ;; Set button style: |
95 | ;; Set button style: |
96 | ;< ebx = 1 |
96 | ;< ebx = 1 |
97 | ;< ecx = 0 (flat) or 1 (with gradient) |
97 | ;< ecx = 0 (flat) or 1 (with gradient) |
98 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
98 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
99 | ;; Set system color palette: |
99 | ;; Set system color palette: |
100 | ;< ebx = 2 |
100 | ;< ebx = 2 |
101 | ;< ecx = pointer to color table |
101 | ;< ecx = pointer to color table |
102 | ;< edx = size of color table |
102 | ;< edx = size of color table |
103 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
103 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
104 | ;; Get system color palette: |
104 | ;; Get system color palette: |
105 | ;< ebx = 3 |
105 | ;< ebx = 3 |
106 | ;< ecx = pointer to color table buffer |
106 | ;< ecx = pointer to color table buffer |
107 | ;< edx = size of color table buffer |
107 | ;< edx = size of color table buffer |
108 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
108 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
109 | ;; Get skinned caption height: |
109 | ;; Get skinned caption height: |
110 | ;< ebx = 4 |
110 | ;< ebx = 4 |
111 | ;> eax = height in pixels |
111 | ;> eax = height in pixels |
112 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
112 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
113 | ;; Get screen working area: |
113 | ;; Get screen working area: |
114 | ;< ebx = 5 |
114 | ;< ebx = 5 |
115 | ;> eax = pack[16(left), 16(right)] |
115 | ;> eax = pack[16(left), 16(right)] |
116 | ;> ebx = pack[16(top), 16(bottom)] |
116 | ;> ebx = pack[16(top), 16(bottom)] |
117 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
117 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
118 | ;; Set screen working area: |
118 | ;; Set screen working area: |
119 | ;< ebx = 6 |
119 | ;< ebx = 6 |
120 | ;< ecx = pack[16(left), 16(right)] |
120 | ;< ecx = pack[16(left), 16(right)] |
121 | ;< edx = pack[16(top), 16(bottom)] |
121 | ;< edx = pack[16(top), 16(bottom)] |
122 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
122 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
123 | ;; Get skin margins: |
123 | ;; Get skin margins: |
124 | ;< ebx = 7 |
124 | ;< ebx = 7 |
125 | ;> eax = pack[16(left), 16(right)] |
125 | ;> eax = pack[16(left), 16(right)] |
126 | ;> ebx = pack[16(top), 16(bottom)] |
126 | ;> ebx = pack[16(top), 16(bottom)] |
127 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
127 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
128 | ;; Set skin: |
128 | ;; Set skin: |
129 | ;< ebx = 8 |
129 | ;< ebx = 8 |
130 | ;< ecx = pointer to FileInfoBlock struct |
130 | ;< ecx = pointer to FileInfoBlock struct |
131 | ;> eax = FS error code |
131 | ;> eax = FS error code |
132 | ;------------------------------------------------------------------------------ |
132 | ;------------------------------------------------------------------------------ |
133 | cmp ebx, .sizeof.ftable / 4 |
133 | cmp ebx, .sizeof.ftable / 4 |
134 | ja @f |
134 | ja @f |
135 | jmp [.ftable + ebx * 4] |
135 | jmp [.ftable + ebx * 4] |
136 | @@: ret |
136 | @@: ret |
137 | 137 | ||
138 | 138 | ||
139 | align 4 |
139 | align 4 |
140 | syscall_display_settings.00: |
140 | syscall_display_settings.00: |
141 | xor eax, eax |
141 | xor eax, eax |
142 | inc ebx |
142 | inc ebx |
143 | cmp [windowtypechanged], ebx |
143 | cmp [windowtypechanged], ebx |
144 | jne .exit |
144 | jne .exit |
145 | mov [windowtypechanged], eax |
145 | mov [windowtypechanged], eax |
146 | 146 | ||
147 | jmp syscall_display_settings._.redraw_whole_screen |
147 | jmp syscall_display_settings._.redraw_whole_screen |
148 | 148 | ||
149 | .exit: |
149 | .exit: |
150 | ret |
150 | ret |
151 | 151 | ||
152 | align 4 |
152 | align 4 |
153 | syscall_display_settings.01: |
153 | syscall_display_settings.01: |
154 | and ecx, 1 |
154 | and ecx, 1 |
155 | cmp ecx, [buttontype] |
155 | cmp ecx, [buttontype] |
156 | je .exit |
156 | je .exit |
157 | mov [buttontype], ecx |
157 | mov [buttontype], ecx |
158 | mov [windowtypechanged], ebx |
158 | mov [windowtypechanged], ebx |
159 | 159 | ||
160 | .exit: |
160 | .exit: |
161 | ret |
161 | ret |
162 | 162 | ||
163 | align 4 |
163 | align 4 |
164 | syscall_display_settings.02: |
164 | syscall_display_settings.02: |
165 | dec ebx |
165 | dec ebx |
166 | mov esi, ecx |
166 | mov esi, ecx |
167 | and edx, 127 |
167 | and edx, 127 |
168 | mov edi, common_colours |
168 | mov edi, common_colours |
169 | mov ecx, edx |
169 | mov ecx, edx |
170 | rep movsb |
170 | rep movsb |
171 | mov [windowtypechanged], ebx |
171 | mov [windowtypechanged], ebx |
172 | ret |
172 | ret |
173 | 173 | ||
174 | align 4 |
174 | align 4 |
175 | syscall_display_settings.03: |
175 | syscall_display_settings.03: |
176 | mov edi, ecx |
176 | mov edi, ecx |
177 | and edx, 127 |
177 | and edx, 127 |
178 | mov esi, common_colours |
178 | mov esi, common_colours |
179 | mov ecx, edx |
179 | mov ecx, edx |
180 | rep movsb |
180 | rep movsb |
181 | ret |
181 | ret |
182 | 182 | ||
183 | align 4 |
183 | align 4 |
184 | syscall_display_settings.04: |
184 | syscall_display_settings.04: |
185 | mov eax, [_skinh] |
185 | mov eax, [_skinh] |
186 | mov [esp + 32], eax |
186 | mov [esp + 32], eax |
187 | ret |
187 | ret |
188 | 188 | ||
189 | align 4 |
189 | align 4 |
190 | syscall_display_settings.05: |
190 | syscall_display_settings.05: |
191 | mov eax, [screen_workarea.left - 2] |
191 | mov eax, [screen_workarea.left - 2] |
192 | mov ax, word[screen_workarea.right] |
192 | mov ax, word[screen_workarea.right] |
193 | mov [esp + 32], eax |
193 | mov [esp + 32], eax |
194 | mov eax, [screen_workarea.top - 2] |
194 | mov eax, [screen_workarea.top - 2] |
195 | mov ax, word[screen_workarea.bottom] |
195 | mov ax, word[screen_workarea.bottom] |
196 | mov [esp + 20], eax |
196 | mov [esp + 20], eax |
197 | ret |
197 | ret |
198 | 198 | ||
199 | align 4 |
199 | align 4 |
200 | syscall_display_settings.06: |
200 | syscall_display_settings.06: |
201 | xor esi, esi |
201 | xor esi, esi |
202 | 202 | ||
203 | mov edi, [Screen_Max_X] |
203 | mov edi, [Screen_Max_X] |
204 | mov eax, ecx |
204 | mov eax, ecx |
205 | movsx ebx, ax |
205 | movsx ebx, ax |
206 | sar eax, 16 |
206 | sar eax, 16 |
207 | cmp eax, ebx |
207 | cmp eax, ebx |
208 | jge .check_horizontal |
208 | jge .check_horizontal |
209 | inc esi |
209 | inc esi |
210 | or eax, eax |
210 | or eax, eax |
211 | jge @f |
211 | jge @f |
212 | xor eax, eax |
212 | xor eax, eax |
213 | @@: mov [screen_workarea.left], eax |
213 | @@: mov [screen_workarea.left], eax |
214 | cmp ebx, edi |
214 | cmp ebx, edi |
215 | jle @f |
215 | jle @f |
216 | mov ebx, edi |
216 | mov ebx, edi |
217 | @@: mov [screen_workarea.right], ebx |
217 | @@: mov [screen_workarea.right], ebx |
218 | 218 | ||
219 | .check_horizontal: |
219 | .check_horizontal: |
220 | mov edi, [Screen_Max_Y] |
220 | mov edi, [Screen_Max_Y] |
221 | mov eax, edx |
221 | mov eax, edx |
222 | movsx ebx, ax |
222 | movsx ebx, ax |
223 | sar eax, 16 |
223 | sar eax, 16 |
224 | cmp eax, ebx |
224 | cmp eax, ebx |
225 | jge .check_if_redraw_needed |
225 | jge .check_if_redraw_needed |
226 | inc esi |
226 | inc esi |
227 | or eax, eax |
227 | or eax, eax |
228 | jge @f |
228 | jge @f |
229 | xor eax, eax |
229 | xor eax, eax |
230 | @@: mov [screen_workarea.top], eax |
230 | @@: mov [screen_workarea.top], eax |
231 | cmp ebx, edi |
231 | cmp ebx, edi |
232 | jle @f |
232 | jle @f |
233 | mov ebx, edi |
233 | mov ebx, edi |
234 | @@: mov [screen_workarea.bottom], ebx |
234 | @@: mov [screen_workarea.bottom], ebx |
235 | 235 | ||
236 | .check_if_redraw_needed: |
236 | .check_if_redraw_needed: |
237 | or esi, esi |
237 | or esi, esi |
238 | jz .exit |
238 | jz .exit |
239 | 239 | ||
240 | call repos_windows |
240 | call repos_windows |
241 | jmp syscall_display_settings._.calculate_whole_screen |
241 | jmp syscall_display_settings._.calculate_whole_screen |
242 | 242 | ||
243 | .exit: |
243 | .exit: |
244 | ret |
244 | ret |
245 | 245 | ||
246 | align 4 |
246 | align 4 |
247 | syscall_display_settings.07: |
247 | syscall_display_settings.07: |
248 | mov eax, [_skinmargins + 0] |
248 | mov eax, [_skinmargins + 0] |
249 | mov [esp + 32], eax |
249 | mov [esp + 32], eax |
250 | mov eax, [_skinmargins + 4] |
250 | mov eax, [_skinmargins + 4] |
251 | mov [esp + 20], eax |
251 | mov [esp + 20], eax |
252 | ret |
252 | ret |
253 | 253 | ||
254 | align 4 |
254 | align 4 |
255 | syscall_display_settings.08: |
255 | syscall_display_settings.08: |
256 | mov ebx, ecx |
256 | mov ebx, ecx |
257 | call read_skin_file |
257 | call read_skin_file |
258 | mov [esp + 32], eax |
258 | mov [esp + 32], eax |
259 | test eax, eax |
259 | test eax, eax |
260 | jnz .exit |
260 | jnz .exit |
261 | 261 | ||
262 | call syscall_display_settings._.calculate_whole_screen |
262 | call syscall_display_settings._.calculate_whole_screen |
263 | jmp syscall_display_settings._.redraw_whole_screen |
263 | jmp syscall_display_settings._.redraw_whole_screen |
264 | 264 | ||
265 | .exit: |
265 | .exit: |
266 | ret |
266 | ret |
267 | 267 | ||
268 | syscall_display_settings._.calculate_whole_screen: |
268 | syscall_display_settings._.calculate_whole_screen: |
269 | xor eax, eax |
269 | xor eax, eax |
270 | xor ebx, ebx |
270 | xor ebx, ebx |
271 | mov ecx, [Screen_Max_X] |
271 | mov ecx, [Screen_Max_X] |
272 | mov edx, [Screen_Max_Y] |
272 | mov edx, [Screen_Max_Y] |
273 | jmp calculatescreen |
273 | jmp calculatescreen |
274 | 274 | ||
275 | syscall_display_settings._.redraw_whole_screen: |
275 | syscall_display_settings._.redraw_whole_screen: |
276 | xor eax, eax |
276 | xor eax, eax |
277 | mov [draw_limits.left], eax |
277 | mov [draw_limits.left], eax |
278 | mov [draw_limits.top], eax |
278 | mov [draw_limits.top], eax |
279 | mov eax, [Screen_Max_X] |
279 | mov eax, [Screen_Max_X] |
280 | mov [draw_limits.right], eax |
280 | mov [draw_limits.right], eax |
281 | mov eax, [Screen_Max_Y] |
281 | mov eax, [Screen_Max_Y] |
282 | mov [draw_limits.bottom], eax |
282 | mov [draw_limits.bottom], eax |
283 | mov eax, window_data |
283 | mov eax, window_data |
284 | jmp redrawscreen |
284 | jmp redrawscreen |
285 | 285 | ||
286 | align 4 |
286 | align 4 |
287 | ;------------------------------------------------------------------------------ |
287 | ;------------------------------------------------------------------------------ |
288 | syscall_set_window_shape: ;///// system function 50 /////////////////////////// |
288 | syscall_set_window_shape: ;///// system function 50 /////////////////////////// |
289 | ;------------------------------------------------------------------------------ |
289 | ;------------------------------------------------------------------------------ |
290 | ;; Set window shape address: |
290 | ;; Set window shape address: |
291 | ;> ebx = 0 |
291 | ;> ebx = 0 |
292 | ;> ecx = shape data address |
292 | ;> ecx = shape data address |
293 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
293 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
294 | ;; Set window shape scale: |
294 | ;; Set window shape scale: |
295 | ;> ebx = 1 |
295 | ;> ebx = 1 |
296 | ;> ecx = scale power (resulting scale is 2^ebx) |
296 | ;> ecx = scale power (resulting scale is 2^ebx) |
297 | ;------------------------------------------------------------------------------ |
297 | ;------------------------------------------------------------------------------ |
298 | mov edi, [current_slot] |
298 | mov edi, [current_slot] |
299 | 299 | ||
300 | test ebx, ebx |
300 | test ebx, ebx |
301 | jne .shape_scale |
301 | jne .shape_scale |
302 | mov [edi + APPDATA.wnd_shape], ecx |
302 | mov [edi + APPDATA.wnd_shape], ecx |
303 | 303 | ||
304 | .shape_scale: |
304 | .shape_scale: |
305 | dec ebx |
305 | dec ebx |
306 | jnz .exit |
306 | jnz .exit |
307 | mov [edi + APPDATA.wnd_shape_scale], ecx |
307 | mov [edi + APPDATA.wnd_shape_scale], ecx |
308 | 308 | ||
309 | .exit: |
309 | .exit: |
310 | ret |
310 | ret |
311 | 311 | ||
312 | align 4 |
312 | align 4 |
313 | ;------------------------------------------------------------------------------ |
313 | ;------------------------------------------------------------------------------ |
314 | syscall_move_window: ;///// system function 67 //////////////////////////////// |
314 | syscall_move_window: ;///// system function 67 //////////////////////////////// |
315 | ;------------------------------------------------------------------------------ |
315 | ;------------------------------------------------------------------------------ |
316 | ;? |
316 | ;? |
317 | ;------------------------------------------------------------------------------ |
317 | ;------------------------------------------------------------------------------ |
318 | mov edi, [CURRENT_TASK] |
318 | mov edi, [CURRENT_TASK] |
319 | shl edi, 5 |
319 | shl edi, 5 |
320 | add edi, window_data |
320 | add edi, window_data |
- | 321 | ||
- | 322 | test [edi + WDATA.fl_wdrawn], 1 |
|
- | 323 | jz .exit |
|
321 | 324 | ||
322 | test [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED |
325 | test [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED |
323 | jnz .exit |
326 | jnz .exit |
324 | 327 | ||
325 | cmp ebx, -1 |
328 | cmp ebx, -1 |
326 | jne @f |
329 | jne @f |
327 | mov ebx, [edi + WDATA.box.left] |
330 | mov ebx, [edi + WDATA.box.left] |
328 | @@: cmp ecx, -1 |
331 | @@: cmp ecx, -1 |
329 | jne @f |
332 | jne @f |
330 | mov ecx, [edi + WDATA.box.top] |
333 | mov ecx, [edi + WDATA.box.top] |
331 | @@: cmp edx, -1 |
334 | @@: cmp edx, -1 |
332 | jne @f |
335 | jne @f |
333 | mov edx, [edi + WDATA.box.width] |
336 | mov edx, [edi + WDATA.box.width] |
334 | @@: cmp esi, -1 |
337 | @@: cmp esi, -1 |
335 | jne @f |
338 | jne @f |
336 | mov esi, [edi + WDATA.box.height] |
339 | mov esi, [edi + WDATA.box.height] |
337 | 340 | ||
338 | @@: push esi edx ecx ebx |
341 | @@: push esi edx ecx ebx |
339 | mov eax, esp |
342 | mov eax, esp |
340 | mov bl, [edi + WDATA.fl_wstate] |
343 | mov bl, [edi + WDATA.fl_wstate] |
341 | call window._.set_window_box |
344 | call window._.set_window_box |
342 | add esp, BOX.sizeof |
345 | add esp, BOX.sizeof |
343 | 346 | ||
344 | ; NOTE: do we really need this? to be reworked |
347 | ; NOTE: do we really need this? to be reworked |
345 | ; mov byte[DONT_DRAW_MOUSE], 0 ; mouse pointer |
348 | ; mov byte[DONT_DRAW_MOUSE], 0 ; mouse pointer |
346 | ; mov byte[MOUSE_BACKGROUND], 0 ; no mouse under |
349 | ; mov byte[MOUSE_BACKGROUND], 0 ; no mouse under |
347 | ; mov byte[MOUSE_DOWN], 0 ; react to mouse up/down |
350 | ; mov byte[MOUSE_DOWN], 0 ; react to mouse up/down |
348 | 351 | ||
349 | ; NOTE: do we really need this? to be reworked |
352 | ; NOTE: do we really need this? to be reworked |
350 | ; call [draw_pointer] |
353 | ; call [draw_pointer] |
351 | 354 | ||
352 | .exit: |
355 | .exit: |
353 | ret |
356 | ret |
354 | 357 | ||
355 | align 4 |
358 | align 4 |
356 | ;------------------------------------------------------------------------------ |
359 | ;------------------------------------------------------------------------------ |
357 | syscall_window_settings: ;///// system function 71 ///////////////////////////// |
360 | syscall_window_settings: ;///// system function 71 ///////////////////////////// |
358 | ;------------------------------------------------------------------------------ |
361 | ;------------------------------------------------------------------------------ |
359 | ;? |
362 | ;? |
360 | ;------------------------------------------------------------------------------ |
363 | ;------------------------------------------------------------------------------ |
361 | dec ebx ; subfunction #1 - set window caption |
364 | dec ebx ; subfunction #1 - set window caption |
362 | jnz .exit_fail |
365 | jnz .exit_fail |
363 | 366 | ||
364 | ; NOTE: only window owner thread can set its caption, |
367 | ; NOTE: only window owner thread can set its caption, |
365 | ; so there's no parameter for PID/TID |
368 | ; so there's no parameter for PID/TID |
366 | 369 | ||
367 | mov edi, [CURRENT_TASK] |
370 | mov edi, [CURRENT_TASK] |
368 | shl edi, 5 |
371 | shl edi, 5 |
369 | 372 | ||
370 | mov [edi * 8 + SLOT_BASE + APPDATA.wnd_caption], ecx |
373 | mov [edi * 8 + SLOT_BASE + APPDATA.wnd_caption], ecx |
371 | or [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION |
374 | or [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION |
372 | 375 | ||
373 | call window._.draw_window_caption |
376 | call window._.draw_window_caption |
374 | 377 | ||
375 | xor eax, eax ; eax = 0 (success) |
378 | xor eax, eax ; eax = 0 (success) |
376 | ret |
379 | ret |
377 | 380 | ||
378 | ; .get_window_caption: |
381 | ; .get_window_caption: |
379 | ; dec eax ; subfunction #2 - get window caption |
382 | ; dec eax ; subfunction #2 - get window caption |
380 | ; jnz .exit_fail |
383 | ; jnz .exit_fail |
381 | 384 | ||
382 | ; not implemented yet |
385 | ; not implemented yet |
383 | 386 | ||
384 | .exit_fail: |
387 | .exit_fail: |
385 | xor eax, eax |
388 | xor eax, eax |
386 | inc eax ; eax = 1 (fail) |
389 | inc eax ; eax = 1 (fail) |
387 | ret |
390 | ret |
388 | 391 | ||
389 | align 4 |
392 | align 4 |
390 | ;------------------------------------------------------------------------------ |
393 | ;------------------------------------------------------------------------------ |
391 | set_window_defaults: ;///////////////////////////////////////////////////////// |
394 | set_window_defaults: ;///////////////////////////////////////////////////////// |
392 | ;------------------------------------------------------------------------------ |
395 | ;------------------------------------------------------------------------------ |
393 | ;? |
396 | ;? |
394 | ;------------------------------------------------------------------------------ |
397 | ;------------------------------------------------------------------------------ |
395 | mov byte [window_data + 0x20 + WDATA.cl_titlebar + 3], 1 ; desktop is not movable |
398 | mov byte [window_data + 0x20 + WDATA.cl_titlebar + 3], 1 ; desktop is not movable |
396 | push eax ecx |
399 | push eax ecx |
397 | xor eax, eax |
400 | xor eax, eax |
398 | mov ecx, WIN_STACK |
401 | mov ecx, WIN_STACK |
399 | @@: inc eax |
402 | @@: inc eax |
400 | add ecx, 2 |
403 | add ecx, 2 |
401 | ; process no |
404 | ; process no |
402 | mov [ecx + 0x000], ax |
405 | mov [ecx + 0x000], ax |
403 | ; positions in stack |
406 | ; positions in stack |
404 | mov [ecx + 0x400], ax |
407 | mov [ecx + 0x400], ax |
405 | cmp ecx, WIN_POS - 2 |
408 | cmp ecx, WIN_POS - 2 |
406 | jne @b |
409 | jne @b |
407 | pop ecx eax |
410 | pop ecx eax |
408 | ret |
411 | ret |
409 | 412 | ||
410 | align 4 |
413 | align 4 |
411 | ;------------------------------------------------------------------------------ |
414 | ;------------------------------------------------------------------------------ |
412 | calculatescreen: ;///////////////////////////////////////////////////////////// |
415 | calculatescreen: ;///////////////////////////////////////////////////////////// |
413 | ;------------------------------------------------------------------------------ |
416 | ;------------------------------------------------------------------------------ |
414 | ;? Scan all windows from bottom to top, calling `setscreen` for each one |
417 | ;? Scan all windows from bottom to top, calling `setscreen` for each one |
415 | ;? intersecting given screen area |
418 | ;? intersecting given screen area |
416 | ;------------------------------------------------------------------------------ |
419 | ;------------------------------------------------------------------------------ |
417 | ;> eax = left |
420 | ;> eax = left |
418 | ;> ebx = top |
421 | ;> ebx = top |
419 | ;> ecx = right |
422 | ;> ecx = right |
420 | ;> edx = bottom |
423 | ;> edx = bottom |
421 | ;------------------------------------------------------------------------------ |
424 | ;------------------------------------------------------------------------------ |
422 | push esi |
425 | push esi |
423 | pushfd |
426 | pushfd |
424 | cli |
427 | cli |
425 | 428 | ||
426 | mov esi, 1 |
429 | mov esi, 1 |
427 | call window._.set_screen |
430 | call window._.set_screen |
428 | 431 | ||
429 | push ebp |
432 | push ebp |
430 | 433 | ||
431 | mov ebp, [TASK_COUNT] |
434 | mov ebp, [TASK_COUNT] |
432 | cmp ebp, 1 |
435 | cmp ebp, 1 |
433 | jbe .exit |
436 | jbe .exit |
434 | 437 | ||
435 | push edx ecx ebx eax |
438 | push edx ecx ebx eax |
436 | 439 | ||
437 | .next_window: |
440 | .next_window: |
438 | movzx edi, word[WIN_POS + esi * 2] |
441 | movzx edi, word[WIN_POS + esi * 2] |
439 | shl edi, 5 |
442 | shl edi, 5 |
440 | 443 | ||
441 | cmp [CURRENT_TASK + edi + TASKDATA.state], TSTATE_FREE |
444 | cmp [CURRENT_TASK + edi + TASKDATA.state], TSTATE_FREE |
442 | je .skip_window |
445 | je .skip_window |
443 | 446 | ||
444 | add edi, window_data |
447 | add edi, window_data |
445 | test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
448 | test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
446 | jnz .skip_window |
449 | jnz .skip_window |
447 | 450 | ||
448 | mov eax, [edi + WDATA.box.left] |
451 | mov eax, [edi + WDATA.box.left] |
449 | cmp eax, [esp + RECT.right] |
452 | cmp eax, [esp + RECT.right] |
450 | jg .skip_window |
453 | jg .skip_window |
451 | mov ebx, [edi + WDATA.box.top] |
454 | mov ebx, [edi + WDATA.box.top] |
452 | cmp ebx, [esp + RECT.bottom] |
455 | cmp ebx, [esp + RECT.bottom] |
453 | jg .skip_window |
456 | jg .skip_window |
454 | mov ecx, [edi + WDATA.box.width] |
457 | mov ecx, [edi + WDATA.box.width] |
455 | add ecx, eax |
458 | add ecx, eax |
456 | cmp ecx, [esp + RECT.left] |
459 | cmp ecx, [esp + RECT.left] |
457 | jl .skip_window |
460 | jl .skip_window |
458 | mov edx, [edi + WDATA.box.height] |
461 | mov edx, [edi + WDATA.box.height] |
459 | add edx, ebx |
462 | add edx, ebx |
460 | cmp edx, [esp + RECT.top] |
463 | cmp edx, [esp + RECT.top] |
461 | jl .skip_window |
464 | jl .skip_window |
462 | 465 | ||
463 | cmp eax, [esp + RECT.left] |
466 | cmp eax, [esp + RECT.left] |
464 | jae @f |
467 | jae @f |
465 | mov eax, [esp + RECT.left] |
468 | mov eax, [esp + RECT.left] |
466 | @@: cmp ebx, [esp + RECT.top] |
469 | @@: cmp ebx, [esp + RECT.top] |
467 | jae @f |
470 | jae @f |
468 | mov ebx, [esp + RECT.top] |
471 | mov ebx, [esp + RECT.top] |
469 | @@: cmp ecx, [esp + RECT.right] |
472 | @@: cmp ecx, [esp + RECT.right] |
470 | jbe @f |
473 | jbe @f |
471 | mov ecx, [esp + RECT.right] |
474 | mov ecx, [esp + RECT.right] |
472 | @@: cmp edx, [esp + RECT.bottom] |
475 | @@: cmp edx, [esp + RECT.bottom] |
473 | jbe @f |
476 | jbe @f |
474 | mov edx, [esp + RECT.bottom] |
477 | mov edx, [esp + RECT.bottom] |
475 | 478 | ||
476 | @@: push esi |
479 | @@: push esi |
477 | movzx esi, word[WIN_POS + esi * 2] |
480 | movzx esi, word[WIN_POS + esi * 2] |
478 | call window._.set_screen |
481 | call window._.set_screen |
479 | pop esi |
482 | pop esi |
480 | 483 | ||
481 | .skip_window: |
484 | .skip_window: |
482 | inc esi |
485 | inc esi |
483 | dec ebp |
486 | dec ebp |
484 | jnz .next_window |
487 | jnz .next_window |
485 | 488 | ||
486 | pop eax ebx ecx edx |
489 | pop eax ebx ecx edx |
487 | 490 | ||
488 | .exit: |
491 | .exit: |
489 | pop ebp |
492 | pop ebp |
490 | popfd |
493 | popfd |
491 | pop esi |
494 | pop esi |
492 | ret |
495 | ret |
493 | 496 | ||
494 | align 4 |
497 | align 4 |
495 | ;------------------------------------------------------------------------------ |
498 | ;------------------------------------------------------------------------------ |
496 | repos_windows: ;/////////////////////////////////////////////////////////////// |
499 | repos_windows: ;/////////////////////////////////////////////////////////////// |
497 | ;------------------------------------------------------------------------------ |
500 | ;------------------------------------------------------------------------------ |
498 | ;? |
501 | ;? |
499 | ;------------------------------------------------------------------------------ |
502 | ;------------------------------------------------------------------------------ |
500 | mov ecx, [TASK_COUNT] |
503 | mov ecx, [TASK_COUNT] |
501 | mov edi, window_data + WDATA.sizeof * 2 |
504 | mov edi, window_data + WDATA.sizeof * 2 |
502 | call force_redraw_background |
505 | call force_redraw_background |
503 | dec ecx |
506 | dec ecx |
504 | jle .exit |
507 | jle .exit |
505 | 508 | ||
506 | .next_window: |
509 | .next_window: |
507 | mov [edi + WDATA.fl_redraw], 1 |
510 | mov [edi + WDATA.fl_redraw], 1 |
508 | test [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED |
511 | test [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED |
509 | jnz .fix_maximized |
512 | jnz .fix_maximized |
510 | 513 | ||
511 | mov eax, [edi + WDATA.box.left] |
514 | mov eax, [edi + WDATA.box.left] |
512 | add eax, [edi + WDATA.box.width] |
515 | add eax, [edi + WDATA.box.width] |
513 | mov ebx, [Screen_Max_X] |
516 | mov ebx, [Screen_Max_X] |
514 | cmp eax, ebx |
517 | cmp eax, ebx |
515 | jle .fix_vertical |
518 | jle .fix_vertical |
516 | mov eax, [edi + WDATA.box.width] |
519 | mov eax, [edi + WDATA.box.width] |
517 | sub eax, ebx |
520 | sub eax, ebx |
518 | jle @f |
521 | jle @f |
519 | mov [edi + WDATA.box.width], ebx |
522 | mov [edi + WDATA.box.width], ebx |
520 | @@: sub ebx, [edi + WDATA.box.width] |
523 | @@: sub ebx, [edi + WDATA.box.width] |
521 | mov [edi + WDATA.box.left], ebx |
524 | mov [edi + WDATA.box.left], ebx |
522 | 525 | ||
523 | .fix_vertical: |
526 | .fix_vertical: |
524 | mov eax, [edi + WDATA.box.top] |
527 | mov eax, [edi + WDATA.box.top] |
525 | add eax, [edi + WDATA.box.height] |
528 | add eax, [edi + WDATA.box.height] |
526 | mov ebx, [Screen_Max_Y] |
529 | mov ebx, [Screen_Max_Y] |
527 | cmp eax, ebx |
530 | cmp eax, ebx |
528 | jle .fix_client_box |
531 | jle .fix_client_box |
529 | mov eax, [edi + WDATA.box.height] |
532 | mov eax, [edi + WDATA.box.height] |
530 | sub eax, ebx |
533 | sub eax, ebx |
531 | jle @f |
534 | jle @f |
532 | mov [edi + WDATA.box.height], ebx |
535 | mov [edi + WDATA.box.height], ebx |
533 | @@: sub ebx, [edi + WDATA.box.height] |
536 | @@: sub ebx, [edi + WDATA.box.height] |
534 | mov [edi + WDATA.box.top], ebx |
537 | mov [edi + WDATA.box.top], ebx |
535 | jmp .fix_client_box |
538 | jmp .fix_client_box |
536 | 539 | ||
537 | .fix_maximized: |
540 | .fix_maximized: |
538 | mov eax, [screen_workarea.left] |
541 | mov eax, [screen_workarea.left] |
539 | mov [edi + WDATA.box.left], eax |
542 | mov [edi + WDATA.box.left], eax |
540 | sub eax, [screen_workarea.right] |
543 | sub eax, [screen_workarea.right] |
541 | neg eax |
544 | neg eax |
542 | mov [edi + WDATA.box.width], eax |
545 | mov [edi + WDATA.box.width], eax |
543 | mov eax, [screen_workarea.top] |
546 | mov eax, [screen_workarea.top] |
544 | mov [edi + WDATA.box.top], eax |
547 | mov [edi + WDATA.box.top], eax |
545 | test [edi + WDATA.fl_wstate], WSTATE_ROLLEDUP |
548 | test [edi + WDATA.fl_wstate], WSTATE_ROLLEDUP |
546 | jnz .fix_client_box |
549 | jnz .fix_client_box |
547 | sub eax, [screen_workarea.bottom] |
550 | sub eax, [screen_workarea.bottom] |
548 | neg eax |
551 | neg eax |
549 | mov [edi + WDATA.box.height], eax |
552 | mov [edi + WDATA.box.height], eax |
550 | 553 | ||
551 | .fix_client_box: |
554 | .fix_client_box: |
552 | call window._.set_window_clientbox |
555 | call window._.set_window_clientbox |
553 | 556 | ||
554 | add edi, WDATA.sizeof |
557 | add edi, WDATA.sizeof |
555 | loop .next_window |
558 | loop .next_window |
556 | 559 | ||
557 | .exit: |
560 | .exit: |
558 | ret |
561 | ret |
559 | 562 | ||
560 | align 4 |
563 | align 4 |
561 | ;------------------------------------------------------------------------------ |
564 | ;------------------------------------------------------------------------------ |
562 | sys_window_mouse: ;//////////////////////////////////////////////////////////// |
565 | sys_window_mouse: ;//////////////////////////////////////////////////////////// |
563 | ;------------------------------------------------------------------------------ |
566 | ;------------------------------------------------------------------------------ |
564 | ;? |
567 | ;? |
565 | ;------------------------------------------------------------------------------ |
568 | ;------------------------------------------------------------------------------ |
566 | ; NOTE: commented out since doesn't provide necessary functionality |
569 | ; NOTE: commented out since doesn't provide necessary functionality |
567 | ; anyway, to be reworked |
570 | ; anyway, to be reworked |
568 | ; push eax |
571 | ; push eax |
569 | ; |
572 | ; |
570 | ; mov eax, [timer_ticks] |
573 | ; mov eax, [timer_ticks] |
571 | ; cmp [new_window_starting], eax |
574 | ; cmp [new_window_starting], eax |
572 | ; jb .exit |
575 | ; jb .exit |
573 | ; |
576 | ; |
574 | ; mov byte[MOUSE_BACKGROUND], 0 |
577 | ; mov byte[MOUSE_BACKGROUND], 0 |
575 | ; mov byte[DONT_DRAW_MOUSE], 0 |
578 | ; mov byte[DONT_DRAW_MOUSE], 0 |
576 | ; |
579 | ; |
577 | ; mov [new_window_starting], eax |
580 | ; mov [new_window_starting], eax |
578 | ; |
581 | ; |
579 | ; .exit: |
582 | ; .exit: |
580 | ; pop eax |
583 | ; pop eax |
581 | ret |
584 | ret |
582 | 585 | ||
583 | align 4 |
586 | align 4 |
584 | ;------------------------------------------------------------------------------ |
587 | ;------------------------------------------------------------------------------ |
585 | draw_rectangle: ;////////////////////////////////////////////////////////////// |
588 | draw_rectangle: ;////////////////////////////////////////////////////////////// |
586 | ;------------------------------------------------------------------------------ |
589 | ;------------------------------------------------------------------------------ |
587 | ;> eax = pack[16(left), 16(right)] |
590 | ;> eax = pack[16(left), 16(right)] |
588 | ;> ebx = pack[16(top), 16(bottom)] |
591 | ;> ebx = pack[16(top), 16(bottom)] |
589 | ;> esi = color |
592 | ;> esi = color |
590 | ;------------------------------------------------------------------------------ |
593 | ;------------------------------------------------------------------------------ |
591 | push eax ebx ecx edi |
594 | push eax ebx ecx edi |
592 | 595 | ||
593 | xor edi, edi |
596 | xor edi, edi |
594 | 597 | ||
595 | .flags_set: |
598 | .flags_set: |
596 | push ebx |
599 | push ebx |
597 | 600 | ||
598 | ; set line color |
601 | ; set line color |
599 | mov ecx, esi |
602 | mov ecx, esi |
600 | 603 | ||
601 | ; draw top border |
604 | ; draw top border |
602 | rol ebx, 16 |
605 | rol ebx, 16 |
603 | push ebx |
606 | push ebx |
604 | rol ebx, 16 |
607 | rol ebx, 16 |
605 | pop bx |
608 | pop bx |
606 | call [draw_line] |
609 | call [draw_line] |
607 | 610 | ||
608 | ; draw bottom border |
611 | ; draw bottom border |
609 | mov ebx, [esp - 2] |
612 | mov ebx, [esp - 2] |
610 | pop bx |
613 | pop bx |
611 | call [draw_line] |
614 | call [draw_line] |
612 | 615 | ||
613 | pop ebx |
616 | pop ebx |
614 | add ebx, 1 * 65536 - 1 |
617 | add ebx, 1 * 65536 - 1 |
615 | 618 | ||
616 | ; draw left border |
619 | ; draw left border |
617 | rol eax, 16 |
620 | rol eax, 16 |
618 | push eax |
621 | push eax |
619 | rol eax, 16 |
622 | rol eax, 16 |
620 | pop ax |
623 | pop ax |
621 | call [draw_line] |
624 | call [draw_line] |
622 | 625 | ||
623 | ; draw right border |
626 | ; draw right border |
624 | mov eax, [esp - 2] |
627 | mov eax, [esp - 2] |
625 | pop ax |
628 | pop ax |
626 | call [draw_line] |
629 | call [draw_line] |
627 | 630 | ||
628 | pop edi ecx ebx eax |
631 | pop edi ecx ebx eax |
629 | ret |
632 | ret |
630 | 633 | ||
631 | .forced: |
634 | .forced: |
632 | push eax ebx ecx edi |
635 | push eax ebx ecx edi |
633 | xor edi, edi |
636 | xor edi, edi |
634 | inc edi |
637 | inc edi |
635 | jmp .flags_set |
638 | jmp .flags_set |
636 | 639 | ||
637 | align 4 |
640 | align 4 |
638 | ;------------------------------------------------------------------------------ |
641 | ;------------------------------------------------------------------------------ |
639 | drawwindow_I_caption: ;//////////////////////////////////////////////////////// |
642 | drawwindow_I_caption: ;//////////////////////////////////////////////////////// |
640 | ;------------------------------------------------------------------------------ |
643 | ;------------------------------------------------------------------------------ |
641 | ;? |
644 | ;? |
642 | ;------------------------------------------------------------------------------ |
645 | ;------------------------------------------------------------------------------ |
643 | push [edx + WDATA.cl_titlebar] |
646 | push [edx + WDATA.cl_titlebar] |
644 | mov esi, edx |
647 | mov esi, edx |
645 | 648 | ||
646 | mov edx, [esi + WDATA.box.top] |
649 | mov edx, [esi + WDATA.box.top] |
647 | mov eax, edx |
650 | mov eax, edx |
648 | lea ebx, [edx + 21] |
651 | lea ebx, [edx + 21] |
649 | inc edx |
652 | inc edx |
650 | add eax, [esi + WDATA.box.height] |
653 | add eax, [esi + WDATA.box.height] |
651 | 654 | ||
652 | cmp ebx, eax |
655 | cmp ebx, eax |
653 | jbe @f |
656 | jbe @f |
654 | mov ebx, eax |
657 | mov ebx, eax |
655 | @@: push ebx |
658 | @@: push ebx |
656 | 659 | ||
657 | xor edi, edi |
660 | xor edi, edi |
658 | 661 | ||
659 | .next_line: |
662 | .next_line: |
660 | mov ebx, edx |
663 | mov ebx, edx |
661 | shl ebx, 16 |
664 | shl ebx, 16 |
662 | add ebx, edx |
665 | add ebx, edx |
663 | mov eax, [esi + WDATA.box.left] |
666 | mov eax, [esi + WDATA.box.left] |
664 | inc eax |
667 | inc eax |
665 | shl eax, 16 |
668 | shl eax, 16 |
666 | add eax, [esi + WDATA.box.left] |
669 | add eax, [esi + WDATA.box.left] |
667 | add eax, [esi + WDATA.box.width] |
670 | add eax, [esi + WDATA.box.width] |
668 | dec eax |
671 | dec eax |
669 | mov ecx, [esi + WDATA.cl_titlebar] |
672 | mov ecx, [esi + WDATA.cl_titlebar] |
670 | test ecx, 0x80000000 |
673 | test ecx, 0x80000000 |
671 | jz @f |
674 | jz @f |
672 | sub ecx, 0x00040404 |
675 | sub ecx, 0x00040404 |
673 | mov [esi + WDATA.cl_titlebar], ecx |
676 | mov [esi + WDATA.cl_titlebar], ecx |
674 | @@: and ecx, 0x00ffffff |
677 | @@: and ecx, 0x00ffffff |
675 | call [draw_line] |
678 | call [draw_line] |
676 | inc edx |
679 | inc edx |
677 | cmp edx, [esp] |
680 | cmp edx, [esp] |
678 | jb .next_line |
681 | jb .next_line |
679 | 682 | ||
680 | add esp, 4 |
683 | add esp, 4 |
681 | pop [esi + WDATA.cl_titlebar] |
684 | pop [esi + WDATA.cl_titlebar] |
682 | ret |
685 | ret |
683 | 686 | ||
684 | align 4 |
687 | align 4 |
685 | ;------------------------------------------------------------------------------ |
688 | ;------------------------------------------------------------------------------ |
686 | drawwindow_I: ;//////////////////////////////////////////////////////////////// |
689 | drawwindow_I: ;//////////////////////////////////////////////////////////////// |
687 | ;------------------------------------------------------------------------------ |
690 | ;------------------------------------------------------------------------------ |
688 | ;? |
691 | ;? |
689 | ;------------------------------------------------------------------------------ |
692 | ;------------------------------------------------------------------------------ |
690 | pushad |
693 | pushad |
691 | 694 | ||
692 | ; window border |
695 | ; window border |
693 | 696 | ||
694 | mov eax, [edx + WDATA.box.left - 2] |
697 | mov eax, [edx + WDATA.box.left - 2] |
695 | mov ax, word[edx + WDATA.box.left] |
698 | mov ax, word[edx + WDATA.box.left] |
696 | add ax, word[edx + WDATA.box.width] |
699 | add ax, word[edx + WDATA.box.width] |
697 | mov ebx, [edx + WDATA.box.top - 2] |
700 | mov ebx, [edx + WDATA.box.top - 2] |
698 | mov bx, word[edx + WDATA.box.top] |
701 | mov bx, word[edx + WDATA.box.top] |
699 | add bx, word[edx + WDATA.box.height] |
702 | add bx, word[edx + WDATA.box.height] |
700 | 703 | ||
701 | mov esi, [edx + WDATA.cl_frames] |
704 | mov esi, [edx + WDATA.cl_frames] |
702 | call draw_rectangle |
705 | call draw_rectangle |
703 | 706 | ||
704 | ; window caption |
707 | ; window caption |
705 | 708 | ||
706 | call drawwindow_I_caption |
709 | call drawwindow_I_caption |
707 | 710 | ||
708 | ; window client area |
711 | ; window client area |
709 | 712 | ||
710 | ; do we need to draw it? |
713 | ; do we need to draw it? |
711 | mov edi, [esi + WDATA.cl_workarea] |
714 | mov edi, [esi + WDATA.cl_workarea] |
712 | test edi, 0x40000000 |
715 | test edi, 0x40000000 |
713 | jnz .exit |
716 | jnz .exit |
714 | 717 | ||
715 | ; does client area have a positive size on screen? |
718 | ; does client area have a positive size on screen? |
716 | mov edx, [esi + WDATA.box.top] |
719 | mov edx, [esi + WDATA.box.top] |
717 | add edx, 21 + 5 |
720 | add edx, 21 + 5 |
718 | mov ebx, [esi + WDATA.box.top] |
721 | mov ebx, [esi + WDATA.box.top] |
719 | add ebx, [esi + WDATA.box.height] |
722 | add ebx, [esi + WDATA.box.height] |
720 | cmp edx, ebx |
723 | cmp edx, ebx |
721 | jg .exit |
724 | jg .exit |
722 | 725 | ||
723 | ; okay, let's draw it |
726 | ; okay, let's draw it |
724 | mov eax, 1 |
727 | mov eax, 1 |
725 | mov ebx, 21 |
728 | mov ebx, 21 |
726 | mov ecx, [esi + WDATA.box.width] |
729 | mov ecx, [esi + WDATA.box.width] |
727 | mov edx, [esi + WDATA.box.height] |
730 | mov edx, [esi + WDATA.box.height] |
728 | call [drawbar] |
731 | call [drawbar] |
729 | 732 | ||
730 | .exit: |
733 | .exit: |
731 | popad |
734 | popad |
732 | ret |
735 | ret |
733 | 736 | ||
734 | align 4 |
737 | align 4 |
735 | ;------------------------------------------------------------------------------ |
738 | ;------------------------------------------------------------------------------ |
736 | drawwindow_III_caption: ;///////////////////////////////////////////////////// |
739 | drawwindow_III_caption: ;///////////////////////////////////////////////////// |
737 | ;------------------------------------------------------------------------------ |
740 | ;------------------------------------------------------------------------------ |
738 | ;? |
741 | ;? |
739 | ;------------------------------------------------------------------------------ |
742 | ;------------------------------------------------------------------------------ |
740 | mov ecx, [edx + WDATA.cl_titlebar] |
743 | mov ecx, [edx + WDATA.cl_titlebar] |
741 | push ecx |
744 | push ecx |
742 | mov esi, edx |
745 | mov esi, edx |
743 | mov edx, [esi + WDATA.box.top] |
746 | mov edx, [esi + WDATA.box.top] |
744 | add edx, 4 |
747 | add edx, 4 |
745 | mov ebx, [esi + WDATA.box.top] |
748 | mov ebx, [esi + WDATA.box.top] |
746 | add ebx, 20 |
749 | add ebx, 20 |
747 | mov eax, [esi + WDATA.box.top] |
750 | mov eax, [esi + WDATA.box.top] |
748 | add eax, [esi + WDATA.box.height] |
751 | add eax, [esi + WDATA.box.height] |
749 | 752 | ||
750 | cmp ebx, eax |
753 | cmp ebx, eax |
751 | jb @f |
754 | jb @f |
752 | mov ebx, eax |
755 | mov ebx, eax |
753 | @@: push ebx |
756 | @@: push ebx |
754 | 757 | ||
755 | xor edi, edi |
758 | xor edi, edi |
756 | 759 | ||
757 | .next_line: |
760 | .next_line: |
758 | mov ebx, edx |
761 | mov ebx, edx |
759 | shl ebx, 16 |
762 | shl ebx, 16 |
760 | add ebx, edx |
763 | add ebx, edx |
761 | mov eax, [esi + WDATA.box.left] |
764 | mov eax, [esi + WDATA.box.left] |
762 | shl eax, 16 |
765 | shl eax, 16 |
763 | add eax, [esi + WDATA.box.left] |
766 | add eax, [esi + WDATA.box.left] |
764 | add eax, [esi + WDATA.box.width] |
767 | add eax, [esi + WDATA.box.width] |
765 | add eax, 4 * 65536 - 4 |
768 | add eax, 4 * 65536 - 4 |
766 | mov ecx, [esi + WDATA.cl_titlebar] |
769 | mov ecx, [esi + WDATA.cl_titlebar] |
767 | test ecx, 0x40000000 |
770 | test ecx, 0x40000000 |
768 | jz @f |
771 | jz @f |
769 | add ecx, 0x00040404 |
772 | add ecx, 0x00040404 |
770 | @@: test ecx, 0x80000000 |
773 | @@: test ecx, 0x80000000 |
771 | jz @f |
774 | jz @f |
772 | sub ecx, 0x00040404 |
775 | sub ecx, 0x00040404 |
773 | @@: mov [esi + WDATA.cl_titlebar], ecx |
776 | @@: mov [esi + WDATA.cl_titlebar], ecx |
774 | and ecx, 0x00ffffff |
777 | and ecx, 0x00ffffff |
775 | call [draw_line] |
778 | call [draw_line] |
776 | inc edx |
779 | inc edx |
777 | cmp edx, [esp] |
780 | cmp edx, [esp] |
778 | jb .next_line |
781 | jb .next_line |
779 | 782 | ||
780 | add esp, 4 |
783 | add esp, 4 |
781 | pop [esi + WDATA.cl_titlebar] |
784 | pop [esi + WDATA.cl_titlebar] |
782 | ret |
785 | ret |
783 | 786 | ||
784 | align 4 |
787 | align 4 |
785 | ;------------------------------------------------------------------------------ |
788 | ;------------------------------------------------------------------------------ |
786 | drawwindow_III: ;////////////////////////////////////////////////////////////// |
789 | drawwindow_III: ;////////////////////////////////////////////////////////////// |
787 | ;------------------------------------------------------------------------------ |
790 | ;------------------------------------------------------------------------------ |
788 | ;? |
791 | ;? |
789 | ;------------------------------------------------------------------------------ |
792 | ;------------------------------------------------------------------------------ |
790 | pushad |
793 | pushad |
791 | 794 | ||
792 | ; window border |
795 | ; window border |
793 | 796 | ||
794 | mov eax, [edx + WDATA.box.left - 2] |
797 | mov eax, [edx + WDATA.box.left - 2] |
795 | mov ax, word[edx + WDATA.box.left] |
798 | mov ax, word[edx + WDATA.box.left] |
796 | add ax, word[edx + WDATA.box.width] |
799 | add ax, word[edx + WDATA.box.width] |
797 | mov ebx, [edx + WDATA.box.top - 2] |
800 | mov ebx, [edx + WDATA.box.top - 2] |
798 | mov bx, word[edx + WDATA.box.top] |
801 | mov bx, word[edx + WDATA.box.top] |
799 | add bx, word[edx + WDATA.box.height] |
802 | add bx, word[edx + WDATA.box.height] |
800 | 803 | ||
801 | mov esi, [edx + WDATA.cl_frames] |
804 | mov esi, [edx + WDATA.cl_frames] |
802 | shr esi, 1 |
805 | shr esi, 1 |
803 | and esi, 0x007f7f7f |
806 | and esi, 0x007f7f7f |
804 | call draw_rectangle |
807 | call draw_rectangle |
805 | 808 | ||
806 | push esi |
809 | push esi |
807 | mov ecx, 3 |
810 | mov ecx, 3 |
808 | mov esi, [edx + WDATA.cl_frames] |
811 | mov esi, [edx + WDATA.cl_frames] |
809 | 812 | ||
810 | .next_frame: |
813 | .next_frame: |
811 | add eax, 1 * 65536 - 1 |
814 | add eax, 1 * 65536 - 1 |
812 | add ebx, 1 * 65536 - 1 |
815 | add ebx, 1 * 65536 - 1 |
813 | call draw_rectangle |
816 | call draw_rectangle |
814 | dec ecx |
817 | dec ecx |
815 | jnz .next_frame |
818 | jnz .next_frame |
816 | 819 | ||
817 | pop esi |
820 | pop esi |
818 | add eax, 1 * 65536 - 1 |
821 | add eax, 1 * 65536 - 1 |
819 | add ebx, 1 * 65536 - 1 |
822 | add ebx, 1 * 65536 - 1 |
820 | call draw_rectangle |
823 | call draw_rectangle |
821 | 824 | ||
822 | ; window caption |
825 | ; window caption |
823 | 826 | ||
824 | call drawwindow_III_caption |
827 | call drawwindow_III_caption |
825 | 828 | ||
826 | ; window client area |
829 | ; window client area |
827 | 830 | ||
828 | ; do we need to draw it? |
831 | ; do we need to draw it? |
829 | mov edi, [esi + WDATA.cl_workarea] |
832 | mov edi, [esi + WDATA.cl_workarea] |
830 | test edi, 0x40000000 |
833 | test edi, 0x40000000 |
831 | jnz .exit |
834 | jnz .exit |
832 | 835 | ||
833 | ; does client area have a positive size on screen? |
836 | ; does client area have a positive size on screen? |
834 | mov edx, [esi + WDATA.box.top] |
837 | mov edx, [esi + WDATA.box.top] |
835 | add edx, 21 + 5 |
838 | add edx, 21 + 5 |
836 | mov ebx, [esi + WDATA.box.top] |
839 | mov ebx, [esi + WDATA.box.top] |
837 | add ebx, [esi + WDATA.box.height] |
840 | add ebx, [esi + WDATA.box.height] |
838 | cmp edx, ebx |
841 | cmp edx, ebx |
839 | jg .exit |
842 | jg .exit |
840 | 843 | ||
841 | ; okay, let's draw it |
844 | ; okay, let's draw it |
842 | mov eax, 5 |
845 | mov eax, 5 |
843 | mov ebx, 20 |
846 | mov ebx, 20 |
844 | mov ecx, [esi + WDATA.box.width] |
847 | mov ecx, [esi + WDATA.box.width] |
845 | mov edx, [esi + WDATA.box.height] |
848 | mov edx, [esi + WDATA.box.height] |
846 | sub ecx, 4 |
849 | sub ecx, 4 |
847 | sub edx, 4 |
850 | sub edx, 4 |
848 | call [drawbar] |
851 | call [drawbar] |
849 | 852 | ||
850 | .exit: |
853 | .exit: |
851 | popad |
854 | popad |
852 | ret |
855 | ret |
853 | 856 | ||
854 | align 4 |
857 | align 4 |
855 | ;------------------------------------------------------------------------------ |
858 | ;------------------------------------------------------------------------------ |
856 | waredraw: ;//////////////////////////////////////////////////////////////////// |
859 | waredraw: ;//////////////////////////////////////////////////////////////////// |
857 | ;------------------------------------------------------------------------------ |
860 | ;------------------------------------------------------------------------------ |
858 | ;? Activate window, redrawing if necessary |
861 | ;? Activate window, redrawing if necessary |
859 | ;------------------------------------------------------------------------------ |
862 | ;------------------------------------------------------------------------------ |
860 | push -1 |
863 | push -1 |
861 | mov eax, [TASK_COUNT] |
864 | mov eax, [TASK_COUNT] |
862 | lea eax, [WIN_POS + eax * 2] |
865 | lea eax, [WIN_POS + eax * 2] |
863 | cmp eax, esi |
866 | cmp eax, esi |
864 | pop eax |
867 | pop eax |
865 | je .exit |
868 | je .exit |
866 | 869 | ||
867 | ; is it overlapped by another window now? |
870 | ; is it overlapped by another window now? |
868 | push ecx |
871 | push ecx |
869 | call window._.check_window_draw |
872 | call window._.check_window_draw |
870 | test ecx, ecx |
873 | test ecx, ecx |
871 | pop ecx |
874 | pop ecx |
872 | jz .do_not_draw |
875 | jz .do_not_draw |
873 | 876 | ||
874 | ; yes it is, activate and update screen buffer |
877 | ; yes it is, activate and update screen buffer |
875 | mov byte[MOUSE_DOWN], 1 |
878 | mov byte[MOUSE_DOWN], 1 |
876 | call window._.window_activate |
879 | call window._.window_activate |
877 | 880 | ||
878 | pushad |
881 | pushad |
879 | mov edi, [TASK_COUNT] |
882 | mov edi, [TASK_COUNT] |
880 | movzx esi, word[WIN_POS + edi * 2] |
883 | movzx esi, word[WIN_POS + edi * 2] |
881 | shl esi, 5 |
884 | shl esi, 5 |
882 | add esi, window_data |
885 | add esi, window_data |
883 | 886 | ||
884 | mov eax, [esi + WDATA.box.left] |
887 | mov eax, [esi + WDATA.box.left] |
885 | mov ebx, [esi + WDATA.box.top] |
888 | mov ebx, [esi + WDATA.box.top] |
886 | mov ecx, [esi + WDATA.box.width] |
889 | mov ecx, [esi + WDATA.box.width] |
887 | mov edx, [esi + WDATA.box.height] |
890 | mov edx, [esi + WDATA.box.height] |
888 | 891 | ||
889 | add ecx, eax |
892 | add ecx, eax |
890 | add edx, ebx |
893 | add edx, ebx |
891 | 894 | ||
892 | mov edi, [TASK_COUNT] |
895 | mov edi, [TASK_COUNT] |
893 | movzx esi, word[WIN_POS + edi * 2] |
896 | movzx esi, word[WIN_POS + edi * 2] |
894 | call window._.set_screen |
897 | call window._.set_screen |
895 | popad |
898 | popad |
896 | 899 | ||
897 | ; tell application to redraw itself |
900 | ; tell application to redraw itself |
898 | mov [edi + WDATA.fl_redraw], 1 |
901 | mov [edi + WDATA.fl_redraw], 1 |
899 | xor eax, eax |
902 | xor eax, eax |
900 | jmp .exit |
903 | jmp .exit |
901 | 904 | ||
902 | .do_not_draw: |
905 | .do_not_draw: |
903 | ; no it's not, just activate the window |
906 | ; no it's not, just activate the window |
904 | call window._.window_activate |
907 | call window._.window_activate |
905 | xor eax, eax |
908 | xor eax, eax |
906 | mov byte[MOUSE_BACKGROUND], al |
909 | mov byte[MOUSE_BACKGROUND], al |
907 | mov byte[DONT_DRAW_MOUSE], al |
910 | mov byte[DONT_DRAW_MOUSE], al |
908 | 911 | ||
909 | 912 | ||
910 | .exit: |
913 | .exit: |
911 | mov byte[MOUSE_DOWN], 0 |
914 | mov byte[MOUSE_DOWN], 0 |
912 | inc eax |
915 | inc eax |
913 | ret |
916 | ret |
914 | 917 | ||
915 | align 4 |
918 | align 4 |
916 | ;------------------------------------------------------------------------------ |
919 | ;------------------------------------------------------------------------------ |
917 | minimize_window: ;///////////////////////////////////////////////////////////// |
920 | minimize_window: ;///////////////////////////////////////////////////////////// |
918 | ;------------------------------------------------------------------------------ |
921 | ;------------------------------------------------------------------------------ |
919 | ;> eax = window number on screen |
922 | ;> eax = window number on screen |
920 | ;------------------------------------------------------------------------------ |
923 | ;------------------------------------------------------------------------------ |
921 | ;# corrupts [dl*] |
924 | ;# corrupts [dl*] |
922 | ;------------------------------------------------------------------------------ |
925 | ;------------------------------------------------------------------------------ |
923 | push edi |
926 | push edi |
924 | pushfd |
927 | pushfd |
925 | cli |
928 | cli |
926 | 929 | ||
927 | ; is it already minimized? |
930 | ; is it already minimized? |
928 | movzx edi, word[WIN_POS + eax * 2] |
931 | movzx edi, word[WIN_POS + eax * 2] |
929 | shl edi, 5 |
932 | shl edi, 5 |
930 | add edi, window_data |
933 | add edi, window_data |
931 | test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
934 | test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
932 | jnz .exit |
935 | jnz .exit |
933 | 936 | ||
934 | push eax ebx ecx edx esi |
937 | push eax ebx ecx edx esi |
935 | 938 | ||
936 | ; no it's not, let's do that |
939 | ; no it's not, let's do that |
937 | or [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
940 | or [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
938 | mov eax, [edi + WDATA.box.left] |
941 | mov eax, [edi + WDATA.box.left] |
939 | mov [draw_limits.left], eax |
942 | mov [draw_limits.left], eax |
940 | mov ecx, eax |
943 | mov ecx, eax |
941 | add ecx, [edi + WDATA.box.width] |
944 | add ecx, [edi + WDATA.box.width] |
942 | mov [draw_limits.right], ecx |
945 | mov [draw_limits.right], ecx |
943 | mov ebx, [edi + WDATA.box.top] |
946 | mov ebx, [edi + WDATA.box.top] |
944 | mov [draw_limits.top], ebx |
947 | mov [draw_limits.top], ebx |
945 | mov edx, ebx |
948 | mov edx, ebx |
946 | add edx, [edi + WDATA.box.height] |
949 | add edx, [edi + WDATA.box.height] |
947 | mov [draw_limits.bottom], edx |
950 | mov [draw_limits.bottom], edx |
948 | call calculatescreen |
951 | call calculatescreen |
949 | xor esi, esi |
952 | xor esi, esi |
950 | xor eax, eax |
953 | xor eax, eax |
951 | call redrawscreen |
954 | call redrawscreen |
952 | 955 | ||
953 | pop esi edx ecx ebx eax |
956 | pop esi edx ecx ebx eax |
954 | 957 | ||
955 | .exit: |
958 | .exit: |
956 | popfd |
959 | popfd |
957 | pop edi |
960 | pop edi |
958 | ret |
961 | ret |
959 | 962 | ||
960 | align 4 |
963 | align 4 |
961 | ;------------------------------------------------------------------------------ |
964 | ;------------------------------------------------------------------------------ |
962 | restore_minimized_window: ;//////////////////////////////////////////////////// |
965 | restore_minimized_window: ;//////////////////////////////////////////////////// |
963 | ;------------------------------------------------------------------------------ |
966 | ;------------------------------------------------------------------------------ |
964 | ;> eax = window number on screen |
967 | ;> eax = window number on screen |
965 | ;------------------------------------------------------------------------------ |
968 | ;------------------------------------------------------------------------------ |
966 | ;# corrupts [dl*] |
969 | ;# corrupts [dl*] |
967 | ;------------------------------------------------------------------------------ |
970 | ;------------------------------------------------------------------------------ |
968 | pushad |
971 | pushad |
969 | pushfd |
972 | pushfd |
970 | cli |
973 | cli |
971 | 974 | ||
972 | ; is it already restored? |
975 | ; is it already restored? |
973 | movzx esi, word[WIN_POS + eax * 2] |
976 | movzx esi, word[WIN_POS + eax * 2] |
974 | mov edi, esi |
977 | mov edi, esi |
975 | shl edi, 5 |
978 | shl edi, 5 |
976 | add edi, window_data |
979 | add edi, window_data |
977 | test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
980 | test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
978 | jz .exit |
981 | jz .exit |
979 | 982 | ||
980 | ; no it's not, let's do that |
983 | ; no it's not, let's do that |
981 | mov [edi + WDATA.fl_redraw], 1 |
984 | mov [edi + WDATA.fl_redraw], 1 |
982 | and [edi + WDATA.fl_wstate], not WSTATE_MINIMIZED |
985 | and [edi + WDATA.fl_wstate], not WSTATE_MINIMIZED |
983 | mov ebp, window._.set_screen |
986 | mov ebp, window._.set_screen |
984 | cmp eax, [TASK_COUNT] |
987 | cmp eax, [TASK_COUNT] |
985 | jz @f |
988 | jz @f |
986 | mov ebp, calculatescreen |
989 | mov ebp, calculatescreen |
987 | @@: mov eax, [edi + WDATA.box.left] |
990 | @@: mov eax, [edi + WDATA.box.left] |
988 | mov ebx, [edi + WDATA.box.top] |
991 | mov ebx, [edi + WDATA.box.top] |
989 | mov ecx, [edi + WDATA.box.width] |
992 | mov ecx, [edi + WDATA.box.width] |
990 | mov edx, [edi + WDATA.box.height] |
993 | mov edx, [edi + WDATA.box.height] |
991 | add ecx, eax |
994 | add ecx, eax |
992 | add edx, ebx |
995 | add edx, ebx |
993 | call ebp |
996 | call ebp |
994 | 997 | ||
995 | mov byte[MOUSE_BACKGROUND], 0 |
998 | mov byte[MOUSE_BACKGROUND], 0 |
996 | 999 | ||
997 | .exit: |
1000 | .exit: |
998 | popfd |
1001 | popfd |
999 | popad |
1002 | popad |
1000 | ret |
1003 | ret |
1001 | 1004 | ||
1002 | align 4 |
1005 | align 4 |
1003 | ; TODO: remove this proc |
1006 | ; TODO: remove this proc |
1004 | ;------------------------------------------------------------------------------ |
1007 | ;------------------------------------------------------------------------------ |
1005 | window_check_events: ;///////////////////////////////////////////////////////// |
1008 | window_check_events: ;///////////////////////////////////////////////////////// |
1006 | ;------------------------------------------------------------------------------ |
1009 | ;------------------------------------------------------------------------------ |
1007 | ;? |
1010 | ;? |
1008 | ;------------------------------------------------------------------------------ |
1011 | ;------------------------------------------------------------------------------ |
1009 | ; do we have window minimize/restore request? |
1012 | ; do we have window minimize/restore request? |
1010 | cmp [window_minimize], 0 |
1013 | cmp [window_minimize], 0 |
1011 | je .exit |
1014 | je .exit |
1012 | 1015 | ||
1013 | ; okay, minimize or restore top-most window and exit |
1016 | ; okay, minimize or restore top-most window and exit |
1014 | mov eax, [TASK_COUNT] |
1017 | mov eax, [TASK_COUNT] |
1015 | mov bl, 0 |
1018 | mov bl, 0 |
1016 | xchg [window_minimize], bl |
1019 | xchg [window_minimize], bl |
1017 | dec bl |
1020 | dec bl |
1018 | jnz @f |
1021 | jnz @f |
1019 | call minimize_window |
1022 | call minimize_window |
1020 | jmp .exit |
1023 | jmp .exit |
1021 | 1024 | ||
1022 | @@: call restore_minimized_window |
1025 | @@: call restore_minimized_window |
1023 | 1026 | ||
1024 | .exit: |
1027 | .exit: |
1025 | ret |
1028 | ret |
1026 | 1029 | ||
1027 | align 4 |
1030 | align 4 |
1028 | ;------------------------------------------------------------------------------ |
1031 | ;------------------------------------------------------------------------------ |
1029 | sys_window_maximize_handler: ;///////////////////////////////////////////////// |
1032 | sys_window_maximize_handler: ;///////////////////////////////////////////////// |
1030 | ;------------------------------------------------------------------------------ |
1033 | ;------------------------------------------------------------------------------ |
1031 | ;? |
1034 | ;? |
1032 | ;------------------------------------------------------------------------------ |
1035 | ;------------------------------------------------------------------------------ |
1033 | ;> esi = process slot |
1036 | ;> esi = process slot |
1034 | ;------------------------------------------------------------------------------ |
1037 | ;------------------------------------------------------------------------------ |
1035 | mov edi, esi |
1038 | mov edi, esi |
1036 | shl edi, 5 |
1039 | shl edi, 5 |
1037 | add edi, window_data |
1040 | add edi, window_data |
1038 | 1041 | ||
1039 | ; can window change its height? |
1042 | ; can window change its height? |
1040 | ; only types 2 and 3 can be resized |
1043 | ; only types 2 and 3 can be resized |
1041 | mov dl, [edi + WDATA.fl_wstyle] |
1044 | mov dl, [edi + WDATA.fl_wstyle] |
1042 | test dl, 2 |
1045 | test dl, 2 |
1043 | jz .exit |
1046 | jz .exit |
1044 | 1047 | ||
1045 | ; toggle normal/maximized window state |
1048 | ; toggle normal/maximized window state |
1046 | mov bl, [edi + WDATA.fl_wstate] |
1049 | mov bl, [edi + WDATA.fl_wstate] |
1047 | xor bl, WSTATE_MAXIMIZED |
1050 | xor bl, WSTATE_MAXIMIZED |
1048 | 1051 | ||
1049 | ; calculate and set appropriate window bounds |
1052 | ; calculate and set appropriate window bounds |
1050 | test bl, WSTATE_MAXIMIZED |
1053 | test bl, WSTATE_MAXIMIZED |
1051 | jz .restore_size |
1054 | jz .restore_size |
1052 | 1055 | ||
1053 | mov eax, [screen_workarea.left] |
1056 | mov eax, [screen_workarea.left] |
1054 | mov ecx, [screen_workarea.top] |
1057 | mov ecx, [screen_workarea.top] |
1055 | push [screen_workarea.bottom] \ |
1058 | push [screen_workarea.bottom] \ |
1056 | [screen_workarea.right] \ |
1059 | [screen_workarea.right] \ |
1057 | ecx \ |
1060 | ecx \ |
1058 | eax |
1061 | eax |
1059 | sub [esp + BOX.width], eax |
1062 | sub [esp + BOX.width], eax |
1060 | sub [esp + BOX.height], ecx |
1063 | sub [esp + BOX.height], ecx |
1061 | mov eax, esp |
1064 | mov eax, esp |
1062 | jmp .set_box |
1065 | jmp .set_box |
1063 | 1066 | ||
1064 | .restore_size: |
1067 | .restore_size: |
1065 | mov eax, esi |
1068 | mov eax, esi |
1066 | shl eax, 8 |
1069 | shl eax, 8 |
1067 | add eax, SLOT_BASE + APPDATA.saved_box |
1070 | add eax, SLOT_BASE + APPDATA.saved_box |
1068 | push [eax + BOX.height] \ |
1071 | push [eax + BOX.height] \ |
1069 | [eax + BOX.width] \ |
1072 | [eax + BOX.width] \ |
1070 | [eax + BOX.top] \ |
1073 | [eax + BOX.top] \ |
1071 | [eax + BOX.left] |
1074 | [eax + BOX.left] |
1072 | mov eax, esp |
1075 | mov eax, esp |
1073 | 1076 | ||
1074 | .set_box: |
1077 | .set_box: |
1075 | test bl, WSTATE_ROLLEDUP |
1078 | test bl, WSTATE_ROLLEDUP |
1076 | jz @f |
1079 | jz @f |
1077 | 1080 | ||
1078 | xchg eax, ecx |
1081 | xchg eax, ecx |
1079 | call window._.get_rolledup_height |
1082 | call window._.get_rolledup_height |
1080 | mov [ecx + BOX.height], eax |
1083 | mov [ecx + BOX.height], eax |
1081 | xchg eax, ecx |
1084 | xchg eax, ecx |
1082 | 1085 | ||
1083 | @@: call window._.set_window_box |
1086 | @@: call window._.set_window_box |
1084 | add esp, BOX.sizeof |
1087 | add esp, BOX.sizeof |
1085 | 1088 | ||
1086 | .exit: |
1089 | .exit: |
1087 | ret |
1090 | ret |
1088 | 1091 | ||
1089 | align 4 |
1092 | align 4 |
1090 | ;------------------------------------------------------------------------------ |
1093 | ;------------------------------------------------------------------------------ |
1091 | sys_window_rollup_handler: ;/////////////////////////////////////////////////// |
1094 | sys_window_rollup_handler: ;/////////////////////////////////////////////////// |
1092 | ;------------------------------------------------------------------------------ |
1095 | ;------------------------------------------------------------------------------ |
1093 | ;? |
1096 | ;? |
1094 | ;------------------------------------------------------------------------------ |
1097 | ;------------------------------------------------------------------------------ |
1095 | ;> esi = process slot |
1098 | ;> esi = process slot |
1096 | ;------------------------------------------------------------------------------ |
1099 | ;------------------------------------------------------------------------------ |
1097 | mov edx, esi |
1100 | mov edx, esi |
1098 | shl edx, 8 |
1101 | shl edx, 8 |
1099 | add edx, SLOT_BASE |
1102 | add edx, SLOT_BASE |
1100 | 1103 | ||
1101 | ; toggle normal/rolled up window state |
1104 | ; toggle normal/rolled up window state |
1102 | mov bl, [edi + WDATA.fl_wstate] |
1105 | mov bl, [edi + WDATA.fl_wstate] |
1103 | xor bl, WSTATE_ROLLEDUP |
1106 | xor bl, WSTATE_ROLLEDUP |
1104 | 1107 | ||
1105 | ; calculate and set appropriate window bounds |
1108 | ; calculate and set appropriate window bounds |
1106 | test bl, WSTATE_ROLLEDUP |
1109 | test bl, WSTATE_ROLLEDUP |
1107 | jz .restore_size |
1110 | jz .restore_size |
1108 | 1111 | ||
1109 | call window._.get_rolledup_height |
1112 | call window._.get_rolledup_height |
1110 | push eax \ |
1113 | push eax \ |
1111 | [edi + WDATA.box.width] \ |
1114 | [edi + WDATA.box.width] \ |
1112 | [edi + WDATA.box.top] \ |
1115 | [edi + WDATA.box.top] \ |
1113 | [edi + WDATA.box.left] |
1116 | [edi + WDATA.box.left] |
1114 | mov eax, esp |
1117 | mov eax, esp |
1115 | jmp .set_box |
1118 | jmp .set_box |
1116 | 1119 | ||
1117 | .restore_size: |
1120 | .restore_size: |
1118 | test bl, WSTATE_MAXIMIZED |
1121 | test bl, WSTATE_MAXIMIZED |
1119 | jnz @f |
1122 | jnz @f |
1120 | add esp, -BOX.sizeof |
1123 | add esp, -BOX.sizeof |
1121 | lea eax, [edx + APPDATA.saved_box] |
1124 | lea eax, [edx + APPDATA.saved_box] |
1122 | jmp .set_box |
1125 | jmp .set_box |
1123 | 1126 | ||
1124 | @@: mov eax, [screen_workarea.top] |
1127 | @@: mov eax, [screen_workarea.top] |
1125 | push [screen_workarea.bottom] \ |
1128 | push [screen_workarea.bottom] \ |
1126 | [edi + WDATA.box.width] \ |
1129 | [edi + WDATA.box.width] \ |
1127 | eax \ |
1130 | eax \ |
1128 | [edi + WDATA.box.left] |
1131 | [edi + WDATA.box.left] |
1129 | sub [esp + BOX.height], eax |
1132 | sub [esp + BOX.height], eax |
1130 | mov eax, esp |
1133 | mov eax, esp |
1131 | 1134 | ||
1132 | .set_box: |
1135 | .set_box: |
1133 | call window._.set_window_box |
1136 | call window._.set_window_box |
1134 | add esp, BOX.sizeof |
1137 | add esp, BOX.sizeof |
1135 | 1138 | ||
1136 | ret |
1139 | ret |
1137 | 1140 | ||
1138 | align 4 |
1141 | align 4 |
1139 | ;------------------------------------------------------------------------------ |
1142 | ;------------------------------------------------------------------------------ |
1140 | sys_window_start_moving_handler: ;///////////////////////////////////////////// |
1143 | sys_window_start_moving_handler: ;///////////////////////////////////////////// |
1141 | ;------------------------------------------------------------------------------ |
1144 | ;------------------------------------------------------------------------------ |
1142 | ;? |
1145 | ;? |
1143 | ;------------------------------------------------------------------------------ |
1146 | ;------------------------------------------------------------------------------ |
1144 | ;> eax = old (original) window box |
1147 | ;> eax = old (original) window box |
1145 | ;> esi = process slot |
1148 | ;> esi = process slot |
1146 | ;------------------------------------------------------------------------------ |
1149 | ;------------------------------------------------------------------------------ |
1147 | mov edi, eax |
1150 | mov edi, eax |
1148 | call window._.draw_negative_box |
1151 | call window._.draw_negative_box |
1149 | 1152 | ||
1150 | ret |
1153 | ret |
1151 | 1154 | ||
1152 | align 4 |
1155 | align 4 |
1153 | ;------------------------------------------------------------------------------ |
1156 | ;------------------------------------------------------------------------------ |
1154 | sys_window_end_moving_handler: ;/////////////////////////////////////////////// |
1157 | sys_window_end_moving_handler: ;/////////////////////////////////////////////// |
1155 | ;------------------------------------------------------------------------------ |
1158 | ;------------------------------------------------------------------------------ |
1156 | ;? |
1159 | ;? |
1157 | ;------------------------------------------------------------------------------ |
1160 | ;------------------------------------------------------------------------------ |
1158 | ;> eax = old (original) window box |
1161 | ;> eax = old (original) window box |
1159 | ;> ebx = new (final) window box |
1162 | ;> ebx = new (final) window box |
1160 | ;> esi = process slot |
1163 | ;> esi = process slot |
1161 | ;------------------------------------------------------------------------------ |
1164 | ;------------------------------------------------------------------------------ |
1162 | mov edi, ebx |
1165 | mov edi, ebx |
1163 | call window._.draw_negative_box |
1166 | call window._.draw_negative_box |
1164 | 1167 | ||
1165 | mov edi, esi |
1168 | mov edi, esi |
1166 | shl edi, 5 |
1169 | shl edi, 5 |
1167 | add edi, window_data |
1170 | add edi, window_data |
1168 | 1171 | ||
1169 | mov eax, ebx |
1172 | mov eax, ebx |
1170 | mov bl, [edi + WDATA.fl_wstate] |
1173 | mov bl, [edi + WDATA.fl_wstate] |
1171 | call window._.set_window_box |
1174 | call window._.set_window_box |
1172 | ret |
1175 | ret |
1173 | 1176 | ||
1174 | align 4 |
1177 | align 4 |
1175 | ;------------------------------------------------------------------------------ |
1178 | ;------------------------------------------------------------------------------ |
1176 | sys_window_moving_handler: ;/////////////////////////////////////////////////// |
1179 | sys_window_moving_handler: ;/////////////////////////////////////////////////// |
1177 | ;------------------------------------------------------------------------------ |
1180 | ;------------------------------------------------------------------------------ |
1178 | ;? |
1181 | ;? |
1179 | ;------------------------------------------------------------------------------ |
1182 | ;------------------------------------------------------------------------------ |
1180 | ;> eax = old (from previous call) window box |
1183 | ;> eax = old (from previous call) window box |
1181 | ;> ebx = new (current) window box |
1184 | ;> ebx = new (current) window box |
1182 | ;> esi = process_slot |
1185 | ;> esi = process_slot |
1183 | ;------------------------------------------------------------------------------ |
1186 | ;------------------------------------------------------------------------------ |
1184 | mov edi, eax |
1187 | mov edi, eax |
1185 | call window._.draw_negative_box |
1188 | call window._.draw_negative_box |
1186 | mov edi, ebx |
1189 | mov edi, ebx |
1187 | call window._.draw_negative_box |
1190 | call window._.draw_negative_box |
1188 | ret |
1191 | ret |
1189 | 1192 | ||
1190 | ;============================================================================== |
1193 | ;============================================================================== |
1191 | ;///// private functions ////////////////////////////////////////////////////// |
1194 | ;///// private functions ////////////////////////////////////////////////////// |
1192 | ;============================================================================== |
1195 | ;============================================================================== |
1193 | 1196 | ||
1194 | iglobal |
1197 | iglobal |
1195 | FuncTable syscall_display_settings, ftable, \ |
1198 | FuncTable syscall_display_settings, ftable, \ |
1196 | 00, 01, 02, 03, 04, 05, 06, 07, 08 |
1199 | 00, 01, 02, 03, 04, 05, 06, 07, 08 |
1197 | 1200 | ||
1198 | align 4 |
1201 | align 4 |
1199 | window_topleft dd \ |
1202 | window_topleft dd \ |
1200 | 1, 21, \ ;type 0 |
1203 | 1, 21, \ ;type 0 |
1201 | 0, 0, \ ;type 1 |
1204 | 0, 0, \ ;type 1 |
1202 | 5, 20, \ ;type 2 |
1205 | 5, 20, \ ;type 2 |
1203 | 5, ?, \ ;type 3 {set by skin} |
1206 | 5, ?, \ ;type 3 {set by skin} |
1204 | 5, ? ;type 4 {set by skin} |
1207 | 5, ? ;type 4 {set by skin} |
1205 | endg |
1208 | endg |
1206 | 1209 | ||
1207 | ;uglobal |
1210 | ;uglobal |
1208 | ; NOTE: commented out since doesn't provide necessary functionality anyway, |
1211 | ; NOTE: commented out since doesn't provide necessary functionality anyway, |
1209 | ; to be reworked |
1212 | ; to be reworked |
1210 | ; new_window_starting dd ? |
1213 | ; new_window_starting dd ? |
1211 | ;endg |
1214 | ;endg |
1212 | 1215 | ||
1213 | align 4 |
1216 | align 4 |
1214 | ;------------------------------------------------------------------------------ |
1217 | ;------------------------------------------------------------------------------ |
1215 | window._.invalidate_screen: ;////////////////////////////////////////////////// |
1218 | window._.invalidate_screen: ;////////////////////////////////////////////////// |
1216 | ;------------------------------------------------------------------------------ |
1219 | ;------------------------------------------------------------------------------ |
1217 | ;? |
1220 | ;? |
1218 | ;------------------------------------------------------------------------------ |
1221 | ;------------------------------------------------------------------------------ |
1219 | ;> eax = old (original) window box |
1222 | ;> eax = old (original) window box |
1220 | ;> ebx = new (final) window box |
1223 | ;> ebx = new (final) window box |
1221 | ;> edi = pointer to WDATA struct |
1224 | ;> edi = pointer to WDATA struct |
1222 | ;------------------------------------------------------------------------------ |
1225 | ;------------------------------------------------------------------------------ |
1223 | push eax ebx |
1226 | push eax ebx |
1224 | 1227 | ||
1225 | ; TODO: do we really need `draw_limits`? |
1228 | ; TODO: do we really need `draw_limits`? |
1226 | ; Yes, they are used by background drawing code. |
1229 | ; Yes, they are used by background drawing code. |
1227 | mov ecx, [eax + BOX.left] |
1230 | mov ecx, [eax + BOX.left] |
1228 | mov edx, [ebx + BOX.left] |
1231 | mov edx, [ebx + BOX.left] |
1229 | cmp ecx, edx |
1232 | cmp ecx, edx |
1230 | jle @f |
1233 | jle @f |
1231 | mov ecx, edx |
1234 | mov ecx, edx |
1232 | @@: mov [draw_limits.left], ecx |
1235 | @@: mov [draw_limits.left], ecx |
1233 | mov ecx, [eax + BOX.left] |
1236 | mov ecx, [eax + BOX.left] |
1234 | add ecx, [eax + BOX.width] |
1237 | add ecx, [eax + BOX.width] |
1235 | add edx, [ebx + BOX.width] |
1238 | add edx, [ebx + BOX.width] |
1236 | cmp ecx, edx |
1239 | cmp ecx, edx |
1237 | jae @f |
1240 | jae @f |
1238 | mov ecx, edx |
1241 | mov ecx, edx |
1239 | @@: mov [draw_limits.right], ecx |
1242 | @@: mov [draw_limits.right], ecx |
1240 | mov ecx, [eax + BOX.top] |
1243 | mov ecx, [eax + BOX.top] |
1241 | mov edx, [ebx + BOX.top] |
1244 | mov edx, [ebx + BOX.top] |
1242 | cmp ecx, edx |
1245 | cmp ecx, edx |
1243 | jle @f |
1246 | jle @f |
1244 | mov ecx, edx |
1247 | mov ecx, edx |
1245 | @@: mov [draw_limits.top], ecx |
1248 | @@: mov [draw_limits.top], ecx |
1246 | mov ecx, [eax + BOX.top] |
1249 | mov ecx, [eax + BOX.top] |
1247 | add ecx, [eax + BOX.height] |
1250 | add ecx, [eax + BOX.height] |
1248 | add edx, [ebx + BOX.height] |
1251 | add edx, [ebx + BOX.height] |
1249 | cmp ecx, edx |
1252 | cmp ecx, edx |
1250 | jae @f |
1253 | jae @f |
1251 | mov ecx, edx |
1254 | mov ecx, edx |
1252 | @@: mov [draw_limits.bottom], ecx |
1255 | @@: mov [draw_limits.bottom], ecx |
1253 | 1256 | ||
1254 | ; recalculate screen buffer at old position |
1257 | ; recalculate screen buffer at old position |
1255 | push ebx |
1258 | push ebx |
1256 | mov edx, [eax + BOX.height] |
1259 | mov edx, [eax + BOX.height] |
1257 | mov ecx, [eax + BOX.width] |
1260 | mov ecx, [eax + BOX.width] |
1258 | mov ebx, [eax + BOX.top] |
1261 | mov ebx, [eax + BOX.top] |
1259 | mov eax, [eax + BOX.left] |
1262 | mov eax, [eax + BOX.left] |
1260 | add ecx, eax |
1263 | add ecx, eax |
1261 | add edx, ebx |
1264 | add edx, ebx |
1262 | call calculatescreen |
1265 | call calculatescreen |
1263 | pop eax |
1266 | pop eax |
1264 | 1267 | ||
1265 | ; recalculate screen buffer at new position |
1268 | ; recalculate screen buffer at new position |
1266 | mov edx, [eax + BOX.height] |
1269 | mov edx, [eax + BOX.height] |
1267 | mov ecx, [eax + BOX.width] |
1270 | mov ecx, [eax + BOX.width] |
1268 | mov ebx, [eax + BOX.top] |
1271 | mov ebx, [eax + BOX.top] |
1269 | mov eax, [eax + BOX.left] |
1272 | mov eax, [eax + BOX.left] |
1270 | add ecx, eax |
1273 | add ecx, eax |
1271 | add edx, ebx |
1274 | add edx, ebx |
1272 | call calculatescreen |
1275 | call calculatescreen |
1273 | 1276 | ||
1274 | mov eax, edi |
1277 | mov eax, edi |
1275 | call redrawscreen |
1278 | call redrawscreen |
1276 | 1279 | ||
1277 | ; tell window to redraw itself |
1280 | ; tell window to redraw itself |
1278 | mov [edi + WDATA.fl_redraw], 1 |
1281 | mov [edi + WDATA.fl_redraw], 1 |
1279 | 1282 | ||
1280 | pop ebx eax |
1283 | pop ebx eax |
1281 | ret |
1284 | ret |
1282 | 1285 | ||
1283 | align 4 |
1286 | align 4 |
1284 | ;------------------------------------------------------------------------------ |
1287 | ;------------------------------------------------------------------------------ |
1285 | window._.set_window_box: ;///////////////////////////////////////////////////// |
1288 | window._.set_window_box: ;///////////////////////////////////////////////////// |
1286 | ;------------------------------------------------------------------------------ |
1289 | ;------------------------------------------------------------------------------ |
1287 | ;? |
1290 | ;? |
1288 | ;------------------------------------------------------------------------------ |
1291 | ;------------------------------------------------------------------------------ |
1289 | ;> eax = pointer to BOX struct |
1292 | ;> eax = pointer to BOX struct |
1290 | ;> bl = new window state flags |
1293 | ;> bl = new window state flags |
1291 | ;> edi = pointer to WDATA struct |
1294 | ;> edi = pointer to WDATA struct |
1292 | ;------------------------------------------------------------------------------ |
1295 | ;------------------------------------------------------------------------------ |
1293 | push eax ebx esi |
1296 | push eax ebx esi |
1294 | 1297 | ||
1295 | ; don't do anything if the new box is identical to the old |
1298 | ; don't do anything if the new box is identical to the old |
1296 | cmp bl, [edi + WDATA.fl_wstate] |
1299 | cmp bl, [edi + WDATA.fl_wstate] |
1297 | jnz @f |
1300 | jnz @f |
1298 | mov esi, eax |
1301 | mov esi, eax |
1299 | push edi |
1302 | push edi |
1300 | if WDATA.box |
1303 | if WDATA.box |
1301 | add edi, WDATA.box |
1304 | add edi, WDATA.box |
1302 | end if |
1305 | end if |
1303 | mov ecx, 4 |
1306 | mov ecx, 4 |
1304 | repz cmpsd |
1307 | repz cmpsd |
1305 | pop edi |
1308 | pop edi |
1306 | jz .exit |
1309 | jz .exit |
1307 | @@: |
1310 | @@: |
1308 | 1311 | ||
1309 | add esp, -BOX.sizeof |
1312 | add esp, -BOX.sizeof |
1310 | 1313 | ||
1311 | mov ebx, esp |
1314 | mov ebx, esp |
1312 | if WDATA.box |
1315 | if WDATA.box |
1313 | lea esi, [edi + WDATA.box] |
1316 | lea esi, [edi + WDATA.box] |
1314 | else |
1317 | else |
1315 | mov esi, edi ; optimization for WDATA.box = 0 |
1318 | mov esi, edi ; optimization for WDATA.box = 0 |
1316 | end if |
1319 | end if |
1317 | xchg eax, esi |
1320 | xchg eax, esi |
1318 | mov ecx, BOX.sizeof |
1321 | mov ecx, BOX.sizeof |
1319 | call memmove |
1322 | call memmove |
1320 | xchg eax, esi |
1323 | xchg eax, esi |
1321 | xchg ebx, esi |
1324 | xchg ebx, esi |
1322 | call memmove |
1325 | call memmove |
1323 | mov eax, ebx |
1326 | mov eax, ebx |
1324 | mov ebx, esi |
1327 | mov ebx, esi |
1325 | 1328 | ||
1326 | call window._.check_window_position |
1329 | call window._.check_window_position |
1327 | call window._.set_window_clientbox |
1330 | call window._.set_window_clientbox |
1328 | call window._.invalidate_screen |
1331 | call window._.invalidate_screen |
1329 | 1332 | ||
1330 | add esp, BOX.sizeof |
1333 | add esp, BOX.sizeof |
1331 | 1334 | ||
1332 | mov cl, [esp + 4] |
1335 | mov cl, [esp + 4] |
1333 | mov ch, cl |
1336 | mov ch, cl |
1334 | xchg cl, [edi + WDATA.fl_wstate] |
1337 | xchg cl, [edi + WDATA.fl_wstate] |
1335 | 1338 | ||
1336 | or cl, ch |
1339 | or cl, ch |
1337 | test cl, WSTATE_MAXIMIZED |
1340 | test cl, WSTATE_MAXIMIZED |
1338 | jnz .exit |
1341 | jnz .exit |
1339 | 1342 | ||
1340 | mov eax, edi |
1343 | mov eax, edi |
1341 | sub eax, window_data |
1344 | sub eax, window_data |
1342 | shl eax, 3 |
1345 | shl eax, 3 |
1343 | add eax, SLOT_BASE |
1346 | add eax, SLOT_BASE |
1344 | 1347 | ||
1345 | lea ebx, [edi + WDATA.box] |
1348 | lea ebx, [edi + WDATA.box] |
1346 | xchg esp, ebx |
1349 | xchg esp, ebx |
1347 | 1350 | ||
1348 | pop [eax + APPDATA.saved_box.left] \ |
1351 | pop [eax + APPDATA.saved_box.left] \ |
1349 | [eax + APPDATA.saved_box.top] \ |
1352 | [eax + APPDATA.saved_box.top] \ |
1350 | [eax + APPDATA.saved_box.width] \ |
1353 | [eax + APPDATA.saved_box.width] \ |
1351 | edx |
1354 | edx |
1352 | 1355 | ||
1353 | xchg esp, ebx |
1356 | xchg esp, ebx |
1354 | 1357 | ||
1355 | test ch, WSTATE_ROLLEDUP |
1358 | test ch, WSTATE_ROLLEDUP |
1356 | jnz .exit |
1359 | jnz .exit |
1357 | 1360 | ||
1358 | mov [eax + APPDATA.saved_box.height], edx |
1361 | mov [eax + APPDATA.saved_box.height], edx |
1359 | 1362 | ||
1360 | .exit: |
1363 | .exit: |
1361 | pop esi ebx eax |
1364 | pop esi ebx eax |
1362 | ret |
1365 | ret |
1363 | 1366 | ||
1364 | align 4 |
1367 | align 4 |
1365 | ;------------------------------------------------------------------------------ |
1368 | ;------------------------------------------------------------------------------ |
1366 | window._.set_window_clientbox: ;/////////////////////////////////////////////// |
1369 | window._.set_window_clientbox: ;/////////////////////////////////////////////// |
1367 | ;------------------------------------------------------------------------------ |
1370 | ;------------------------------------------------------------------------------ |
1368 | ;? |
1371 | ;? |
1369 | ;------------------------------------------------------------------------------ |
1372 | ;------------------------------------------------------------------------------ |
1370 | ;> edi = pointer to WDATA struct |
1373 | ;> edi = pointer to WDATA struct |
1371 | ;------------------------------------------------------------------------------ |
1374 | ;------------------------------------------------------------------------------ |
1372 | push eax ecx edi |
1375 | push eax ecx edi |
1373 | 1376 | ||
1374 | mov eax, [_skinh] |
1377 | mov eax, [_skinh] |
1375 | mov [window_topleft + 8 * 3 + 4], eax |
1378 | mov [window_topleft + 8 * 3 + 4], eax |
1376 | mov [window_topleft + 8 * 4 + 4], eax |
1379 | mov [window_topleft + 8 * 4 + 4], eax |
1377 | 1380 | ||
1378 | mov ecx, edi |
1381 | mov ecx, edi |
1379 | sub edi, window_data |
1382 | sub edi, window_data |
1380 | shl edi, 3 |
1383 | shl edi, 3 |
1381 | test [ecx + WDATA.fl_wstyle], WSTYLE_CLIENTRELATIVE |
1384 | test [ecx + WDATA.fl_wstyle], WSTYLE_CLIENTRELATIVE |
1382 | jz .whole_window |
1385 | jz .whole_window |
1383 | 1386 | ||
1384 | movzx eax, [ecx + WDATA.fl_wstyle] |
1387 | movzx eax, [ecx + WDATA.fl_wstyle] |
1385 | and eax, 0x0F |
1388 | and eax, 0x0F |
1386 | mov eax, [eax * 8 + window_topleft + 0] |
1389 | mov eax, [eax * 8 + window_topleft + 0] |
1387 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax |
1390 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax |
1388 | shl eax, 1 |
1391 | shl eax, 1 |
1389 | neg eax |
1392 | neg eax |
1390 | add eax, [ecx + WDATA.box.width] |
1393 | add eax, [ecx + WDATA.box.width] |
1391 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax |
1394 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax |
1392 | 1395 | ||
1393 | movzx eax, [ecx + WDATA.fl_wstyle] |
1396 | movzx eax, [ecx + WDATA.fl_wstyle] |
1394 | and eax, 0x0F |
1397 | and eax, 0x0F |
1395 | push [eax * 8 + window_topleft + 0] |
1398 | push [eax * 8 + window_topleft + 0] |
1396 | mov eax, [eax * 8 + window_topleft + 4] |
1399 | mov eax, [eax * 8 + window_topleft + 4] |
1397 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.top], eax |
1400 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.top], eax |
1398 | neg eax |
1401 | neg eax |
1399 | sub eax, [esp] |
1402 | sub eax, [esp] |
1400 | add eax, [ecx + WDATA.box.height] |
1403 | add eax, [ecx + WDATA.box.height] |
1401 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax |
1404 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax |
1402 | add esp, 4 |
1405 | add esp, 4 |
1403 | jmp .exit |
1406 | jmp .exit |
1404 | 1407 | ||
1405 | .whole_window: |
1408 | .whole_window: |
1406 | xor eax, eax |
1409 | xor eax, eax |
1407 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax |
1410 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax |
1408 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.top], eax |
1411 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.top], eax |
1409 | mov eax, [ecx + WDATA.box.width] |
1412 | mov eax, [ecx + WDATA.box.width] |
1410 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax |
1413 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax |
1411 | mov eax, [ecx + WDATA.box.height] |
1414 | mov eax, [ecx + WDATA.box.height] |
1412 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax |
1415 | mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax |
1413 | 1416 | ||
1414 | .exit: |
1417 | .exit: |
1415 | pop edi ecx eax |
1418 | pop edi ecx eax |
1416 | ret |
1419 | ret |
1417 | 1420 | ||
1418 | align 4 |
1421 | align 4 |
1419 | ;------------------------------------------------------------------------------ |
1422 | ;------------------------------------------------------------------------------ |
1420 | window._.sys_set_window: ;///////////////////////////////////////////////////// |
1423 | window._.sys_set_window: ;///////////////////////////////////////////////////// |
1421 | ;------------------------------------------------------------------------------ |
1424 | ;------------------------------------------------------------------------------ |
1422 | ;? |
1425 | ;? |
1423 | ;------------------------------------------------------------------------------ |
1426 | ;------------------------------------------------------------------------------ |
1424 | ;< edx = pointer to WDATA struct |
1427 | ;< edx = pointer to WDATA struct |
1425 | ;------------------------------------------------------------------------------ |
1428 | ;------------------------------------------------------------------------------ |
1426 | mov eax, [CURRENT_TASK] |
1429 | mov eax, [CURRENT_TASK] |
1427 | shl eax, 5 |
1430 | shl eax, 5 |
1428 | add eax, window_data |
1431 | add eax, window_data |
1429 | 1432 | ||
1430 | ; save window colors |
1433 | ; save window colors |
1431 | mov [eax + WDATA.cl_workarea], edx |
1434 | mov [eax + WDATA.cl_workarea], edx |
1432 | mov [eax + WDATA.cl_titlebar], esi |
1435 | mov [eax + WDATA.cl_titlebar], esi |
1433 | mov [eax + WDATA.cl_frames], edi |
1436 | mov [eax + WDATA.cl_frames], edi |
1434 | 1437 | ||
1435 | mov edi, eax |
1438 | mov edi, eax |
1436 | 1439 | ||
1437 | ; was it already defined before? |
1440 | ; was it already defined before? |
1438 | test [edi + WDATA.fl_wdrawn], 1 |
1441 | test [edi + WDATA.fl_wdrawn], 1 |
1439 | jnz .set_client_box |
1442 | jnz .set_client_box |
- | 1443 | or [edi + WDATA.fl_wdrawn], 1 |
|
1440 | 1444 | ||
1441 | ; NOTE: commented out since doesn't provide necessary functionality |
1445 | ; NOTE: commented out since doesn't provide necessary functionality |
1442 | ; anyway, to be reworked |
1446 | ; anyway, to be reworked |
1443 | ; mov eax, [timer_ticks] ; [0xfdf0] |
1447 | ; mov eax, [timer_ticks] ; [0xfdf0] |
1444 | ; add eax, 100 |
1448 | ; add eax, 100 |
1445 | ; mov [new_window_starting], eax |
1449 | ; mov [new_window_starting], eax |
1446 | 1450 | ||
1447 | ; no it wasn't, performing initial window definition |
1451 | ; no it wasn't, performing initial window definition |
1448 | movzx eax, bx |
1452 | movzx eax, bx |
1449 | mov [edi + WDATA.box.width], eax |
1453 | mov [edi + WDATA.box.width], eax |
1450 | movzx eax, cx |
1454 | movzx eax, cx |
1451 | mov [edi + WDATA.box.height], eax |
1455 | mov [edi + WDATA.box.height], eax |
1452 | sar ebx, 16 |
1456 | sar ebx, 16 |
1453 | sar ecx, 16 |
1457 | sar ecx, 16 |
1454 | mov [edi + WDATA.box.left], ebx |
1458 | mov [edi + WDATA.box.left], ebx |
1455 | mov [edi + WDATA.box.top], ecx |
1459 | mov [edi + WDATA.box.top], ecx |
1456 | 1460 | ||
1457 | call window._.check_window_position |
1461 | call window._.check_window_position |
1458 | 1462 | ||
1459 | push ecx edi |
1463 | push ecx edi |
1460 | 1464 | ||
1461 | mov cl, [edi + WDATA.fl_wstyle] |
1465 | mov cl, [edi + WDATA.fl_wstyle] |
1462 | mov eax, [edi + WDATA.cl_frames] |
1466 | mov eax, [edi + WDATA.cl_frames] |
1463 | 1467 | ||
1464 | sub edi, window_data |
1468 | sub edi, window_data |
1465 | shl edi, 3 |
1469 | shl edi, 3 |
1466 | add edi, SLOT_BASE |
1470 | add edi, SLOT_BASE |
1467 | 1471 | ||
1468 | and cl, 0x0F |
1472 | and cl, 0x0F |
1469 | cmp cl, 3 |
1473 | cmp cl, 3 |
1470 | je @f |
1474 | je @f |
1471 | cmp cl, 4 |
1475 | cmp cl, 4 |
1472 | je @f |
1476 | je @f |
1473 | 1477 | ||
1474 | xor eax, eax |
1478 | xor eax, eax |
1475 | 1479 | ||
1476 | @@: mov [edi + APPDATA.wnd_caption], eax |
1480 | @@: mov [edi + APPDATA.wnd_caption], eax |
1477 | 1481 | ||
1478 | mov esi, [esp] |
1482 | mov esi, [esp] |
1479 | add edi, APPDATA.saved_box |
1483 | add edi, APPDATA.saved_box |
1480 | movsd |
1484 | movsd |
1481 | movsd |
1485 | movsd |
1482 | movsd |
1486 | movsd |
1483 | movsd |
1487 | movsd |
1484 | 1488 | ||
1485 | pop edi ecx |
1489 | pop edi ecx |
1486 | 1490 | ||
1487 | mov esi, [CURRENT_TASK] |
1491 | mov esi, [CURRENT_TASK] |
1488 | movzx esi, word[WIN_STACK + esi * 2] |
1492 | movzx esi, word[WIN_STACK + esi * 2] |
1489 | lea esi, [WIN_POS + esi * 2] |
1493 | lea esi, [WIN_POS + esi * 2] |
1490 | call waredraw |
1494 | call waredraw |
1491 | 1495 | ||
1492 | mov eax, [edi + WDATA.box.left] |
1496 | mov eax, [edi + WDATA.box.left] |
1493 | mov ebx, [edi + WDATA.box.top] |
1497 | mov ebx, [edi + WDATA.box.top] |
1494 | mov ecx, [edi + WDATA.box.width] |
1498 | mov ecx, [edi + WDATA.box.width] |
1495 | mov edx, [edi + WDATA.box.height] |
1499 | mov edx, [edi + WDATA.box.height] |
1496 | add ecx, eax |
1500 | add ecx, eax |
1497 | add edx, ebx |
1501 | add edx, ebx |
1498 | call calculatescreen |
1502 | call calculatescreen |
1499 | 1503 | ||
1500 | mov byte[KEY_COUNT], 0 ; empty keyboard buffer |
1504 | mov byte[KEY_COUNT], 0 ; empty keyboard buffer |
1501 | mov byte[BTN_COUNT], 0 ; empty button buffer |
1505 | mov byte[BTN_COUNT], 0 ; empty button buffer |
1502 | 1506 | ||
1503 | .set_client_box: |
1507 | .set_client_box: |
1504 | ; update window client box coordinates |
1508 | ; update window client box coordinates |
1505 | call window._.set_window_clientbox |
1509 | call window._.set_window_clientbox |
1506 | 1510 | ||
1507 | ; reset window redraw flag and exit |
1511 | ; reset window redraw flag and exit |
1508 | mov [edi + WDATA.fl_redraw], 0 |
1512 | mov [edi + WDATA.fl_redraw], 0 |
1509 | mov edx, edi |
1513 | mov edx, edi |
1510 | ret |
1514 | ret |
1511 | 1515 | ||
1512 | align 4 |
1516 | align 4 |
1513 | ;------------------------------------------------------------------------------ |
1517 | ;------------------------------------------------------------------------------ |
1514 | window._.check_window_position: ;////////////////////////////////////////////// |
1518 | window._.check_window_position: ;////////////////////////////////////////////// |
1515 | ;------------------------------------------------------------------------------ |
1519 | ;------------------------------------------------------------------------------ |
1516 | ;? Check if window is inside screen area |
1520 | ;? Check if window is inside screen area |
1517 | ;------------------------------------------------------------------------------ |
1521 | ;------------------------------------------------------------------------------ |
1518 | ;> edi = pointer to WDATA |
1522 | ;> edi = pointer to WDATA |
1519 | ;------------------------------------------------------------------------------ |
1523 | ;------------------------------------------------------------------------------ |
1520 | push eax ebx ecx edx esi |
1524 | push eax ebx ecx edx esi |
1521 | 1525 | ||
1522 | mov eax, [edi + WDATA.box.left] |
1526 | mov eax, [edi + WDATA.box.left] |
1523 | mov ebx, [edi + WDATA.box.top] |
1527 | mov ebx, [edi + WDATA.box.top] |
1524 | mov ecx, [edi + WDATA.box.width] |
1528 | mov ecx, [edi + WDATA.box.width] |
1525 | mov edx, [edi + WDATA.box.height] |
1529 | mov edx, [edi + WDATA.box.height] |
1526 | 1530 | ||
1527 | mov esi, [Screen_Max_X] |
1531 | mov esi, [Screen_Max_X] |
1528 | cmp ecx, esi |
1532 | cmp ecx, esi |
1529 | ja .fix_width_high |
1533 | ja .fix_width_high |
1530 | 1534 | ||
1531 | .check_left: |
1535 | .check_left: |
1532 | or eax, eax |
1536 | or eax, eax |
1533 | jl .fix_left_low |
1537 | jl .fix_left_low |
1534 | add eax, ecx |
1538 | add eax, ecx |
1535 | cmp eax, esi |
1539 | cmp eax, esi |
1536 | jg .fix_left_high |
1540 | jg .fix_left_high |
1537 | 1541 | ||
1538 | .check_height: |
1542 | .check_height: |
1539 | mov esi, [Screen_Max_Y] |
1543 | mov esi, [Screen_Max_Y] |
1540 | cmp edx, esi |
1544 | cmp edx, esi |
1541 | ja .fix_height_high |
1545 | ja .fix_height_high |
1542 | 1546 | ||
1543 | .check_top: |
1547 | .check_top: |
1544 | or ebx, ebx |
1548 | or ebx, ebx |
1545 | jl .fix_top_low |
1549 | jl .fix_top_low |
1546 | add ebx, edx |
1550 | add ebx, edx |
1547 | cmp ebx, esi |
1551 | cmp ebx, esi |
1548 | jg .fix_top_high |
1552 | jg .fix_top_high |
1549 | 1553 | ||
1550 | .exit: |
1554 | .exit: |
1551 | pop esi edx ecx ebx eax |
1555 | pop esi edx ecx ebx eax |
1552 | ret |
1556 | ret |
1553 | 1557 | ||
1554 | .fix_width_high: |
1558 | .fix_width_high: |
1555 | mov ecx, esi |
1559 | mov ecx, esi |
1556 | mov [edi + WDATA.box.width], esi |
1560 | mov [edi + WDATA.box.width], esi |
1557 | jmp .check_left |
1561 | jmp .check_left |
1558 | 1562 | ||
1559 | .fix_left_low: |
1563 | .fix_left_low: |
1560 | xor eax, eax |
1564 | xor eax, eax |
1561 | mov [edi + WDATA.box.left], eax |
1565 | mov [edi + WDATA.box.left], eax |
1562 | jmp .check_height |
1566 | jmp .check_height |
1563 | 1567 | ||
1564 | .fix_left_high: |
1568 | .fix_left_high: |
1565 | mov eax, esi |
1569 | mov eax, esi |
1566 | sub eax, ecx |
1570 | sub eax, ecx |
1567 | mov [edi + WDATA.box.left], eax |
1571 | mov [edi + WDATA.box.left], eax |
1568 | jmp .check_height |
1572 | jmp .check_height |
1569 | 1573 | ||
1570 | .fix_height_high: |
1574 | .fix_height_high: |
1571 | mov edx, esi |
1575 | mov edx, esi |
1572 | mov [edi + WDATA.box.height], esi |
1576 | mov [edi + WDATA.box.height], esi |
1573 | jmp .check_top |
1577 | jmp .check_top |
1574 | 1578 | ||
1575 | .fix_top_low: |
1579 | .fix_top_low: |
1576 | xor ebx, ebx |
1580 | xor ebx, ebx |
1577 | mov [edi + WDATA.box.top], ebx |
1581 | mov [edi + WDATA.box.top], ebx |
1578 | jmp .exit |
1582 | jmp .exit |
1579 | 1583 | ||
1580 | .fix_top_high: |
1584 | .fix_top_high: |
1581 | mov ebx, esi |
1585 | mov ebx, esi |
1582 | sub ebx, edx |
1586 | sub ebx, edx |
1583 | mov [edi + WDATA.box.top], ebx |
1587 | mov [edi + WDATA.box.top], ebx |
1584 | jmp .exit |
1588 | jmp .exit |
1585 | 1589 | ||
1586 | align 4 |
1590 | align 4 |
1587 | ;------------------------------------------------------------------------------ |
1591 | ;------------------------------------------------------------------------------ |
1588 | window._.get_titlebar_height: ;//////////////////////////////////////////////// |
1592 | window._.get_titlebar_height: ;//////////////////////////////////////////////// |
1589 | ;------------------------------------------------------------------------------ |
1593 | ;------------------------------------------------------------------------------ |
1590 | ;? |
1594 | ;? |
1591 | ;------------------------------------------------------------------------------ |
1595 | ;------------------------------------------------------------------------------ |
1592 | ;> edi = pointer to WDATA |
1596 | ;> edi = pointer to WDATA |
1593 | ;------------------------------------------------------------------------------ |
1597 | ;------------------------------------------------------------------------------ |
1594 | mov al, [edi + WDATA.fl_wstyle] |
1598 | mov al, [edi + WDATA.fl_wstyle] |
1595 | and al, 0x0f |
1599 | and al, 0x0f |
1596 | cmp al, 0x03 |
1600 | cmp al, 0x03 |
1597 | jne @f |
1601 | jne @f |
1598 | mov eax, [_skinh] |
1602 | mov eax, [_skinh] |
1599 | ret |
1603 | ret |
1600 | @@: mov eax, 21 |
1604 | @@: mov eax, 21 |
1601 | ret |
1605 | ret |
1602 | 1606 | ||
1603 | align 4 |
1607 | align 4 |
1604 | ;------------------------------------------------------------------------------ |
1608 | ;------------------------------------------------------------------------------ |
1605 | window._.get_rolledup_height: ;//////////////////////////////////////////////// |
1609 | window._.get_rolledup_height: ;//////////////////////////////////////////////// |
1606 | ;------------------------------------------------------------------------------ |
1610 | ;------------------------------------------------------------------------------ |
1607 | ;? |
1611 | ;? |
1608 | ;------------------------------------------------------------------------------ |
1612 | ;------------------------------------------------------------------------------ |
1609 | ;> edi = pointer to WDATA |
1613 | ;> edi = pointer to WDATA |
1610 | ;------------------------------------------------------------------------------ |
1614 | ;------------------------------------------------------------------------------ |
1611 | mov al, [edi + WDATA.fl_wstyle] |
1615 | mov al, [edi + WDATA.fl_wstyle] |
1612 | and al, 0x0f |
1616 | and al, 0x0f |
1613 | cmp al, 0x03 |
1617 | cmp al, 0x03 |
1614 | jb @f |
1618 | jb @f |
1615 | mov eax, [_skinh] |
1619 | mov eax, [_skinh] |
1616 | add eax, 3 |
1620 | add eax, 3 |
1617 | ret |
1621 | ret |
1618 | @@: or al, al |
1622 | @@: or al, al |
1619 | jnz @f |
1623 | jnz @f |
1620 | mov eax, 21 |
1624 | mov eax, 21 |
1621 | ret |
1625 | ret |
1622 | @@: mov eax, 21 + 2 |
1626 | @@: mov eax, 21 + 2 |
1623 | ret |
1627 | ret |
1624 | 1628 | ||
1625 | align 4 |
1629 | align 4 |
1626 | ;------------------------------------------------------------------------------ |
1630 | ;------------------------------------------------------------------------------ |
1627 | window._.set_screen: ;///////////////////////////////////////////////////////// |
1631 | window._.set_screen: ;///////////////////////////////////////////////////////// |
1628 | ;------------------------------------------------------------------------------ |
1632 | ;------------------------------------------------------------------------------ |
1629 | ;? Reserve window area in screen buffer |
1633 | ;? Reserve window area in screen buffer |
1630 | ;------------------------------------------------------------------------------ |
1634 | ;------------------------------------------------------------------------------ |
1631 | ;> eax = left |
1635 | ;> eax = left |
1632 | ;> ebx = top |
1636 | ;> ebx = top |
1633 | ;> ecx = right |
1637 | ;> ecx = right |
1634 | ;> edx = bottom |
1638 | ;> edx = bottom |
1635 | ;> esi = process number |
1639 | ;> esi = process number |
1636 | ;------------------------------------------------------------------------------ |
1640 | ;------------------------------------------------------------------------------ |
1637 | virtual at esp |
1641 | virtual at esp |
1638 | ff_x dd ? |
1642 | ff_x dd ? |
1639 | ff_y dd ? |
1643 | ff_y dd ? |
1640 | ff_width dd ? |
1644 | ff_width dd ? |
1641 | ff_xsz dd ? |
1645 | ff_xsz dd ? |
1642 | ff_ysz dd ? |
1646 | ff_ysz dd ? |
1643 | ff_scale dd ? |
1647 | ff_scale dd ? |
1644 | end virtual |
1648 | end virtual |
1645 | 1649 | ||
1646 | pushad |
1650 | pushad |
1647 | 1651 | ||
1648 | cmp esi, 1 |
1652 | cmp esi, 1 |
1649 | jz .check_for_shaped_window |
1653 | jz .check_for_shaped_window |
1650 | mov edi, esi |
1654 | mov edi, esi |
1651 | shl edi, 5 |
1655 | shl edi, 5 |
1652 | cmp [window_data + edi + WDATA.box.width], 0 |
1656 | cmp [window_data + edi + WDATA.box.width], 0 |
1653 | jnz .check_for_shaped_window |
1657 | jnz .check_for_shaped_window |
1654 | cmp [window_data + edi + WDATA.box.height], 0 |
1658 | cmp [window_data + edi + WDATA.box.height], 0 |
1655 | jz .exit |
1659 | jz .exit |
1656 | 1660 | ||
1657 | .check_for_shaped_window: |
1661 | .check_for_shaped_window: |
1658 | mov edi, esi |
1662 | mov edi, esi |
1659 | shl edi, 8 |
1663 | shl edi, 8 |
1660 | add edi, SLOT_BASE |
1664 | add edi, SLOT_BASE |
1661 | cmp [edi + APPDATA.wnd_shape], 0 |
1665 | cmp [edi + APPDATA.wnd_shape], 0 |
1662 | jne .shaped_window |
1666 | jne .shaped_window |
1663 | 1667 | ||
1664 | ; get x&y size |
1668 | ; get x&y size |
1665 | sub ecx, eax |
1669 | sub ecx, eax |
1666 | sub edx, ebx |
1670 | sub edx, ebx |
1667 | inc ecx |
1671 | inc ecx |
1668 | inc edx |
1672 | inc edx |
1669 | 1673 | ||
1670 | ; get WinMap start |
1674 | ; get WinMap start |
1671 | push esi |
1675 | push esi |
1672 | mov edi, [Screen_Max_X] |
1676 | mov edi, [Screen_Max_X] |
1673 | inc edi |
1677 | inc edi |
1674 | mov esi, edi |
1678 | mov esi, edi |
1675 | imul edi, ebx |
1679 | imul edi, ebx |
1676 | add edi, eax |
1680 | add edi, eax |
1677 | add edi, [_WinMapAddress] |
1681 | add edi, [_WinMapAddress] |
1678 | pop eax |
1682 | pop eax |
1679 | mov ah, al |
1683 | mov ah, al |
1680 | push ax |
1684 | push ax |
1681 | shl eax, 16 |
1685 | shl eax, 16 |
1682 | pop ax |
1686 | pop ax |
1683 | 1687 | ||
1684 | .next_line: |
1688 | .next_line: |
1685 | push ecx |
1689 | push ecx |
1686 | shr ecx, 2 |
1690 | shr ecx, 2 |
1687 | rep stosd |
1691 | rep stosd |
1688 | mov ecx, [esp] |
1692 | mov ecx, [esp] |
1689 | and ecx, 3 |
1693 | and ecx, 3 |
1690 | rep stosb |
1694 | rep stosb |
1691 | pop ecx |
1695 | pop ecx |
1692 | add edi, esi |
1696 | add edi, esi |
1693 | sub edi, ecx |
1697 | sub edi, ecx |
1694 | dec edx |
1698 | dec edx |
1695 | jnz .next_line |
1699 | jnz .next_line |
1696 | 1700 | ||
1697 | jmp .exit |
1701 | jmp .exit |
1698 | 1702 | ||
1699 | .shaped_window: |
1703 | .shaped_window: |
1700 | ; for (y=0; y <= x_size; y++) |
1704 | ; for (y=0; y <= x_size; y++) |
1701 | ; for (x=0; x <= x_size; x++) |
1705 | ; for (x=0; x <= x_size; x++) |
1702 | ; if (shape[coord(x,y,scale)]==1) |
1706 | ; if (shape[coord(x,y,scale)]==1) |
1703 | ; set_pixel(x, y, process_number); |
1707 | ; set_pixel(x, y, process_number); |
1704 | 1708 | ||
1705 | sub ecx, eax |
1709 | sub ecx, eax |
1706 | sub edx, ebx |
1710 | sub edx, ebx |
1707 | inc ecx |
1711 | inc ecx |
1708 | inc edx |
1712 | inc edx |
1709 | 1713 | ||
1710 | push [edi + APPDATA.wnd_shape_scale] ; push scale first -> for loop |
1714 | push [edi + APPDATA.wnd_shape_scale] ; push scale first -> for loop |
1711 | 1715 | ||
1712 | ; get WinMap start -> ebp |
1716 | ; get WinMap start -> ebp |
1713 | push eax |
1717 | push eax |
1714 | mov eax, [Screen_Max_X] ; screen_sx |
1718 | mov eax, [Screen_Max_X] ; screen_sx |
1715 | inc eax |
1719 | inc eax |
1716 | imul eax, ebx |
1720 | imul eax, ebx |
1717 | add eax, [esp] |
1721 | add eax, [esp] |
1718 | add eax, [_WinMapAddress] |
1722 | add eax, [_WinMapAddress] |
1719 | mov ebp, eax |
1723 | mov ebp, eax |
1720 | 1724 | ||
1721 | mov edi, [edi + APPDATA.wnd_shape] |
1725 | mov edi, [edi + APPDATA.wnd_shape] |
1722 | pop eax |
1726 | pop eax |
1723 | 1727 | ||
1724 | ; eax = x_start |
1728 | ; eax = x_start |
1725 | ; ebx = y_start |
1729 | ; ebx = y_start |
1726 | ; ecx = x_size |
1730 | ; ecx = x_size |
1727 | ; edx = y_size |
1731 | ; edx = y_size |
1728 | ; esi = process_number |
1732 | ; esi = process_number |
1729 | ; edi = &shape |
1733 | ; edi = &shape |
1730 | ; [scale] |
1734 | ; [scale] |
1731 | push edx ecx ; for loop - x,y size |
1735 | push edx ecx ; for loop - x,y size |
1732 | 1736 | ||
1733 | mov ecx, esi |
1737 | mov ecx, esi |
1734 | shl ecx, 5 |
1738 | shl ecx, 5 |
1735 | mov edx, [window_data + ecx + WDATA.box.top] |
1739 | mov edx, [window_data + ecx + WDATA.box.top] |
1736 | push [window_data + ecx + WDATA.box.width] ; for loop - width |
1740 | push [window_data + ecx + WDATA.box.width] ; for loop - width |
1737 | mov ecx, [window_data + ecx + WDATA.box.left] |
1741 | mov ecx, [window_data + ecx + WDATA.box.left] |
1738 | sub ebx, edx |
1742 | sub ebx, edx |
1739 | sub eax, ecx |
1743 | sub eax, ecx |
1740 | push ebx eax ; for loop - x,y |
1744 | push ebx eax ; for loop - x,y |
1741 | 1745 | ||
1742 | add [ff_xsz], eax |
1746 | add [ff_xsz], eax |
1743 | add [ff_ysz], ebx |
1747 | add [ff_ysz], ebx |
1744 | 1748 | ||
1745 | mov ebx, [ff_y] |
1749 | mov ebx, [ff_y] |
1746 | 1750 | ||
1747 | .ff_new_y: |
1751 | .ff_new_y: |
1748 | mov edx, [ff_x] |
1752 | mov edx, [ff_x] |
1749 | 1753 | ||
1750 | .ff_new_x: |
1754 | .ff_new_x: |
1751 | ; -- body -- |
1755 | ; -- body -- |
1752 | mov ecx, [ff_scale] |
1756 | mov ecx, [ff_scale] |
1753 | mov eax, [ff_width] |
1757 | mov eax, [ff_width] |
1754 | inc eax |
1758 | inc eax |
1755 | shr eax, cl |
1759 | shr eax, cl |
1756 | push ebx edx |
1760 | push ebx edx |
1757 | shr ebx, cl |
1761 | shr ebx, cl |
1758 | shr edx, cl |
1762 | shr edx, cl |
1759 | imul eax, ebx |
1763 | imul eax, ebx |
1760 | add eax, edx |
1764 | add eax, edx |
1761 | pop edx ebx |
1765 | pop edx ebx |
1762 | add eax, edi |
1766 | add eax, edi |
1763 | call .read_byte |
1767 | call .read_byte |
1764 | test al,al |
1768 | test al,al |
1765 | jz @f |
1769 | jz @f |
1766 | mov eax, esi |
1770 | mov eax, esi |
1767 | mov [ebp], al |
1771 | mov [ebp], al |
1768 | ; -- end body -- |
1772 | ; -- end body -- |
1769 | @@: inc ebp |
1773 | @@: inc ebp |
1770 | inc edx |
1774 | inc edx |
1771 | cmp edx, [ff_xsz] |
1775 | cmp edx, [ff_xsz] |
1772 | jb .ff_new_x |
1776 | jb .ff_new_x |
1773 | 1777 | ||
1774 | sub ebp, [ff_xsz] |
1778 | sub ebp, [ff_xsz] |
1775 | add ebp, [ff_x] |
1779 | add ebp, [ff_x] |
1776 | add ebp, [Screen_Max_X] ; screen.x |
1780 | add ebp, [Screen_Max_X] ; screen.x |
1777 | inc ebp |
1781 | inc ebp |
1778 | inc ebx |
1782 | inc ebx |
1779 | cmp ebx, [ff_ysz] |
1783 | cmp ebx, [ff_ysz] |
1780 | jb .ff_new_y |
1784 | jb .ff_new_y |
1781 | 1785 | ||
1782 | add esp, 24 |
1786 | add esp, 24 |
1783 | 1787 | ||
1784 | .exit: |
1788 | .exit: |
1785 | popad |
1789 | popad |
1786 | ret |
1790 | ret |
1787 | 1791 | ||
1788 | .read_byte: |
1792 | .read_byte: |
1789 | ; eax - address |
1793 | ; eax - address |
1790 | ; esi - slot |
1794 | ; esi - slot |
1791 | push eax ecx edx esi |
1795 | push eax ecx edx esi |
1792 | xchg eax, esi |
1796 | xchg eax, esi |
1793 | lea ecx, [esp + 12] |
1797 | lea ecx, [esp + 12] |
1794 | mov edx, 1 |
1798 | mov edx, 1 |
1795 | call read_process_memory |
1799 | call read_process_memory |
1796 | pop esi edx ecx eax |
1800 | pop esi edx ecx eax |
1797 | ret |
1801 | ret |
1798 | 1802 | ||
1799 | align 4 |
1803 | align 4 |
1800 | ;------------------------------------------------------------------------------ |
1804 | ;------------------------------------------------------------------------------ |
1801 | window._.window_activate: ;//////////////////////////////////////////////////// |
1805 | window._.window_activate: ;//////////////////////////////////////////////////// |
1802 | ;------------------------------------------------------------------------------ |
1806 | ;------------------------------------------------------------------------------ |
1803 | ;? Activate window |
1807 | ;? Activate window |
1804 | ;------------------------------------------------------------------------------ |
1808 | ;------------------------------------------------------------------------------ |
1805 | ;> esi = pointer to WIN_POS+ window data |
1809 | ;> esi = pointer to WIN_POS+ window data |
1806 | ;------------------------------------------------------------------------------ |
1810 | ;------------------------------------------------------------------------------ |
1807 | push eax ebx |
1811 | push eax ebx |
1808 | 1812 | ||
1809 | ; if type of current active window is 3 or 4, it must be redrawn |
1813 | ; if type of current active window is 3 or 4, it must be redrawn |
1810 | mov ebx, [TASK_COUNT] |
1814 | mov ebx, [TASK_COUNT] |
1811 | movzx ebx, word[WIN_POS + ebx * 2] |
1815 | movzx ebx, word[WIN_POS + ebx * 2] |
1812 | shl ebx, 5 |
1816 | shl ebx, 5 |
1813 | add eax, window_data |
1817 | add eax, window_data |
1814 | mov al, [window_data + ebx + WDATA.fl_wstyle] |
1818 | mov al, [window_data + ebx + WDATA.fl_wstyle] |
1815 | and al, 0x0f |
1819 | and al, 0x0f |
1816 | cmp al, 0x03 |
1820 | cmp al, 0x03 |
1817 | je .set_window_redraw_flag |
1821 | je .set_window_redraw_flag |
1818 | cmp al, 0x04 |
1822 | cmp al, 0x04 |
1819 | jne .move_others_down |
1823 | jne .move_others_down |
1820 | 1824 | ||
1821 | .set_window_redraw_flag: |
1825 | .set_window_redraw_flag: |
1822 | mov [window_data + ebx + WDATA.fl_redraw], 1 |
1826 | mov [window_data + ebx + WDATA.fl_redraw], 1 |
1823 | 1827 | ||
1824 | .move_others_down: |
1828 | .move_others_down: |
1825 | ; ax <- process no |
1829 | ; ax <- process no |
1826 | movzx ebx, word[esi] |
1830 | movzx ebx, word[esi] |
1827 | ; ax <- position in window stack |
1831 | ; ax <- position in window stack |
1828 | movzx ebx, word[WIN_STACK + ebx * 2] |
1832 | movzx ebx, word[WIN_STACK + ebx * 2] |
1829 | 1833 | ||
1830 | ; drop others |
1834 | ; drop others |
1831 | xor eax, eax |
1835 | xor eax, eax |
1832 | 1836 | ||
1833 | .next_stack_window: |
1837 | .next_stack_window: |
1834 | cmp eax, [TASK_COUNT] |
1838 | cmp eax, [TASK_COUNT] |
1835 | jae .move_self_up |
1839 | jae .move_self_up |
1836 | inc eax |
1840 | inc eax |
1837 | cmp [WIN_STACK + eax * 2], bx |
1841 | cmp [WIN_STACK + eax * 2], bx |
1838 | jbe .next_stack_window |
1842 | jbe .next_stack_window |
1839 | dec word[WIN_STACK + eax * 2] |
1843 | dec word[WIN_STACK + eax * 2] |
1840 | jmp .next_stack_window |
1844 | jmp .next_stack_window |
1841 | 1845 | ||
1842 | .move_self_up: |
1846 | .move_self_up: |
1843 | movzx ebx, word[esi] |
1847 | movzx ebx, word[esi] |
1844 | ; number of processes |
1848 | ; number of processes |
1845 | mov ax, [TASK_COUNT] |
1849 | mov ax, [TASK_COUNT] |
1846 | ; this is the last (and the upper) |
1850 | ; this is the last (and the upper) |
1847 | mov [WIN_STACK + ebx * 2], ax |
1851 | mov [WIN_STACK + ebx * 2], ax |
1848 | 1852 | ||
1849 | ; update on screen - window stack |
1853 | ; update on screen - window stack |
1850 | xor eax, eax |
1854 | xor eax, eax |
1851 | 1855 | ||
1852 | .next_window_pos: |
1856 | .next_window_pos: |
1853 | cmp eax, [TASK_COUNT] |
1857 | cmp eax, [TASK_COUNT] |
1854 | jae .reset_vars |
1858 | jae .reset_vars |
1855 | inc eax |
1859 | inc eax |
1856 | movzx ebx, word[WIN_STACK + eax * 2] |
1860 | movzx ebx, word[WIN_STACK + eax * 2] |
1857 | mov [WIN_POS + ebx * 2], ax |
1861 | mov [WIN_POS + ebx * 2], ax |
1858 | jmp .next_window_pos |
1862 | jmp .next_window_pos |
1859 | 1863 | ||
1860 | .reset_vars: |
1864 | .reset_vars: |
1861 | mov byte[KEY_COUNT], 0 |
1865 | mov byte[KEY_COUNT], 0 |
1862 | mov byte[BTN_COUNT], 0 |
1866 | mov byte[BTN_COUNT], 0 |
1863 | mov word[MOUSE_SCROLL_H], 0 |
1867 | mov word[MOUSE_SCROLL_H], 0 |
1864 | mov word[MOUSE_SCROLL_V], 0 |
1868 | mov word[MOUSE_SCROLL_V], 0 |
1865 | 1869 | ||
1866 | pop ebx eax |
1870 | pop ebx eax |
1867 | ret |
1871 | ret |
1868 | 1872 | ||
1869 | align 4 |
1873 | align 4 |
1870 | ;------------------------------------------------------------------------------ |
1874 | ;------------------------------------------------------------------------------ |
1871 | window._.check_window_draw: ;////////////////////////////////////////////////// |
1875 | window._.check_window_draw: ;////////////////////////////////////////////////// |
1872 | ;------------------------------------------------------------------------------ |
1876 | ;------------------------------------------------------------------------------ |
1873 | ;? Check if window is necessary to draw |
1877 | ;? Check if window is necessary to draw |
1874 | ;------------------------------------------------------------------------------ |
1878 | ;------------------------------------------------------------------------------ |
1875 | ;> edi = pointer to WDATA |
1879 | ;> edi = pointer to WDATA |
1876 | ;------------------------------------------------------------------------------ |
1880 | ;------------------------------------------------------------------------------ |
1877 | mov cl, [edi + WDATA.fl_wstyle] |
1881 | mov cl, [edi + WDATA.fl_wstyle] |
1878 | and cl, 0x0f |
1882 | and cl, 0x0f |
1879 | cmp cl, 3 |
1883 | cmp cl, 3 |
1880 | je .exit.redraw ; window type 3 |
1884 | je .exit.redraw ; window type 3 |
1881 | cmp cl, 4 |
1885 | cmp cl, 4 |
1882 | je .exit.redraw ; window type 4 |
1886 | je .exit.redraw ; window type 4 |
1883 | 1887 | ||
1884 | push eax ebx edx esi |
1888 | push eax ebx edx esi |
1885 | 1889 | ||
1886 | mov eax, edi |
1890 | mov eax, edi |
1887 | sub eax, window_data |
1891 | sub eax, window_data |
1888 | shr eax, 5 |
1892 | shr eax, 5 |
1889 | 1893 | ||
1890 | movzx eax, word[WIN_STACK + eax * 2] ; get value of the curr process |
1894 | movzx eax, word[WIN_STACK + eax * 2] ; get value of the curr process |
1891 | lea esi, [WIN_POS + eax * 2] ; get address of this process at 0xC400 |
1895 | lea esi, [WIN_POS + eax * 2] ; get address of this process at 0xC400 |
1892 | 1896 | ||
1893 | .next_window: |
1897 | .next_window: |
1894 | add esi, 2 |
1898 | add esi, 2 |
1895 | 1899 | ||
1896 | mov eax, [TASK_COUNT] |
1900 | mov eax, [TASK_COUNT] |
1897 | lea eax, word[WIN_POS + eax * 2] ; number of the upper window |
1901 | lea eax, word[WIN_POS + eax * 2] ; number of the upper window |
1898 | 1902 | ||
1899 | cmp esi, eax |
1903 | cmp esi, eax |
1900 | ja .exit.no_redraw |
1904 | ja .exit.no_redraw |
1901 | 1905 | ||
1902 | movzx edx, word[esi] |
1906 | movzx edx, word[esi] |
1903 | shl edx, 5 |
1907 | shl edx, 5 |
1904 | cmp [CURRENT_TASK + edx + TASKDATA.state], TSTATE_FREE |
1908 | cmp [CURRENT_TASK + edx + TASKDATA.state], TSTATE_FREE |
1905 | je .next_window |
1909 | je .next_window |
1906 | 1910 | ||
1907 | mov eax, [edi + WDATA.box.top] |
1911 | mov eax, [edi + WDATA.box.top] |
1908 | mov ebx, [edi + WDATA.box.height] |
1912 | mov ebx, [edi + WDATA.box.height] |
1909 | add ebx, eax |
1913 | add ebx, eax |
1910 | 1914 | ||
1911 | mov ecx, [window_data + edx + WDATA.box.top] |
1915 | mov ecx, [window_data + edx + WDATA.box.top] |
1912 | cmp ecx, ebx |
1916 | cmp ecx, ebx |
1913 | jge .next_window |
1917 | jge .next_window |
1914 | add ecx, [window_data + edx + WDATA.box.height] |
1918 | add ecx, [window_data + edx + WDATA.box.height] |
1915 | cmp eax, ecx |
1919 | cmp eax, ecx |
1916 | jge .next_window |
1920 | jge .next_window |
1917 | 1921 | ||
1918 | mov eax, [edi + WDATA.box.left] |
1922 | mov eax, [edi + WDATA.box.left] |
1919 | mov ebx, [edi + WDATA.box.width] |
1923 | mov ebx, [edi + WDATA.box.width] |
1920 | add ebx, eax |
1924 | add ebx, eax |
1921 | 1925 | ||
1922 | mov ecx, [window_data + edx + WDATA.box.left] |
1926 | mov ecx, [window_data + edx + WDATA.box.left] |
1923 | cmp ecx, ebx |
1927 | cmp ecx, ebx |
1924 | jge .next_window |
1928 | jge .next_window |
1925 | add ecx, [window_data + edx + WDATA.box.width] |
1929 | add ecx, [window_data + edx + WDATA.box.width] |
1926 | cmp eax, ecx |
1930 | cmp eax, ecx |
1927 | jge .next_window |
1931 | jge .next_window |
1928 | 1932 | ||
1929 | pop esi edx ebx eax |
1933 | pop esi edx ebx eax |
1930 | 1934 | ||
1931 | .exit.redraw: |
1935 | .exit.redraw: |
1932 | xor ecx, ecx |
1936 | xor ecx, ecx |
1933 | inc ecx |
1937 | inc ecx |
1934 | ret |
1938 | ret |
1935 | 1939 | ||
1936 | .exit.no_redraw: |
1940 | .exit.no_redraw: |
1937 | pop esi edx ebx eax |
1941 | pop esi edx ebx eax |
1938 | xor ecx, ecx |
1942 | xor ecx, ecx |
1939 | ret |
1943 | ret |
1940 | 1944 | ||
1941 | align 4 |
1945 | align 4 |
1942 | ;------------------------------------------------------------------------------ |
1946 | ;------------------------------------------------------------------------------ |
1943 | window._.draw_window_caption: ;//////////////////////////////////////////////// |
1947 | window._.draw_window_caption: ;//////////////////////////////////////////////// |
1944 | ;------------------------------------------------------------------------------ |
1948 | ;------------------------------------------------------------------------------ |
1945 | ;? |
1949 | ;? |
1946 | ;------------------------------------------------------------------------------ |
1950 | ;------------------------------------------------------------------------------ |
1947 | inc [mouse_pause] |
1951 | inc [mouse_pause] |
1948 | call [_display.disable_mouse] |
1952 | call [_display.disable_mouse] |
1949 | 1953 | ||
1950 | xor eax, eax |
1954 | xor eax, eax |
1951 | mov edx, [TASK_COUNT] |
1955 | mov edx, [TASK_COUNT] |
1952 | movzx edx, word[WIN_POS + edx * 2] |
1956 | movzx edx, word[WIN_POS + edx * 2] |
1953 | cmp edx, [CURRENT_TASK] |
1957 | cmp edx, [CURRENT_TASK] |
1954 | jne @f |
1958 | jne @f |
1955 | inc eax |
1959 | inc eax |
1956 | @@: mov edx, [CURRENT_TASK] |
1960 | @@: mov edx, [CURRENT_TASK] |
1957 | shl edx, 5 |
1961 | shl edx, 5 |
1958 | add edx, window_data |
1962 | add edx, window_data |
1959 | movzx ebx, [edx + WDATA.fl_wstyle] |
1963 | movzx ebx, [edx + WDATA.fl_wstyle] |
1960 | and bl, 0x0F |
1964 | and bl, 0x0F |
1961 | cmp bl, 3 |
1965 | cmp bl, 3 |
1962 | je .draw_caption_style_3 |
1966 | je .draw_caption_style_3 |
1963 | cmp bl, 4 |
1967 | cmp bl, 4 |
1964 | je .draw_caption_style_3 |
1968 | je .draw_caption_style_3 |
1965 | 1969 | ||
1966 | jmp .not_style_3 |
1970 | jmp .not_style_3 |
1967 | 1971 | ||
1968 | .draw_caption_style_3: |
1972 | .draw_caption_style_3: |
1969 | push edx |
1973 | push edx |
1970 | call drawwindow_IV_caption |
1974 | call drawwindow_IV_caption |
1971 | add esp, 4 |
1975 | add esp, 4 |
1972 | jmp .2 |
1976 | jmp .2 |
1973 | 1977 | ||
1974 | .not_style_3: |
1978 | .not_style_3: |
1975 | cmp bl, 2 |
1979 | cmp bl, 2 |
1976 | jne .not_style_2 |
1980 | jne .not_style_2 |
1977 | 1981 | ||
1978 | call drawwindow_III_caption |
1982 | call drawwindow_III_caption |
1979 | jmp .2 |
1983 | jmp .2 |
1980 | 1984 | ||
1981 | .not_style_2: |
1985 | .not_style_2: |
1982 | cmp bl, 0 |
1986 | cmp bl, 0 |
1983 | jne .2 |
1987 | jne .2 |
1984 | 1988 | ||
1985 | call drawwindow_I_caption |
1989 | call drawwindow_I_caption |
1986 | 1990 | ||
1987 | .2: mov edi, [CURRENT_TASK] |
1991 | .2: mov edi, [CURRENT_TASK] |
1988 | shl edi, 5 |
1992 | shl edi, 5 |
1989 | test [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION |
1993 | test [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION |
1990 | jz .exit |
1994 | jz .exit |
1991 | mov edx, [edi * 8 + SLOT_BASE + APPDATA.wnd_caption] |
1995 | mov edx, [edi * 8 + SLOT_BASE + APPDATA.wnd_caption] |
1992 | or edx, edx |
1996 | or edx, edx |
1993 | jz .exit |
1997 | jz .exit |
1994 | 1998 | ||
1995 | movzx eax, [edi + window_data + WDATA.fl_wstyle] |
1999 | movzx eax, [edi + window_data + WDATA.fl_wstyle] |
1996 | and al, 0x0F |
2000 | and al, 0x0F |
1997 | cmp al, 3 |
2001 | cmp al, 3 |
1998 | je .skinned |
2002 | je .skinned |
1999 | cmp al, 4 |
2003 | cmp al, 4 |
2000 | je .skinned |
2004 | je .skinned |
2001 | 2005 | ||
2002 | jmp .not_skinned |
2006 | jmp .not_skinned |
2003 | 2007 | ||
2004 | .skinned: |
2008 | .skinned: |
2005 | mov ebp, [edi + window_data + WDATA.box.left - 2] |
2009 | mov ebp, [edi + window_data + WDATA.box.left - 2] |
2006 | mov bp, word[edi + window_data + WDATA.box.top] |
2010 | mov bp, word[edi + window_data + WDATA.box.top] |
2007 | movzx eax, word[edi + window_data + WDATA.box.width] |
2011 | movzx eax, word[edi + window_data + WDATA.box.width] |
2008 | sub ax, [_skinmargins.left] |
2012 | sub ax, [_skinmargins.left] |
2009 | sub ax, [_skinmargins.right] |
2013 | sub ax, [_skinmargins.right] |
2010 | push edx |
2014 | push edx |
2011 | cwde |
2015 | cwde |
2012 | cdq |
2016 | cdq |
2013 | mov ebx, 6 |
2017 | mov ebx, 6 |
2014 | idiv ebx |
2018 | idiv ebx |
2015 | pop edx |
2019 | pop edx |
2016 | or eax, eax |
2020 | or eax, eax |
2017 | js .exit |
2021 | js .exit |
2018 | 2022 | ||
2019 | mov esi, eax |
2023 | mov esi, eax |
2020 | mov ebx, dword[_skinmargins.left - 2] |
2024 | mov ebx, dword[_skinmargins.left - 2] |
2021 | mov bx, word[_skinh] |
2025 | mov bx, word[_skinh] |
2022 | sub bx, [_skinmargins.bottom] |
2026 | sub bx, [_skinmargins.bottom] |
2023 | sub bx, [_skinmargins.top] |
2027 | sub bx, [_skinmargins.top] |
2024 | sar bx, 1 |
2028 | sar bx, 1 |
2025 | adc bx, 0 |
2029 | adc bx, 0 |
2026 | add bx, [_skinmargins.top] |
2030 | add bx, [_skinmargins.top] |
2027 | add bx, -3 |
2031 | add bx, -3 |
2028 | add ebx, ebp |
2032 | add ebx, ebp |
2029 | jmp .dodraw |
2033 | jmp .dodraw |
2030 | 2034 | ||
2031 | .not_skinned: |
2035 | .not_skinned: |
2032 | cmp al, 1 |
2036 | cmp al, 1 |
2033 | je .exit |
2037 | je .exit |
2034 | 2038 | ||
2035 | mov ebp, [edi + window_data + WDATA.box.left - 2] |
2039 | mov ebp, [edi + window_data + WDATA.box.left - 2] |
2036 | mov bp, word[edi + window_data + WDATA.box.top] |
2040 | mov bp, word[edi + window_data + WDATA.box.top] |
2037 | movzx eax, word[edi + window_data + WDATA.box.width] |
2041 | movzx eax, word[edi + window_data + WDATA.box.width] |
2038 | sub eax, 16 |
2042 | sub eax, 16 |
2039 | push edx |
2043 | push edx |
2040 | cwde |
2044 | cwde |
2041 | cdq |
2045 | cdq |
2042 | mov ebx, 6 |
2046 | mov ebx, 6 |
2043 | idiv ebx |
2047 | idiv ebx |
2044 | pop edx |
2048 | pop edx |
2045 | or eax, eax |
2049 | or eax, eax |
2046 | js .exit |
2050 | js .exit |
2047 | 2051 | ||
2048 | mov esi, eax |
2052 | mov esi, eax |
2049 | mov ebx, 0x00080007 |
2053 | mov ebx, 0x00080007 |
2050 | add ebx, ebp |
2054 | add ebx, ebp |
2051 | 2055 | ||
2052 | .dodraw: |
2056 | .dodraw: |
2053 | mov ecx, [common_colours + 16] |
2057 | mov ecx, [common_colours + 16] |
2054 | or ecx, 0x80000000 |
2058 | or ecx, 0x80000000 |
2055 | xor edi, edi |
2059 | xor edi, edi |
2056 | call dtext_asciiz_esi |
2060 | call dtext_asciiz_esi |
2057 | 2061 | ||
2058 | .exit: |
2062 | .exit: |
2059 | dec [mouse_pause] |
2063 | dec [mouse_pause] |
2060 | call [draw_pointer] |
2064 | call [draw_pointer] |
2061 | ret |
2065 | ret |
2062 | 2066 | ||
2063 | align 4 |
2067 | align 4 |
2064 | ;------------------------------------------------------------------------------ |
2068 | ;------------------------------------------------------------------------------ |
2065 | window._.draw_negative_box: ;////////////////////////////////////////////////// |
2069 | window._.draw_negative_box: ;////////////////////////////////////////////////// |
2066 | ;------------------------------------------------------------------------------ |
2070 | ;------------------------------------------------------------------------------ |
2067 | ;? Draw negative box |
2071 | ;? Draw negative box |
2068 | ;------------------------------------------------------------------------------ |
2072 | ;------------------------------------------------------------------------------ |
2069 | ;> edi = pointer to BOX struct |
2073 | ;> edi = pointer to BOX struct |
2070 | ;------------------------------------------------------------------------------ |
2074 | ;------------------------------------------------------------------------------ |
2071 | push eax ebx esi |
2075 | push eax ebx esi |
2072 | mov eax, [edi + BOX.left - 2] |
2076 | mov eax, [edi + BOX.left - 2] |
2073 | mov ax, word[edi + BOX.left] |
2077 | mov ax, word[edi + BOX.left] |
2074 | add ax, word[edi + BOX.width] |
2078 | add ax, word[edi + BOX.width] |
2075 | mov ebx, [edi + BOX.top - 2] |
2079 | mov ebx, [edi + BOX.top - 2] |
2076 | mov bx, word[edi + BOX.top] |
2080 | mov bx, word[edi + BOX.top] |
2077 | add bx, word[edi + BOX.height] |
2081 | add bx, word[edi + BOX.height] |
2078 | mov esi, 0x01000000 |
2082 | mov esi, 0x01000000 |
2079 | call draw_rectangle.forced |
2083 | call draw_rectangle.forced |
2080 | pop esi ebx eax |
2084 | pop esi ebx eax |
2081 | ret->->=>=>>>>>>>>>>>>>>>>>>> |
2085 | ret->->=>=>>>>>>>>>>>>>>>>>>> |