public void SetPaletteOption(PPConfig.PaletteOptions paletteOption, WithoutHaste.Drawing.Colors.ColorPalette colorPalette = null, string paletteFileName = null) { if (!OptionsHaveChanged(paletteOption, colorPalette, paletteFileName)) { return; } Config.PaletteOption = paletteOption; switch (Config.PaletteOption) { case PPConfig.PaletteOptions.SaveNothing: Config.PaletteFileName = null; ColorPalette = null; break; case PPConfig.PaletteOptions.SaveFile: Config.PaletteFileName = null; ColorPalette = colorPalette; break; case PPConfig.PaletteOptions.SaveFileName: Config.PaletteFileName = paletteFileName; ColorPalette = null; break; } EditedSinceLastSave = true; }
/// <summary> /// Returns true when options or values have changed. /// </summary> private bool OptionsHaveChanged(PPConfig.PaletteOptions paletteOption, WithoutHaste.Drawing.Colors.ColorPalette colorPalette = null, string paletteFileName = null) { if (Config.PaletteOption == paletteOption) { switch (Config.PaletteOption) { case PPConfig.PaletteOptions.SaveNothing: return(false); case PPConfig.PaletteOptions.SaveFile: if (ColorPalette == colorPalette) { return(false); } break; case PPConfig.PaletteOptions.SaveFileName: if (Config.PaletteFileName == paletteFileName) { return(false); } break; } } return(true); }
public ProjectOptionsDialog(PPConfig config) { paletteOption = config.PaletteOption; InitForm(); }