/// <summary>
        /// Initialize a new instance of the KryptonPaletteActionList class.
        /// </summary>
        /// <param name="owner">Designer that owns this action list instance.</param>
        public KryptonPaletteActionList(KryptonPaletteDesigner owner)
            : base(owner.Component)
        {
            // Remember the panel instance
            _palette = owner.Component as KryptonPalette;

            // Cache service used to notify when a property has changed
            _service = (IComponentChangeService)GetService(typeof(IComponentChangeService));
        }
示例#2
0
        private void loadPaletteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Create a new palette for the importing
            KryptonPalette newPalette = new KryptonPalette();

            // If the user managed to load a palette file
            if (newPalette.Import().Length > 0)
            {
                // Then switch the using the new one
                kryptonPaletteCustom = newPalette;

                if (!toolStripCustom.Checked)
                {
                    // Then use existing method to switch to using the custom palette
                    toolStripCustom_Click(null, EventArgs.Empty);
                }
                else
                {
                    // Use the custom palette
                    kryptonManager.GlobalPalette = kryptonPaletteCustom;
                    UpdateOnPaletteChanged();
                }

                // Change of palette means a change in colors that need
                // applying to the background of the standard controls
                UpdateOnPaletteChanged();
            }
        }
示例#3
0
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ThemeSelector));
     this.kpnlButtons           = new ComponentFactory.Krypton.Toolkit.KryptonPanel();
     this.kbtnRestoreToDefaults = new ComponentFactory.Krypton.Toolkit.KryptonButton();
     this.kbtnCancel            = new ComponentFactory.Krypton.Toolkit.KryptonButton();
     this.kbtnOk           = new ComponentFactory.Krypton.Toolkit.KryptonButton();
     this.kbtnApply        = new ComponentFactory.Krypton.Toolkit.KryptonButton();
     this.pnlSeperator     = new System.Windows.Forms.Panel();
     this.kpnlContent      = new ComponentFactory.Krypton.Toolkit.KryptonPanel();
     this.kbtnTry          = new ComponentFactory.Krypton.Toolkit.KryptonButton();
     this.kbtnBrowse       = new ComponentFactory.Krypton.Toolkit.KryptonButton();
     this.ktxtCustomPath   = new ComponentFactory.Krypton.Toolkit.KryptonTextBox();
     this.klblCustomTheme  = new ComponentFactory.Krypton.Toolkit.KryptonLabel();
     this.kcmbPaletteTheme = new ComponentFactory.Krypton.Toolkit.KryptonComboBox();
     this.kryptonLabel1    = new ComponentFactory.Krypton.Toolkit.KryptonLabel();
     this.palette          = new ComponentFactory.Krypton.Toolkit.KryptonPalette(this.components);
     this.kman             = new ComponentFactory.Krypton.Toolkit.KryptonManager(this.components);
     ((System.ComponentModel.ISupportInitialize)(this.kpnlButtons)).BeginInit();
     this.kpnlButtons.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.kpnlContent)).BeginInit();
     this.kpnlContent.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.kcmbPaletteTheme)).BeginInit();
     this.SuspendLayout();
     //
     // kpnlButtons
     //
     this.kpnlButtons.Controls.Add(this.kbtnRestoreToDefaults);
     this.kpnlButtons.Controls.Add(this.kbtnCancel);
     this.kpnlButtons.Controls.Add(this.kbtnOk);
     this.kpnlButtons.Controls.Add(this.kbtnApply);
     this.kpnlButtons.Dock     = System.Windows.Forms.DockStyle.Bottom;
     this.kpnlButtons.Location = new System.Drawing.Point(0, 146);
     this.kpnlButtons.Name     = "kpnlButtons";
     this.kpnlButtons.Size     = new System.Drawing.Size(785, 54);
     this.kpnlButtons.TabIndex = 1;
     //
     // kbtnRestoreToDefaults
     //
     this.kbtnRestoreToDefaults.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.kbtnRestoreToDefaults.Enabled  = false;
     this.kbtnRestoreToDefaults.Location = new System.Drawing.Point(16, 12);
     this.kbtnRestoreToDefaults.Name     = "kbtnRestoreToDefaults";
     this.kbtnRestoreToDefaults.Size     = new System.Drawing.Size(163, 30);
     this.kbtnRestoreToDefaults.StateCommon.Content.ShortText.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.kbtnRestoreToDefaults.TabIndex    = 3;
     this.kbtnRestoreToDefaults.Values.Text = "&Restore to Defaults";
     this.kbtnRestoreToDefaults.Click      += new System.EventHandler(this.kbtnRestoreToDefaults_Click);
     //
     // kbtnCancel
     //
     this.kbtnCancel.Anchor       = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.kbtnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
     this.kbtnCancel.Location     = new System.Drawing.Point(587, 12);
     this.kbtnCancel.Name         = "kbtnCancel";
     this.kbtnCancel.Size         = new System.Drawing.Size(90, 30);
     this.kbtnCancel.StateCommon.Content.ShortText.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.kbtnCancel.TabIndex    = 2;
     this.kbtnCancel.Values.Text = "&Cancel";
     this.kbtnCancel.Click      += new System.EventHandler(this.kbtnCancel_Click);
     //
     // kbtnOk
     //
     this.kbtnOk.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.kbtnOk.Location = new System.Drawing.Point(491, 12);
     this.kbtnOk.Name     = "kbtnOk";
     this.kbtnOk.Size     = new System.Drawing.Size(90, 30);
     this.kbtnOk.StateCommon.Content.ShortText.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.kbtnOk.TabIndex    = 1;
     this.kbtnOk.Values.Text = "&Ok";
     this.kbtnOk.Click      += new System.EventHandler(this.kbtnOk_Click);
     //
     // kbtnApply
     //
     this.kbtnApply.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.kbtnApply.Enabled  = false;
     this.kbtnApply.Location = new System.Drawing.Point(683, 12);
     this.kbtnApply.Name     = "kbtnApply";
     this.kbtnApply.Size     = new System.Drawing.Size(90, 30);
     this.kbtnApply.StateCommon.Content.ShortText.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.kbtnApply.TabIndex    = 0;
     this.kbtnApply.Values.Text = "A&pply";
     this.kbtnApply.Click      += new System.EventHandler(this.kbtnApply_Click);
     //
     // pnlSeperator
     //
     this.pnlSeperator.BackColor = System.Drawing.SystemColors.ControlDarkDark;
     this.pnlSeperator.Dock      = System.Windows.Forms.DockStyle.Bottom;
     this.pnlSeperator.Location  = new System.Drawing.Point(0, 143);
     this.pnlSeperator.Name      = "pnlSeperator";
     this.pnlSeperator.Size      = new System.Drawing.Size(785, 3);
     this.pnlSeperator.TabIndex  = 3;
     //
     // kpnlContent
     //
     this.kpnlContent.Controls.Add(this.kbtnTry);
     this.kpnlContent.Controls.Add(this.kbtnBrowse);
     this.kpnlContent.Controls.Add(this.ktxtCustomPath);
     this.kpnlContent.Controls.Add(this.klblCustomTheme);
     this.kpnlContent.Controls.Add(this.kcmbPaletteTheme);
     this.kpnlContent.Controls.Add(this.kryptonLabel1);
     this.kpnlContent.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.kpnlContent.Location = new System.Drawing.Point(0, 0);
     this.kpnlContent.Name     = "kpnlContent";
     this.kpnlContent.Size     = new System.Drawing.Size(785, 143);
     this.kpnlContent.TabIndex = 4;
     //
     // kbtnTry
     //
     this.kbtnTry.AutoSize     = true;
     this.kbtnTry.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.kbtnTry.Enabled      = false;
     this.kbtnTry.Location     = new System.Drawing.Point(733, 87);
     this.kbtnTry.Name         = "kbtnTry";
     this.kbtnTry.Size         = new System.Drawing.Size(34, 30);
     this.kbtnTry.StateCommon.Content.ShortText.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.kbtnTry.TabIndex    = 5;
     this.kbtnTry.Values.Text = "T&ry";
     this.kbtnTry.Click      += new System.EventHandler(this.kbtnTry_Click);
     //
     // kbtnBrowse
     //
     this.kbtnBrowse.AutoSize     = true;
     this.kbtnBrowse.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.kbtnBrowse.Enabled      = false;
     this.kbtnBrowse.Location     = new System.Drawing.Point(744, 51);
     this.kbtnBrowse.Name         = "kbtnBrowse";
     this.kbtnBrowse.Size         = new System.Drawing.Size(23, 30);
     this.kbtnBrowse.StateCommon.Content.ShortText.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.kbtnBrowse.TabIndex    = 4;
     this.kbtnBrowse.Values.Text = ".&..";
     this.kbtnBrowse.Click      += new System.EventHandler(this.kbtnBrowse_Click);
     //
     // ktxtCustomPath
     //
     this.ktxtCustomPath.Enabled  = false;
     this.ktxtCustomPath.Location = new System.Drawing.Point(248, 52);
     this.ktxtCustomPath.Name     = "ktxtCustomPath";
     this.ktxtCustomPath.Size     = new System.Drawing.Size(490, 29);
     this.ktxtCustomPath.StateCommon.Content.Font  = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.ktxtCustomPath.StateCommon.Content.TextH = ComponentFactory.Krypton.Toolkit.PaletteRelativeAlign.Inherit;
     this.ktxtCustomPath.TabIndex     = 3;
     this.ktxtCustomPath.TextChanged += new System.EventHandler(this.ktxtCustomPath_TextChanged);
     //
     // klblCustomTheme
     //
     this.klblCustomTheme.Enabled  = false;
     this.klblCustomTheme.Location = new System.Drawing.Point(38, 55);
     this.klblCustomTheme.Name     = "klblCustomTheme";
     this.klblCustomTheme.Size     = new System.Drawing.Size(204, 26);
     this.klblCustomTheme.StateCommon.ShortText.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.klblCustomTheme.TabIndex    = 2;
     this.klblCustomTheme.Values.Text = "Custom Theme File Path:";
     //
     // kcmbPaletteTheme
     //
     this.kcmbPaletteTheme.DropDownWidth  = 216;
     this.kcmbPaletteTheme.IntegralHeight = false;
     this.kcmbPaletteTheme.Location       = new System.Drawing.Point(147, 12);
     this.kcmbPaletteTheme.Name           = "kcmbPaletteTheme";
     this.kcmbPaletteTheme.Size           = new System.Drawing.Size(216, 27);
     this.kcmbPaletteTheme.StateCommon.ComboBox.Content.Font  = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.kcmbPaletteTheme.StateCommon.ComboBox.Content.TextH = ComponentFactory.Krypton.Toolkit.PaletteRelativeAlign.Near;
     this.kcmbPaletteTheme.TabIndex     = 1;
     this.kcmbPaletteTheme.TextChanged += new System.EventHandler(this.kcmbPaletteTheme_TextChanged);
     //
     // kryptonLabel1
     //
     this.kryptonLabel1.Location = new System.Drawing.Point(12, 12);
     this.kryptonLabel1.Name     = "kryptonLabel1";
     this.kryptonLabel1.Size     = new System.Drawing.Size(128, 26);
     this.kryptonLabel1.StateCommon.ShortText.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.kryptonLabel1.TabIndex    = 0;
     this.kryptonLabel1.Values.Text = "Palette Theme:";
     //
     // palette
     //
     this.palette.CustomisedKryptonPaletteFilePath = null;
     //
     // ThemeSelector
     //
     this.ClientSize = new System.Drawing.Size(785, 200);
     this.Controls.Add(this.kpnlContent);
     this.Controls.Add(this.pnlSeperator);
     this.Controls.Add(this.kpnlButtons);
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
     this.Icon            = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.MaximizeBox     = false;
     this.MinimizeBox     = false;
     this.Name            = "ThemeSelector";
     this.Text            = "Palette Theme Selector";
     this.FormClosing    += new System.Windows.Forms.FormClosingEventHandler(this.ThemeSelector_FormClosing);
     this.Load           += new System.EventHandler(this.ThemeSelector_Load);
     ((System.ComponentModel.ISupportInitialize)(this.kpnlButtons)).EndInit();
     this.kpnlButtons.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.kpnlContent)).EndInit();
     this.kpnlContent.ResumeLayout(false);
     this.kpnlContent.PerformLayout();
     ((System.ComponentModel.ISupportInitialize)(this.kcmbPaletteTheme)).EndInit();
     this.ResumeLayout(false);
 }
        private void Open()
        {
            tslStatus.Text = "Attempting to inport colours from selected palette. Please wait...";

            // If the current palette has been changed
            if (Dirty)
            {
                // Ask user if the current palette should be saved
                switch (KryptonMessageBox.Show(this,
                                               "Save changes to the current palette?",
                                               "Palette Changed",
                                               MessageBoxButtons.YesNoCancel,
                                               MessageBoxIcon.Warning))
                {
                case DialogResult.Yes:
                    // Use existing save method
                    Save();
                    break;

                case DialogResult.Cancel:
                    // Cancel out entirely
                    return;
                }
            }

            // Create a fresh palette instance for loading into
            KryptonPalette palette = new KryptonPalette();

            // Get the name of the file we imported from
            Cursor = Cursors.WaitCursor;
            Application.DoEvents();
            string filename = palette.Import();

            Cursor = Cursors.Default;

            // If the load succeeded
            if (filename.Length > 0)
            {
                // Need to unhook from any existing palette
                if (Palette != null)
                {
                    Palette.PalettePaint -= new EventHandler <PaletteLayoutEventArgs>(OnPalettePaint);
                }

                // Use the new instance instead
                Palette = palette;

                // We need to know when a change occurs to the palette settings
                Palette.PalettePaint += new EventHandler <PaletteLayoutEventArgs>(OnPalettePaint);

                // Hook up the property grid to the palette
                labelGridNormal.SelectedObject = Palette;

                // Use the loaded filename
                FileName = filename;

                // Reset the state flags
                Loaded = true;
                Dirty  = false;

                // Define the initial title bar string
                UpdateTitlebar();
            }

            PaletteImportManager paletteImportManager = new PaletteImportManager();

            paletteImportManager.ImportColourScheme(palette);

            kchkUpdateColours.Enabled = true;

            kcmbBasePaletteMode.Text = _globalStringSettingsManager.GetBasePaletteMode();

            tslStatus.Text = _globalStringSettingsManager.GetFeedbackText();

            kchkUpdateColours.Checked = true;

            invertColoursToolStripMenuItem.Enabled = true;

            kchkInvertColours.Enabled = true;

            _mostRecentlyUsedFileManager.AddRecentFile(filename);
        }
        private void Open()
        {
            // If the current palette has been changed
            if (_dirty)
            {
                // Ask user if the current palette should be saved
                switch (MessageBox.Show(this,
                                        "Save changes to the current palette?",
                                        "Palette Changed",
                                        MessageBoxButtons.YesNoCancel,
                                        MessageBoxIcon.Warning))
                {
                case DialogResult.Yes:
                    // Use existing save method
                    Save();
                    break;

                case DialogResult.Cancel:
                    // Cancel out entirely
                    return;
                }
            }

            // Create a fresh palette instance for loading into
            KryptonPalette palette = new KryptonPalette();

            // Get the name of the file we imported from
            Cursor = Cursors.WaitCursor;
            Application.DoEvents();
            string filename = palette.Import();

            Cursor = Cursors.Default;

            // If the load succeeded
            if (filename.Length > 0)
            {
                // Need to unhook from any existing palette
                if (_palette != null)
                {
                    _palette.PalettePaint -= new EventHandler <PaletteLayoutEventArgs>(OnPalettePaint);
                }

                // Use the new instance instead
                _palette                      = palette;
                _chromeTMS.Palette            = _palette;
                _chromeRibbon.OverridePalette = _palette;

                // We need to know when a change occurs to the palette settings
                _palette.PalettePaint += new EventHandler <PaletteLayoutEventArgs>(OnPalettePaint);

                // Hook up the property grid to the palette
                labelGridNormal.SelectedObject = _palette;

                // Use the loaded filename
                _filename = filename;

                // Reset the state flags
                _loaded = true;
                _dirty  = false;

                // Apply the new palette to the design controls
                ApplyPalette();

                // Define the initial title bar string
                UpdateTitlebar();
            }

            _recentlyUsedDocumentsManager.AddRecentFile(filename);
        }