Subversion Repositories Kolibri OS

Rev

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