public print_fg_color ( BrightIdeasSoftware.OLVListItem item, |
||
item | BrightIdeasSoftware.OLVListItem | |
return | Color |
private void set_text(bool force) { if (drawer_ == null) { return; } if (sel_row_ == parent_.sel_row_idx && sel_col_ == parent_.sel_col_idx && !force) { return; } sel_row_ = parent_.sel_row_idx; sel_col_ = parent_.sel_col_idx; string txt = parent_.sel_subitem_text; ++ignore_change_; Multiline = txt.IndexOfAny(util.any_enter_char) >= 0; var prints = parent_.sel.override_print(parent_, txt, sel_col_); print_info.to_single_enter_char(ref txt, ref prints); Clear(); AppendText(txt); var full_row = parent_.list.GetItem(sel_row_); 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 != "") { Select(last_idx, cur_idx - last_idx); SelectionColor = drawer_.print_fg_color(full_row, default_print_); SelectionBackColor = drawer_.bg_color(full_row, sel_col_); } Select(cur_idx, cur_len); SelectionColor = drawer_.print_fg_color(full_row, prints[print_idx].Item3); 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) { Select(last_idx, txt.Length - last_idx); SelectionColor = drawer_.print_fg_color(full_row, default_print_); SelectionBackColor = drawer_.bg_color(full_row, sel_col_); } // ... safety net SelectionStart = 0; SelectionLength = 0; --ignore_change_; }
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); } }
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); } }
private void set_text(bool force) { if (drawer_ == null) { return; } if (sel_row_ == parent_.sel_row_idx && sel_col_ == parent_.sel_col_idx && !force) { return; } sel_row_ = parent_.sel_row_idx; sel_col_ = parent_.sel_col_idx; string txt = parent_.sel_subitem_text; ++ignore_change_; Multiline = txt.IndexOfAny(util.any_enter_char) >= 0; var prints = parent_.sel.override_print(parent_, txt, sel_col_, column_formatter_base.format_cell.location_type.smart_edit).format_text.to_single_enter_char(); prints.bg = parent_.render.sel_bg_color(); // ... text has changed txt = prints.text; Clear(); AppendText(txt); var full_row = parent_.list.GetItem(sel_row_); var parts = prints.parts(default_print_); foreach (var part in parts) { Select(part.start, part.len); SelectionColor = drawer_.print_fg_color(full_row, part); SelectionBackColor = part.bg; } // ... safety net SelectionStart = 0; SelectionLength = 0; --ignore_change_; }
private void draw_sub_string(int left, string sub, Graphics g, Brush b, Rectangle r, StringFormat fmt, text_part print) { int width = drawer_.text_width(g, sub, drawer_.font(print)); Color print_bg = drawer_.print_bg_color(ListItem, print); if (print_bg.ToArgb() != bg_color_.ToArgb()) { Rectangle here = new Rectangle(r.Location, r.Size); here.X += left; here.Width = width + 1; g.FillRectangle(brush_.brush(print_bg), here); } Rectangle sub_r = new Rectangle(r.Location, r.Size); sub_r.X += left; sub_r.Width -= left; g.DrawString(sub, drawer_.font(print), brush_.brush(drawer_.print_fg_color(ListItem, print)), sub_r, fmt); }