public VisualizerControl(IToolWindowIntegration integration, ActivateWindow activateWindow)
        {
            _context = integration.GetVisualizerContext();
            _context.PropertyChanged    += ContextPropertyChanged;
            _context.GroupFetched       += GroupFetched;
            _context.GroupFetching      += SetupDataFetch;
            _context.CellSelectionEvent += CellSelected;
            DataContext = _context;
            InitializeComponent();

            _wavemap = new WavemapImage(HeaderHost.WavemapImage, _context);
            _wavemap.NavigationRequested += NavigateToWave;
            HeaderHost.WavemapSelector.Setup(_context, _wavemap);
            _activateWindow = activateWindow;

            _integration           = integration;
            _integration.AddWatch += AddWatch;
            PropertyChangedEventManager.AddHandler(_context.Options.VisualizerOptions, OptionsChanged, "");
            PropertyChangedEventManager.AddHandler(_context.Options.DebuggerOptions, OptionsChanged, "");
            PropertyChangedEventManager.AddHandler(_context.Options.VisualizerAppearance, OptionsChanged, "");
            PropertyChangedEventManager.AddHandler(_context.Options.VisualizerColumnStyling, VisualizerColumnStylingPropertyChanged, "");

            _fontAndColorProvider = new FontAndColorProvider();
            _fontAndColorProvider.FontAndColorInfoChanged += RefreshDataStyling;
            _table = new VisualizerTable(
                _context.Options,
                _fontAndColorProvider,
                getValidWatches: () => _context?.BreakData?.Watches);
            _table.WatchStateChanged += (newWatchState, invalidatedRows) =>
            {
                _context.Options.DebuggerOptions.Watches.Clear();
                _context.Options.DebuggerOptions.Watches.AddRange(newWatchState);
                if (invalidatedRows != null)
                {
                    foreach (var row in invalidatedRows)
                    {
                        SetRowContentsFromBreakState(row);
                    }
                }
            };
            _table.SetScalingMode(_context.Options.VisualizerAppearance.ScalingMode);
            TableHost.Setup(_table);
            RestoreSavedState();
        }
Пример #2
0
        public FontAndColorState(FontAndColorProvider provider)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            var highlightColors = (DataHighlightColor[])Enum.GetValues(typeof(DataHighlightColor));

            HighlightForeground = new Color[highlightColors.Length];
            HighlightBackground = new Color[highlightColors.Length];
            HighlightBold       = new bool[highlightColors.Length];
            foreach (var color in highlightColors)
            {
                var(fg, bg, bold) = provider.GetHighlightInfo(color);
                HighlightForeground[(int)color] = fg;
                HighlightBackground[(int)color] = bg;
                HighlightBold[(int)color]       = bold;
            }

            var heatmapColors = (HeatmapColor[])Enum.GetValues(typeof(HeatmapColor));

            HeatmapBackground = new Color[heatmapColors.Length];
            foreach (var color in heatmapColors)
            {
                var(_, bg, _) = provider.GetInfo(color);
                HeatmapBackground[(int)color] = bg;
            }

            (HeaderForeground, HeaderBackground, HeaderBold)          = provider.GetInfo(FontAndColorItem.Header);
            (WatchNameForeground, WatchNameBackground, WatchNameBold) = provider.GetInfo(FontAndColorItem.WatchNames);

            ColumnSeparatorBrush            = new SolidBrush(provider.GetInfo(FontAndColorItem.ColumnSeparator).bg);
            HiddenColumnSeparatorBrush      = new SolidBrush(provider.GetInfo(FontAndColorItem.HiddenColumnSeparator).bg);
            SliceHiddenColumnSeparatorBrush = new SolidBrush(provider.GetInfo(FontAndColorItem.SliceHiddenColumnSeparator).bg);
            SliceSubgroupSeparatorBrush     = new SolidBrush(provider.GetInfo(FontAndColorItem.SliceSubgroupSeparator).bg);

            var(fontName, fontSize) = provider.GetFontInfo();
            RegularFont             = new Font(fontName, fontSize, FontStyle.Regular);
            BoldFont = new Font(fontName, fontSize, FontStyle.Bold);
        }