Example #1
0
        private void set_text(log_view lv)
        {
            if (drawer_ == null)
            {
                drawer_ = new log_view_item_draw_ui(lv)
                {
                    ignore_selection = true
                };
                txt.Font = drawer_.default_font;
            }
            drawer_.set_parent(lv);

            int    msg_col = lv.msgCol.fixed_index();
            string msg_txt = lv.sel_line_text;

            txt.Clear();
            txt.AppendText(msg_txt);

            var prints   = lv.sel.override_print(lv, msg_txt, msg_col, column_formatter_base.format_cell.location_type.msg_description).format_text;
            var full_row = lv.list.GetItem(lv.sel_row_idx);

            BackColor = txt.BackColor = drawer_.bg_color(full_row, msg_col, prints);

            var parts = prints.parts(default_print_);

            foreach (var part in parts)
            {
                txt.Select(part.start, part.len);
                txt.SelectionColor     = drawer_.print_fg_color(full_row, part);
                txt.SelectionBackColor = drawer_.print_bg_color(full_row, part);
            }

            txt.SelectionStart  = 0;
            txt.SelectionLength = 0;
        }
 public column_formatter_renderer(log_view parent, ObjectListView list)
 {
     parent_    = parent;
     list_      = list;
     drawer_    = new log_view_item_draw_ui(parent_);
     formatter_ = parent.formatter;
 }
Example #3
0
        public test_log_view()
        {
            InitializeComponent();

            string file   = @"C:\john\code\buff\lw-tests\small.log";
            string syntax = "$time[0,12] $ctx1[13,10] $level[24,5] $class[' ','- '] $msg";

            var sett = new log_settings_string("");

            sett.type.set(log_type.file);
            sett.name.set(file);
            sett.syntax.set(syntax);

            lv_      = new log_view(this, "testing 123");
            lv_.Dock = DockStyle.Fill;
            this.Controls.Add(lv_);
            lv_.show_name = false;

            lv_.set_log(new log_reader(new log_parser(new file_text_reader(sett))));
            var filter = new List <raw_filter_row>();

            lv_.set_filter(filter);

            app.inst.edit_mode = app.edit_mode_type.always;
//            app.inst.edit_mode = app.edit_mode_type.with_space;
        }
        public log_view_data_source(VirtualObjectListView lv, log_view parent ) : base(lv) {
            lv_ = lv;
            parent_ = parent;
            items_ = parent.filter.matches ;
            change_event_.current_thread_is_owner();

            new Thread(update_filter_thread) {IsBackground = true}.Start();
        }
Example #5
0
        public void update(log_view view, int top_offset, int bottom_offset, bool force_update)
        {
            Rectangle wizard_rect   = (wizard_parent_ as log_view_parent).client_rect_no_filter;
            Rectangle wizard_screen = wizard_parent_.RectangleToScreen(wizard_rect);

            // ... care about the lower buttons
            wizard_rect.Y      += top_offset;
            wizard_rect.Height -= bottom_offset + top_offset;

            string sel = view.sel_line_text;

            if (sel == "")
            {
                show(false);
                return;
            }
            if (sel == txt.Text && !force_update)
            {
                return; // nothing changed
            }
            if (view == force_hide_for_view_ && view.sel_row_idx == force_hide_for_row_)
            {
                // user forced us to hide
                return;
            }

            int height_offset = 10;
            var new_size      = new Size(wizard_rect.Width, Math.Min(text_height(sel, wizard_rect.Width) + height_offset, MAX_HEIGHT));

            Size = new_size;

            Rectangle line_rect = view.sel_rect_screen;

            if (can_text_fit_in_width(sel, line_rect.Width))
            {
                show(false);
                return;
            }
            int distance_to_top    = line_rect.Top - wizard_screen.Top;
            int distance_to_bottom = wizard_screen.Bottom - line_rect.Bottom;

            bool on_top = distance_to_top >= distance_to_bottom;

            // always prefer bottom
            var bottom_rect_screen = Parent.RectangleToScreen(new Rectangle(new Point(wizard_rect.Left, wizard_rect.Bottom - Height), new_size));

            if (!line_rect.IntersectsWith(bottom_rect_screen))
            {
                on_top = false;
            }
            var new_location = new Point(wizard_rect.Left, on_top ? wizard_rect.Top : wizard_rect.Bottom - Height);

            set_text(view);
            show(true, new_location);
        }
Example #6
0
        private void set_text(log_view lv)
        {
            if (drawer_ == null)
            {
                drawer_ = new log_view_item_draw_ui(lv)
                {
                    ignore_selection = true
                };
                txt.Font = drawer_.default_font;
            }
            drawer_.set_parent(lv);

            int    msg_col = lv.msgCol.fixed_index();
            string msg_txt = lv.sel_line_text;

            txt.Clear();
            txt.AppendText(msg_txt);

            var prints   = lv.sel.override_print(lv, msg_txt, msg_col);
            var full_row = lv.list.GetItem(lv.sel_row_idx);

            BackColor = txt.BackColor = drawer_.bg_color(full_row, msg_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 = msg_txt.Substring(last_idx, cur_idx - last_idx);
                if (before != "")
                {
                    txt.Select(last_idx, cur_idx - last_idx);
                    txt.SelectionColor     = drawer_.print_fg_color(full_row, default_print_);
                    txt.SelectionBackColor = drawer_.bg_color(full_row, msg_col);
                }
                txt.Select(cur_idx, cur_len);
                txt.SelectionColor     = drawer_.print_fg_color(full_row, prints[print_idx].Item3);
                txt.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 < msg_txt.Length)
            {
                txt.Select(last_idx, msg_txt.Length - last_idx);
                txt.SelectionColor     = drawer_.print_fg_color(full_row, default_print_);
                txt.SelectionBackColor = drawer_.bg_color(full_row, msg_col);
            }

            txt.SelectionStart  = 0;
            txt.SelectionLength = 0;
        }
            public format_cell(match_item item, log_view parent, int col_idx, info_type col_type, formatted_text text, int row_index, int top_row_index, int sel_index, bool is_bookmark, string prev_text, location_type location) {
                this.item = item;
                this.parent = parent;
                this.col_idx = col_idx;
                this.col_type = col_type;
                this.format_text = text;
                this.row_index = row_index;
                this.top_row_index = top_row_index;
                this.prev_text = prev_text;
                this.location = location;
                this.sel_index = sel_index;
                this.is_bookmark = is_bookmark;

                fg_color = item.fg(parent);
                bg_color = item.bg(parent);
            }
Example #8
0
        public Color sel_bg(log_view parent) {
            var bg = this.bg(parent);

            if ( parent.needs_scroll)
                // the idea is that if this view updates a LOT and we're at the last row, 
                // it's disturbing to the eye to constantly have new rows added (thus the former "last" would go up - being marked as "selected",
                // then the selection would change to be the new "last", and so on)
                if (parent.filter.last_change.AddSeconds(3.5) > DateTime.Now)
                    return bg;

            Color dark_bg = util.darker_color(bg);
            Color darker_bg = util.darker_color(dark_bg);
            var focus = win32.focused_ctrl();
            bool is_focused = focus == parent.list || focus == parent.edit;
            return is_focused ? darker_bg : dark_bg;
        }
Example #9
0
 internal snoop_filter(log_view view)
 {
     view_ = view;
     // add the most of possible snoops
     foreach (info_type type in Enum.GetValues(typeof(info_type)))
     {
         if (info_type_io.is_snoopable(type))
         {
             var form = new snoop_around_form();
             form.on_apply = on_apply;
             form.on_snoop = on_snoop;
             unused_.Add(new snoop_form_info {
                 form = form
             });
         }
     }
 }
Example #10
0
            public format_cell(match_item item, log_view parent, int col_idx, info_type col_type, formatted_text text, int row_index, int top_row_index, int sel_index, bool is_bookmark, string prev_text, location_type location)
            {
                this.item          = item;
                this.parent        = parent;
                this.col_idx       = col_idx;
                this.col_type      = col_type;
                this.format_text   = text;
                this.row_index     = row_index;
                this.top_row_index = top_row_index;
                this.prev_text     = prev_text;
                this.location      = location;
                this.sel_index     = sel_index;
                this.is_bookmark   = is_bookmark;

                fg_color = item.fg(parent);
                bg_color = item.bg(parent);
            }
Example #11
0
        public test_log_view() {
            InitializeComponent();

            string file = @"C:\john\code\buff\lw-tests\small.log";
            string syntax = "$time[0,12] $ctx1[13,10] $level[24,5] $class[' ','- '] $msg";

            lv_ = new log_view(this, "testing 123");
            lv_.Dock = DockStyle.Fill;
            this.Controls.Add(lv_);
            lv_.show_name = false;

            lv_.set_log( new log_reader( new log_parser(new file_text_reader(file) /*, "syntax=" + syntax */)) );
            var filter = new List<raw_filter_row>();
            lv_.set_filter( filter  );

            app.inst.edit_mode = app.edit_mode_type.always;
//            app.inst.edit_mode = app.edit_mode_type.with_space;
        }
Example #12
0
        private void show(bool do_show, Point p = default(Point))
        {
            // 1.5.10 - when Description control is shown, we never show this
            do_show = do_show && !force_hide_;

            if (do_show)
            {
                force_hide_for_row_  = -1;
                force_hide_for_view_ = null;
                Location             = p;
                BringToFront();
            }
            else
            {
                txt.Text = "";
                Location = new Point(-100000, -100000);
            }
        }
Example #13
0
 public void after_column_positions_modified(log_view lv) {
 }
Example #14
0
 public void on_sel_line(log_view lv, int line_idx) {
 }
Example #15
0
        private void update_filter(log_view lv) {
            return;
            /* 1.0.91+ - we get notified of filter changes

            // as long as we're editing the filter, don't set_aliases anything
            if (filtCtrl.is_editing_any_filter)
                return;

            lv.set_filter( filtCtrl.to_filter_row_list());
            */
        }
Example #16
0
 public void on_sel_line(log_view lv, int line_idx)
 {
 }
Example #17
0
 public formatted_text_cache(log_view parent, column_formatter_base.format_cell.location_type location) {
     parent_ = parent;
     location_ = location;
 }
Example #18
0
 public log_view_right_click(log_view parent) {
     parent_ = parent;
 }
Example #19
0
 public match_item(BitArray matches, font_info font, line line, int line_idx, log_view parent) : base(matches, font, line, line_idx) {
 }
Example #20
0
 public void force_temporary_hide(log_view lv)
 {
     force_hide_for_view_ = lv;
     force_hide_for_row_  = lv.sel_row_idx;
     show(false);
 }
Example #21
0
 internal snoop_filter(log_view view)
 {
     view_ = view;
 }
Example #22
0
        private List<Tuple<int, int, print_info>> override_print_from_all_places(log_view parent, string text, int col_idx) {
            List<Tuple<int, int, print_info>> print = new List<Tuple<int, int, print_info>>();

            // 1.2.6 - for now, just for msg do match-color
            if (col_idx == parent.msgCol.fixed_index()) {
                var from_filter = parent.filter.match_indexes(base.line, info_type.msg);
                foreach ( var ff in from_filter)
                    print.Add( new Tuple<int, int, print_info>( ff.start, ff.len, new print_info {
                        bg = ff.bg, fg = ff.fg, text = new string('?', ff.len), bold = true
                    } ));
            }

            string sel = parent.edit.sel_text.ToLower();
            if (col_idx == parent.sel_col_idx && sel != "") {
                // look for the text typed by the user
                var matches = util.find_all_matches(text.ToLower(), sel);
                if (matches.Count > 0) {
                    print_info print_sel = new print_info { bold = true, text = sel };
                    foreach ( var match in matches)
                        print.Add( new Tuple<int, int, print_info>(match, sel.Length, print_sel));
                }
            }

            string find = parent.cur_search != null ? parent.cur_search.text : "";
            if (col_idx == parent.msgCol.fixed_index() && find != "") {
                var matches = string_search.match_indexes(text, parent.cur_search);
                if (matches.Count > 0) {
                    // if we're showing both selected text and the results of a find, differentiate them visually
                    bool italic = sel != "";
                    print_info print_sel = new print_info { text = find, bg = parent.cur_search.bg, fg = parent.cur_search.fg, bold = true, italic = italic };
                    foreach ( var match in matches)
                        print.Add( new Tuple<int, int, print_info>(match.Item1, match.Item2, print_sel));
                }                    
            }
                
            if ( util.is_debug)
                foreach ( var p in print)
                    Debug.Assert(p.Item1 >= 0 && p.Item2 >= 0);

            return print;
        }
Example #23
0
        // returns the overrides, sorted by index in the string to print
        public List<Tuple<int, int, print_info>> override_print(log_view parent, string text, int col_idx) {
            var print = override_print_from_all_places(parent, text, col_idx);

            // for testing only
            // var old_print = util.is_debug ? print.ToList() : null;

            // check for collitions
            bool collitions_found = true;
            while (collitions_found) {
                // sort it
                // note: I need to sort it after each collision is solved, since in imbricated prints, we can get un-sorted
                print.Sort((x, y) => {
                    if (x.Item1 != y.Item1)
                        return x.Item1 - y.Item1;
                    // if two items at same index - first will be the one with larger len
                    return - (x.Item2 - y.Item2);
                });

                collitions_found = false;
                for (int idx = 0; !collitions_found && idx < print.Count - 1; ++idx) {
                    var now = print[idx];
                    var next = print[idx + 1];

                    // special case - we split something into 3, but one of the parts was empty
                    if (now.Item2 == 0) {
                        print.RemoveAt(idx);
                        collitions_found = true;
                        continue;
                    }
                    if (next.Item2 == 0) {
                        print.RemoveAt(idx + 1);
                        collitions_found = true;
                        continue;
                    }

                    if (now.Item1 + now.Item2 > next.Item1)
                        collitions_found = true;

                    if (collitions_found) {
                        // first, see what type of collision it is
                        bool exactly_same = now.Item1 == next.Item1 && now.Item2 == next.Item2;
                        if (exactly_same)
                            // doesn't matter - just keep one
                            print.RemoveAt(idx + 1);
                        else {
                            // here - either one completely contains the other, or they just intersect
                            bool contains_fully = now.Item1 + now.Item2 >= next.Item1 + next.Item2;
                            if (contains_fully) {
                                bool starts_at_same_idx = now.Item1 == next.Item1;
                                if (starts_at_same_idx) {
                                    print[idx] = next;
                                    int len = next.Item2;
                                    int second_len = now.Item2 - len;
                                    Debug.Assert(second_len >= 0);
                                    print[idx + 1] = new Tuple<int, int, print_info>(now.Item1 + len, second_len, now.Item3);
                                } else {
                                    // in this case, we need to split in 3
                                    int len1 = next.Item1 - now.Item1;
                                    int len2 = now.Item2 - len1 - next.Item2;
                                    var now1 = new Tuple<int, int, print_info>(now.Item1, len1, now.Item3);
                                    var now2 = new Tuple<int, int, print_info>(next.Item1 + next.Item2, len2, now.Item3);
                                    Debug.Assert(len1 >= 0 && len2 >= 0);
                                    print[idx] = now1;
                                    print.Insert(idx + 2, now2);
                                }
                            } else {
                                // they just intersect
                                int intersect_count = now.Item1 + now.Item2 - next.Item1;
                                Debug.Assert( intersect_count > 0);
                                int interesect_len = now.Item2 - intersect_count;
                                Debug.Assert(interesect_len >= 0);
                                now = new Tuple<int, int, print_info>(now.Item1, interesect_len, now.Item3);
                                print[idx] = now;
                            }
                        }
                    }
                }
            }

            if ( util.is_debug)
                foreach ( var p in print)
                    Debug.Assert(p.Item1 >= 0 && p.Item2 >= 0);

            return print;
        } 
Example #24
0
 public List<Tuple<int, int, print_info>> override_print(log_view parent, string text, info_type type) {
     return override_print(parent, text, log_view_cell.info_type_to_cell_idx(type));
 }
Example #25
0
        private List<text_part> override_print_from_all_places(log_view parent, string text, int col_idx) {
            List<text_part> print = new List<text_part>();

            // 1.2.6 - for now, just for msg do match-color
            if (col_idx == parent.msgCol.fixed_index()) {
                var from_filter = parent.filter.match_indexes(base.line, info_type.msg);
                foreach ( var ff in from_filter)
                    print.Add( new text_part(ff.start, ff.len) { bg = ff.bg, fg = ff.fg, text = new string('?', ff.len), bold = true } );
            }

            string sel = parent.edit.sel_text.ToLower();
            if ((col_idx == parent.sel_col_idx || col_idx == parent.search_found_col_idx) && sel != "") {
                // look for the text typed by the user
                var matches = util.find_all_matches(text.ToLower(), sel);
                if (matches.Count > 0) 
                    foreach ( var match in matches)
                        print.Add( new text_part(match, sel.Length) { bold = true, text = sel, is_typed_search = true } );
            }

            string find = parent.cur_search != null ? parent.cur_search.text : "";
            var col_type = log_view_cell.cell_idx_to_type(col_idx);
            if (parent.cur_search != null && parent.cur_search.is_column_searchable(col_type) && find != "") {
                var matches = string_search.match_indexes(text, parent.cur_search);
                if (matches.Count > 0) {
                    // if we're showing both selected text and the results of a find, differentiate them visually
                    bool italic = sel != "";
                    foreach ( var match in matches)
                        print.Add( new text_part(match.Item1, match.Item2) { text = find, bg = parent.cur_search.bg, fg = parent.cur_search.fg, bold = true, italic = italic, is_find_search = true } );
                }
            }
                
            return print;
        }
Example #26
0
 public void after_column_positions_modified(log_view lv)
 {
 }
Example #27
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;
        } 
Example #28
0
        public virtual Color bg(log_view parent) {
            Color result;
            if (parent.has_bookmark(base.line_idx))
                result = parent.bookmark_bg;
            else if (override_bg != util.transparent)
                result = override_bg;
            else 
                result = font.bg;

            if (result == util.transparent)
                result = app.inst.bg;
            return result;
        }
Example #29
0
        public virtual Color fg(log_view parent) {
            Color result;

#if old_code
            if (parent.has_bookmark(base.line_idx))
                result = parent.bookmark_fg;
            else 
#endif
            if (override_fg != util.transparent)
                result = override_fg;
            else if (parent.filter.matches.binary_search(line_idx).Item2 < 0)
                result = font_info.full_log_gray.fg;
            else 
                result = font.fg;

            if (result == util.transparent)
                result = app.inst.fg;
            return result;
        }
Example #30
0
        // if first item is true, we found colors, and the colors are item2 & 3
        private Tuple<bool,Color,Color> has_found_colors(int row_idx, log_view other_log, bool is_sel) {
            var i = item_at(row_idx) as full_log_match_item;

            int line_idx = i.match.line_idx;
            match_item found_line = null;
            switch (app.inst.syncronize_colors) {
            case app.synchronize_colors_type.none: // nothing to do
                return new Tuple<bool, Color, Color>(true, font_info.default_font.fg, font_info.default_font.bg);
            case app.synchronize_colors_type.with_current_view:
                found_line = other_log.filter_.matches.binary_search(line_idx).Item1 as match_item;
                if (found_line != null) 
                    return new Tuple<bool, Color, Color>(true, found_line.fg(this), found_line.bg(this));
                break;
            case app.synchronize_colors_type.with_all_views:
                found_line = other_log.filter_.matches.binary_search(line_idx).Item1 as match_item;
                if (found_line != null) {
                    Color bg = found_line.bg(this), fg = found_line.fg(this);
                    if (app.inst.sync_colors_all_views_gray_non_active && !is_sel)
                        fg = util.grayer_color(fg);
                    return new Tuple<bool, Color, Color>(true, fg, bg);
                }
                break;
            default:
                Debug.Assert(false);
                break;
            }
            return new Tuple<bool, Color, Color>(false, util.transparent, util.transparent);
        }
Example #31
0
 public formatted_text_cache(log_view parent, column_formatter_base.format_cell.location_type location)
 {
     parent_   = parent;
     location_ = location;
 }
Example #32
0
        private void on_log_changed_line_do_sync(int line_idx, log_view from) {
            if (global_ui.show_fulllog) {
                if (from != full_log_ctrl_ && app.inst.sync_full_log_view)
                    full_log_ctrl_.go_to_row(line_idx, log_view.select_type.do_not_notify_parent);
            }

            bool keep_all_in_sync = (from != full_log_ctrl_ && app.inst.sync_all_views) ||
                                    // if the current log is full log, we will synchronize all views only if both checks are checked
                                    // (note: this is always a bit time consuming as well)
                                    (from == full_log_ctrl_ && app.inst.sync_all_views && app.inst.sync_full_log_view);
            if (keep_all_in_sync)
                keep_logs_in_sync(from);

            description.show_cur_item(selected_view());
        }
Example #33
0
 public void on_view_name_changed(log_view view, string name)
 {
 }
Example #34
0
        // keeps the other logs in sync with this one - if needed
        private void keep_logs_in_sync(log_view src) {
            int line_idx = src.sel_line_idx;
            if (line_idx < 0)
                return;
            foreach (log_view lv in all_log_views_and_full_log())
                if (lv != src) {
                    if (global_ui.show_fulllog && lv == full_log_ctrl_ && app.inst.sync_full_log_view)
                        // in this case, we already synched the full log
                        continue;

                    lv.go_to_closest_line(line_idx, log_view.select_type.do_not_notify_parent);
                }
        }
Example #35
0
        // this is called when the user has manually changed the view name
        public void on_view_name_changed(log_view view, string name) {
            if (ignore_change_ > 0)
                return;
            if (view == full_log)
                return;

            ui_context cur = cur_context();
            int view_idx = all_log_views().IndexOf(view);
            ui_view cur_view = cur.views[view_idx];
            string old_name = cur_view.name;
            if (name == old_name)
                // nothing changed
                return;

            var other_views = all_log_views();
            other_views.Remove(view);
            var other_view_names = other_views.Select(x => x.name);
            string new_name = util.unique_name(other_view_names, name);
            if (new_name != name) 
                // in this case, another view already had that name - we want names to be unique
                view.name = name = new_name;

            cur_view.name = name;
            global_ui.rename_view(old_name, name);
        }
Example #36
0
        private log_view ensure_we_have_log_view_for_tab(int idx) {
            TabPage tab = viewsTab.TabPages[idx];
            foreach ( Control c in tab.Controls)
                if ( c is log_view)
                    return c as log_view; // we have it

            foreach ( Control c in tab.Controls)
                c.Visible = false;

            Debug.Assert( idx < cur_context().views.Count );
            string name = cur_context().views[idx].name;
            log_view new_ = new log_view( this, name );
            new_.Dock = DockStyle.Fill;
            tab.Controls.Add(new_);
            new_.show_name = false;
            new_.set_bookmarks(bookmarks_.ToList());
            if ( log_parser_ != null)
                new_.set_log( new log_reader(log_parser_));
            return new_;
        }
Example #37
0
        public void on_sel_line(log_view lv, int line_idx) {
            if (any_moving_key_still_down())
                // user is still moving the selection
                return;

            logger.Debug("[log] new line " + lv.name + " = " + line_idx);
            update_notes_current_line();
        }
Example #38
0
 public void on_view_name_changed(log_view view, string name) {
 }
Example #39
0
        public log_wizard()
        {
            InitializeComponent();
            show_tips_ = new show_tips(status);
            whatsup.animate = false;
            toggled_to_custom_ui_ = first_available_toggle_custom_ui();
            forms_.Add(this);
            Text += " " + version();
            bool first_time = contexts_.Count == 0;
            if (first_time) {
                load_contexts(sett_);
                notes_keeper.inst.init( util.is_debug ? "notes" : Program.local_dir() + "\\notes", app.inst.identify_notes_files);

                new Thread(load_release_info_thread) {IsBackground = true}.Start();
            }
            notes.set_author( app.inst.notes_author_name, app.inst.notes_initials, app.inst.notes_color);
            notes.on_note_selected = on_note_selected;

            description.on_description_changed += on_description_template_changed;

            ++ignore_change_;

            full_log_ctrl_ = new log_view( this, log_view.FULLLOG_NAME);
            full_log_ctrl_.Dock = DockStyle.Fill;
            filteredLeft.Panel2.Controls.Add(full_log_ctrl_);
            full_log_ctrl_.show_name = false;
            full_log_ctrl_.show_view(true);

            filtCtrl.design_mode = false;
            filtCtrl.on_save = save;
            filtCtrl.ui_to_view = (view_idx) => log_view_for_tab(view_idx).set_filter(filtCtrl.to_filter_row_list());
            filtCtrl.on_rerun_view = (view_idx) => refreshToolStripMenuItem_Click(null, null);
            filtCtrl.on_refresh_view = (view_idx) => {
                log_view_for_tab(view_idx).Refresh();
                full_log.list.Refresh();
            };
            filtCtrl.mark_match = (filter_idx) => {
                var lv = log_view_for_tab(viewsTab.SelectedIndex);
                Color fg = util.str_to_color(sett_.get("filter_fg", "transparent"));
                Color bg = util.str_to_color(sett_.get("filter_bg", "#faebd7"));
                lv.mark_match(filter_idx, fg, bg);
            };

            recreate_contexts_combo();

            foreach ( history hist in history_)
                logHistory.Items.Add(hist.ui_friendly_name);

            --ignore_change_;
            load();
            ++ignore_change_;

            util.postpone(() => set_tabs_visible(leftPane, false), 1);

            msg_details_ = new msg_details_ctrl(this);
            Controls.Add(msg_details_);
            msg_details_.force_hide = global_ui.show_details;
            handle_subcontrol_keys(this);

            viewsTab.DrawMode = TabDrawMode.OwnerDrawFixed;
            viewsTab.DrawItem += ViewsTabOnDrawItem;

            update_topmost_image();
            update_toggle_topmost_visibility();
            --ignore_change_;

            update_status_prefix();
            set_status_forever("");

            // 1.0.80d+ - the reason we postpone this is so that we don't set up all UI in the constructor - the splitters would get extra SplitterMove() events,
            //            and we would end up positioning them wrong
            bool is_first_form = forms_.Count == 1;
            // 1.5.20+ note: if more than one form -> for the new forms, don't select anything
            if ( is_first_form)
                util.postpone(() => {
                    bool open_cmd_line_file = forms_.Count == 1 && Program.open_file_name != null;
                    if (history_.Count > 0 && !open_cmd_line_file)
                        logHistory.SelectedIndex = history_.Count - 1;
                    if (open_cmd_line_file)
                        on_file_drop(Program.open_file_name);
                }, 10);
            else 
                set_status("Alternatively, you can <i>Actions >> Open Log</i>, or re-open an older log (<i>Actions >> Show History</i>)");

            util.postpone(animate_whatsup, util.is_debug ? 2500 : 10000);
        }
Example #40
0
        private void load_surrounding_rows(log_view lv) {
            int sel = lv.sel_row_idx;
            if (sel < 0)
                sel = 0;
            // get as many rows as possible, in both directions
            int max_count = Math.Min(MAX_PREVIEW_ROWS, lv.item_count);
            int min = sel - max_count / 2, max = sel + max_count / 2;
            if (min < 0) {
                max += -min;
                min = 0;
            }
            if (max > lv.item_count) {
                min -= max - lv.item_count;
                max = lv.item_count;
            }
            if (min < 0)
                min = 0;
            if (max > lv.item_count)
                max = lv.item_count;
            // at this point, we know the start and end

            // see which columns actuall have useful data
            List< Tuple<int,int>> columns_and_displayidx = new List<Tuple<int,int>>();
            for (int col_idx = 0; col_idx < lv.list.AllColumns.Count; ++col_idx) {
                if ( lv.list.AllColumns[col_idx].Width > 0)
                    if ( lv.visible_columns.Contains(log_view_cell.cell_idx_to_type(col_idx)))
                        columns_and_displayidx.Add( new Tuple<int, int>(col_idx, lv.list.AllColumns[col_idx].DisplayIndex ));
            }
            var columns = columns_and_displayidx.OrderBy(x => x.Item2).Select(x => x.Item1).ToList();

            for (int idx = min; idx < max; ++idx) {
                var i = lv.item_at(idx);
                List<string> row = new List<string>();
                foreach (int col_idx in columns)
                    row.Add(log_view_cell.cell_value(i, col_idx));
                preview_items_.Add(row);
            }

            searchable_columns_.Clear();
            searchable_columns_msg_only_.Clear();
            int preview_col_idx = 0;
            foreach (int col_idx in columns) {
                result.AllColumns[preview_col_idx].Width = lv.list.AllColumns[col_idx].Width;
                result.AllColumns[preview_col_idx].Text = lv.list.AllColumns[col_idx] != lv.msgCol ? lv.list.AllColumns[col_idx].Text : "Message";
                result.AllColumns[preview_col_idx].FillsFreeSpace = lv.list.AllColumns[col_idx].FillsFreeSpace;
                // note: the line column never enters the search
                bool is_searchable = info_type_io.is_searchable(log_view_cell.cell_idx_to_type(col_idx));
                if (is_searchable)
                    searchable_columns_.Add(preview_col_idx);
                if ( lv.msgCol == lv.list.AllColumns[col_idx])
                    searchable_columns_msg_only_.Add(preview_col_idx);

                if (lv.lineCol != lv.list.AllColumns[col_idx])
                    result.AllColumns[preview_col_idx].Renderer = render_;
                ++preview_col_idx;
            }
            for (; preview_col_idx < result.AllColumns.Count; ++preview_col_idx)
                result.AllColumns[preview_col_idx].IsVisible = false;
            result.RebuildColumns();

            for ( int match_idx = 0; match_idx < preview_items_.Count; ++match_idx)
                matches_.Add(match_idx);
        }
Example #41
0
        public void after_column_positions_modified(log_view lv) {
            string positions = lv.column_positions;
            if (positions == "")
                // user changed nothing
                return;

            if ( !lv.apply_column_settings_only_to_me)
                foreach ( var other in all_log_views())
                    if ( other != lv && !other.apply_column_settings_only_to_me)
                        other.column_positions = positions ;

            // now, save them
            if (lv.apply_column_settings_only_to_me) {
                var old = global_ui.view(lv.name);
                global_ui.view( lv.name, new ui_info.view_info(lv.column_positions, old.show_full_log));
            } else
                global_ui.global_column_positions = lv.column_positions;

            save();
        }
Example #42
0
        public virtual Color bg(log_view parent) {
            Color result;
#if old_code
            if (parent.has_bookmark(base.line_idx))
                result = parent.bookmark_bg;
            else 
#endif
            if (override_bg != util.transparent)
                result = override_bg;
            else 
                result = font.bg;

            // 1.6.6 - if user has searched for something only visible in description pane, show it a bit darker, so the user knows it's a match on this line
            if (result == util.transparent) 
                if (parent.is_searching()) {
                    var view_visible = parent.view_visible_column_types();
                    bool search_matches_view = search_matches_any_column(parent, view_visible);
                    if (!search_matches_view) {
                        var all_visible = parent.all_visible_column_types();
                        var details_visible = all_visible.Where( x => !view_visible.Contains(x) ).ToList();
                        if (search_matches_any_column(parent, details_visible))
                            result = search_form_history.inst.default_search.bg;
                    }
                }
            

            if (result == util.transparent)
                result = app.inst.bg;
            return result;
        }
Example #43
0
        /* Edit mode:
           1. if more than 1 entry, the combo is dropped down by default
           2. if you type any letter while the combo is first dropped down (or paste something), it will auto close the dropdown
           3. if you select any entry from the combo, you are EDITING that entry. If you don't select anything, you are ADDING
        */
        // 1.2.7+ if there's something selected by the user, override what we had
        public search_form(Form parent, log_view lv, string smart_edit_search_for_text) {
            InitializeComponent();
            TopMost = parent.TopMost;
            result.Font = lv.list.Font;

            lv_ = lv;
            render_ = new search_renderer(lv, this);
            history_ = search_form_history.inst.all_searches_cur_view_first(lv.name);
            // use the last ones...
            fg.BackColor = history_[0].fg;
            bg.BackColor = history_[0].bg;
            allColumns.Checked = history_[0].all_columns;
            load_combo();

            load_surrounding_rows(lv);
            if (smart_edit_search_for_text != "") {
                combo.Text = smart_edit_search_for_text;
                radioText.Checked = true;
            }
            update_autorecognize_radio();

            prev_search_ = current_search();

            util.postpone(() => {
                combo.Focus();                
                if (combo.Items.Count > 1) {
                    dropped_first_time_ = true;
                    combo.DroppedDown = true;
                }
            },1);

            new Thread(do_searches_thread) {IsBackground = true }.Start();
        }
Example #44
0
 private bool search_matches_any_column(log_view parent,  List<info_type> columns) {
     string sel_text = parent.edit.sel_text.ToLower();
     var cur_col = log_view_cell.cell_idx_to_type(parent.cur_col_idx);
     if (sel_text != "") {
         if (app.inst.edit_search_all_columns) {
             foreach (info_type col in columns) {
                 string txt = log_view_cell.cell_value_by_type(this, col).ToLower();
                 if (txt.Contains(sel_text))
                     return true;
             }
         } else if (columns.Contains(cur_col)) {
             string txt = log_view_cell.cell_value_by_type(this, cur_col).ToLower();
             if (txt.Contains(sel_text))
                 return true;
         }
     } else {
         // search for cur_search
         if (string_search.matches( match, columns.Where(info_type_io.is_searchable) , parent.cur_search))
             return true;
     }
     return false;            
 }