示例#1
0
        /// <summary>
        /// Loads the palette editor.
        /// </summary>
        /// <param name="update">Functiont to execute when updating.</param>
        /// <param name="paletteSet">The palette set to use.</param>
        /// <param name="count">The total number of palettes in the set.</param>
        /// <param name="startRow">The palette row (index) to start at.</param>
        /// <param name="max">The maximum number of palettes to show.</param>
        public PaletteEditor(PaletteUpdater updater, PaletteSet paletteSet, int count, int startRow, int max)
        {
            this.updater           = updater;
            this.paletteSetBackup2 = paletteSet.Copy();
            this.paletteSetBackup  = paletteSet.Copy();
            this.paletteSet        = paletteSet;
            this.count             = count;
            this.startRow          = startRow;
            this.max          = max;
            this.currentColor = startRow * 16;

            //
            InitializeComponent();
            CreateHelperForms();
            CreateShortcuts();
            CreateCheckBoxRows();
            CreateCheckBoxCols();
            SetControlSizes();
            InitializeColor();
            SetColorMapImage();
            SetPaletteImage();

            //
            this.BringToFront();

            //
            this.History = new History(this);
        }
示例#2
0
        public void Reload(PaletteSet paletteSet, int count, int startRow, int max)
        {
            this.paletteSetBackup2 = paletteSet.Copy();
            this.paletteSetBackup  = paletteSet.Copy();
            this.paletteSet        = paletteSet;
            this.count             = count;
            this.startRow          = startRow;
            this.max = max;

            // Create checkbox rows, but only if different number
            if (rows.Count != Math.Min(count - startRow, max))
            {
                foreach (CheckBox checkBox in this.rows)
                {
                    this.Controls.Remove(checkBox);
                }
                List <CheckBox> rows_temp = new List <CheckBox>();
                for (int i = 0; i < count - startRow && i < max; i++)
                {
                    CheckBox checkBox = new CheckBox();
                    checkBox.Appearance = Appearance.Button;
                    checkBox.AutoSize   = false;
                    if (i < this.rows.Count)
                    {
                        checkBox.Checked = this.rows[i].Checked;
                    }
                    else
                    {
                        checkBox.Checked = true;
                    }
                    checkBox.Location        = new Point(12, i * 12 + 43);
                    checkBox.Size            = new Size(12, 12);
                    checkBox.CheckedChanged += new EventHandler(checkBox_CheckedChanged);
                    rows_temp.Add(checkBox);
                    this.Controls.Add(checkBox);
                }
                this.currentColor = 0;
                this.rows         = rows_temp;
            }

            //
            SetControlSizes();
            InitializeColor();
            SetColorMapImage();
            SetPaletteImage();
            CheckAllColors();

            //
            this.BringToFront();
        }