protected override void OnContextChanged(EventArgs e)
        {
            base.OnContextChanged(e);

            if (Context == null)
            {
                return;
            }

            IFileIconMapper mapper = Context.GetService <IFileIconMapper>();

            dirView.SmallImageList = mapper.ImageList;
            _dirOffset             = mapper.DirectoryIcon;
            _fileOffset            = mapper.FileIcon;

            if (VSVersion.VS2012OrLater)
            {
                return;
            }

            IUIService ds = GetService <IUIService>();

            if (ds != null)
            {
                ToolStripRenderer renderer = ds.Styles["VsToolWindowRenderer"] as ToolStripRenderer;

                if (renderer != null)
                {
                    toolStrip1.Renderer = renderer;
                }
                else
                {
                    IAnkhVSColor color = Context.GetService <IAnkhVSColor>();

                    Color clr;
                    if (color != null && color.TryGetColor(__VSSYSCOLOREX.VSCOLOR_COMMANDBAR_GRADIENT_MIDDLE, out clr))
                    {
                        toolStrip1.BackColor = clr;
                    }

                    if (color != null && color.TryGetColor(__VSSYSCOLOREX.VSCOLOR_COMMANDBAR_HOVEROVERSELECTED, out clr))
                    {
                        toolStrip1.ForeColor = clr;
                    }

                    if (color != null && color.TryGetColor(__VSSYSCOLOREX.VSCOLOR_COMMANDBAR_TEXT_ACTIVE, out clr))
                    {
                        urlLabel.ForeColor = clr;
                    }
                }
            }
        }
Beispiel #2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            conflictView.Context = Context;

            IAnkhVSColor clr = Context.GetService <IAnkhVSColor>();

            if (clr != null)
            {
                Color c;
                if (clr.TryGetColor(__VSSYSCOLOREX.VSCOLOR_TITLEBAR_INACTIVE, out c))
                {
                    resolvePanel.BackColor = c;
                }

                if (clr.TryGetColor(__VSSYSCOLOREX.VSCOLOR_TITLEBAR_INACTIVE_TEXT, out c))
                {
                    resolvePanel.ForeColor = c;
                }

                if (clr.TryGetColor((__VSSYSCOLOREX)(-207) /* VS2010: VSCOLOR_INFOBACKGROUND */, out c))
                {
                    conflictHeader.BackColor = c;
                }
                else
                {
                    conflictHeader.BackColor = System.Drawing.SystemColors.Info;
                }

                if (clr.TryGetColor((__VSSYSCOLOREX)(-208) /* VS2010: VSCOLOR_INFOTEXT */, out c))
                {
                    conflictHeader.ForeColor = c;
                }
                else
                {
                    conflictHeader.ForeColor = System.Drawing.SystemColors.InfoText;
                }
            }

            conflictView.ColumnWidthChanged += new ColumnWidthChangedEventHandler(conflictView_ColumnWidthChanged);
            IDictionary <string, int> widths = ConfigurationService.GetColumnWidths(GetType());

            conflictView.SetColumnWidths(widths);

            ResizeToFit();
            _loaded = true;
        }
        protected virtual void OnThemeChanged(EventArgs e)
        {
            if (Context == null)
            {
                return;
            }

            IWinFormsThemingService wfts = Context.GetService <IWinFormsThemingService>();

            if (wfts != null)
            {
                wfts.ThemeRecursive(this, false);
            }
            else
            {
                IAnkhVSColor colorSvc = Context.GetService <IAnkhVSColor>();

                if (colorSvc != null)
                {
                    Color color;
                    if (colorSvc.TryGetColor(__VSSYSCOLOREX.VSCOLOR_TOOLWINDOW_BACKGROUND, out color))
                    {
                        BackColor = color;
                    }

                    if (colorSvc.TryGetColor(__VSSYSCOLOREX.VSCOLOR_TOOLWINDOW_TEXT, out color))
                    {
                        ForeColor = color;
                    }
                }

                IUIService uis = Context.GetService <IUIService>();

                if (uis != null)
                {
                    Font f = (Font)uis.Styles["DialogFont"];

                    if (f != null)
                    {
                        this.Font = f;
                    }
                }
            }
        }
        protected override void OnThemeChanged(EventArgs e)
        {
            base.OnThemeChanged(e);

            ToolStripRenderer renderer = null;

            System.Windows.Forms.Design.IUIService ds = Context.GetService <System.Windows.Forms.Design.IUIService>();
            if (ds != null)
            {
                renderer = ds.Styles["VsRenderer"] as ToolStripRenderer;
            }

            if (renderer != null)
            {
                pendingChangesTabs.Renderer = renderer;
            }

            if (VSVersion.VS2008OrOlder && !SystemInformation.HighContrast)
            {
                // We should use the VS colors instead of the ones provided by the OS
                IAnkhVSColor colorSvc = Context.GetService <IAnkhVSColor>();

                Color color;
                if (colorSvc.TryGetColor(__VSSYSCOLOREX.VSCOLOR_COMMANDBAR_GRADIENT_MIDDLE, out color))
                {
                    pendingChangesTabs.BackColor = color;
                    pendingChangesTabs.OverflowButton.BackColor = color;
                }

                if (renderer == null && colorSvc.TryGetColor(__VSSYSCOLOREX.VSCOLOR_COMMANDBAR_HOVEROVERSELECTED, out color))
                {
                    pendingChangesTabs.ForeColor = color;
                    pendingChangesTabs.OverflowButton.ForeColor = color;
                }
            }

            foreach (PendingChangesPage p in _pages)
            {
                p.OnThemeChanged(e);
            }

            pendingChangesTabs.Invalidate();
        }