Esempio n. 1
0
        public static void test() {
            export_text e = new export_text();

            e.add_cell(new export_text.cell(0,0, "first cell"));
            e.add_cell(new export_text.cell(1,1, "cell[1,1]") { bg = Color.Blue });

            e.add_cell(new export_text.cell(2,1, "time") {bg = Color.CornflowerBlue, fg = Color.Red});
            e.add_cell(new export_text.cell(3,1, "time"));
            e.add_cell(new export_text.cell(4,1, "time"));
            e.add_cell(new export_text.cell(5,1, "err"));
            e.add_cell(new export_text.cell(6,1, "err"));

            e.add_cell(new export_text.cell(2,2, "pot"));
            e.add_cell(new export_text.cell(3,2, "pot"));
            e.add_cell(new export_text.cell(4,2, "pot"));
            e.add_cell(new export_text.cell(5,2, "betty"));
            e.add_cell(new export_text.cell(6,2, "lasting"));

            e.add_cell(new export_text.cell(2,3, "load_save - on_change not implemented - enable_vision") { font_size = 9, font = "Arial", fg = Color.Blue} );
            e.add_cell(new export_text.cell(3,3, "[find] compute_pots, scrapes= 14 - 295ms.") { font_size = 10, font = "Tahoma", fg = Color.Blue});
            e.add_cell(new export_text.cell(4,3, "[pot] Pot string could not be parsed [] : Input string was not in a correct format.") { font_size = 10, font = "Courier New", fg = Color.Blue});
            e.add_cell(new export_text.cell(5,3, "this is the last error") { font_size = 12, font = "Courier New", fg = Color.CornflowerBlue});
            e.add_cell(new export_text.cell(6,3, "[hk] key handler created - 410D2") { font_size = 13, font = "Courier New", fg = Color.Red});

            string txt = e.to_text();
            File.WriteAllText("out.txt", txt);
            string html = e.to_html();
            File.WriteAllText("out.html", html);

            clipboard_util.copy(html, txt);
        }
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
        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;
        }
Esempio n. 4
0
        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;
        }
Esempio n. 5
0
        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;
        }