public override void Render(Graphics g, Rectangle r) { DrawBackground(g, r); string text = GetText(); override_print_ = override_print_from_search(text); g.FillRectangle(brush_.brush(default_.bg), r); StringFormat fmt = new StringFormat(StringFormatFlags.NoWrap); fmt.LineAlignment = StringAlignment.Center; fmt.Trimming = StringTrimming.EllipsisCharacter; switch (this.Column.TextAlign) { case HorizontalAlignment.Center: fmt.Alignment = StringAlignment.Center; break; case HorizontalAlignment.Left: fmt.Alignment = StringAlignment.Near; break; case HorizontalAlignment.Right: fmt.Alignment = StringAlignment.Far; break; } draw_string(0, text, g, brush_.brush(default_.bg), r, fmt); }
public Color bg_color(OLVListItem item, int col_idx, formatted_text format) { int row_idx = item.Index; bool is_sel = !ignore_selection?parent_sel.Contains(row_idx) : false; if (format.bg != util.transparent) { return(is_sel ? sel_bg_color(format.bg) : format.bg); } return(bg_color(item)); }
private formatted_text category_formatted(formatted_text txt, match_item row, info_type col_type) { if (category_formatter_.running) { txt = txt.copy(); int sel_row_idx = parent_.sel_row_idx; if (sel_row_idx >= 0) { var sel = parent_.item_at(sel_row_idx); category_formatter_.format(txt, row, sel, col_type); } } return(txt); }
public format_cell(match_item item, log_view parent, int col_idx, info_type col_type, formatted_text text, int row_index, int top_row_index, int sel_index, bool is_bookmark, string prev_text, location_type location) { this.item = item; this.parent = parent; this.col_idx = col_idx; this.col_type = col_type; this.format_text = text; this.row_index = row_index; this.top_row_index = top_row_index; this.prev_text = prev_text; this.location = location; this.sel_index = sel_index; this.is_bookmark = is_bookmark; fg_color = item.fg(parent); bg_color = item.bg(parent); }
public override void Render(Graphics g, Rectangle r) { // 1.3.30+ solved rendering issue :) DrawBackground(g, r); var i = ListItem.RowObject as match_item; if (i == null) { return; } var col_idx = Column.fixed_index(); var col_type = log_view_cell.cell_idx_to_type(col_idx); drawer_.cached_sel = parent_.multi_sel_idx_ui_thread; var text = GetText(); override_print_ = category_formatted(cache_.override_print(i, text, ListItem.Index, col_idx), i, col_type); text = override_print_.text; bg_color_ = drawer_.bg_color(ListItem, col_idx, override_print_); Brush brush = brush_.brush(bg_color_); g.FillRectangle(brush, r); StringFormat fmt = new StringFormat(StringFormatFlags.NoWrap); fmt.LineAlignment = StringAlignment.Center; fmt.Trimming = override_print_.align == HorizontalAlignment.Left ? StringTrimming.EllipsisCharacter : StringTrimming.None; fmt.Alignment = StringAlignment.Near; int left = 0; if (override_print_.align != HorizontalAlignment.Left) { var full_text_size = drawer_.text_width(g, text, drawer_.font(override_print_.merge_parts)) + image_width(); int width = r.Width; int extra = width - full_text_size; left = override_print_.align == HorizontalAlignment.Right ? extra - 5 : extra / 2; } left += image_width(); draw_string(left, text, g, brush, r, fmt); draw_image(g, r); }
internal void format(formatted_text text, match_item row, match_item sel, info_type col_type) { if (!running || colors_ == null || colors_.Count < 1 || column_ == info_type.max) return; if (col_type == info_type.line) // don't category format the line return; var row_text = log_view_cell.cell_value_by_type(row, column_); var sel_text = log_view_cell.cell_value_by_type(sel, column_); category_colors category_col; if (colors_.TryGetValue(row_text, out category_col)) { var color = row_text == sel_text ? category_col.this_category_bg : category_col.same_category_bg; text.bg = color; text.update_parts(); } }
private formatted_text override_print_from_search(string text) { List <text_part> print = new List <text_part>(); var matches = string_search.match_indexes(text, search_.running_search); if (matches.Count > 0) { foreach (var match in matches) { print.Add(new text_part(match.Item1, match.Item2, search_text_)); } } formatted_text format = new formatted_text(text); format.add_parts(print); return(format); }
internal void format(formatted_text text, match_item row, match_item sel, info_type col_type) { if (!running || colors_ == null || colors_.Count < 1 || column_ == info_type.max) { return; } if (col_type == info_type.line) { // don't category format the line return; } var row_text = log_view_cell.cell_value_by_type(row, column_); var sel_text = log_view_cell.cell_value_by_type(sel, column_); category_colors category_col; if (colors_.TryGetValue(row_text, out category_col)) { var color = row_text == sel_text ? category_col.this_category_bg : category_col.same_category_bg; text.bg = color; text.update_parts(); } }
private formatted_text override_print_from_search(string text) { List<text_part> print = new List<text_part>(); var matches = string_search.match_indexes(text, search_.running_search); if (matches.Count > 0) { foreach ( var match in matches) print.Add( new text_part(match.Item1, match.Item2, search_text_)); } formatted_text format = new formatted_text(text); format.add_parts(print); return format; }
private formatted_text category_formatted(formatted_text txt, match_item row, info_type col_type) { if (category_formatter_.running) { txt = txt.copy(); int sel_row_idx = parent_.sel_row_idx; if (sel_row_idx >= 0) { var sel = parent_.item_at(sel_row_idx); category_formatter_.format(txt, row, sel, col_type ); } } return txt; }
public override void Render(Graphics g, Rectangle r) { // 1.3.30+ solved rendering issue :) DrawBackground(g, r); var i = ListItem.RowObject as match_item; if (i == null) return; var col_idx = Column.fixed_index(); var col_type = log_view_cell.cell_idx_to_type(col_idx); drawer_.cached_sel = parent_.multi_sel_idx_ui_thread; var text = GetText(); override_print_ = category_formatted( cache_.override_print(i, text, ListItem.Index, col_idx), i, col_type); text = override_print_.text; bg_color_ = drawer_.bg_color(ListItem, col_idx, override_print_); Brush brush = brush_.brush( bg_color_); g.FillRectangle(brush, r); StringFormat fmt = new StringFormat(StringFormatFlags.NoWrap); fmt.LineAlignment = StringAlignment.Center; fmt.Trimming = override_print_.align == HorizontalAlignment.Left ? StringTrimming.EllipsisCharacter : StringTrimming.None; fmt.Alignment = StringAlignment.Near; int left = 0; if (override_print_.align != HorizontalAlignment.Left) { var full_text_size = drawer_.text_width(g, text, drawer_.font(override_print_.merge_parts)) + image_width(); int width = r.Width; int extra = width - full_text_size; left = override_print_.align == HorizontalAlignment.Right ? extra - 5 : extra / 2; } left += image_width(); draw_string(left, text, g, brush, r, fmt); draw_image(g, r); }
public override void Render(Graphics g, Rectangle r) { DrawBackground(g, r); var i = ListItem.RowObject as match_item; if (i == null) return; var col_idx = Column.fixed_index(); string text = GetText(); override_print_ = override_print(i, text, col_idx, column_formatter_base.format_cell.location_type.view); var type = log_view_cell.cell_idx_to_type(col_idx); if (info_type_io.can_be_multi_line(type)) override_print_ = override_print_.get_most_important_single_line(); text = override_print_.text; bg_color_ = drawer_.bg_color(ListItem, col_idx, override_print_); Brush brush = brush_.brush( bg_color_); g.FillRectangle(brush, r); StringFormat fmt = new StringFormat(StringFormatFlags.NoWrap); fmt.LineAlignment = StringAlignment.Center; fmt.Trimming = override_print_.align == HorizontalAlignment.Left ? StringTrimming.EllipsisCharacter : StringTrimming.None; fmt.Alignment = StringAlignment.Near; int left = 0; if (override_print_.align != HorizontalAlignment.Left) { var full_text_size = drawer_.text_width(g, text, drawer_.font(override_print_.merge_parts)); int width = r.Width; int extra = width - full_text_size; left = override_print_.align == HorizontalAlignment.Right ? extra - 5 : extra / 2; } draw_string(left, text, g, brush, r, fmt); draw_image(g, r); }
public Color bg_color(OLVListItem item, int col_idx, formatted_text format) { int row_idx = item.Index; bool is_sel = !ignore_selection ? parent_sel.Contains(row_idx) : false; if (format.bg != util.transparent) return is_sel ? sel_bg_color(format.bg) : format.bg; return bg_color(item); }