Esempio n. 1
0
        /// <summary>
        /// Adjusts the image for different themes
        /// </summary>
        public static Image AdjustImage(Image image)
        {
            String style = Globals.MainForm.GetThemeValue("ImageManager.ImageSet");

            if (style == "Bright")
            {
                return(ImageKonverter.ImageAdjust(image, 20, 0));
            }
            else if (style == "Dim")
            {
                return(ImageKonverter.ImageAdjust(image, -5, -2));
            }
            else if (style == "Dark")
            {
                return(ImageKonverter.ImageAdjust(image, -5, -10));
            }
            else if (style == "Darker")
            {
                return(ImageKonverter.ImageAdjust(image, -20, -20));
            }
            else if (style == "Black")
            {
                return(ImageKonverter.ImageAdjust(image, -50, -25));
            }
            else
            {
                return(image);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Refreshes the icon.
 /// </summary>
 public void RefreshIcon()
 {
     if (image != null)
     {
         Icon = ImageKonverter.ImageToIcon(image);
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Ask the shell to feed us the appropriate icon for the given file, but
        /// first try looking in our cache to see if we've already loaded it.
        /// </summary>
        private int ExtractIconIfNecessary(String path)
        {
            Icon   icon;
            Size   size = GetSmallIconSize();
            String ext  = Path.GetExtension(path);

            if (String.IsNullOrEmpty(ext))
            {
                ext = "folder";
            }
            if (this.imageList.Images[ext] != null)
            {
                return(this.imageList.Images.IndexOfKey(ext));
            }
            else
            {
                if (File.Exists(path))
                {
                    icon = IconExtractor.GetFileIcon(path, false, true);
                }
                else
                {
                    icon = IconExtractor.GetFolderIcon(path, false, true);
                }
                Image image = ImageKonverter.ImageResize(icon.ToBitmap(), size.Width, size.Height);
                this.imageList.Images.Add(ext, image); icon.Dispose(); image.Dispose();
                return(this.imageList.Images.Count - 1);
            }
        }
Esempio n. 4
0
        public static FDImage GetGray(string data)
        {
            Image image     = (mainForm != null) ? mainForm.FindImage(data) : new Bitmap(16, 16);
            Image converted = ImageKonverter.ImageToGrayscale(image);

            imageList.Images.Add(converted);
            return(new FDImage(converted, imageList.Images.Count - 1));
        }
Esempio n. 5
0
        public static FDImage GetGray(string data)
        {
            Image image = (mainForm != null) ? mainForm.FindImage(data, false) : new Bitmap(16, 16);

            image = mainForm.GetAutoAdjustedImage(ImageKonverter.ImageToGrayscale(image));
            imageList.Images.Add(image);
            return(new FDImage(image, imageList.Images.Count - 1));
        }
Esempio n. 6
0
 /// <summary>
 /// Creates the Start Page Tab
 /// </summary>
 public void CreateStartPage()
 {
     this.startPageWebBrowser = new StartPageWebBrowser(this.CurrentPageUrl, this.CurrentRssUrl);
     this.startPage           = PluginBase.MainForm.CreateCustomDocument(this.startPageWebBrowser);
     this.startPage.Icon      = ImageKonverter.ImageToIcon(this.pluginImage);
     this.startPage.Disposed += new EventHandler(this.PluginPanelDisposed);
     this.startPage.Closing  += new CancelEventHandler(this.PluginPanelClosing);
     this.startPage.Text      = TextHelper.GetString("Title.StartPage");
 }
Esempio n. 7
0
        /// <summary>
        /// Gets an adjusted copy of the specified image.
        /// </summary>
        public static Image SetImageAdjustment(Image original)
        {
            int saturation, brightness;

            if (GetImageAdjustments(out saturation, out brightness))
            {
                return(ImageKonverter.ImageAdjust(original, saturation, brightness));
            }
            return(new Bitmap(original));
        }
        /// <summary>
        /// Resizes the image based on the display scale. Uses high quality settings.
        /// </summary>
        public static Bitmap Scale(Bitmap image)
        {
            if (GetScale() == 1)
            {
                return(image);
            }
            int width  = Scale(image.Width);
            int height = Scale(image.Height);

            return((Bitmap)ImageKonverter.ImageResize(image, width, height));
        }
Esempio n. 9
0
 /// <summary>
 /// Automaticly updates the document icon
 /// </summary>
 private void UpdateDocumentIcon(String file)
 {
     if (this.useCustomIcon)
     {
         return;
     }
     if (!this.IsBrowsable)
     {
         this.Icon = IconExtractor.GetFileIcon(file, true);
     }
     else
     {
         Image image = Globals.MainForm.FindImage("480");
         this.Icon          = ImageKonverter.ImageToIcon(image);
         this.useCustomIcon = true;
     }
 }
Esempio n. 10
0
        /// <summary>
        /// Ask the shell to feed us the appropriate icon for the given file, but
        /// first try looking in our cache to see if we've already loaded it.
        /// </summary>
        private int ExtractIconIfNecessary(String path)
        {
            Icon icon;
            Size size = GetSmallIconSize();

            if (File.Exists(path))
            {
                icon = IconExtractor.GetFileIcon(path, false, true);
            }
            else
            {
                icon = IconExtractor.GetFolderIcon(path, false, true);
            }
            Image image = ImageKonverter.ImageResize(icon.ToBitmap(), size.Width, size.Height);

            this.imageList.Images.Add(image); icon.Dispose(); image.Dispose();
            return(this.imageList.Images.Count - 1);
        }
Esempio n. 11
0
        public static FDImage ExtractIconIfNecessary(string file)
        {
            string extension = Path.GetExtension(file);

            if (extensionIcons.ContainsKey(extension))
            {
                return(extensionIcons[extension]);
            }
            else
            {
                Icon  icon  = IconExtractor.GetFileIcon(file, true);
                Image image = ImageKonverter.ImageResize(icon.ToBitmap(), 16, 16);
                icon.Dispose(); imageList.Images.Add(image);
                int     index   = imageList.Images.Count - 1; // of the icon we just added
                FDImage fdImage = new FDImage(image, index);
                extensionIcons.Add(extension, fdImage);
                return(fdImage);
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Adjust colors of all cached images.
        /// </summary>
        public static void AdjustAllImages()
        {
            int saturation, brightness;

            GetImageAdjustments(out saturation, out brightness);

            for (int i = 0, length = AutoAdjusted.Count; i < length; i++)
            {
                var imagePair = AutoAdjusted[i];
                var adjusted  = imagePair.Adjusted;
                if (adjusted == null)
                {
                    AutoAdjusted.RemoveAt(i--);
                    length--;
                }
                else
                {
                    ImageKonverter.ImageAdjust(imagePair.Original, adjusted, saturation, brightness);
                }
            }
        }
Esempio n. 13
0
 /// <summary>
 /// Makes the plugin panel top most form of FD
 /// </summary>
 private void TopMostButtonClick(Object sender, EventArgs e)
 {
     this.topMostButton.Checked = !this.topMostButton.Checked;
     if (this.topMostButton.Checked)
     {
         this.ClosePluginPanel();
         this.popupForm = new Form();
         this.popupForm.Controls.Add(this);
         this.popupForm.MinimumSize = new Size(350, 120);
         this.popupForm.Text        = TextHelper.GetString("Title.PluginPanel");
         this.popupForm.FormClosed += new FormClosedEventHandler(this.PopupFormClosed);
         this.popupForm.Icon        = ImageKonverter.ImageToIcon(PluginBase.MainForm.FindImage("412"));
         if (this.Settings.KeepPopupTopMost)
         {
             this.popupForm.TopMost = true;
         }
         this.popupForm.Show();
     }
     else
     {
         this.popupForm.Close();
     }
 }