Пример #1
0
        public VS2005DockPaneCaption(DockPane pane) : base(pane)
        {
            SuspendLayout();

            Font         = PluginCore.PluginBase.Settings.DefaultFont;
            m_components = new Container();
            m_toolTip    = new ToolTip(Components);

            // Adjust size based on scale
            double scale = ScaleHelper.GetScale();

            if (scale >= 2) // 200%
            {
                _TextGapTop      = 3;
                _TextGapBottom   = 6;
                _ButtonGapBottom = 4;
            }
            else if (scale >= 1.5) // 150%
            {
                _TextGapTop      = 2;
                _TextGapBottom   = 4;
                _ButtonGapBottom = 4;
            }
            else if (scale >= 1.2) // 120%
            {
                _TextGapTop    = 2;
                _TextGapBottom = 2;
            }
            // Else 100%

            ResumeLayout();
        }
Пример #2
0
 protected override void InitializeItem(ToolStripItem item)
 {
     base.InitializeItem(item);
     // Set default blank image to look ok in high dpi
     if (item.Image == null && item.IsOnDropDown)
     {
         item.Image = PluginBase.MainForm.FindImage("559");
     }
     if (item is ToolStripButton)
     {
         Double scale = ScaleHelper.GetScale();
         if (scale >= 1.5)
         {
             item.Padding = new Padding(4, 2, 4, 2);
         }
         else if (scale >= 1.2)
         {
             item.Padding = new Padding(2, 1, 2, 1);
         }
         else if (renderer is ToolStripSystemRenderer && Win32.IsRunningOnWindows())
         {
             item.Padding = new Padding(2, 2, 2, 2);
         }
     }
     else if (item is ToolStripComboBoxEx)
     {
         ToolStripComboBoxEx comboBox = item as ToolStripComboBoxEx;
         comboBox.Margin             = new Padding(2, 0, 2, 0);
         comboBox.FlatCombo.UseTheme = useTheme;
     }
 }
Пример #3
0
 protected override void InitializeItem(ToolStripItem item)
 {
     base.InitializeItem(item);
     if (item is ToolStripButton)
     {
         Double scale = ScaleHelper.GetScale();
         if (scale >= 1.5)
         {
             item.Padding = new Padding(4, 2, 4, 2);
         }
         else if (scale >= 1.2)
         {
             item.Padding = new Padding(2, 1, 2, 1);
         }
         else if (renderer is ToolStripSystemRenderer && Win32.IsRunningOnWindows())
         {
             item.Padding = new Padding(2, 2, 2, 2);
         }
     }
     else if (item is ToolStripTextBox)
     {
         var   textBox = item as ToolStripTextBox;
         Color border  = Globals.MainForm.GetThemeColor("ToolStripTextBoxControl.BorderColor");
         if (border != Color.Empty) // Are we theming?
         {
             textBox.Margin      = new Padding(2, 1, 2, 1);
             textBox.BorderStyle = BorderStyle.None;
         }
     }
 }
        public static void Init()
        {
            if (initialized)
            {
                return;
            }

            if (Skin == null)
            {
                try
                {
                    Assembly assembly = Assembly.GetExecutingAssembly();
                    Skin = new Bitmap(assembly.GetManifestResourceStream(ScaleHelper.GetScale() > 1.5 ? "SourceControl.Resources.icons32.png" : "SourceControl.Resources.icons.png"));
                }
                catch
                {
                    Skin = ScaleHelper.GetScale() > 1.5 ? new Bitmap(320, 32) : new Bitmap(160, 16);
                }
            }

            fsWatchers = new FSWatchers();
            ovManager  = new OverlayManager(fsWatchers);
            vcManager  = new VCManager(ovManager);

            SetProject(PluginBase.CurrentProject as Project);

            initialized = true;
        }
Пример #5
0
        static public void SetOverlay(VCItemStatus status, TreeNode node, TreeView tree)
        {
            if (!maps.ContainsKey(status))
            {
                return;
            }
            OverlayMap map = maps[status];

            if (map.ContainsKey(node.ImageIndex))
            {
                node.SelectedImageIndex = node.ImageIndex = map[node.ImageIndex];
                return;
            }

            if (tree.ImageList.Images.Count <= node.ImageIndex)
            {
                return;
            }

            Image  original = tree.ImageList.Images[node.ImageIndex];
            Bitmap composed = original.Clone() as Bitmap;
            Int32  curSize  = ScaleHelper.GetScale() > 1.5 ? 32 : 16;

            using (Graphics destination = Graphics.FromImage(composed))
            {
                destination.DrawImage(iconSkin,
                                      new Rectangle(0, 0, composed.Width, composed.Height),
                                      new Rectangle((int)status * curSize, 0, curSize, curSize), GraphicsUnit.Pixel);
            }
            int index = tree.ImageList.Images.Count;

            tree.ImageList.Images.Add(composed);
            map[node.ImageIndex]    = index;
            node.SelectedImageIndex = node.ImageIndex = index;
        }
Пример #6
0
        /// <summary>
        /// Initializes the graphics used in the control.
        /// </summary>
        private void InitializeGraphics()
        {
            Color text = Globals.MainForm.GetThemeColor("QuickFind.ForeColor");
            Color fore = Globals.MainForm.GetThemeColor("ToolStripTextBoxControl.ForeColor");
            Color back = Globals.MainForm.GetThemeColor("ToolStripTextBoxControl.BackColor");

            if (back != Color.Empty)
            {
                this.backColor = this.findTextBox.BackColor = back;
            }
            if (text != Color.Empty)
            {
                this.infoLabel.ForeColor = text;
            }
            if (fore != Color.Empty)
            {
                this.findTextBox.ForeColor = fore;
            }
            if (ScaleHelper.GetScale() >= 1.5)
            {
                this.nextButton.Image     = Globals.MainForm.FindImage("67");
                this.previousButton.Image = Globals.MainForm.FindImage("63");
                this.closeButton.Image    = Globals.MainForm.FindImage("111");
            }
        }
Пример #7
0
        /// <summary>
        /// Initializes the graphics used in the control.
        /// </summary>
        private void InitializeGraphics()
        {
            Color   text     = Globals.MainForm.GetThemeColor("QuickFind.ForeColor");
            Color   fore     = Globals.MainForm.GetThemeColor("ToolStripTextBoxControl.ForeColor");
            Color   back     = Globals.MainForm.GetThemeColor("ToolStripTextBoxControl.BackColor");
            Boolean useTheme = Globals.MainForm.GetThemeColor("QuickFind.BackColor") != Color.Empty;

            if (back != Color.Empty)
            {
                this.backColor = this.findTextBox.BackColor = back;
            }
            if (text != Color.Empty)
            {
                this.infoLabel.ForeColor = text;
            }
            if (fore != Color.Empty)
            {
                this.findTextBox.ForeColor = fore;
            }
            if (ScaleHelper.GetScale() >= 1.5)
            {
                this.nextButton.Image     = Globals.MainForm.FindImage("67");
                this.previousButton.Image = Globals.MainForm.FindImage("63");
                this.closeButton.Image    = Globals.MainForm.FindImage("111");
            }
            Padding pad = new Padding(0, 2, 6, useTheme ? 3 : 1);

            this.highlightHost.Margin = this.matchCaseHost.Margin = this.wholeWordHost.Margin = pad;
            PluginBase.MainForm.SetUseTheme(this.highlightCheckBox, useTheme);
            PluginBase.MainForm.SetUseTheme(this.matchCaseCheckBox, useTheme);
            PluginBase.MainForm.SetUseTheme(this.wholeWordCheckBox, useTheme);
            PluginBase.MainForm.ThemeControls(this.highlightCheckBox);
            PluginBase.MainForm.ThemeControls(this.matchCaseCheckBox);
            PluginBase.MainForm.ThemeControls(this.wholeWordCheckBox);
        }
Пример #8
0
 /// <summary>
 /// Initializes the graphics used in the control.
 /// </summary>
 private void InitializeGraphics()
 {
     if (ScaleHelper.GetScale() < 1.5)
     {
         return;
     }
     this.nextButton.Image     = Globals.MainForm.FindImage("67");
     this.previousButton.Image = Globals.MainForm.FindImage("63");
     this.closeButton.Image    = Globals.MainForm.FindImage("111");
 }
Пример #9
0
 /// <summary>
 /// Initializes the ui based on settings
 /// </summary>
 private void InitializeInterface()
 {
     this.addressComboBox.FlatStyle  = Globals.Settings.ComboBoxFlatStyle;
     this.toolStrip.Renderer         = new DockPanelStripRenderer(true, true);
     this.toolStrip.ImageScalingSize = ScaleHelper.Scale(new Size(16, 16));
     if (ScaleHelper.GetScale() >= 1.5)
     {
         ComponentResourceManager resources = new ComponentResourceManager(typeof(Browser));
         this.goButton.Image      = ((System.Drawing.Image)(resources.GetObject("goButton.Image32")));
         this.forwardButton.Image = ((System.Drawing.Image)(resources.GetObject("forwardButton.Image32")));
         this.refreshButton.Image = ((System.Drawing.Image)(resources.GetObject("refreshButton.Image32")));
         this.backButton.Image    = ((System.Drawing.Image)(resources.GetObject("backButton.Image32")));
         this.Refresh();
     }
 }
Пример #10
0
        /// <summary>
        /// Static constructor
        /// </summary>
        static ImageManager()
        {
            Double scale = ScaleHelper.GetScale();

            Cache = new Dictionary <String, Bitmap>();
            if (scale >= 1.5)
            {
                Size    = 32;
                Padding = scale > 1.5 ? 2 : 1;
                Source  = new Bitmap(FileNameHelper.Images32);
            }
            else
            {
                Size    = 16;
                Padding = 0;
                Source  = new Bitmap(FileNameHelper.Images);
            }
            Source = (Bitmap)AdjustImage(Source);
        }
Пример #11
0
        /// <summary>
        /// Resizes the image and encodes the BlurHash representation of the image.
        /// </summary>
        /// <param name="xComponent">The number x components.</param>
        /// <param name="yComponent">The number y components.</param>
        /// <param name="filename">The path to an encoded image on the file system.</param>
        /// <param name="maxWidth">The maximum width to resize the image to.</param>
        /// <param name="maxHeight">The maximum height to resize the image to.</param>
        /// <returns>BlurHash representation of the image.</returns>
        public static string Encode(int xComponent, int yComponent, string filename, int maxWidth, int maxHeight)
        {
            using (SKCodec codec = SKCodec.Create(filename))
            {
                var   width       = codec.Info.Width;
                var   height      = codec.Info.Height;
                float scaleFactor = 0;
                if (width > maxWidth || height > maxHeight)
                {
                    scaleFactor = ScaleHelper.GetScale(width, height, maxWidth, maxHeight);
                    SKSizeI supportedScale = codec.GetScaledDimensions(scaleFactor);
                    width  = supportedScale.Width;
                    height = supportedScale.Height;
                }

                var newInfo = new SKImageInfo()
                {
                    Width      = width,
                    Height     = height,
                    ColorType  = SKColorType.Rgba8888,
                    AlphaType  = SKAlphaType.Unpremul,
                    ColorSpace = SKColorSpace.CreateSrgb()
                };

                using (SKBitmap bitmap = SKBitmap.Decode(codec, newInfo))
                {
                    if (scaleFactor == 0)
                    {
                        return(EncodeInternal(xComponent, yComponent, bitmap));
                    }

                    var(scaledWidth, scaledHeight) = ScaleHelper.GetScaleDimensions(bitmap.Width, bitmap.Height, scaleFactor);

                    newInfo = newInfo.WithSize(scaledWidth, scaledHeight);

                    using (SKBitmap scaledBitmap = bitmap.Resize(newInfo, SKFilterQuality.Low))
                    {
                        return(EncodeInternal(xComponent, yComponent, scaledBitmap));
                    }
                }
            }
        }
Пример #12
0
        /// <summary>
        /// Static constructor
        /// </summary>
        static ImageManager()
        {
            double scale = ScaleHelper.GetScale();

            Cache        = new Dictionary <string, ImagePair>();
            AutoAdjusted = new List <ImagePair>();

            if (scale >= 1.5)
            {
                Size    = Size32;
                Padding = scale > 1.5 ? 2 : 1;
                Source  = new Bitmap(FileNameHelper.Images32);
            }
            else
            {
                Size    = Size16;
                Padding = 0;
                Source  = new Bitmap(FileNameHelper.Images);
            }
        }
Пример #13
0
        private void init()
        {
            this.AutoKeyHandling     = true;
            this.dgv                 = new DataGridViewEx();
            this.dgv.Dock            = DockStyle.Fill;
            this.dgv.BorderStyle     = BorderStyle.None;
            this.dgv.BackgroundColor = SystemColors.Window;
            this.dgv.Font            = PluginBase.Settings.DefaultFont;
            if (ScaleHelper.GetScale() > 1)
            {
                this.dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            }
            else
            {
                this.dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
            }
            this.dgv.ColumnHeadersBorderStyle  = DataGridViewHeaderBorderStyle.None;
            this.dgv.AutoSizeColumnsMode       = DataGridViewAutoSizeColumnsMode.Fill;
            this.dgv.CellBorderStyle           = DataGridViewCellBorderStyle.Single;
            this.dgv.EnableHeadersVisualStyles = true;
            this.dgv.RowHeadersVisible         = false;
            DataGridViewCellStyle viewStyle = new DataGridViewCellStyle();

            viewStyle.Padding = new Padding(1);
            this.dgv.ColumnHeadersDefaultCellStyle = viewStyle;
            this.ColumnBreakPointEnable            = new DataGridViewCheckBoxColumn();
            this.ColumnBreakPointFilePath          = new DataGridViewTextBoxColumn();
            this.ColumnBreakPointFileName          = new DataGridViewTextBoxColumn();
            this.ColumnBreakPointLine = new DataGridViewTextBoxColumn();
            this.ColumnBreakPointExp  = new DataGridViewTextBoxColumn();
            this.ColumnBreakPointEnable.HeaderText   = TextHelper.GetString("Label.Enable");
            this.ColumnBreakPointEnable.Name         = "Enable";
            this.ColumnBreakPointEnable.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
            this.ColumnBreakPointEnable.Width        = 70;
            this.ColumnBreakPointFilePath.HeaderText = TextHelper.GetString("Label.Path");
            this.ColumnBreakPointFilePath.Name       = "FilePath";
            this.ColumnBreakPointFilePath.ReadOnly   = true;
            this.ColumnBreakPointFileName.HeaderText = TextHelper.GetString("Label.File");
            this.ColumnBreakPointFileName.Name       = "FileName";
            this.ColumnBreakPointFileName.ReadOnly   = true;
            this.ColumnBreakPointLine.HeaderText     = TextHelper.GetString("Label.Line");
            this.ColumnBreakPointLine.Name           = "Line";
            this.ColumnBreakPointLine.ReadOnly       = true;
            this.ColumnBreakPointExp.HeaderText      = TextHelper.GetString("Label.Exp");
            this.ColumnBreakPointExp.Name            = "Exp";
            this.dgv.AllowUserToAddRows = false;
            this.dgv.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[]
            {
                this.ColumnBreakPointEnable,
                this.ColumnBreakPointFilePath,
                this.ColumnBreakPointFileName,
                this.ColumnBreakPointLine,
                this.ColumnBreakPointExp
            });
            foreach (DataGridViewColumn column in dgv.Columns)
            {
                column.Width = ScaleHelper.Scale(column.Width);
            }
            defaultColor = dgv.Rows[dgv.Rows.Add()].DefaultCellStyle.BackColor;
            dgv.Rows.Clear();
            this.dgv.CellEndEdit     += new DataGridViewCellEventHandler(dgv_CellEndEdit);
            this.dgv.CellMouseUp     += new DataGridViewCellMouseEventHandler(dgv_CellMouseUp);
            this.dgv.CellDoubleClick += new DataGridViewCellEventHandler(dgv_CellDoubleClick);
            this.Controls.Add(this.dgv);
            InitializeComponent();
            tsbRemoveSelected.Image          = PluginBase.MainForm.FindImage("548|27|5|5");
            tsbRemoveFiltered.Image          = PluginBase.MainForm.FindImage("549|27|5|5");
            tsbAlternateFiltered.Image       = PluginBase.MainForm.FindImage("136|23|5|5");
            tsbExportFiltered.Image          = PluginBase.MainForm.FindImage("549|22|4|4");
            tsbImport.Image                  = PluginBase.MainForm.FindImage("549|8|4|4");
            this.tscbFilterColumns.FlatStyle = PluginBase.Settings.ComboBoxFlatStyle;
            this.tsActions.Renderer          = new DockPanelStripRenderer(false);
            ScrollBarEx.Attach(dgv);
        }