Rev 4143 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4060 | 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 | |||
13 | print_text: ; eax = start ptr |
||
14 | ; dl = end char |
||
15 | pusha |
||
16 | ptr2: |
||
17 | mov bl, [eax] |
||
18 | |||
19 | cmp bl, dl |
||
20 | je .done |
||
21 | test bl, bl |
||
22 | jz .done |
||
23 | call print_character |
||
24 | |||
25 | inc eax |
||
26 | jmp ptr2 |
||
27 | |||
28 | .done: |
||
29 | popa |
||
30 | ret |
||
31 | |||
32 | |||
33 | |||
34 | print_text2: ; esi = ptr to ASCIIZ string |
||
35 | |||
36 | pusha |
||
37 | .loop: |
||
38 | lodsb |
||
39 | test al, al |
||
40 | jz .done |
||
41 | mov bl, al |
||
42 | call print_character |
||
43 | jmp .loop |
||
44 | |||
45 | .done: |
||
46 | popa |
||
47 | ret |
||
48 | |||
49 | |||
50 | |||
51 | ; Character in bl |
||
52 | print_character: |
||
53 | |||
54 | pusha |
||
55 | mov ecx, TEXTBOX_LINES |
||
56 | imul ecx, [textbox_width] |
||
57 | mov esi, [text_start] |
||
58 | |||
59 | cmp bl, 10 ; line down |
||
60 | je .linefeed |
||
61 | |||
62 | mov eax, [text_pos] |
||
63 | mov byte[esi + eax], bl ; write the byte |
||
64 | inc [text_pos] |
||
65 | |||
66 | cmp [text_pos], ecx |
||
67 | jb .done |
||
68 | |||
69 | .linefeed: |
||
70 | ; scroll all text one line to the top |
||
71 | mov edi, esi |
||
72 | add esi, [textbox_width] |
||
73 | rep movsb |
||
74 | |||
75 | mov ecx, TEXTBOX_LINES - 1 |
||
76 | imul ecx, [textbox_width] |
||
77 | mov [text_pos], ecx |
||
78 | |||
79 | .done: |
||
80 | call window_is_updated |
||
81 | |||
82 | popa |
||
83 | ret |
||
84 | |||
85 | |||
86 | |||
87 | draw_channel_text: ; edx = pointer to text |
||
88 | |||
89 | pusha |
||
90 | |||
91 | mov ebx, TEXT_X shl 16 + TEXT_Y |
||
92 | mov ecx, TEXTBOX_LINES |
||
93 | |||
94 | .drawloop: |
||
95 | pusha |
||
96 | mov cx, bx |
||
97 | shl ecx, 16 |
||
98 | mov cx, 9 ; character height |
||
99 | mov ebx, TEXT_X shl 16 |
||
100 | mov bx, word[textbox_width] |
||
101 | imul bx, 6 ; character width |
||
102 | mov edx, [colors.work] |
||
103 | mcall 13 ; draw rectangle |
||
104 | popa |
||
105 | |||
106 | push ecx |
||
107 | mov ecx, [colors.work_text] |
||
108 | |||
109 | .draw: |
||
110 | mov esi, [textbox_width] |
||
111 | mcall 4 ; draw text |
||
112 | add edx, [textbox_width] |
||
113 | add ebx, 10 ; height distance between lines |
||
114 | |||
115 | pop ecx |
||
116 | loop .drawloop |
||
117 | |||
118 | mov eax, [window_active] |
||
119 | and [eax + window.flags], not FLAG_UPDATED ; clear the 'window is updated' flag |
||
120 | |||
121 | popa |
||
122 | ret |
||
123 |