Rev 5025 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
6865 | serge | 1 | |
2 | #include |
||
3 | #include |
||
4 | #include FT_FREETYPE_H |
||
5 | #include FT_GLYPH_H |
||
6 | #include |
||
7 | |||
8 | |||
9 | |||
10 | |||
11 | |||
12 | |||
13 | |||
14 | void txv_get_margins(const tview_t *txv, rect_t *margins); |
||
15 | void txv_set_margins(tview_t *txv, const rect_t *margins); |
||
16 | void txv_set_size(tview_t *txv, int txw, int txh); |
||
17 | void txv_set_font_size(tview_t *txv, int size); |
||
18 | int txv_get_font_size(tview_t *txv); |
||
19 | void txv_set_text(tview_t *txv, char *text, int size); |
||
20 | int txv_scroll_up(tview_t *txv); |
||
21 | int txv_scroll_down(tview_t *txv); |
||
22 | int txv_page_up(tview_t *txv); |
||
23 | int txv_page_down(tview_t *txv); |
||
24 | |||
25 | |||
26 | { |
||
27 | volatile int lock; |
||
28 | unsigned int handle; |
||
29 | }mutex_t; |
||
30 | |||
31 | |||
32 | |||
33 | |||
34 | |||
35 | { |
||
36 | BeginDraw(); |
||
37 | DrawWindow(0,0,0,0,NULL,0,0x73); |
||
38 | EndDraw(); |
||
39 | } |
||
40 | |||
41 | |||
42 | |||
43 | |||
44 | |||
45 | |||
46 | { |
||
47 | ufile_t uf; |
||
48 | oskey_t key; |
||
49 | ctx_t *ctx; |
||
50 | rect_t margins = {4,2,20,0}; |
||
51 | |||
52 | |||
53 | int clh = 480; |
||
54 | |||
55 | |||
56 | |||
57 | "int $0x40" |
||
58 | ::"a"(40), "b"(0xc0000027)); |
||
59 | |||
60 | |||
61 | uf = load_file("/RD/1/EXAMPLE.ASM"); |
||
62 | else uf = load_file(argv[1]); |
||
63 | |||
64 | |||
65 | uf.size == 0) |
||
66 | return 0; |
||
67 | |||
68 | |||
69 | |||
70 | |||
71 | |||
72 | |||
73 | txv_set_margins(txv, &margins); |
||
74 | txv_set_text(txv, uf.data, uf.size); |
||
75 | |||
76 | |||
77 | DrawWindow(10, 40, clw+TYPE_3_BORDER_WIDTH*2, |
||
78 | clh+TYPE_3_BORDER_WIDTH+get_skin_height(), "Text example", 0x000000, 0x73); |
||
79 | show_context(ctx); |
||
80 | EndDraw(); |
||
81 | |||
82 | |||
83 | { |
||
84 | uint32_t wheels; |
||
85 | int buttons; |
||
86 | pos_t pos; |
||
87 | |||
88 | |||
89 | { |
||
90 | case 1: |
||
91 | { |
||
92 | char proc_info[1024]; |
||
93 | int winx, winy, winw, winh; |
||
94 | int txw, txh; |
||
95 | char state; |
||
96 | |||
97 | |||
98 | |||
99 | |||
100 | state = *(char*)(proc_info+70); |
||
101 | if(state & (WIN_STATE_MINIMIZED|WIN_STATE_ROLLED)) |
||
102 | continue; |
||
103 | |||
104 | |||
105 | winy = *(uint32_t*)(proc_info+38); |
||
106 | winw = *(uint32_t*)(proc_info+42)+1; |
||
107 | winh = *(uint32_t*)(proc_info+46)+1; |
||
108 | |||
109 | |||
110 | txh = winh - TYPE_3_BORDER_WIDTH - get_skin_height(); |
||
111 | |||
112 | |||
113 | (txh != clh) ) |
||
114 | { |
||
115 | resize_context(ctx, txw, txh); |
||
116 | txv_set_size(txv, txw, txh); |
||
117 | clw = txw; |
||
118 | clh = txh; |
||
119 | }; |
||
120 | |||
121 | |||
122 | break; |
||
123 | } |
||
124 | case 2: |
||
125 | key = get_key(); |
||
126 | // printf("key %d\n", key.code); |
||
127 | switch(key.code) |
||
128 | { |
||
129 | case 27: |
||
130 | return 0; |
||
131 | |||
132 | |||
133 | txv_set_font_size(txv, txv_get_font_size(txv) - 2); |
||
134 | show_context(ctx); |
||
135 | break; |
||
136 | |||
137 | |||
138 | txv_set_font_size(txv, txv_get_font_size(txv) + 2); |
||
139 | show_context(ctx); |
||
140 | break; |
||
141 | |||
142 | |||
143 | if( txv_scroll_down(txv) ) |
||
144 | show_context(ctx); |
||
145 | break; |
||
146 | |||
147 | |||
148 | if( txv_scroll_up(txv) ) |
||
149 | show_context(ctx); |
||
150 | break; |
||
151 | case 183: |
||
152 | if( txv_page_down(txv) ) |
||
153 | show_context(ctx); |
||
154 | break; |
||
155 | case 184: |
||
156 | if( txv_page_up(txv) ) |
||
157 | show_context(ctx); |
||
158 | break; |
||
159 | } |
||
160 | break; |
||
161 | |||
162 | |||
163 | // button pressed; we have only one button, close |
||
164 | return 0; |
||
165 | |||
166 | |||
167 | // pos = get_mouse_pos(); |
||
168 | // buttons = get_mouse_buttons(); |
||
169 | wheels = get_mouse_wheels(); |
||
170 | |||
171 | |||
172 | { |
||
173 | int r = 0; |
||
174 | |||
175 | |||
176 | r = txv_scroll_down(txv); |
||
177 | else if((short)wheels < 0) |
||
178 | r = txv_scroll_up(txv); |
||
179 | |||
180 | |||
181 | show_context(ctx); |
||
182 | } |
||
183 | } |
||
184 | } |
||
185 | return 0; |
||
186 | }>> |
||
187 |