Subversion Repositories Kolibri OS

Rev

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

  1.  
  2. void ParseAndPaint()
  3. {
  4.         //search.clear();
  5.         list.count=0;
  6.         selection.cancel();
  7.  
  8.         Parse();
  9.  
  10.         list.visible = list.h / list.item_h;
  11.         DrawBuf.Init(list.x, list.y, list.w, list.visible+1*list.item_h);
  12.         DrawPage();    
  13. }
  14.  
  15. void Parse()
  16. {
  17. dword off;
  18. int line_end;
  19. dword line_length=0;
  20. dword line_start = io.buffer_data;
  21. dword buflen = strlen(io.buffer_data) + io.buffer_data;
  22.  
  23.         lines.drop();
  24.         lines.add(io.buffer_data);
  25.  
  26.         for (off = io.buffer_data; off < buflen; off++)
  27.         {
  28.                 line_length += list.font_w;
  29.                 if (line_length + 30 >= list.w) || (ESBYTE[off] == 10)
  30.                 {
  31.                         //searching a 'white' for a normal word-break
  32.                         for(line_end = off; line_end != line_start; line_end--)
  33.                         {
  34.                                 if (__isWhite(ESBYTE[line_end])) { off=line_end+1; break; }
  35.                         }
  36.                         line_length = off - line_start * list.font_w;
  37.                         list.count++;
  38.                         lines.add(off);
  39.                         line_start = off;
  40.                         line_length = 0;
  41.                 }
  42.         }
  43.         lines.add(buflen);
  44.         list.count++;
  45. }
  46.  
  47. void PaintVisible()
  48. {
  49.         int i;
  50.         dword ydraw, absolute_y;
  51.         dword line_bg;
  52.         bool swapped_selection = false;
  53.  
  54.         list.column_max = lines.get(list.cur_y+1) - lines.get(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 (absolute_y<list.count) DrawBuf.WriteText(3, ydraw+3, list.font_type, theme.text,
  72.                         lines.get(absolute_y), lines.get(absolute_y+1) - lines.get(absolute_y));
  73.         }
  74.  
  75.         PutPaletteImage(buf_data+8, DrawBuf.bufw, list.h, list.x, list.y, 32, 0);
  76.  
  77.         if (swapped_selection) selection.swap_start_end();
  78. }
  79.  
  80.