Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
3191 hidnplayr 1
draw_window:
2
 
3
        pusha
4
 
5
        mcall   9, thread_info, -1              ; get current window size
6
        mov     eax, dword[thread_info+42]      ; window xsize
7
        mov     ebx, dword[thread_info+46]      ; ysize
8
        mov     edx, dword[thread_info+62]      ; work area xsize
9
        mov     esi, dword[thread_info+66]      ; ysize
10
        sub     eax, edx
11
        sub     ebx, esi
12
 
13
        cmp     edx, WIN_MIN_X
14
        jae     .x_ok
15
        mov     edx, WIN_MIN_X
16
  .x_ok:
17
        mov     [xsize], edx
18
        add     edx, eax
19
 
20
        cmp     esi, WIN_MIN_Y
21
        jae     .y_ok
22
        mov     esi, WIN_MIN_Y
23
  .y_ok:
24
        mov     [ysize], esi
25
        add     esi, ebx
26
        mcall   67, -1, -1                      ; set the new sizes
27
 
28
        mcall   12, 1
29
        xor     eax, eax                        ; draw window
30
        mov     ebx, WIN_MIN_X
31
        mov     ecx, WIN_MIN_Y
32
        mov     edx, [colors.work]
33
        add     edx, 0x33000000
34
        mov     edi, str_programname
35
        mcall
36
 
37
        mov     ebx, [xsize]
38
        mov     ecx, [ysize]
3216 hidnplayr 39
        sub     cx, 15 ;;;;
3191 hidnplayr 40
        push    cx
41
        shl     ecx, 16
42
        pop     cx
43
        mov     edx, [colors.work_graph]
44
        mcall   38                              ; draw line
45
 
46
        mov     ecx, TOP_Y SHL 16 + TOP_Y
47
        mcall
48
 
49
        mov     edi, [window_open]
50
        cmp     [edi + window.type], WINDOWTYPE_CHANNEL
51
        jne     .not_channel
52
 
53
        mov     ebx, [xsize]
3215 hidnplayr 54
        sub     ebx, USERLIST_X + SCROLLBAR_WIDTH + 3
3191 hidnplayr 55
        push    bx
56
        shl     ebx, 16
57
        pop     bx
58
        mov     ecx, [ysize]
3216 hidnplayr 59
        add     ecx, TOP_Y SHL 16 -(15) ;;;;
3191 hidnplayr 60
        mcall
61
 
62
        call    print_channel_list
63
 
3216 hidnplayr 64
; scrollbar
65
 
66
        mov     eax, [ysize]
67
        sub     eax, TOP_Y + 15 ;;;;
68
        push    eax
69
        mov     [scroll1.y_size], ax
70
 
71
        mov     eax, [xsize]
72
        sub     eax, SCROLLBAR_WIDTH
73
        mov     [scroll1.x_pos], ax
74
 
75
        pop     eax             ; scrollbar height
76
        xor     edx, edx
77
        mov     ecx, 10
78
        div     ecx
79
        mov     [scroll1.cur_area], eax
80
 
81
        mov     [scroll1.all_redraw], 1
82
 
83
        push    dword scroll1
84
        call    [scrollbar_v_draw]
85
 
3191 hidnplayr 86
  .not_channel:
87
        mov     edx, [edi + window.data_ptr]
88
        add     edx, window_data.text
89
        call    draw_channel_text
90
 
91
; editbox
92
 
93
        mov     eax, [ysize]
3216 hidnplayr 94
        sub     eax, 12 ;;;;;;
3191 hidnplayr 95
        mov     [edit1.top], eax
96
 
97
        mov     eax, [xsize]
98
        mov     [edit1.width], eax
99
 
100
        push    dword edit1
101
        call    [edit_box_draw]
102
 
3216 hidnplayr 103
; tabs
3191 hidnplayr 104
 
105
        call    draw_windownames
106
 
107
        mcall   12, 2
108
        popa
109
        ret
110
 
111
 
112
 
113
print_channel_list:
114
 
115
        pusha
116
 
3215 hidnplayr 117
        mov     eax, 13                         ; draw rectangle (clear list)
3191 hidnplayr 118
 
119
        mov     ebx, [xsize]
3215 hidnplayr 120
        sub     ebx, USERLIST_X + SCROLLBAR_WIDTH
3191 hidnplayr 121
        shl     ebx, 16
122
        push    ebx
3215 hidnplayr 123
        mov     bx, USERLIST_X
124
        mov     ecx, [ysize]
3216 hidnplayr 125
        add     ecx, TEXT_Y shl 16 - (TEXT_Y + 15)        ;;;;;   + 10???
3191 hidnplayr 126
        mov     edx, [colors.work]
127
        mcall
128
 
3215 hidnplayr 129
        mov     eax, [scroll1.position]
130
        xor     edx, edx
131
        mov     ecx, MAX_NICK_LEN
132
        mul     ecx
133
        mov     edx, eax
134
        mov     eax, [window_open]
135
        add     edx, [eax + window.data_ptr]
136
        add     edx, window_data.names
137
 
3191 hidnplayr 138
        pop     ebx
139
        mov     bx, TEXT_Y
140
        mov     ecx, [colors.work_text]
3215 hidnplayr 141
        or      ecx, 0x80000000                 ; ASCIIZ string
142
        mov     eax, 4                          ; draw text
143
 
144
        mov     edi, [ysize]                    ; Calculate how many names will fit on screen
3216 hidnplayr 145
        sub     edi, TEXT_Y + 15 ;+ 10           ;;;;;
3191 hidnplayr 146
  .loop:
3215 hidnplayr 147
        ; TODO: check if name is selected and highlight background color if so
148
        cmp     byte[edx], ' '                  ; end of list?
149
        je      .done
3191 hidnplayr 150
        mcall
151
 
3215 hidnplayr 152
        add     edx, MAX_NICK_LEN               ; next name
153
        add     ebx, 10                         ; height distance between lines
154
        sub     edi, 10
155
        ja      .loop
156
  .done:
3191 hidnplayr 157
 
158
        popa
159
 
160
        ret
161
 
162
 
163
 
164
 
165
draw_channel_text:
166
 
167
        pusha
168
 
169
        mov     eax, 4                  ; draw text
170
        mov     ebx, TEXT_X shl 16 + TEXT_Y
171
        mov     ecx, 12                 ; 12 lines max ?
172
        mov     esi, [textbox_width]
173
 
174
  .dct:
175
        pusha
176
        mov     cx, bx
177
        shl     ecx, 16
178
        mov     cx, 9                   ; character height
179
        mov     eax, 13                 ; draw rectangle
180
        mov     ebx, TEXT_X shl 16
181
        mov     bx, word[textbox_width]
182
        imul    bx, 6                   ; character width
183
        mov     edx, [colors.work]
184
        mcall
185
        popa
186
 
187
        push    ecx
188
        mov     ecx, [colors.work_text]
189
        cmp     word[edx], '* '
190
        jne     .no_red
191
        mov     ecx, 0x00aa0000
192
        jmp     .draw
193
  .no_red:
194
 
195
        cmp     word[edx], '**'
196
        jne     .no_light_blue
197
        cmp     byte[edx+2], '*'
198
        jne     .no_light_blue
199
        mov     ecx, 0x000000aa
200
        jmp     .draw
201
  .no_light_blue:
202
 
203
        cmp     byte[edx], '#'
204
        jne     .no_blue
205
        mov     ecx, 0x0000aa00
206
;        jmp     .draw
207
  .no_blue:
208
 
209
  .draw:
210
        mcall
211
        add     edx, [textbox_width]
212
        add     ebx, 10                 ; height distance between lines
213
 
214
        pop     ecx
215
        loop    .dct
216
 
217
        popa
218
        ret
219
 
220
 
221
 
222
draw_windownames:
223
 
224
        mov     eax, 8
225
        mov     ebx, 5 shl 16 + 120
226
        mov     ecx, 12 shl 16 + 12
227
        mov     edx, WINDOW_BTN_START
228
        mov     edi, windows
229
  .more_btn:
230
        mov     esi, [colors.work_button]
231
        cmp     [window_open], edi
232
        jne     @f
233
        not     esi
234
        and     esi, 0x00ffffff
235
      @@:
236
        mcall
237
        inc     edx
238
        add     ebx, 125 shl 16
239
        add     edi, sizeof.window
240
        cmp     [edi + + window.data_ptr], 0
241
        jne     .more_btn
242
 
243
        mov     eax, 4
244
        mov     ebx, 10 shl 16 + 15
245
        mov     ecx, [colors.work_button_text]
246
        or      ecx, 0x80000000         ; ASCIIZ string
247
        lea     edx, [windows + window.name]
248
        mov     esi, MAX_WINDOWS
249
  .more:
250
        mcall
251
        add     edx, sizeof.window
252
        cmp     byte[edx], 0
253
        je      .enough
254
        add     ebx, 125 shl 16
255
        dec     esi
256
        jnz     .more
257
  .enough:
258
 
259
        ret
260