Subversion Repositories Kolibri OS

Rev

Rev 8439 | Rev 8584 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.  
  2. void ParseAndPaint()
  3. {
  4.         list.count=0;
  5.         selection.cancel();
  6.         if (list.w != canvas.bufw) canvas.Init(list.x, list.y, list.w, screen.height);
  7.         Parse();
  8.         DrawPage();    
  9. }
  10.  
  11. void Parse()
  12. {
  13. dword off;
  14. int line_end;
  15. dword line_length=0;
  16. dword line_start = io.buffer_data;
  17. dword buflen = strlen(io.buffer_data) + io.buffer_data;
  18.  
  19.         lines.drop();
  20.         lines.add(io.buffer_data);
  21.  
  22.         for (off = io.buffer_data; off < buflen; off++)
  23.         {
  24.                 line_length += list.font_w;
  25.                 if (line_length + 30 >= list.w) || (ESBYTE[off] == 10)
  26.                 {
  27.                         //searching a 'white' for a normal word-break
  28.                         for(line_end = off; line_end != line_start; line_end--)
  29.                         {
  30.                                 if (__isWhite(ESBYTE[line_end])) { off=line_end+1; break; }
  31.                         }
  32.                         line_length = off - line_start * list.font_w;
  33.                         list.count++;
  34.                         lines.add(off);
  35.                         line_start = off;
  36.                         line_length = 0;
  37.                 }
  38.         }
  39.         lines.add(buflen);
  40.         list.count++;
  41. }
  42.  
  43. void PaintVisible()
  44. {
  45.         int i, ff;
  46.         signed s1, s2;
  47.         dword ydraw, absolute_y;
  48.         dword line_bg;
  49.         bool swapped_selection = false;
  50.  
  51.         list.column_max = lines.len(list.cur_y);
  52.         list.CheckDoesValuesOkey();
  53.         if (selection.end_offset < selection.start_offset) {
  54.                 swapped_selection = selection.swap_start_end();
  55.         }
  56.  
  57.         for ( i=0; i < list.visible+1; i++)
  58.         {
  59.                 ydraw = i * list.item_h;
  60.                 absolute_y = i + list.first;
  61.                 line_bg = theme.bg;
  62.  
  63.                 if (selection.start_y < absolute_y) && (selection.end_y > absolute_y) line_bg = selection.color;
  64.                 canvas.DrawBar(0, ydraw, list.w, list.item_h, line_bg);
  65.  
  66.                 selection.draw(absolute_y);
  67.  
  68.                 if (search.visible) || (search_next) for (ff=0; ff<search.found.count; ff++) {
  69.                         s1 = search.found.get(ff) - lines.get(absolute_y);
  70.                         s2 = search.found.get(ff) - lines.get(absolute_y+1);
  71.  
  72.                         if (s2 > 0) break;
  73.  
  74.                         if (s1 > 0) && (s2 < 0) {
  75.                                 canvas.DrawBar(search.found.get(ff) - lines.get(absolute_y) * list.font_w + 3,
  76.                                         ydraw, strlen(#found_text) * list.font_w, list.item_h, theme.found);
  77.                                 search_next = false;
  78.                         }
  79.                 }
  80.  
  81.                 if (absolute_y<list.count) canvas.WriteText(3, ydraw+3, list.font_type, theme.text,
  82.                         lines.get(absolute_y), lines.len(absolute_y));
  83.         }
  84.  
  85.         PutPaletteImage(buf_data+8, canvas.bufw, list.h, list.x, list.y, 32, 0);
  86.  
  87.         if (swapped_selection) selection.swap_start_end();
  88. }
  89.