Rev 5926 | Rev 6802 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5926 | Rev 6800 | ||
---|---|---|---|
Line 4... | Line 4... | ||
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 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 8... | Line 8... | ||
8 | 8 | ||
Line 9... | Line 9... | ||
9 | $Revision: 5926 $ |
9 | $Revision: 6800 $ |
10 | 10 | ||
11 | ;============================================================================== |
11 | ;============================================================================== |
Line 12... | Line 12... | ||
12 | ;///// public functions /////////////////////////////////////////////////////// |
12 | ;///// public functions /////////////////////////////////////////////////////// |
Line 13... | Line -... | ||
13 | ;============================================================================== |
- | |
14 | - | ||
15 | window.BORDER_SIZE = 5 |
- | |
16 | - | ||
17 | macro FuncTable name, table_name, [label] |
- | |
18 | { |
- | |
19 | common |
- | |
20 | align 4 |
- | |
21 | \label name#.#table_name dword |
- | |
22 | forward |
- | |
23 | dd name#.#label |
- | |
24 | common |
13 | ;============================================================================== |
25 | name#.sizeof.#table_name = $ - name#.#table_name |
14 | |
26 | } |
15 | window.BORDER_SIZE = 5 |
27 | 16 | ||
Line 80... | Line 69... | ||
80 | .exit: |
69 | .exit: |
81 | ret |
70 | ret |
82 | ;------------------------------------------------------------------------------ |
71 | ;------------------------------------------------------------------------------ |
83 | syscall_display_settings: ;///// system function 48 /////////////////////////// |
72 | syscall_display_settings: ;///// system function 48 /////////////////////////// |
84 | ;------------------------------------------------------------------------------ |
73 | ;------------------------------------------------------------------------------ |
85 | ;; Redraw screen: |
- | |
86 | ;< ebx = 0 |
- | |
87 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
- | |
88 | ;; Set button style: |
- | |
89 | ;< ebx = 1 |
- | |
90 | ;< ecx = 0 (flat) or 1 (with gradient) |
- | |
91 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
- | |
92 | ;; Set system color palette: |
- | |
93 | ;< ebx = 2 |
- | |
94 | ;< ecx = pointer to color table |
- | |
95 | ;< edx = size of color table |
- | |
96 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
- | |
97 | ;; Get system color palette: |
- | |
98 | ;< ebx = 3 |
- | |
99 | ;< ecx = pointer to color table buffer |
- | |
100 | ;< edx = size of color table buffer |
- | |
101 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
- | |
102 | ;; Get skinned caption height: |
- | |
103 | ;< ebx = 4 |
- | |
104 | ;> eax = height in pixels |
- | |
105 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
- | |
106 | ;; Get screen working area: |
- | |
107 | ;< ebx = 5 |
- | |
108 | ;> eax = pack[16(left), 16(right)] |
- | |
109 | ;> ebx = pack[16(top), 16(bottom)] |
- | |
110 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
- | |
111 | ;; Set screen working area: |
- | |
112 | ;< ebx = 6 |
- | |
113 | ;< ecx = pack[16(left), 16(right)] |
- | |
114 | ;< edx = pack[16(top), 16(bottom)] |
- | |
115 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
- | |
116 | ;; Get skin margins: |
- | |
117 | ;< ebx = 7 |
- | |
118 | ;> eax = pack[16(left), 16(right)] |
- | |
119 | ;> ebx = pack[16(top), 16(bottom)] |
- | |
120 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
- | |
121 | ;; Set skin: |
- | |
122 | ;< ebx = 8 |
- | |
123 | ;< ecx = pointer to FileInfoBlock struct |
- | |
124 | ;> eax = FS error code |
- | |
125 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
- | |
126 | ;; Get font smoothing: |
- | |
127 | ;< ebx = 9 |
- | |
128 | ;> eax = 0 — off, 1 — on, 2 — subpixel |
- | |
129 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
- | |
130 | ;; Set font smoothing: |
- | |
131 | ;< ebx = 10 |
- | |
132 | ;< ecx = 0 — off, 1 — on, 2 — subpixel |
- | |
133 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
- | |
134 | ;; Get font size: |
- | |
135 | ;< ebx = 11 |
- | |
136 | ;> eax = height in pixels |
- | |
137 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
- | |
138 | ;; Set font size: |
- | |
139 | ;< ebx = 12 |
- | |
140 | ;< ecx = height in pixels |
- | |
141 | ;------------------------------------------------------------------------------ |
- | |
142 | cmp ebx, .sizeof.ftable / 4 |
74 | cmp ebx, 13 |
143 | ja @f |
75 | ja @f |
144 | jmp [.ftable + ebx * 4] |
76 | jmp dword[.ftable + ebx*4] |
- | 77 | ||
- | 78 | align 4 |
|
- | 79 | .ftable: |
|
- | 80 | dd .redrawWholeScreen |
|
- | 81 | dd .setButtonStyle |
|
- | 82 | dd .setSystemColors |
|
- | 83 | dd .getSystemColors |
|
- | 84 | dd .getCaptionHeight |
|
145 | ;------------------------------------------------------------------------------ |
85 | dd .getScreenWorkingArea |
146 | syscall_display_settings.00: |
86 | dd .setScreenWorkingArea |
- | 87 | dd .getSkinMargins |
|
- | 88 | dd .setSkin |
|
- | 89 | dd .getFontSmoothing |
|
- | 90 | dd .setFontSmoothing |
|
- | 91 | dd .getFontSize |
|
- | 92 | dd .setFontSize |
|
- | 93 | dd .setSkinUnicode |
|
- | 94 | ||
- | 95 | .redrawWholeScreen: |
|
147 | xor eax, eax |
96 | xor eax, eax |
148 | inc ebx |
97 | inc ebx |
149 | cmp [windowtypechanged], ebx |
98 | cmp [windowtypechanged], ebx |
150 | jne @f |
99 | jne .ret |
151 | mov [windowtypechanged], eax |
100 | mov [windowtypechanged], eax |
- | 101 | .redrawScreen: |
|
- | 102 | xor eax, eax |
|
- | 103 | mov [draw_limits.left], eax |
|
- | 104 | mov [draw_limits.top], eax |
|
- | 105 | mov eax, [_display.width] |
|
- | 106 | dec eax |
|
- | 107 | mov [draw_limits.right], eax |
|
152 | jmp syscall_display_settings._.redraw_whole_screen |
108 | mov eax, [_display.height] |
- | 109 | dec eax |
|
153 | ;------------------------------------------------------------------------------ |
110 | mov [draw_limits.bottom], eax |
- | 111 | mov eax, window_data |
|
154 | syscall_display_settings.01: |
112 | jmp redrawscreen |
- | 113 | ||
- | 114 | .setButtonStyle: |
|
- | 115 | ; in: ecx: 0 = flat, 1 = with gradient |
|
155 | and ecx, 1 |
116 | and ecx, 1 |
156 | cmp ecx, [buttontype] |
117 | cmp ecx, [buttontype] |
157 | je @f |
118 | je .ret |
158 | mov [buttontype], ecx |
119 | mov [buttontype], ecx |
159 | mov [windowtypechanged], ebx |
120 | mov [windowtypechanged], ebx |
160 | @@: |
121 | .ret: |
161 | ret |
122 | ret |
162 | ;------------------------------------------------------------------------------ |
- | |
- | 123 | ||
163 | syscall_display_settings.02: |
124 | .setSystemColors: |
- | 125 | ; in: ecx = pointer to color table, edx = size of color table |
|
164 | dec ebx |
126 | dec ebx |
165 | mov esi, ecx |
127 | mov esi, ecx |
166 | cmp edx, 192 |
128 | cmp edx, 192 |
167 | jnae @f |
129 | jnae @f |
168 | mov edx, 192 ; max size |
130 | mov edx, 192 ; max size |
Line 170... | Line 132... | ||
170 | mov edi, common_colours |
132 | mov edi, common_colours |
171 | mov ecx, edx |
133 | mov ecx, edx |
172 | rep movsb |
134 | rep movsb |
173 | mov [windowtypechanged], ebx |
135 | mov [windowtypechanged], ebx |
174 | ret |
136 | ret |
175 | ;------------------------------------------------------------------------------ |
- | |
- | 137 | ||
176 | syscall_display_settings.03: |
138 | .getSystemColors: |
- | 139 | ; in: ecx = pointer to color table, edx = size of color table |
|
177 | mov edi, ecx |
140 | mov edi, ecx |
178 | cmp edx, 192 |
141 | cmp edx, 192 |
179 | jnae @f |
142 | jnae @f |
180 | mov edx, 192 ; max size |
143 | mov edx, 192 ; max size |
181 | @@: |
144 | @@: |
182 | mov esi, common_colours |
145 | mov esi, common_colours |
183 | mov ecx, edx |
146 | mov ecx, edx |
184 | rep movsb |
147 | rep movsb |
185 | ret |
148 | ret |
186 | ;------------------------------------------------------------------------------ |
- | |
- | 149 | ||
187 | syscall_display_settings.04: |
150 | .getCaptionHeight: |
188 | mov eax, [_skinh] |
151 | mov eax, [_skinh] |
189 | mov [esp + 32], eax |
152 | mov [esp + 32], eax |
190 | ret |
153 | ret |
191 | ;------------------------------------------------------------------------------ |
- | |
- | 154 | ||
192 | syscall_display_settings.05: |
155 | .getScreenWorkingArea: |
- | 156 | ; out: eax = pack[left, right], ebx = pack[top, bottom] |
|
193 | mov eax, [screen_workarea.left - 2] |
157 | mov eax, [screen_workarea.left - 2] |
194 | mov ax, word[screen_workarea.right] |
158 | mov ax, word[screen_workarea.right] |
195 | mov [esp + 32], eax |
159 | mov [esp + 32], eax |
196 | mov eax, [screen_workarea.top - 2] |
160 | mov eax, [screen_workarea.top - 2] |
197 | mov ax, word[screen_workarea.bottom] |
161 | mov ax, word[screen_workarea.bottom] |
198 | mov [esp + 20], eax |
162 | mov [esp + 20], eax |
199 | ret |
163 | ret |
200 | ;------------------------------------------------------------------------------ |
- | |
- | 164 | ||
201 | syscall_display_settings.06: |
165 | .setScreenWorkingArea: |
- | 166 | ; in: ecx = pack[left, right], edx = pack[top, bottom] |
|
202 | xor esi, esi |
167 | xor esi, esi |
203 | mov edi, [_display.width] |
168 | mov edi, [_display.width] |
204 | dec edi |
169 | dec edi |
205 | mov eax, ecx |
170 | mov eax, ecx |
206 | movsx ebx, ax |
171 | movsx ebx, ax |
Line 238... | Line 203... | ||
238 | @@: |
203 | @@: |
239 | mov [screen_workarea.bottom], ebx |
204 | mov [screen_workarea.bottom], ebx |
240 | .check_if_redraw_needed: |
205 | .check_if_redraw_needed: |
241 | or esi, esi |
206 | or esi, esi |
242 | jz @f |
207 | jz @f |
243 | - | ||
244 | call repos_windows |
208 | call repos_windows |
- | 209 | .calculateScreen: |
|
- | 210 | xor eax, eax |
|
- | 211 | xor ebx, ebx |
|
245 | jmp syscall_display_settings._.calculate_whole_screen |
212 | mov ecx, [_display.width] |
246 | ;------------------------------------------------------------------------------ |
213 | mov edx, [_display.height] |
- | 214 | dec ecx |
|
- | 215 | dec edx |
|
- | 216 | jmp calculatescreen |
|
- | 217 | ||
247 | syscall_display_settings.07: |
218 | .getSkinMargins: |
- | 219 | ; out: eax = pack[left, right], ebx = pack[top, bottom] |
|
248 | mov eax, [_skinmargins + 0] |
220 | mov eax, [_skinmargins + 0] |
249 | mov [esp + 32], eax |
221 | mov [esp + 32], eax |
250 | mov eax, [_skinmargins + 4] |
222 | mov eax, [_skinmargins + 4] |
251 | mov [esp + 20], eax |
223 | mov [esp + 20], eax |
252 | @@: |
- | |
253 | ret |
224 | ret |
254 | ;------------------------------------------------------------------------------ |
- | |
- | 225 | ||
- | 226 | .setSkin: |
|
255 | syscall_display_settings.08: |
227 | ; in: ecx -> file path string |
256 | mov ebx, ecx |
228 | mov ebx, ecx |
257 | call read_skin_file |
229 | call read_skin_file |
258 | mov [esp + 32], eax |
230 | mov [esp + 32], eax |
259 | test eax, eax |
231 | test eax, eax |
260 | jnz @b |
232 | jnz .ret |
- | 233 | call .calculateScreen |
|
- | 234 | jmp .redrawScreen |
|
Line 261... | Line -... | ||
261 | - | ||
262 | call syscall_display_settings._.calculate_whole_screen |
- | |
263 | jmp syscall_display_settings._.redraw_whole_screen |
- | |
264 | ;------------------------------------------------------------------------------ |
235 | |
265 | syscall_display_settings.09: |
236 | .getFontSmoothing: |
266 | xor eax, eax |
237 | xor eax, eax |
267 | mov al, [fontSmoothing] |
238 | mov al, [fontSmoothing] |
268 | mov [esp + 32], eax |
239 | mov [esp + 32], eax |
269 | ret |
- | |
- | 240 | ret |
|
270 | ;------------------------------------------------------------------------------ |
241 | |
271 | syscall_display_settings.10: |
242 | .setFontSmoothing: |
272 | mov [fontSmoothing], cl |
243 | mov [fontSmoothing], cl |
273 | ret |
- | |
- | 244 | ret |
|
274 | ;------------------------------------------------------------------------------ |
245 | |
275 | syscall_display_settings.11: |
246 | .getFontSize: |
276 | xor eax, eax |
247 | xor eax, eax |
277 | mov al, [fontSize] |
248 | mov al, [fontSize] |
278 | mov [esp + 32], eax |
249 | mov [esp + 32], eax |
279 | ret |
- | |
- | 250 | ret |
|
280 | ;------------------------------------------------------------------------------ |
251 | |
281 | syscall_display_settings.12: |
252 | .setFontSize: |
282 | mov [fontSize], cl |
253 | mov [fontSize], cl |
283 | ret |
- | |
- | 254 | ret |
|
284 | ;------------------------------------------------------------------------------ |
255 | |
285 | syscall_display_settings._.calculate_whole_screen: |
256 | .setSkinUnicode: |
286 | xor eax, eax |
257 | ; in: ecx -> file path string, edx = string encoding |
287 | xor ebx, ebx |
258 | push ecx edx |
288 | mov ecx, [_display.width] |
259 | stdcall kernel_alloc, maxPathLength |
289 | mov edx, [_display.height] |
260 | mov edi, eax |
290 | dec ecx |
261 | pop eax esi |
291 | dec edx |
262 | push edi |
292 | jmp calculatescreen |
- | |
293 | ;------------------------------------------------------------------------------ |
- | |
294 | syscall_display_settings._.redraw_whole_screen: |
263 | call getFullPath |
295 | xor eax, eax |
- | |
296 | mov [draw_limits.left], eax |
264 | test eax, eax |
297 | mov [draw_limits.top], eax |
265 | jz @f |
298 | mov eax, [_display.width] |
266 | mov ebx, [esp] |
299 | dec eax |
267 | call read_skin_file |
300 | mov [draw_limits.right], eax |
- | |
- | 268 | mov [esp + 32 + 4], eax |
|
301 | mov eax, [_display.height] |
269 | @@: |
302 | dec eax |
- | |
303 | mov [draw_limits.bottom], eax |
270 | call kernel_free |
304 | mov eax, window_data |
271 | call .calculateScreen |
- | 272 | jmp .redrawScreen |
|
305 | jmp redrawscreen |
273 | |
306 | ;------------------------------------------------------------------------------ |
274 | ;------------------------------------------------------------------------------ |
307 | syscall_set_window_shape: ;///// system function 50 /////////////////////////// |
275 | syscall_set_window_shape: ;///// system function 50 /////////////////////////// |
308 | ;------------------------------------------------------------------------------ |
276 | ;------------------------------------------------------------------------------ |
309 | ;; Set window shape address: |
277 | ;; Set window shape address: |
Line 615... | Line 583... | ||
615 | sub eax, [screen_workarea.bottom] |
583 | sub eax, [screen_workarea.bottom] |
616 | neg eax |
584 | neg eax |
617 | mov [edi + WDATA.box.height], eax |
585 | mov [edi + WDATA.box.height], eax |
618 | jmp .fix_client_box |
586 | jmp .fix_client_box |
619 | ;------------------------------------------------------------------------------ |
587 | ;------------------------------------------------------------------------------ |
620 | ;align 4 |
- | |
621 | ;------------------------------------------------------------------------------ |
- | |
622 | ;sys_window_mouse: ;//////////////////////////////////////////////////////////// |
- | |
623 | ;------------------------------------------------------------------------------ |
- | |
624 | ;? |
- | |
625 | ;------------------------------------------------------------------------------ |
- | |
626 | ; NOTE: commented out since doesn't provide necessary functionality |
- | |
627 | ; anyway, to be reworked |
- | |
628 | ; push eax |
- | |
629 | ; |
- | |
630 | ; mov eax, [timer_ticks] |
- | |
631 | ; cmp [new_window_starting], eax |
- | |
632 | ; jb .exit |
- | |
633 | ; |
- | |
634 | ; mov byte[MOUSE_BACKGROUND], 0 |
- | |
635 | ; mov byte[DONT_DRAW_MOUSE], 0 |
- | |
636 | ; |
- | |
637 | ; mov [new_window_starting], eax |
- | |
638 | ; |
- | |
639 | ; .exit: |
- | |
640 | ; pop eax |
- | |
641 | ; ret |
- | |
642 | ;------------------------------------------------------------------------------ |
- | |
643 | align 4 |
588 | align 4 |
644 | ;------------------------------------------------------------------------------ |
589 | ;------------------------------------------------------------------------------ |
645 | draw_rectangle: ;////////////////////////////////////////////////////////////// |
590 | draw_rectangle: ;////////////////////////////////////////////////////////////// |
646 | ;------------------------------------------------------------------------------ |
591 | ;------------------------------------------------------------------------------ |
647 | ;> eax = pack[16(left), 16(right)] |
592 | ;> eax = pack[16(left), 16(right)] |
Line 1044... | Line 989... | ||
1044 | ; If nothing has changed |
989 | ; If nothing has changed |
1045 | test edx, edx |
990 | test edx, edx |
1046 | jz @f |
991 | jz @f |
Line 1047... | Line 992... | ||
1047 | 992 | ||
1048 | push edx |
993 | push edx |
1049 | call syscall_display_settings._.calculate_whole_screen |
994 | call syscall_display_settings.calculateScreen |
1050 | call syscall_display_settings._.redraw_whole_screen |
995 | call syscall_display_settings.redrawScreen |
1051 | pop edx |
996 | pop edx |
1052 | ;-------------------------------------- |
997 | ;-------------------------------------- |
1053 | align 4 |
998 | align 4 |
1054 | @@: |
999 | @@: |
Line 1379... | Line 1324... | ||
1379 | ;============================================================================== |
1324 | ;============================================================================== |
1380 | ;///// private functions ////////////////////////////////////////////////////// |
1325 | ;///// private functions ////////////////////////////////////////////////////// |
1381 | ;============================================================================== |
1326 | ;============================================================================== |
Line 1382... | Line 1327... | ||
1382 | 1327 | ||
1383 | iglobal |
- | |
1384 | FuncTable syscall_display_settings, ftable, \ |
- | |
1385 | 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12 |
- | |
1386 | 1328 | iglobal |
|
1387 | align 4 |
1329 | align 4 |
1388 | window_topleft dd \ |
1330 | window_topleft dd \ |
1389 | 1, 21, \ ;type 0 |
1331 | 1, 21, \ ;type 0 |
1390 | 0, 0, \ ;type 1 |
1332 | 0, 0, \ ;type 1 |
1391 | 5, 20, \ ;type 2 |
1333 | 5, 20, \ ;type 2 |
1392 | 5, ?, \ ;type 3 {set by skin} |
1334 | 5, ?, \ ;type 3 {set by skin} |
1393 | 5, ? ;type 4 {set by skin} |
1335 | 5, ? ;type 4 {set by skin} |
Line 1394... | Line -... | ||
1394 | endg |
- | |
1395 | - | ||
1396 | ;uglobal |
- | |
1397 | ; NOTE: commented out since doesn't provide necessary functionality anyway, |
- | |
1398 | ; to be reworked |
- | |
1399 | ; new_window_starting dd ? |
1336 | endg |
1400 | ;endg |
1337 | |
1401 | ;------------------------------------------------------------------------------ |
1338 | ;------------------------------------------------------------------------------ |
1402 | align 4 |
1339 | align 4 |
1403 | ;------------------------------------------------------------------------------ |
1340 | ;------------------------------------------------------------------------------ |