internal static string cell_value(match_item i, int column_idx) { switch (column_idx) { case 0: return "" + i.line; case 1: return i.view; case 2: return i.date; case 3: return i.time; case 4:return i.level; case 5:return i.thread; case 6:return i.file; case 7:return i.func; case 8:return i.class_; case 9:return i.ctx1; case 10:return i.ctx2; case 11:return i.ctx3; case 12:return i.ctx4; case 13:return i.ctx5; case 14:return i.ctx6; case 15:return i.ctx7; case 16:return i.ctx8; case 17:return i.ctx9; case 18:return i.ctx10; case 19:return i.ctx11; case 20:return i.ctx12; case 21:return i.ctx13; case 22:return i.ctx14; case 23:return i.ctx15; case 24:return i.msg; default: Debug.Assert(false); return ""; } }
private void show_sub_item(log_view lv, info_type type, RichTextBox text_ctrl) { match_item item = lv.sel; int row = lv.sel_row_idx; string txt = (item as filter.match).line.part(type); int col_idx = log_view_cell.info_type_to_cell_idx(type); var prints = lv.sel.override_print(lv, txt, col_idx, column_formatter_base.format_cell.location_type.details_pane).format_text.to_single_enter_char(); // ... text has changed txt = prints.text; text_ctrl.Clear(); text_ctrl.AppendText(txt); var full_row = lv.list.GetItem(row); text_ctrl.BackColor = drawer_.bg_color(full_row, col_idx, prints); var parts = prints.parts(default_print_); foreach (var part in parts) { text_ctrl.Select(part.start, part.len); text_ctrl.SelectionColor = drawer_.print_fg_color(full_row, part); text_ctrl.SelectionBackColor = drawer_.print_bg_color(full_row, part); } }
public Color print_bg_color(OLVListItem item, text_part print) { match_item i = item.RowObject as match_item; bool is_sel = !ignore_selection?parent_sel.Contains(item.Index) : false; Color default_bg = i.bg(parent_); Color bg = print.bg != util.transparent ? print.bg : default_bg; if (bg == util.transparent) { bg = app.inst.bg; } // selection needs a bit of dark if (is_sel) { bg = sel_bg_color(bg); } if (print.is_typed_search && !print.is_find_search) { // 1.7.22 - don't use the overridden background - we want to have the same background for all finds bg = util.darker_color(default_bg); } return(bg); }
internal static string cell_value_by_type(match_item i, info_type type) { switch (type) { case info_type.msg: return(i.msg); case info_type.time: return(i.time); case info_type.date: return(i.date); case info_type.level: return(i.level); case info_type.thread: return(i.thread); case info_type.class_: return(i.class_); case info_type.file: return(i.file); case info_type.func: return(i.func); case info_type.line: return("" + i.line); case info_type.view: return(i.view); case info_type.ctx1: return(i.ctx1); case info_type.ctx2: return(i.ctx2); case info_type.ctx3: return(i.ctx3); case info_type.ctx4: return(i.ctx4); case info_type.ctx5: return(i.ctx5); case info_type.ctx6: return(i.ctx6); case info_type.ctx7: return(i.ctx7); case info_type.ctx8: return(i.ctx8); case info_type.ctx9: return(i.ctx9); case info_type.ctx10: return(i.ctx10); case info_type.ctx11: return(i.ctx11); case info_type.ctx12: return(i.ctx12); case info_type.ctx13: return(i.ctx13); case info_type.ctx14: return(i.ctx14); case info_type.ctx15: return(i.ctx15); } Debug.Assert(false); return(i.msg); }
internal static string cell_value(match_item i, int column_idx) { switch (column_idx) { case 0: return("" + i.line); case 1: return(i.view); case 2: return(i.date); case 3: return(i.time); case 4: return(i.level); case 5: return(i.thread); case 6: return(i.file); case 7: return(i.func); case 8: return(i.class_); case 9: return(i.ctx1); case 10: return(i.ctx2); case 11: return(i.ctx3); case 12: return(i.ctx4); case 13: return(i.ctx5); case 14: return(i.ctx6); case 15: return(i.ctx7); case 16: return(i.ctx8); case 17: return(i.ctx9); case 18: return(i.ctx10); case 19: return(i.ctx11); case 20: return(i.ctx12); case 21: return(i.ctx13); case 22: return(i.ctx14); case 23: return(i.ctx15); case 24: return(i.msg); default: Debug.Assert(false); return(""); } }
public Color print_bg_color(OLVListItem item, print_info print) { match_item i = item.RowObject as match_item; Color bg = print.bg != util.transparent ? print.bg : util.darker_color(i.bg(parent_)); if (bg == util.transparent) { bg = app.inst.bg; } return(bg); }
public Color print_fg_color(OLVListItem item, print_info print) { match_item i = item.RowObject as match_item; Color fg = i.fg(parent_); Color print_fg = print.fg != util.transparent ? print.fg : fg; if (print_fg == util.transparent) { print_fg = app.inst.fg; } return(print_fg); }
private Color bg_color(OLVListItem item) { match_item i = item.RowObject as match_item; int row_idx = item.Index; bool is_sel = !ignore_selection?parent_sel.Contains(row_idx) : false; Color bg = i.bg(parent_); Color dark_bg = sel_bg_color(bg); var color = is_sel ? dark_bg : bg; Debug.Assert(color != util.transparent); return(color); }
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 Color bg_color(OLVListItem item, int col_idx) { match_item i = item.RowObject as match_item; int row_idx = item.Index; Color color; bool is_sel = !ignore_selection?parent_.multi_sel_idx.Contains(row_idx) : false; Color bg = i.bg(parent_); Color dark_bg = i.sel_bg(parent_); if (col_idx == parent_.msgCol.fixed_index()) { if (is_sel) { color = is_sel ? dark_bg : bg; } else if (app.inst.use_bg_gradient) { Rectangle r = item.GetSubItemBounds(col_idx); if (r.Width > 0 && r.Height > 0) { // it's a gradient color = util.transparent; } else { color = bg; } } else { color = bg; } } else { color = is_sel ? dark_bg : bg; } if (color == util.transparent) { color = app.inst.bg; } return(color); }
public Color sel_bg_color() { int row_idx = parent_.sel_row_idx; if (row_idx < 0) { return(drawer_.sel_bg_color(app.inst.bg)); } int col_idx = parent_.cur_col_idx; match_item i = parent_.item_at(row_idx); var col_type = log_view_cell.cell_idx_to_type(col_idx); var txt = log_view_cell.cell_value_by_type(i, col_type); var print = category_formatted(cache_.override_print(i, txt, row_idx, col_idx), i, col_type); var bg = i.bg(parent_); return(drawer_.sel_bg_color(print.bg != util.transparent ? print.bg : bg)); }
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 void show_sub_item(log_view lv, info_type type, RichTextBox text_ctrl) { match_item item = lv.sel; int row = lv.sel_row_idx; string txt = (item as filter.match).line.part(type); int col = log_view_cell.info_type_to_cell_idx(type); var prints = lv.sel.override_print(lv, txt, col); print_info.to_single_enter_char(ref txt, ref prints); text_ctrl.Clear(); text_ctrl.AppendText(txt); var full_row = lv.list.GetItem(row); text_ctrl.BackColor = drawer_.bg_color(full_row, 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 = txt.Substring(last_idx, cur_idx - last_idx); if (before != "") { text_ctrl.Select(last_idx, cur_idx - last_idx); text_ctrl.SelectionColor = drawer_.print_fg_color(full_row, default_print_); text_ctrl.SelectionBackColor = drawer_.bg_color(full_row, col); } text_ctrl.Select(cur_idx, cur_len); text_ctrl.SelectionColor = drawer_.print_fg_color(full_row, prints[print_idx].Item3); text_ctrl.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 < txt.Length) { text_ctrl.Select(last_idx, txt.Length - last_idx); text_ctrl.SelectionColor = drawer_.print_fg_color(full_row, default_print_); text_ctrl.SelectionBackColor = drawer_.bg_color(full_row, col); } }
public Brush bg_brush(OLVListItem item, int col_idx) { match_item i = item.RowObject as match_item; int row_idx = item.Index; if (col_idx == parent_.msgCol.fixed_index()) { bool is_sel = !ignore_selection?parent_.multi_sel_idx.Contains(row_idx) : false; if (!is_sel && app.inst.use_bg_gradient) { Rectangle r = item.GetSubItemBounds(col_idx); if (r.Width > 0 && r.Height > 0) { return(gradient_.brush(r, app.inst.bg_from, app.inst.bg_to)); } } } return(brush_.brush(bg_color(item, col_idx))); }
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(); } }
internal int item_index(match_item m) { return model_.GetObjectIndex(m); }
public bool matches(match_item item) { return(snoop_filter_.matches(item)); }
public bool matches(match_item item) { return snoop_filter_.matches(item); }
public void update_ui() { if (parent_ == null) { return; } if (ignore_change_ > 0) { return; } var bounds = parent_.sel_subrect_bounds; bool visible = should_be_visible(); if (!visible) { Visible = false; return; } int offset_x = parent_.list.Left + 4; int offset_y = parent_.list.Top; var location = new Point(offset_x + bounds.X, offset_y + bounds.Y + 2); if (location.Y + bounds.Height > parent_.Height) { // it was the last row when user is moving down (down arrow) - we'll get notified again last_force_invisible_ = DateTime.Now; Visible = false; return; } int header_height = parent_.list.HeaderControl.ClientRectangle.Height; if (location.Y < offset_y + header_height) { // it was the first row when user is moving up (up arrow), we'll get notified again last_force_invisible_ = DateTime.Now; Visible = false; return; } ++ignore_change_; Location = location; Size = new Size(bounds.Width, bounds.Height); Font = parent_.list.Font; match_item i = parent_.sel; ForeColor = i.fg(parent_); BackColor = i.sel_bg(parent_); set_text(false); SelectionBackColor = BackColor; SelectionColor = ForeColor; changed_sel_background_ = false; // make visible only after we've properly set the location (otherwise, we would flicker) Visible = true; if (sel_start_ >= 0 && sel_start_ <= TextLength) { SelectionStart = sel_start_; } else if (TextLength > 0) { // our selection is bigger than what we have in the current cell SelectionStart = TextLength; } if (sel_start_ >= 0 && sel_start_ <= TextLength) { if (sel_len_ >= 0 && sel_len_ + sel_start_ <= TextLength) { SelectionLength = sel_len_; } } --ignore_change_; }
string cell_value(match_item i, int column_idx) { return log_view_cell.cell_value(i, column_idx); }
// further filtering (toggle) private bool item_search_filter(match_item item, bool applied_on_full_log) { string sel_text = edit.sel_text; if (cur_search_ == null && sel_text == "") // no search - nothing matches return false; if (sel_text != "") { sel_text = sel_text.ToLower(); string cur = log_view_cell.cell_value(item, cur_col_); return cur.ToLower().Contains(sel_text); } // current search return string_search.matches(item.match, cur_search_); }
// note: even if applied on the full log, or just on the view itself, this will yield exactly the same results // // it's because the filters are already applied on the full log, thus yielding a specific set of results private bool item_run_several_filters(match_item i, List<int> row_indexes) { if (row_indexes.Count < 1) // no filter(s) to apply return true; int count = i.matches.Count; if (count < 1) // it's not from our view, it's from the full log return false; foreach ( int idx in row_indexes) if (idx < count) { if (!i.matches[idx]) return false; } else { // our filter has less rows than are selectected from the current line ??? Debug.Assert(false); return false; } return true; }
internal static string cell_value_by_type(match_item i, info_type type) { switch (type) { case info_type.msg: return i.msg; case info_type.time: return i.time; case info_type.date: return i.date; case info_type.level: return i.level; case info_type.thread: return i.thread; case info_type.class_: return i.class_; case info_type.file: return i.file; case info_type.func: return i.func; case info_type.line: return "" + i.line; case info_type.view: return i.view; case info_type.ctx1: return i.ctx1; case info_type.ctx2: return i.ctx2; case info_type.ctx3: return i.ctx3; case info_type.ctx4: return i.ctx4; case info_type.ctx5: return i.ctx5; case info_type.ctx6: return i.ctx6; case info_type.ctx7: return i.ctx7; case info_type.ctx8: return i.ctx8; case info_type.ctx9: return i.ctx9; case info_type.ctx10: return i.ctx10; case info_type.ctx11: return i.ctx11; case info_type.ctx12: return i.ctx12; case info_type.ctx13: return i.ctx13; case info_type.ctx14: return i.ctx14; case info_type.ctx15: return i.ctx15; } Debug.Assert(false); return i.msg; }
internal bool matches(match_item item) { lock(this) foreach ( var snoop in snoops_) if (snoop.Value.snoop_selection.Count > 0 && snoop.Value.selection_used) { var cur_value = (item as filter.match).line.part(snoop.Key); if (!snoop.Value.snoop_selection.Contains(cur_value)) return false; } return true; }
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; }