Rev 6567 | Rev 6638 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6567 | Rev 6631 | ||
---|---|---|---|
Line 49... | Line 49... | ||
49 | if (id>0) DefineButton(x,y,w,h,id,color_b); |
49 | if (id>0) DefineButton(x,y,w,h,id,color_b); |
50 | WriteText(tx+1,ty+1,0x90,MixColors(color_b,0,230),text); |
50 | WriteText(tx+1,ty+1,0x90,MixColors(color_b,0,230),text); |
51 | WriteText(tx,ty,0x90,color_t,text); |
51 | WriteText(tx,ty,0x90,color_t,text); |
52 | } |
52 | } |
Line 53... | Line 53... | ||
53 | 53 | ||
54 | :int DrawStandartCaptButton(dword x, y, id, color_b, color_t, text) |
54 | :int DrawStandartCaptButton(dword x, y, id, text) |
55 | { |
55 | { |
56 | int padding_v = 5; |
56 | int padding_v = 5; |
57 | int padding_h = 15; |
57 | int padding_h = 15; |
58 | int right_margin = 12; |
58 | int right_margin = 12; |
59 | int tx = x + padding_h; |
59 | int tx = x + padding_h; |
60 | int ty = y + padding_v; |
60 | int ty = y + padding_v; |
61 | int h = padding_v + padding_v + 16; //16 font height |
61 | int h = padding_v + padding_v + 16; //16 font height |
Line 62... | Line 62... | ||
62 | int w = strlen(text)*8 + padding_h + padding_h; |
62 | int w = strlen(text)*8 + padding_h + padding_h; |
63 | 63 | ||
64 | if (id>0) DefineButton(x,y,w,h,id,color_b); |
64 | if (id>0) DefineButton(x,y,w,h,id,system.color.work_button); |
65 | WriteText(tx+1,ty+1,0x90,MixColors(color_b,0,230),text); |
65 | WriteText(tx+1,ty+1,0x90,MixColors(system.color.work_button,0,230),text); |
66 | WriteText(tx,ty,0x90,color_t,text); |
66 | WriteText(tx,ty,0x90,system.color.work_button_text,text); |
Line 67... | Line 67... | ||
67 | return w + right_margin; |
67 | return w + right_margin; |
68 | } |
68 | } |
Line 271... | Line 271... | ||
271 | ESBYTE[next_word_pointer] = NULL; |
271 | ESBYTE[next_word_pointer] = NULL; |
272 | WriteText(dword x, y, byte fontType, dword color, text_pointer); |
272 | WriteText(dword x, y, byte fontType, dword color, text_pointer); |
273 | ESBYTE[next_word_pointer] = '\n'; |
273 | ESBYTE[next_word_pointer] = '\n'; |
274 | } |
274 | } |
Line -... | Line 275... | ||
- | 275 | ||
- | 276 | /* |
|
- | 277 | We have a long text and need to show it in block. |
|
- | 278 | Normal line break '\n' must be applied. |
|
- | 279 | Long lines should be breaked by word. |
|
- | 280 | TODO: scroll |
|
- | 281 | */ |
|
- | 282 | :int DrawTextViewArea(int x,y,w,h,line_h, dword buf_start, bg_col, text_col) |
|
- | 283 | { |
|
- | 284 | dword write_start; |
|
- | 285 | dword buf_end; |
|
- | 286 | int label_length_max; |
|
- | 287 | int write_length; |
|
- | 288 | bool end_found; |
|
- | 289 | ||
- | 290 | write_start = buf_start; |
|
- | 291 | buf_end = strlen(buf_start) + buf_start; |
|
- | 292 | label_length_max = w / 8; // 8 big font char width |
|
- | 293 | ||
- | 294 | //DrawRectangle(x-2, y-2, w+4, h+4, system.color.work_graph); |
|
- | 295 | //DrawRectangle3D(x-1, y-1, w+2, h+2, 0xDDDddd, 0xffffff); |
|
- | 296 | ||
- | 297 | loop() |
|
- | 298 | { |
|
- | 299 | if (bg_col!=-1) DrawBar(x, y, w+1, line_h, bg_col); |
|
- | 300 | end_found = false; |
|
- | 301 | write_length = strchr(write_start, '\n') - write_start; //search normal line break |
|
- | 302 | if (write_length > label_length_max) || (write_length<=0) //check its position: exceeds maximum line length or not found |
|
- | 303 | { |
|
- | 304 | if (buf_end - write_start < label_length_max) //check does current line the last |
|
- | 305 | { |
|
- | 306 | write_length = buf_end - write_start; |
|
- | 307 | end_found = true; |
|
- | 308 | } |
|
- | 309 | else |
|
- | 310 | { |
|
- | 311 | for (write_length=label_length_max; write_length>0; write_length--) { //search for white space to make the line break |
|
- | 312 | if (ESBYTE[write_start+write_length] == ' ') { |
|
- | 313 | end_found = true; |
|
- | 314 | break; |
|
- | 315 | } |
|
- | 316 | } |
|
- | 317 | } |
|
- | 318 | if (end_found != true) write_length = label_length_max; //no white space, so we write label_length_max |
|
- | 319 | } |
|
- | 320 | ESI = write_length; //set text length attribute for WriteText() |
|
- | 321 | WriteText(x+1, y, 0x10, text_col, write_start); |
|
- | 322 | // if (editpos >= write_start-buf_start) && (editpos <= write_start-buf_start + write_length) { |
|
- | 323 | // WriteTextB(-write_start+buf_start+editpos * 8 + x - 5 +1, y, 0x90, 0xFF0000, "|"); |
|
- | 324 | // } |
|
- | 325 | write_start += write_length + 1; |
|
- | 326 | y += line_h; |
|
- | 327 | if (write_start >= buf_end) break; |
|
- | 328 | } |
|
- | 329 | if (bg_col!=-1) DrawBar(x,y,w+1,h-y+line_h-4,bg_col); |
|
- | 330 | return y+line_h; |
|
- | 331 | } |
|
- | 332 | ||
275 | 333 | ||
276 | //this function increase falue and return it |
334 | //this function increase falue and return it |
277 | //useful for list of controls which goes one after one |
335 | //useful for list of controls which goes one after one |
278 | struct incn |
336 | struct incn |
279 | { |
337 | { |