Ejemplo n.º 1
0
        public void update(log_view view, int top_offset, int bottom_offset, bool force_update)
        {
            Rectangle wizard_rect = wizard_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
            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;
            txt.Text = sel;

            Rectangle line_rect = view.sel_rect;
            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;
            var new_location = new Point(wizard_rect.Left, on_top ? wizard_rect.Top : wizard_rect.Bottom - Height);
            show(true, new_location);
            var cols = view.sel_line_colors;
            txt.ForeColor = cols.Item1;
            txt.BackColor = cols.Item2;
        }
Ejemplo n.º 2
0
        public void update(log_view view, int top_offset, int bottom_offset, bool force_update)
        {
            Rectangle wizard_rect   = wizard_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
            }
            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;
            txt.Text = sel;

            Rectangle line_rect = view.sel_rect;

            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;
            var  new_location = new Point(wizard_rect.Left, on_top ? wizard_rect.Top : wizard_rect.Bottom - Height);

            show(true, new_location);
            var cols = view.sel_line_colors;

            txt.ForeColor = cols.Item1;
            txt.BackColor = cols.Item2;
        }
Ejemplo n.º 3
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 (cur_context().show_fulllog && lv == fullLogCtrl && 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);
                }
        }
Ejemplo n.º 4
0
        public log_wizard()
        {
            InitializeComponent();
            forms.Add(this);
            Text += " " + version();
            sourceTypeCtrl.SelectedIndex = 0;
            bool first_time = contexts_.Count == 0;
            if (first_time) {
                app.inst.load();
                load_contexts();
            }

            ignore_change = true;

            foreach ( ui_context ctx in contexts_)
                curContextCtrl.Items.Add(ctx.name);
            // just select something
            curContextCtrl.SelectedIndex = 0;

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

            load();

            fullLogCtrl = new log_view( this, "[All]");
            fullLogCtrl.Dock = DockStyle.Fill;
            filteredLeft.Panel2.Controls.Add(fullLogCtrl);
            fullLogCtrl.show_name(false);
            fullLogCtrl.show_view(true);

            ignore_change = false;
            hide_tabs(leftPane);

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

            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);

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

            update_topmost_image();
            update_toggle_topmost_visibility();
        }
Ejemplo n.º 5
0
        private log_view ensure_we_have_log_view_for_tab(int idx)
        {
            //if ( text_ == null)
              //  return;
            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;

            log_view new_ = new log_view( this, viewsTab.TabPages[idx].Text );
            new_.Dock = DockStyle.Fill;
            tab.Controls.Add(new_);
            new_.show_name(source_shown);
            new_.set_bookmarks(bookmarks_.ToList());
            if ( log_parser_ != null)
                new_.set_log( new log_line_reader(log_parser_));
            return new_;
        }
Ejemplo n.º 6
0
 public void on_view_name_changed(log_view view, string name)
 {
     ui_context cur = cur_context();
     for ( int i = 0; i < cur_context().views.Count; ++i)
         if ( log_view_for_tab(i) == view) {
             viewsTab.TabPages[i].Text = name;
             view.name = name;
             cur.views[i].name = name;
         }
 }
Ejemplo n.º 7
0
        public void go_to_line(int line_idx, log_view from)
        {
            if (cur_context().show_fulllog && from != fullLogCtrl && app.inst.sync_full_log_view)
                fullLogCtrl.go_to_line(line_idx, log_view.select_type.do_not_notify_parent);

            bool keep_all_in_sync = (from != fullLogCtrl && 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 == fullLogCtrl&& app.inst.sync_all_views && app.inst.sync_full_log_view);
            if ( keep_all_in_sync)
                keep_logs_in_sync(from);
        }
Ejemplo n.º 8
0
        private void update_filter( log_view lv)
        {
            if (last_filter_text_change_.AddMilliseconds(IGNORE_FILTER_UDPATE_MS) > DateTime.Now)
                return;

            List<filter_row> lvf = new List<filter_row>();
            int count = filterCtrl.GetItemCount();
            for ( int idx = 0; idx < count; ++idx) {
                item i = filterCtrl.GetItem(idx).RowObject as item;
                filter_row filt = new filter_row(i.text);
                filt.enabled = i.enabled;
                filt.dimmed = i.dimmed;

                if ( filt.is_valid)
                    lvf.Add(filt);
            }

            lv.set_filter(lvf);
        }
Ejemplo n.º 9
0
 public void set_matches(List<filter.match> matches, log_view parent)
 {
     items_.Clear();
     add_matches(matches, parent);
 }
Ejemplo n.º 10
0
            public void add_matches(List<filter.match> matches, log_view parent)
            {
                foreach ( var m in matches)
                    items_.Add(new item(m,parent) { row = items_.Count + 1 });

                if ( matches.Count == 0)
                    lv_.ClearObjects();

                lv_.UpdateVirtualListSize();
            }
Ejemplo n.º 11
0
 public item(filter.match match, log_view parent)
 {
     match_ = match;
     parent_ = parent;
 }