public export_text export() { export_text export = new export_text(); int count = filter_.match_count; for (int idx = 0; idx < count; ++idx) { match_item i = item_at(idx); int visible_idx = 0; string font = list.Font.Name; for (int column_idx = 0; column_idx < list.AllColumns.Count; ++column_idx) { if (list.AllColumns[column_idx].IsVisible) { string txt = cell_value(i, column_idx); export_text.cell c = new export_text.cell(idx, visible_idx, txt) {fg = i.fg(this), bg = i.bg(this), font = font, font_size = 7}; export.add_cell(c); ++visible_idx; } } } return export; }
private export_text export_current_sel() { export_text export = new export_text(); string sel_text = edit.currently_selected_text; int row = sel_row_idx; Debug.Assert(sel_text != "" && row >= 0); match_item i = item_at(row); string font = list.Font.Name; export_text.cell c = new export_text.cell(0, 0, sel_text) {fg = i.fg(this), bg = i.bg(this), font = font, font_size = 7}; export.add_cell(c); return export; }
public export_text export(List<int> indices, bool msg_only) { export_text export = new export_text(); int row_idx = 0; foreach (int idx in indices) { match_item i = item_at(idx); int visible_idx = 0; string font = list.Font.Name; for (int column_idx = 0; column_idx < list.AllColumns.Count; ++column_idx) { bool do_print = list.AllColumns[column_idx].IsVisible; if (msg_only) do_print = column_idx == msgCol.fixed_index(); if (do_print) { string txt = cell_value(i, column_idx); export_text.cell c = new export_text.cell(row_idx, visible_idx, txt) {fg = i.fg(this), bg = i.bg(this), font = font, font_size = 7}; export.add_cell(c); ++visible_idx; } } ++row_idx; } return export; }
public export_text export_all_columns(export_type type = export_type.export_line_column_if_needed) { export_text export = new export_text(); int count = filter_.match_count; if (count < 1) // nothing to export return export; bool export_line = true; switch (type) { case export_type.export_line_column: export_line = true; break; case export_type.do_not_export_line_column: export_line = false; break; case export_type.export_line_column_if_needed: // ... note: we could have it in reverse order export_line = Math.Abs( item_at(count - 1).line_idx - item_at(0).line_idx ) != count - 1; break; default: Debug.Assert(false); break; } int visible_idx = 0; string font = list.Font.Name; var export_columns = available_columns.Where(x => { if (x != info_type.line && x != info_type.view) return true; if (x == info_type.line) return export_line; if (x == info_type.view) return is_full_log; Debug.Assert(false); return false; }).ToList(); foreach (var col in export_columns) { match_item i = item_at(0); var txt = filter_.log.aliases.friendly_name(col) ; export_text.cell c = new export_text.cell(0, visible_idx, txt) { fg = i.fg(this), bg = i.bg(this), font = font, font_size = 7 }; export.add_cell(c); ++visible_idx; } for (int idx = 0; idx < count; ++idx) { match_item i = item_at(idx); visible_idx = 0; foreach (var col in export_columns) { string txt = log_view_cell.cell_value_by_type(i, col); export_text.cell c = new export_text.cell(idx + 1, visible_idx, txt) { fg = i.fg(this), bg = i.bg(this), font = font, font_size = 7 }; export.add_cell(c); ++visible_idx; } } return export; }