"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Pinta.Core/Classes/Palette.cs" between
pinta-1.7.tar.gz and pinta-1.7.1.tar.gz

About: Pinta is a powerful image drawing and editing program (modeled after Paint.NET).

Palette.cs  (pinta-1.7):Palette.cs  (pinta-1.7.1)
skipping to change at line 31 skipping to change at line 31
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Linq;
using Cairo; using Cairo;
using Gtk;
using Mono.Unix;
namespace Pinta.Core namespace Pinta.Core
{ {
public sealed class Palette public sealed class Palette
{ {
public event EventHandler PaletteChanged; public event EventHandler PaletteChanged;
private List<Color> colors; private List<Color> colors;
private Palette () private Palette ()
skipping to change at line 162 skipping to change at line 164
colors.Add (new Color (214 / 255f, 127 / 255f, 255 / 255f )); colors.Add (new Color (214 / 255f, 127 / 255f, 255 / 255f ));
colors.Add (new Color (255 / 255f, 127 / 255f, 237 / 255f )); colors.Add (new Color (255 / 255f, 127 / 255f, 237 / 255f ));
colors.Add (new Color (255 / 255f, 127 / 255f, 182 / 255f )); colors.Add (new Color (255 / 255f, 127 / 255f, 182 / 255f ));
colors.TrimExcess (); colors.TrimExcess ();
OnPaletteChanged (); OnPaletteChanged ();
} }
public void Load (string fileName) public void Load (string fileName)
{ {
var loader = PintaCore.System.PaletteFormats.GetLoaderByF try
ilename (fileName); {
colors = loader.Load (fileName); var loader = PintaCore.System.PaletteFormats.GetL
colors.TrimExcess (); oaderByFilename (fileName);
OnPaletteChanged ();
if (loader == null)
throw new FormatException();
colors = loader.Load (fileName);
colors.TrimExcess ();
OnPaletteChanged ();
}
catch (FormatException e)
{
var parent = PintaCore.Chrome.MainWindow;
ShowUnsupportedFormatDialog(parent, fileName, "Un
supported palette format", e.ToString());
}
} }
public void Save (string fileName, IPaletteSaver saver) public void Save (string fileName, IPaletteSaver saver)
{ {
saver.Save (colors, fileName); saver.Save (colors, fileName);
} }
private void ShowUnsupportedFormatDialog(Window parent, string fi
lename, string primaryText, string details)
{
string markup = "<span weight=\"bold\" size=\"larger\">{0
}</span>\n\n{1}";
string secondaryText = string.Format(Catalog.GetString("C
ould not open file: {0}"), filename);
secondaryText += string.Format("\n\n{0}\n", Catalog.GetSt
ring("Pinta supports the following palette formats:"));
var extensions = from format in PintaCore.System.PaletteF
ormats.Formats
where format.Loader != n
ull
from extension in format
.Extensions
where char.IsLower(exten
sion.FirstOrDefault())
orderby extension
select extension;
secondaryText += String.Join(", ", extensions);
string message = string.Format(markup, primaryText, secon
daryText);
PintaCore.Chrome.ShowUnsupportedFormatDialog(parent, mess
age, details);
}
} }
} }
 End of changes. 4 change blocks. 
6 lines changed or deleted 50 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)