public column_formatter_renderer(log_view parent, ObjectListView list) { parent_ = parent; list_ = list; drawer_ = new log_view_item_draw_ui(parent_); formatter_ = parent.formatter; }
private void set_text(log_view lv) { if (drawer_ == null) { drawer_ = new log_view_item_draw_ui(lv) { ignore_selection = true }; txt.Font = drawer_.default_font; } drawer_.set_parent(lv); int msg_col = lv.msgCol.fixed_index(); string msg_txt = lv.sel_line_text; txt.Clear(); txt.AppendText(msg_txt); var prints = lv.sel.override_print(lv, msg_txt, msg_col, column_formatter_base.format_cell.location_type.msg_description).format_text; var full_row = lv.list.GetItem(lv.sel_row_idx); BackColor = txt.BackColor = drawer_.bg_color(full_row, msg_col, prints); var parts = prints.parts(default_print_); foreach (var part in parts) { txt.Select(part.start, part.len); txt.SelectionColor = drawer_.print_fg_color(full_row, part); txt.SelectionBackColor = drawer_.print_bg_color(full_row, part); } txt.SelectionStart = 0; txt.SelectionLength = 0; }
private void set_text(log_view lv) { if (drawer_ == null) { drawer_ = new log_view_item_draw_ui(lv) { ignore_selection = true }; txt.Font = drawer_.default_font; } drawer_.set_parent(lv); int msg_col = lv.msgCol.fixed_index(); string msg_txt = lv.sel_line_text; txt.Clear(); txt.AppendText(msg_txt); var prints = lv.sel.override_print(lv, msg_txt, msg_col); var full_row = lv.list.GetItem(lv.sel_row_idx); BackColor = txt.BackColor = drawer_.bg_color(full_row, msg_col); int last_idx = 0; for (int print_idx = 0; print_idx < prints.Count; ++print_idx) { int cur_idx = prints[print_idx].Item1, cur_len = prints[print_idx].Item2; string before = msg_txt.Substring(last_idx, cur_idx - last_idx); if (before != "") { txt.Select(last_idx, cur_idx - last_idx); txt.SelectionColor = drawer_.print_fg_color(full_row, default_print_); txt.SelectionBackColor = drawer_.bg_color(full_row, msg_col); } txt.Select(cur_idx, cur_len); txt.SelectionColor = drawer_.print_fg_color(full_row, prints[print_idx].Item3); txt.SelectionBackColor = drawer_.print_bg_color(full_row, prints[print_idx].Item3); last_idx = cur_idx + cur_len; } last_idx = prints.Count > 0 ? prints.Last().Item1 + prints.Last().Item2 : 0; if (last_idx < msg_txt.Length) { txt.Select(last_idx, msg_txt.Length - last_idx); txt.SelectionColor = drawer_.print_fg_color(full_row, default_print_); txt.SelectionBackColor = drawer_.bg_color(full_row, msg_col); } txt.SelectionStart = 0; txt.SelectionLength = 0; }