Rev 5819 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5819 | Rev 5825 | ||
---|---|---|---|
Line 21... | Line 21... | ||
21 | proc_info Form; |
21 | proc_info Form; |
22 | char title[4196]; |
22 | char title[4196]; |
Line 23... | Line 23... | ||
23 | 23 | ||
Line -... | Line 24... | ||
- | 24 | byte help_opened = false; |
|
- | 25 | ||
- | 26 | char char_width[255]; |
|
- | 27 | dword line_offset; |
|
24 | byte help_opened = false; |
28 | #define DWORD 4; |
25 | 29 | ||
26 | enum { |
30 | enum { |
27 | OPEN_FILE, |
31 | OPEN_FILE, |
28 | MAGNIFY_MINUS, |
32 | MAGNIFY_MINUS, |
Line 117... | Line 121... | ||
117 | DrawRectangle(scroll.start_x, scroll.start_y, scroll.size_x, scroll.size_y-1, scroll.bckg_col); |
121 | DrawRectangle(scroll.start_x, scroll.start_y, scroll.size_x, scroll.size_y-1, scroll.bckg_col); |
118 | } |
122 | } |
Line 119... | Line 123... | ||
119 | 123 | ||
120 | void DrawPage() |
124 | void DrawPage() |
121 | { |
125 | { |
122 | _PutImage(list.x,list.y,list.w,list.h,list.first*list.line_h*list.w*3 + font.buffer); |
126 | _PutImage(list.x,list.y,list.w,list.h,list.first*list.item_h*list.w*3 + font.buffer); |
123 | DrawScroller(); |
127 | DrawScroller(); |
Line 124... | Line 128... | ||
124 | } |
128 | } |
125 | 129 | ||
Line 130... | Line 134... | ||
130 | byte ch; |
134 | byte ch; |
131 | dword bufoff; |
135 | dword bufoff; |
132 | dword line_length=30; |
136 | dword line_length=30; |
133 | dword stroka_y = 5; |
137 | dword stroka_y = 5; |
134 | dword stroka=0; |
138 | dword stroka=0; |
135 | char ch_width[255]; |
- | |
136 | int i, srch_pos; |
139 | int i, srch_pos; |
137 | font.changeSIZE(); |
140 | font.changeSIZE(); |
138 | list.w = Form.cwidth-scroll.size_x-1; |
141 | list.w = Form.cwidth-scroll.size_x-1; |
139 | //get font chars width, need to increase performance |
142 | //get font chars width, need to increase performance |
140 | for (i=0; i<256; i++) ch_width[i] = font.symbol_size(i); |
143 | for (i=0; i<256; i++) char_width[i] = font.symbol_size(i); |
141 | //get font buffer height |
144 | //get font buffer height |
142 | for (bufoff=io.buffer_data; ESBYTE[bufoff]; bufoff++) |
145 | for (bufoff=io.buffer_data; ESBYTE[bufoff]; bufoff++) |
143 | { |
146 | { |
144 | ch = ESBYTE[bufoff]; |
147 | ch = ESBYTE[bufoff]; |
145 | line_length += ch_width[ch]; |
148 | line_length += char_width[ch]; |
146 | if (line_length>=list.w) || (ch==10) { |
149 | if (line_length>=list.w) || (ch==10) { |
147 | srch_pos = bufoff; |
150 | srch_pos = bufoff; |
148 | loop() |
151 | loop() |
149 | { |
152 | { |
150 | if (__isWhite(ESBYTE[srch_pos])) { bufoff=srch_pos+1; break; } //normal word-break |
153 | if (__isWhite(ESBYTE[srch_pos])) { bufoff=srch_pos+1; break; } //normal word-break |
Line 159... | Line 162... | ||
159 | //draw text in buffer |
162 | //draw text in buffer |
160 | list.count = stroka+2; |
163 | list.count = stroka+2; |
161 | list.SetSizes(0, TOOLBAR_H, list.w, Form.cheight-TOOLBAR_H, font.size.text+1); |
164 | list.SetSizes(0, TOOLBAR_H, list.w, Form.cheight-TOOLBAR_H, font.size.text+1); |
162 | if (list.count < list.visible) list.count = list.visible; |
165 | if (list.count < list.visible) list.count = list.visible; |
Line 163... | Line 166... | ||
163 | 166 | ||
164 | font.size.height = list.count+1*list.line_h; |
167 | font.size.height = list.count+1*list.item_h; |
Line 165... | Line 168... | ||
165 | font.buffer_size = 0; |
168 | font.buffer_size = 0; |
166 | 169 | ||
167 | line_length = 30; |
170 | line_length = 30; |
168 | line_start = io.buffer_data; |
171 | line_start = io.buffer_data; |
169 | for (bufoff=io.buffer_data; ESBYTE[bufoff]; bufoff++) |
172 | for (bufoff=io.buffer_data; ESBYTE[bufoff]; bufoff++) |
170 | { |
173 | { |
171 | ch = ESBYTE[bufoff]; |
174 | ch = ESBYTE[bufoff]; |
172 | line_length += ch_width[ch]; |
175 | line_length += char_width[ch]; |
173 | if (line_length>=list.w) || (ch==10) |
176 | if (line_length>=list.w) || (ch==10) |
174 | { |
177 | { |
175 | //set word break |
178 | //set word break |
Line 181... | Line 184... | ||
181 | srch_pos--; |
184 | srch_pos--; |
182 | } |
185 | } |
183 | i = bufoff-line_start; |
186 | i = bufoff-line_start; |
184 | strlcpy(#line, line_start, i); |
187 | strlcpy(#line, line_start, i); |
185 | font.prepare_buf(8,stroka_y,list.w,font.size.height, #line); |
188 | font.prepare_buf(8,stroka_y,list.w,font.size.height, #line); |
186 | stroka_y += list.line_h; |
189 | stroka_y += list.item_h; |
187 | line_start = bufoff; |
190 | line_start = bufoff; |
188 | line_length = 30; |
191 | line_length = 30; |
189 | } |
192 | } |
190 | } |
193 | } |
191 | font.prepare_buf(8,stroka_y,list.w,font.size.height, line_start); |
194 | font.prepare_buf(8,stroka_y,list.w,font.size.height, line_start); |