private bool needs_apply_formatter(formatter format, column_formatter_base.format_cell cell)
        {
            if (format.column_type == "all")
            {
                return(true);
            }

            var aliases   = cell.parent.filter.log?.aliases;
            var cell_type = aliases?.to_info_type(format.column_type);

            if (cell_type != null && cell_type != info_type.max)
            {
                return(cell.col_type == cell_type);
            }

            // in this case, we don't know what column the formater is to be applied to
            return(false);
        }
Exemple #2
0
        internal void format_before(column_formatter_base.format_cell cell)
        {
            // each formatter is called once "before" the filters
            // then, it's called again "after" the filters
            //
            // this way, I can modify the text before (when dealing with numbers and such)
            foreach (var format in formatters_)
            {
                if (needs_apply_formatter(format, cell))
                {
                    format.the_formatter.format_before_do_replace(cell);
                }
            }

            foreach (var format in formatters_)
            {
                if (needs_apply_formatter(format, cell))
                {
                    format.the_formatter.format_before(cell);
                }
            }
        }
        // IMPORTANT: here, when doing preview, we don't show any results from find/find-as-you-type/running filters
        private formatted_text override_print(match_item i, string text, int col_idx, column_formatter_base.format_cell.location_type location)
        {
            int row_idx = list_.IndexOf(i);

            Debug.Assert(row_idx >= 0);

            int    top_row_idx = top_idx();
            string prev_text   = "";

            if (row_idx > 0)
            {
                prev_text = log_view_cell.cell_value(list_.GetItem(row_idx - 1).RowObject as match_item, col_idx);
            }

            int  sel_index  = parent_.sel_row_idx_ui_thread;
            bool is_bokmark = parent_.has_bookmark(i.line_idx);

            var cell = new column_formatter_base.format_cell(i, parent_, col_idx, log_view_cell.cell_idx_to_type(col_idx), new formatted_text(text),
                                                             row_idx, top_row_idx, sel_index, is_bokmark, prev_text, location);

            formatter_.format_before(cell);
            formatter_.format_after(cell);
            return(cell.format_text);
        }
Exemple #4
0
        // returns the overrides, sorted by index in the string to print
        public column_formatter_base.format_cell override_print(log_view parent, string text, int col_idx, column_formatter_base.format_cell.location_type location) {
            int row_idx = parent.item_index(this);
            int top_row_idx = parent.top_row_idx;
            string prev_text = "";
            if (row_idx > 0)
                prev_text = log_view_cell.cell_value(parent.item_at(row_idx - 1), col_idx);

            int sel_index = parent.sel_row_idx_ui_thread;
            bool is_bokmark = parent.has_bookmark(line_idx);

            var cell = new column_formatter_base.format_cell(this, parent, col_idx, log_view_cell.cell_idx_to_type(col_idx), new formatted_text(text),
                row_idx, top_row_idx, sel_index, is_bokmark, prev_text, location);
            parent.formatter.format_before(cell);
            var print = override_print_from_all_places(parent, cell.format_text.text, col_idx);
            cell.format_text.add_parts( print);
            parent.formatter.format_after(cell);
            return cell;
        } 
        // IMPORTANT: here, when doing preview, we don't show any results from find/find-as-you-type/running filters
        private formatted_text override_print(match_item i, string text, int col_idx, column_formatter_base.format_cell.location_type location) {
            int row_idx = list_.IndexOf(i);
            Debug.Assert(row_idx >= 0);

            int top_row_idx = top_idx();
            string prev_text = "";
            if (row_idx > 0)
                prev_text = log_view_cell.cell_value( list_.GetItem(row_idx - 1).RowObject as match_item , col_idx);

            int sel_index = parent_.sel_row_idx_ui_thread;
            bool is_bokmark = parent_.has_bookmark(i.line_idx);

            var cell = new column_formatter_base.format_cell(i, parent_, col_idx, log_view_cell.cell_idx_to_type(col_idx), new formatted_text(text),
                row_idx, top_row_idx, sel_index, is_bokmark, prev_text, location);
            formatter_.format_before(cell);
            formatter_.format_after(cell);
            return cell.format_text;
        }