Example #1
0
        private void Redraw()
        {
            panelVScroll.SuspendLayout();

            panelVScroll.RemoveAllControls();

            // design for std 8.25 font sizes

            Bitmap backimage = new Bitmap(EDDiscovery.Icons.Controls.Selector);
            Color  centre = backimage.GetPixel(48, 48);
            Size   iconsize = new Size(24, 24);
            int    width = 96;
            int    padbot = 6, padbetween = 5;

            float brigthness = ExtendedControls.Theme.Current.Form.GetBrightness();
            Image selback    = brigthness < 0.3 ? EDDiscovery.Icons.Controls.Selector : EDDiscovery.Icons.Controls.Selector2;

            {
                Versions.VersioningManager mgr = new Versions.VersioningManager();
                AddOnManagerForm.ReadLocalFiles(mgr, true);

                int i = mgr.DownloadItems.Count;

                CompositeButton cb = CompositeButton.QuickInit(
                    selback,
                    (i == 0) ? "NO ADD ONS!".T(EDTx.UserControlPanelSelector_NOADDONS) : i.ToString() + " Add Ons".T(EDTx.UserControlPanelSelector_AddOns),
                    ExtendedControls.Theme.Current.GetFont,
                    (i == 0) ? Color.Red : (ExtendedControls.Theme.Current.TextBlockColor.GetBrightness() < 0.1 ? Color.AntiqueWhite : ExtendedControls.Theme.Current.TextBlockColor),
                    Color.Transparent,
                    EDDiscovery.Icons.Controls.ManageAddOns, iconsize,
                    new Image[] { EDDiscovery.Icons.Controls.ManageAddOns }, iconsize,
                    padbetween,
                    ButtonPress);

                panelVScroll.Controls.Add(cb);
                cb.Name = "Add on";
                cb.Tag  = null;
                toolTip.SetToolTip(cb.Buttons[0], "Click to add or remove Add Ons".T(EDTx.UserControlPanelSelector_TTA));
                toolTip.SetToolTip(cb.Decals[0], "Add ons are essential additions to your EDD experience!".T(EDTx.UserControlPanelSelector_TTB));

                ExtendedControls.Theme.Current.ApplyStd(cb);       // need to theme up the button
                cb.Size                 = new Size(width, cb.FindMaxSubControlArea(0, padbot).Height);
                cb.Label.BackColor      = cb.Decals[0].BackColor = Color.Transparent;
                cb.Buttons[0].BackColor = centre;   // but then fix the back colour again
            }

            PanelInformation.PanelIDs[] pids = PanelInformation.GetUserSelectablePanelIDs(EDDConfig.Instance.SortPanelsByName);

            for (int i = 0; i < pids.Length; i++)
            {
                PanelInformation.PanelInfo pi = PanelInformation.GetPanelInfoByPanelID(pids[i]);

                CompositeButton cb = CompositeButton.QuickInit(
                    selback,
                    pi.WindowTitle,
                    ExtendedControls.Theme.Current.GetFont,
                    ExtendedControls.Theme.Current.TextBlockColor.GetBrightness() < 0.1 ? Color.AntiqueWhite : ExtendedControls.Theme.Current.TextBlockColor,
                    Color.Transparent,
                    pi.TabIcon, iconsize,
                    new Image[] { EDDiscovery.Icons.Controls.Popout, EDDiscovery.Icons.Controls.AddTab }, iconsize,
                    padbetween,
                    ButtonPress);
                cb.SuspendLayout();
                panelVScroll.Controls.Add(cb);
                cb.Tag = pi.PopoutID;
                toolTip.SetToolTip(cb.Buttons[0], "Pop out in a new window".T(EDTx.UserControlPanelSelector_PP1));
                toolTip.SetToolTip(cb.Buttons[1], "Open as a new menu tab".T(EDTx.UserControlPanelSelector_MT1));
                toolTip.SetToolTip(cb.Decals[0], pi.Description);

                ExtendedControls.Theme.Current.ApplyStd(cb);
                cb.ResumeLayout();

                cb.Size                 = new Size(width, cb.FindMaxSubControlArea(0, padbot).Height);
                cb.Label.BackColor      = cb.Decals[0].BackColor = Color.Transparent;
                cb.Buttons[0].BackColor = centre; // need to reset the colour back!
                cb.Buttons[1].BackColor = centre; // need to reset the colour back!
            }

            panelVScroll.Scale(this.FindForm().CurrentAutoScaleFactor());
            Reposition();

            panelVScroll.ResumeLayout();
        }
        private void Redraw()
        {
            panelVScroll.SuspendLayout();

            panelVScroll.RemoveAllControls();

            Bitmap backimage = new Bitmap(EDDiscovery.Icons.Controls.Selector_Background);
            Color  centre    = backimage.GetPixel(48, 48);


            {
                Versions.VersioningManager mgr = new Versions.VersioningManager();
                AddOnManagerForm.ReadLocalFiles(mgr, true);

                int i = mgr.DownloadItems.Count;

                CompositeButton cb = new CompositeButton();
                cb.Size    = panelsize;
                cb.Tag     = 999;
                cb.Padding = new Padding(10);
                cb.QuickInit(EDDiscovery.Icons.Controls.Selector_Background,
                             (i == 0) ? "NO ADD ONS!".Tx(this) : i.ToString() + " Add Ons".Tx(this),
                             EDDTheme.Instance.GetFontAtSize(11),
                             (i == 0) ? Color.Red : (EDDTheme.Instance.TextBlockColor.GetBrightness() < 0.1 ? Color.AntiqueWhite : EDDTheme.Instance.TextBlockColor),
                             centre,
                             EDDiscovery.Icons.Controls.Main_Addons_ManageAddOns,
                             new Size(48, 48),
                             new Image[] { EDDiscovery.Icons.Controls.Main_Addons_ManageAddOns },
                             new Size(48, 48),
                             ButtonPress);

                toolTip.SetToolTip(cb.Buttons[0], "Click to add or remove Add Ons".Tx(this, "TTA"));
                toolTip.SetToolTip(cb.Decals[0], "Add ons are essential additions to your EDD experience!".Tx(this, "TTB"));
                panelVScroll.Controls.Add(cb);
                EDDTheme.Instance.ApplyToControls(cb.Buttons[0], null, true); // need to theme up the button
                cb.Buttons[0].BackColor = centre;                             // but then fix the back colour again
            }

            PanelInformation.PanelIDs[] pids = PanelInformation.GetUserSelectablePanelIDs(EDDConfig.Instance.SortPanelsByName);

            for (int i = 0; i < pids.Length; i++)
            {
                PanelInformation.PanelInfo pi = PanelInformation.GetPanelInfoByPanelID(pids[i]);

                CompositeButton cb = new CompositeButton();
                cb.Size    = panelsize;
                cb.Tag     = pi.PopoutID;
                cb.Padding = new Padding(10);
                cb.QuickInit(EDDiscovery.Icons.Controls.Selector_Background,
                             pi.WindowTitle,
                             EDDTheme.Instance.GetFontAtSize(11),
                             EDDTheme.Instance.TextBlockColor.GetBrightness() < 0.1 ? Color.AntiqueWhite : EDDTheme.Instance.TextBlockColor,
                             centre,
                             pi.TabIcon,
                             new Size(48, 48),
                             new Image[] { EDDiscovery.Icons.Controls.TabStrip_Popout, EDDiscovery.Icons.Controls.Selector_AddTab },
                             new Size(48, 48),
                             ButtonPress);
                toolTip.SetToolTip(cb.Buttons[0], "Pop out in a new window".Tx(this, "PP1"));
                toolTip.SetToolTip(cb.Buttons[1], "Open as a new menu tab".Tx(this, "MT1"));
                toolTip.SetToolTip(cb.Decals[0], pi.Description);
                EDDTheme.Instance.ApplyToControls(cb.Buttons[0], null, true);
                cb.Buttons[0].BackColor = centre; // need to reset the colour back!
                EDDTheme.Instance.ApplyToControls(cb.Buttons[1], null, true);
                cb.Buttons[1].BackColor = centre;

                panelVScroll.Controls.Add(cb);       // we don't theme it.. its already fully themed to a fixed theme.
            }

            Reposition();

            panelVScroll.ResumeLayout();
        }