Esempio n. 1
0
        public LogWindow(LogTabWindow parent, string fileName, bool isTempFile,
                         bool forcePersistenceLoading)
        {
            SuspendLayout();

            InitializeComponent();

            columnNamesLabel.Text = ""; // no filtering on columns by default

            parentLogTabWin = parent;
            IsTempFile      = isTempFile;
            //Thread.CurrentThread.Name = "LogWindowThread";
            ColumnizerCallbackObject = new ColumnizerCallback(this);

            FileName = fileName;
            ForcePersistenceLoading = forcePersistenceLoading;

            dataGridView.CellValueNeeded += dataGridView_CellValueNeeded;
            dataGridView.CellPainting    += dataGridView_CellPainting;

            filterGridView.CellValueNeeded += filterGridView_CellValueNeeded;
            filterGridView.CellPainting    += filterGridView_CellPainting;

            Closing  += LogWindow_Closing;
            Disposed += LogWindow_Disposed;

            timeSpreadCalc = new TimeSpreadCalculator(this);
            timeSpreadingControl1.TimeSpreadCalc       = timeSpreadCalc;
            timeSpreadingControl1.LineSelected        += timeSpreadingControl1_LineSelected;
            tableLayoutPanel1.ColumnStyles[1].SizeType = SizeType.Absolute;
            tableLayoutPanel1.ColumnStyles[1].Width    = 20;
            tableLayoutPanel1.ColumnStyles[0].SizeType = SizeType.Percent;
            tableLayoutPanel1.ColumnStyles[0].Width    = 100;

            parentLogTabWin.HighlightSettingsChanged += parent_HighlightSettingsChanged;

            SetColumnizer(PluginRegistry.GetInstance().RegisteredColumnizers[0]);

            patternArgs.maxMisses      = 5;
            patternArgs.minWeight      = 1;
            patternArgs.maxDiffInBlock = 5;
            patternArgs.fuzzy          = 5;

            //InitPatternWindow();

            //this.toolwinTabControl.TabPages.Add(this.patternWindow);
            //this.toolwinTabControl.TabPages.Add(this.bookmarkWindow);

            filterParams = new FilterParams();
            foreach (string item in ConfigManager.Settings.filterHistoryList)
            {
                filterComboBox.Items.Add(item);
            }

            filterComboBox.DropDownHeight = filterComboBox.ItemHeight * ConfigManager.Settings.preferences.maximumFilterEntriesDisplayed;

            filterRegexCheckBox.Checked         = filterParams.isRegex;
            filterCaseSensitiveCheckBox.Checked = filterParams.isCaseSensitive;
            filterTailCheckBox.Checked          = filterParams.isFilterTail;

            splitContainer1.Panel2Collapsed = true;
            advancedFilterSplitContainer.SplitterDistance = FILTER_ADCANCED_SPLITTER_DISTANCE;

            timeshiftSyncThread = new Thread(SyncTimestampDisplayWorker);
            timeshiftSyncThread.IsBackground = true;
            timeshiftSyncThread.Start();

            logEventHandlerThread = new Thread(LogEventWorker);
            logEventHandlerThread.IsBackground = true;
            logEventHandlerThread.Start();

            //this.filterUpdateThread = new Thread(new ThreadStart(this.FilterUpdateWorker));
            //this.filterUpdateThread.Start();

            advancedButtonImage      = advancedButton.Image;
            searchButtonImage        = filterSearchButton.Image;
            filterSearchButton.Image = null;

            dataGridView.EditModeMenuStrip        = editModeContextMenuStrip;
            markEditModeToolStripMenuItem.Enabled = true;

            panelOpenButtonImage  = new Bitmap(GetType(), "Resources.PanelOpen.gif");
            panelCloseButtonImage = new Bitmap(GetType(), "Resources.PanelClose.gif");

            Settings settings = ConfigManager.Settings;

            if (settings.appBounds != null && settings.appBounds.Right > 0)
            {
                Bounds = settings.appBounds;
            }

            waitingForClose      = false;
            dataGridView.Enabled = false;
            dataGridView.ColumnDividerDoubleClick += dataGridView_ColumnDividerDoubleClick;
            ShowAdvancedFilterPanel(false);
            filterKnobControl1.MinValue      = 0;
            filterKnobControl1.MaxValue      = SPREAD_MAX;
            filterKnobControl1.ValueChanged += filterKnobControl1_ValueChanged;
            filterKnobControl2.MinValue      = 0;
            filterKnobControl2.MaxValue      = SPREAD_MAX;
            filterKnobControl2.ValueChanged += filterKnobControl1_ValueChanged;
            fuzzyKnobControl.MinValue        = 0;
            fuzzyKnobControl.MaxValue        = 10;
            //PreferencesChanged(settings.preferences, true);
            AdjustHighlightSplitterWidth();
            ToggleHighlightPanel(false); // hidden

            bookmarkProvider.BookmarkAdded       += bookmarkProvider_BookmarkAdded;
            bookmarkProvider.BookmarkRemoved     += bookmarkProvider_BookmarkRemoved;
            bookmarkProvider.AllBookmarksRemoved += bookmarkProvider_AllBookmarksRemoved;

            ResumeLayout();

            statusLineTrigger.Signal       += statusLineTrigger_Signal;
            selectionChangedTrigger.Signal += selectionChangedTrigger_Signal;

            PreferencesChanged(parentLogTabWin.Preferences, true, SettingsFlags.GuiOrColors);
        }
Esempio n. 2
0
        public LogWindow(LogTabWindow parent, string fileName, bool isTempFile, bool forcePersistenceLoading)
        {
            _logEventHandlerThread = new Thread(new ThreadStart(LogEventWorker));
            _logEventHandlerThread.IsBackground = true;
            _logEventHandlerThread.Start();

            BookmarkProvider = new BookmarkDataProvider();

            BookmarkColor = Color.FromArgb(165, 200, 225);
            TempTitleName = "";
            SuspendLayout();

            InitializeComponent();

            columnNamesLabel.Text = ""; // no filtering on columns by default

            _parentLogTabWin = parent;
            IsTempFile = isTempFile;
            ColumnizerCallbackObject = new ColumnizerCallback(this);

            FileName = fileName;
            ForcePersistenceLoading = forcePersistenceLoading;

            selectedDataGridView.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
            selectedDataGridView.DefaultCellStyle.Alignment = DataGridViewContentAlignment.TopLeft;
            selectedDataGridView.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;

            selectedDataGridView.SelectionChanged += selectedDataGridView_SelectionChanged;

            dataGridView.CellValueNeeded += DataGridView_CellValueNeeded;
            dataGridView.CellPainting += DataGridView_CellPainting;
            dataGridView.SelectionChanged += DataGridView_NewSelectionChanged;
            dataGridView.DoubleClick += DataGridView_DoubleClick;

            filterGridView.CellValueNeeded += FilterGridView_CellValueNeeded;
            filterGridView.CellPainting += FilterGridView_CellPainting;

            Closing += LogWindow_Closing;
            Disposed += LogWindow_Disposed;

            _timeSpreadCalc = new TimeSpreadCalculator(this);
            timeSpreadingControl1.TimeSpreadCalc = _timeSpreadCalc;
            timeSpreadingControl1.LineSelected += TimeSpreadingControl1_LineSelected;
            tableLayoutPanel1.ColumnStyles[1].SizeType = SizeType.Absolute;
            tableLayoutPanel1.ColumnStyles[1].Width = 20;
            tableLayoutPanel1.ColumnStyles[0].SizeType = SizeType.Percent;
            tableLayoutPanel1.ColumnStyles[0].Width = 100;

            _parentLogTabWin.HighlightSettingsChanged += Parent_HighlightSettingsChanged;

            SetColumnizer(PluginRegistry.GetInstance().RegisteredColumnizers[0]);

            _patternArgs.maxMisses = 5;
            _patternArgs.minWeight = 1;
            _patternArgs.maxDiffInBlock = 5;
            _patternArgs.fuzzy = 5;

            _filterParams = new FilterParams();
            foreach (string item in ConfigManager.Settings.filterHistoryList)
            {
                filterComboBox.Items.Add(item);
            }
            filterRegexCheckBox.Checked = _filterParams.isRegex;
            filterCaseSensitiveCheckBox.Checked = _filterParams.isCaseSensitive;
            filterTailCheckBox.Checked = _filterParams.isFilterTail;

            splitContainer1.Panel2Collapsed = true;
            advancedFilterSplitContainer.SplitterDistance = FILTER_ADCANCED_SPLITTER_DISTANCE;

            _timeshiftSyncThread = new Thread(SyncTimestampDisplayWorker);
            _timeshiftSyncThread.IsBackground = true;
            _timeshiftSyncThread.Start();

            _advancedButtonImage = advancedButton.Image;
            _searchButtonImage = filterSearchButton.Image;
            filterSearchButton.Image = null;

            dataGridView.EditModeMenuStrip = editModeContextMenuStrip;
            markEditModeToolStripMenuItem.Enabled = true;


            _panelOpenButtonImage = new Bitmap(GetType(), "Resources.PanelOpen.gif");
            _panelCloseButtonImage = new Bitmap(GetType(), "Resources.PanelClose.gif");

            Settings settings = ConfigManager.Settings;
            if (settings.appBounds != null && settings.appBounds.Right > 0)
            {
                Bounds = settings.appBounds;
            }

            _waitingForClose = false;
            dataGridView.Enabled = false;
            dataGridView.ColumnDividerDoubleClick += DataGridView_ColumnDividerDoubleClick;
            ShowAdvancedFilterPanel(false);
            filterKnobControl1.MinValue = 0;
            filterKnobControl1.MaxValue = SPREAD_MAX;
            filterKnobControl1.ValueChanged += FilterKnobControl1_CheckForFilterDirty;
            filterKnobControl2.MinValue = 0;
            filterKnobControl2.MaxValue = SPREAD_MAX;
            filterKnobControl2.ValueChanged += FilterKnobControl1_CheckForFilterDirty;
            fuzzyKnobControl.MinValue = 0;
            fuzzyKnobControl.MaxValue = 10;
            ToggleHighlightPanel(false); // hidden

            BookmarkProvider.BookmarkAdded += BookmarkProvider_BookmarkAdded;
            BookmarkProvider.BookmarkRemoved += BookmarkProvider_BookmarkRemoved;

            ResumeLayout();

            _statusLineTrigger.Signal += StatusLineTrigger_Signal;
            _selectionChangedTrigger.Signal += SelectionChangedTrigger_Signal;

            PreferencesChanged(_parentLogTabWin.Preferences, true, SettingsFlags.GuiOrColors);
        }