Beispiel #1
0
        protected void OnItemClicked(ItemClickedEventArgs e)
        {
            int index = this.IndexFromPoint(e.X, e.Y);

            if (index != -1)
            {
                IMedia   media = (this.SelectedItem = this.Items[index]) as IMedia;
                IconPack pack  = null;

                if (media == null)
                {
                    pack = (this.SelectedItem = this.Items[index]) as IconPack;
                    if (pack == null)
                    {
                        return;
                    }
                }
                this.Select();

                e.Media     = media;
                e.IsOutSide = false;
            }
            else
            {
                e.IsOutSide = true;
            }

            e.CurrentIndex = index;

            if (ItemClicked != null)
            {
                ItemClicked(this, e);
            }
        }
Beispiel #2
0
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            base.OnDrawItem(e);

            if (isNormal)
            {
                return;
            }

            if (item == null)
            {
                return;
            }

            int Xpadding = e.Bounds.X + this.IconPadding.X;
            int Ypadding = e.Bounds.Y + this.IconPadding.Y;

            if (e.State.HasFlag(DrawItemState.Selected))
            {
                Xpadding += 1;
                Ypadding += 1;
                lgb       = new LinearGradientBrush(e.Bounds, _backColorCheckedGradientStart, _backColorCheckedGradientEnd, 90, true);
                brdCol    = _borderCheckedColor;
            }
            else
            {
                lgb    = new LinearGradientBrush(e.Bounds, _backColorGradientStart, _backColorGradientEnd, 1, true);
                brdCol = this._borderColor;
            }

            using (GraphicsPath gp = DrawBorder(e, brdCol))
                e.Graphics.FillPath(lgb, gp);

            IconPack iconPack = ((IconPack)item);

            //text = "'" + iconPack.Name + "'.     Version: " + iconPack.Version + ".     Author: " + iconPack.Author;
            Brush[] brush = new Brush[2] {
                Brushes.Gainsboro, new SolidBrush(this.ForeColor)
            };

            Image     im       = iconPack.Image;
            Rectangle photoRct = new Rectangle(Xpadding, Ypadding, im.Width, im.Height);

            e.Graphics.DrawImage(im, photoRct);

            //int Xoffset = Xpadding + im.Width + 22;

            //for (int i = 0; i < 2; i++)
            //e.Graphics.DrawString(text, this.Font, brush[i],
            //    Xpadding + im.Width + 22 - i,
            //    2 - i + Ypadding - this.IconPadding.Y - 1 + (e.Bounds.Height - this.Font.Height) / 2);

            lgb.Dispose();
        }
Beispiel #3
0
        private void iconsListBox_ItemClicked(object sender, UserControls.ItemClickedEventArgs e)
        {
            int index = iconsListBox.IndexFromPoint(e.X, e.Y);

            if (index != -1)
            {
                iconsListBox.SelectedItem = iconsListBox.Items[iconsListBox.IndexFromPoint(e.X, e.Y)];
                iconsListBox.Select();

                IconPack pack = (IconPack)iconsListBox.SelectedItem;

                this.UpdateIconsPackGroupBox(pack);

                if (e.Button == MouseButtons.Right)
                {
                    this.cmsMediaListBox.Show(this.iconsListBox, e.X, e.Y);
                }
            }
        }
Beispiel #4
0
        public ToolsForm()
        {
            InitializeComponent();

            this.dataGridView.AutoGenerateColumns = true;

            this.BuildToolStrip();
            this.UpdateTabIcons();


            IconPack defaultPack = new IconPack(Properties.Resources.Shauni, "Shauni", "1.0.0", "Filippo Testino")
            {
                Description = "Default icons pack for Shauni v1.1.0.0+",
                Tag         = new Tag()
                {
                    AuthorLink = "No link!", Credits = "www.Veryicon.com"
                }
            };

            this.iconsListBox.Items.Add(defaultPack);

            var directories = System.IO.Directory.GetDirectories(Paths.IconPacks(string.Empty));

            foreach (string dir in directories)
            {
                IconPack pack           = new IconPack();
                var      lastFolderName = new System.IO.FileInfo(dir).Name;

                try
                {
                    IconPack pack2 = pack.LoadFromFile(Paths.IconPacks(lastFolderName));
                    this.iconsListBox.Items.Add(pack2);
                }
                catch
                {
                    SharedData.Logger.Append("The Icon Pack '" + lastFolderName + "' is corrupted or invalid and has not been loaded.", 1);
                }
            }

            this.LoadSatelliteAssembly();
        }
Beispiel #5
0
 public static void UseIconPack(IconPack iconPack)
 {
     Icons = IconPacks[iconPack].Concat(IconsDefault)
             .GroupBy(x => x.Key)
             .ToDictionary(x => x.Key, x => new Uri($"pack://application:,,,/KHSave.SaveEditor;component/Images/{x.First().Value}.png"));
 }
Beispiel #6
0
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            if ((e.Index < 0) || (e.Index >= this.Items.Count))
            {
                return;
            }

            e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;

            //Gradient for background
            LinearGradientBrush lgb = new LinearGradientBrush(e.Bounds,
                                                              _backColorGradientStart, _backColorGradientEnd, 1, true);

            var item     = this.Items[e.Index];
            int Xpadding = e.Bounds.X + this.IconPadding.X;
            int Ypadding = e.Bounds.Y + this.IconPadding.Y;

            Color brdCol = this._borderColor;

            if (e.State.HasFlag(DrawItemState.Selected))
            {
                Xpadding += 1;
                Ypadding += 1;
                lgb       = new LinearGradientBrush(e.Bounds,
                                                    _backColorCheckedGradientStart, _backColorCheckedGradientEnd, 1, true);
                brdCol = _borderCheckedColor;
            }

            //Draw photo image
            Bitmap image = Properties.Resources.Attention;

            string text = "";

            if (item is Song)
            {
                using (GraphicsPath gp = DrawBorder(e, brdCol))
                    e.Graphics.FillPath(lgb, gp);

                image = Properties.Resources.AudioFormat;
                Rectangle photoRct = new Rectangle(Xpadding, Ypadding, image.Width, image.Height);
                e.Graphics.DrawImage(image, photoRct);

                text = ((IMedia)item).Name.ToProperCase();

                Brush[] brush = new Brush[2] {
                    Brushes.Gainsboro, new SolidBrush(this.ForeColor)
                };

                for (int i = 0; i < 2; i++)
                {
                    e.Graphics.DrawString(text, this.Font, brush[i],
                                          Xpadding + image.Width + 22 - i,
                                          2 - i + Ypadding - this.IconPadding.Y - 1 + (e.Bounds.Height - this.Font.Height) / 2);
                }

                /*if (((IMedia)item).IsPlaying)
                 * {
                 *  int width = this.GetStringWidth(e.Graphics, text);
                 *
                 *  Image image2 = Properties.Resources.isPlaying;
                 *  Rectangle isPlayingRct = new Rectangle(width + photoRct.Width + 2 * Xpadding + image.Width + 22, Ypadding + 2, 12, 12);
                 *  e.Graphics.DrawImage(image2, isPlayingRct);
                 * }*/
            }
            else if (item is IconPack)
            {
                using (GraphicsPath gp = DrawBorder(e, brdCol))
                    e.Graphics.FillPath(lgb, gp);

                IconPack iconPack = ((IconPack)item);

                //text = "'" + iconPack.Name + "'.     Version: " + iconPack.Version + ".     Author: " + iconPack.Author;
                Brush[] brush = new Brush[2] {
                    Brushes.Gainsboro, new SolidBrush(this.ForeColor)
                };

                Image     im       = iconPack.Image;
                Rectangle photoRct = new Rectangle(Xpadding, Ypadding, im.Width, im.Height);
                e.Graphics.DrawImage(im, photoRct);

                //int Xoffset = Xpadding + im.Width + 22;

                //for (int i = 0; i < 2; i++)
                //e.Graphics.DrawString(text, this.Font, brush[i],
                //    Xpadding + im.Width + 22 - i,
                //    2 - i + Ypadding - this.IconPadding.Y - 1 + (e.Bounds.Height - this.Font.Height) / 2);
            }
            else
            {
                e.Graphics.FillRectangle(lgb, e.Bounds);
                text = this.Items[e.Index].ToString();

                e.Graphics.DrawString(text, this.Font, Brushes.DimGray,
                                      e.Bounds.X, e.Bounds.Y + (e.Bounds.Height - this.Font.Height) / 2);
            }

            lgb.Dispose();
        }