Rev 3545 | Rev 4060 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3981 | hidnplayr | 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
||
3 | ;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;; |
||
4 | ;; Distributed under terms of the GNU General Public License ;; |
||
5 | ;; ;; |
||
6 | ;; ;; |
||
7 | ;; GNU GENERAL PUBLIC LICENSE ;; |
||
8 | ;; Version 2, June 1991 ;; |
||
9 | ;; ;; |
||
10 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
11 | |||
12 | |||
3545 | hidnplayr | 13 | draw_window: |
14 | |||
15 | pusha |
||
16 | |||
17 | mcall 9, thread_info, -1 ; get current window size |
||
18 | mov eax, dword[thread_info+42] ; window xsize |
||
19 | mov ebx, dword[thread_info+46] ; ysize |
||
20 | mov edx, dword[thread_info+62] ; work area xsize |
||
21 | mov esi, dword[thread_info+66] ; ysize |
||
22 | sub eax, edx |
||
23 | sub ebx, esi |
||
24 | |||
25 | cmp edx, WIN_MIN_X |
||
26 | jae .x_ok |
||
27 | mov edx, WIN_MIN_X |
||
28 | .x_ok: |
||
29 | mov [xsize], edx |
||
30 | add edx, eax |
||
31 | |||
32 | cmp esi, WIN_MIN_Y |
||
33 | jae .y_ok |
||
34 | mov esi, WIN_MIN_Y |
||
35 | .y_ok: |
||
36 | mov [ysize], esi |
||
37 | add esi, ebx |
||
38 | mcall 67, -1, -1 ; set the new sizes |
||
39 | |||
40 | mcall 12, 1 |
||
41 | xor eax, eax ; draw window |
||
42 | mov ebx, WIN_MIN_X |
||
43 | mov ecx, WIN_MIN_Y |
||
44 | mov edx, [colors.work] |
||
45 | add edx, 0x33000000 |
||
46 | mov edi, str_programname |
||
47 | mcall |
||
48 | mcall 12, 2 ;; when do we actually need this?? |
||
49 | |||
50 | mov ebx, [xsize] |
||
51 | mov ecx, [ysize] |
||
52 | sub cx, 15 ;;;; |
||
53 | push cx |
||
54 | shl ecx, 16 |
||
55 | pop cx |
||
56 | mov edx, [colors.work_graph] |
||
57 | mcall 38 ; draw line |
||
58 | |||
59 | mov ecx, TOP_Y SHL 16 + TOP_Y |
||
60 | mcall |
||
61 | |||
3981 | hidnplayr | 62 | mov edi, [window_active] |
3545 | hidnplayr | 63 | cmp [edi + window.type], WINDOWTYPE_CHANNEL |
64 | jne .not_channel |
||
65 | |||
66 | ; draw a vertical separator line |
||
67 | mov ebx, [xsize] |
||
68 | sub ebx, USERLIST_X + SCROLLBAR_WIDTH + 3 |
||
69 | push bx |
||
70 | shl ebx, 16 |
||
71 | pop bx |
||
72 | mov ecx, [ysize] |
||
73 | add ecx, TOP_Y SHL 16 -(15) ;;;; |
||
74 | mcall |
||
75 | |||
76 | call redraw_channel_list |
||
77 | |||
78 | .not_channel: |
||
79 | mov edx, [edi + window.data_ptr] |
||
80 | add edx, window_data.text |
||
81 | call draw_channel_text |
||
82 | |||
83 | ; editbox |
||
84 | |||
85 | mov eax, [ysize] |
||
86 | sub eax, 12 ;;;;;; |
||
87 | mov [edit1.top], eax |
||
88 | |||
89 | mov eax, [xsize] |
||
90 | mov [edit1.width], eax |
||
91 | |||
92 | push dword edit1 |
||
93 | call [edit_box_draw] |
||
94 | |||
95 | ; tabs |
||
3981 | hidnplayr | 96 | call draw_windowtabs |
3545 | hidnplayr | 97 | |
98 | popa |
||
99 | ret |
||
100 | |||
101 | |||
102 | |||
103 | redraw_channel_list: |
||
104 | |||
105 | ; First, calculate scrollbar |
||
106 | |||
3981 | hidnplayr | 107 | mov ebx, [window_active] |
3545 | hidnplayr | 108 | mov eax, [ebx + window.users] ; number of users in the open window |
109 | mov [scroll1.max_area], eax |
||
110 | |||
111 | mov eax, [ysize] |
||
112 | sub eax, TOP_Y + 15 ;;;; |
||
113 | push eax |
||
114 | mov [scroll1.y_size], ax |
||
115 | |||
116 | mov eax, [xsize] |
||
117 | sub eax, SCROLLBAR_WIDTH |
||
118 | mov [scroll1.x_pos], ax |
||
119 | |||
120 | pop eax ; scrollbar height |
||
121 | xor edx, edx |
||
122 | mov ecx, 10 |
||
123 | div ecx |
||
124 | mov [scroll1.cur_area], eax |
||
125 | |||
126 | ; Do we need a scrollbar? |
||
127 | cmp eax, [scroll1.max_area] |
||
128 | jae .noscroll |
||
129 | |||
130 | ; Is the current position greater then the max position? |
||
131 | cmp eax, [scroll1.position] |
||
132 | ja @f |
||
133 | mov [scroll1.position], eax |
||
134 | @@: |
||
135 | |||
136 | ; OK, draw the scrollbar |
||
137 | mov [scroll1.all_redraw], 1 |
||
138 | |||
139 | push dword scroll1 |
||
140 | call [scrollbar_v_draw] |
||
141 | |||
142 | jmp print_channel_list |
||
143 | |||
144 | .noscroll: |
||
145 | mov [scroll1.position], 0 |
||
146 | |||
147 | |||
148 | |||
149 | print_channel_list: |
||
150 | |||
151 | pusha |
||
152 | |||
153 | ; first, draw an invisible button |
||
154 | mov ebx, [xsize] |
||
155 | sub ebx, USERLIST_X + SCROLLBAR_WIDTH |
||
156 | shl ebx, 16 |
||
157 | push ebx |
||
158 | mov bx, USERLIST_X |
||
159 | mov ecx, [ysize] |
||
160 | add ecx, TEXT_Y shl 16 - (TEXT_Y + 15) ;;;;; + 10??? |
||
161 | push ecx ebx |
||
3981 | hidnplayr | 162 | mov edx, WINDOW_BTN_LIST + 1 shl 29 + 1 shl 30 |
3545 | hidnplayr | 163 | mcall 8 |
164 | |||
3981 | hidnplayr | 165 | ; draw rectangle to clear previously printed names |
3545 | hidnplayr | 166 | pop ebx ecx |
167 | mov edx, [colors.work] |
||
168 | mcall 13 |
||
169 | |||
3981 | hidnplayr | 170 | ; now draw the names according to the scrollbar position and window size |
3545 | hidnplayr | 171 | mov eax, [scroll1.position] |
172 | xor edx, edx |
||
173 | mov ecx, MAX_NICK_LEN |
||
174 | mul ecx |
||
175 | mov edx, eax |
||
3981 | hidnplayr | 176 | mov eax, [window_active] |
3545 | hidnplayr | 177 | mov ebp, [eax + window.selected] |
178 | add edx, [eax + window.data_ptr] |
||
179 | sub ebp, [scroll1.position] |
||
180 | add edx, window_data.names |
||
181 | |||
182 | pop ebx |
||
183 | mov bx, TEXT_Y |
||
184 | mov ecx, [colors.work_text] |
||
185 | or ecx, 0x80000000 ; ASCIIZ string |
||
186 | mov eax, 4 ; draw text |
||
187 | |||
188 | mov edi, [ysize] ; Calculate how many names will fit on screen |
||
189 | sub edi, TEXT_Y + 15 ;+ 10 ;;;;; |
||
190 | .loop: |
||
191 | cmp byte[edx], 0 ; end of list? |
||
192 | je .done |
||
193 | |||
194 | dec ebp ; is this name selected? |
||
195 | jnz .nothighlight |
||
196 | ; yes, highlight it |
||
197 | pusha |
||
198 | mov cx, bx |
||
199 | mov bx, USERLIST_X |
||
200 | shl ecx, 16 |
||
201 | mov cx, 10 - 1 |
||
202 | mov edx, 0x00000055 ; blue! |
||
203 | mcall 13 |
||
204 | popa |
||
205 | |||
206 | mov ecx, 0x8000ffff ; cyan! |
||
207 | mcall |
||
208 | |||
209 | mov ecx, [colors.work_text] |
||
210 | or ecx, 0x80000000 ; ASCIIZ string |
||
211 | jmp .next |
||
212 | |||
213 | .nothighlight: |
||
214 | mcall |
||
215 | |||
216 | .next: |
||
217 | add edx, MAX_NICK_LEN ; next name |
||
218 | add ebx, 10 ; height distance between lines |
||
219 | sub edi, 10 |
||
220 | ja .loop |
||
221 | |||
222 | .done: |
||
223 | popa |
||
224 | |||
225 | ret |
||
226 | |||
227 | |||
228 | |||
229 | |||
230 | draw_channel_text: |
||
231 | |||
232 | pusha |
||
233 | |||
234 | mov eax, 4 ; draw text |
||
235 | mov ebx, TEXT_X shl 16 + TEXT_Y |
||
236 | mov ecx, 12 ; 12 lines max ? |
||
237 | mov esi, [textbox_width] |
||
238 | |||
239 | .dct: |
||
240 | pusha |
||
241 | mov cx, bx |
||
242 | shl ecx, 16 |
||
243 | mov cx, 9 ; character height |
||
244 | mov eax, 13 ; draw rectangle |
||
245 | mov ebx, TEXT_X shl 16 |
||
246 | mov bx, word[textbox_width] |
||
247 | imul bx, 6 ; character width |
||
248 | mov edx, [colors.work] |
||
249 | mcall |
||
250 | popa |
||
251 | |||
252 | push ecx |
||
253 | mov ecx, [colors.work_text] |
||
254 | cmp word[edx], '* ' |
||
255 | jne .no_red |
||
256 | mov ecx, 0x00aa0000 |
||
257 | jmp .draw |
||
258 | .no_red: |
||
259 | |||
260 | cmp word[edx], '**' |
||
261 | jne .no_light_blue |
||
262 | cmp byte[edx+2], '*' |
||
263 | jne .no_light_blue |
||
264 | mov ecx, 0x000000aa |
||
265 | jmp .draw |
||
266 | .no_light_blue: |
||
267 | |||
268 | cmp byte[edx], '#' |
||
269 | jne .no_blue |
||
270 | mov ecx, 0x0000aa00 |
||
271 | ; jmp .draw |
||
272 | .no_blue: |
||
273 | |||
274 | .draw: |
||
275 | mcall |
||
276 | add edx, [textbox_width] |
||
277 | add ebx, 10 ; height distance between lines |
||
278 | |||
279 | pop ecx |
||
280 | loop .dct |
||
281 | |||
3981 | hidnplayr | 282 | mov eax, [window_active] |
283 | and [eax + window.flags], not FLAG_UPDATED ; clear the 'window is updated' flag |
||
284 | |||
3545 | hidnplayr | 285 | popa |
286 | ret |
||
287 | |||
288 | |||
289 | |||
3981 | hidnplayr | 290 | draw_windowtabs: |
3545 | hidnplayr | 291 | |
3981 | hidnplayr | 292 | ; Create the buttons |
293 | |||
3545 | hidnplayr | 294 | mov eax, 8 |
295 | mov ebx, 5 shl 16 + 120 |
||
296 | mov ecx, 12 shl 16 + 12 |
||
297 | mov edx, WINDOW_BTN_START |
||
298 | mov edi, windows |
||
299 | .more_btn: |
||
300 | mov esi, [colors.work_button] |
||
3981 | hidnplayr | 301 | cmp [window_active], edi |
3545 | hidnplayr | 302 | jne @f |
303 | not esi |
||
304 | and esi, 0x00ffffff |
||
305 | @@: |
||
306 | mcall |
||
307 | inc edx |
||
308 | add ebx, 125 shl 16 |
||
309 | add edi, sizeof.window |
||
310 | cmp [edi + window.data_ptr], 0 |
||
311 | jne .more_btn |
||
312 | |||
3981 | hidnplayr | 313 | ; Draw the windownames onto the buttons |
314 | |||
3545 | hidnplayr | 315 | mov eax, 4 |
316 | mov ebx, 10 shl 16 + 15 |
||
3981 | hidnplayr | 317 | mov esi, MAX_WINDOWS |
318 | mov edi, windows |
||
319 | .more: |
||
3545 | hidnplayr | 320 | mov ecx, [colors.work_button_text] |
3981 | hidnplayr | 321 | test [edi + window.flags], FLAG_UPDATED |
322 | jz @f |
||
323 | mov ecx, 0x00aa0000 ; RED! |
||
324 | @@: |
||
3545 | hidnplayr | 325 | or ecx, 0x80000000 ; ASCIIZ string |
3981 | hidnplayr | 326 | lea edx, [edi + window.name] |
3545 | hidnplayr | 327 | mcall |
3981 | hidnplayr | 328 | add edi, sizeof.window ; get ptr to next window |
329 | cmp [edi + window.data_ptr], 0 |
||
3545 | hidnplayr | 330 | je .enough |
331 | add ebx, 125 shl 16 |
||
332 | dec esi |
||
333 | jnz .more |
||
334 | .enough: |
||
335 | |||
3981 | hidnplayr | 336 | ; Draw the close window button |
337 | |||
338 | mov edi, [window_active] |
||
339 | cmp [edi + window.type], WINDOWTYPE_SERVER ; dont let the user close server window |
||
340 | je @f |
||
341 | |||
342 | mov eax, 8 |
||
343 | mov ebx, [xsize] |
||
344 | sub ebx, 12 |
||
345 | shl ebx, 16 |
||
346 | mov bx, 12 |
||
347 | mov ecx, 6 shl 16 + 12 |
||
348 | mov edx, WINDOW_BTN_CLOSE |
||
349 | ; mov esi, [colors.work_button] |
||
350 | mov esi, 0x00aa0000 ; red ! |
||
351 | mcall |
||
352 | |||
353 | @@: |
||
354 | |||
3545 | hidnplayr | 355 | ret |
356 |