protected void OnPropertiesActionActivated(object sender, EventArgs e) { if (appPal.Palette is GimpPalette) { var unboxed = appPal.Palette as GimpPalette; var pd = new PropertiesDialog(); pd.PaletteTitle = unboxed.Name; pd.PaletteColumns = unboxed.BucketSize; pd.PaletteComments = unboxed.Comments; if (pd.Run() == (int)ResponseType.Ok) { var p = (GimpPalette)unboxed.Clone(); p.Name = pd.PaletteTitle; p.BucketSize = pd.PaletteColumns; p.Comments = pd.PaletteComments; appPal.SetPalette(p, action: "Properties Change"); } pd.Destroy(); } }
private void propertiesToolStripMenuItem_Click(object sender, EventArgs e) { var pd = new PalettePropertiesForm(appPal.Palette); if (pd.ShowDialog(this) == DialogResult.OK) { var p = appPal.Palette.Clone(); if (p is IBucketedPalette) { ((IBucketedPalette)p).BucketSize = pd.PaletteBucket; } if (p is INamedPalette) { ((INamedPalette)p).Name = pd.PaletteTitle; } if (p is GimpPalette) { ((GimpPalette)p).Comments = pd.GimpPaletteComments; } if (p is AcbPalette) { // the ref stays the same var acb = (AcbPalette)p; acb.ID = pd.AcbId; acb.DefaultSelection = pd.AcbDefaultColor; acb.Prefix = pd.AcbPrefix; acb.Postfix = pd.AcbPostfix; acb.Description = pd.AcbDescription; acb.ColorSpace = pd.AcbColorSpace; acb.Purpose = pd.AcbSpotProcess; } if (p is ActPalette) { var act = (ActPalette)p; act.TransparentIndex = pd.ActTransparencyIndex; } appPal.SetPalette(p, action: "Properties Change"); } }