"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Pinta.Core/Managers/WorkspaceManager.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).

WorkspaceManager.cs  (pinta-1.7):WorkspaceManager.cs  (pinta-1.7.1)
skipping to change at line 167 skipping to change at line 167
Layer background = doc.AddNewLayer (Catalog.GetString ("B ackground")); Layer background = doc.AddNewLayer (Catalog.GetString ("B ackground"));
if (backgroundColor.A != 0) { if (backgroundColor.A != 0) {
using (Cairo.Context g = new Cairo.Context (backg round.Surface)) { using (Cairo.Context g = new Cairo.Context (backg round.Surface)) {
g.SetSourceColor (backgroundColor); g.SetSourceColor (backgroundColor);
g.Paint (); g.Paint ();
} }
} }
doc.Workspace.History.PushNewItem (new BaseHistoryItem (S tock.New, Catalog.GetString ("New Image"))); doc.Workspace.History.PushNewItem (new BaseHistoryItem (S tock.New, Catalog.GetString ("New Image")));
doc.IsDirty = false; doc.Workspace.History.SetClean();
// This ensures these are called after the window is done being created and sized. // This ensures these are called after the window is done being created and sized.
// Without it, we sometimes try to zoom when the window h as a size of (0, 0). // Without it, we sometimes try to zoom when the window h as a size of (0, 0).
Gtk.Application.Invoke (delegate { Gtk.Application.Invoke (delegate {
PintaCore.Actions.View.ZoomToWindow.Activate (); PintaCore.Actions.View.ZoomToWindow.Activate ();
}); });
return doc; return doc;
} }
skipping to change at line 196 skipping to change at line 196
try { try {
// Open the image and add it to the layers // Open the image and add it to the layers
IImageImporter importer = PintaCore.System.ImageF ormats.GetImporterByFile (file); IImageImporter importer = PintaCore.System.ImageF ormats.GetImporterByFile (file);
if (importer == null) if (importer == null)
throw new FormatException( Catalog.GetStr ing ("Unsupported file format")); throw new FormatException( Catalog.GetStr ing ("Unsupported file format"));
importer.Import (file, parent); importer.Import (file, parent);
PintaCore.Workspace.ActiveDocument.PathAndFileNam e = file; PintaCore.Workspace.ActiveDocument.PathAndFileNam e = file;
PintaCore.Workspace.ActiveWorkspace.History.PushN ewItem (new BaseHistoryItem (Stock.Open, Catalog.GetString ("Open Image"))); PintaCore.Workspace.ActiveWorkspace.History.PushN ewItem (new BaseHistoryItem (Stock.Open, Catalog.GetString ("Open Image")));
PintaCore.Workspace.ActiveDocument.IsDirty = fals e; PintaCore.Workspace.ActiveDocument.History.SetCle an();
PintaCore.Workspace.ActiveDocument.HasFile = true ; PintaCore.Workspace.ActiveDocument.HasFile = true ;
// This ensures these are called after the window is done being created and sized. // This ensures these are called after the window is done being created and sized.
// Without it, we sometimes try to zoom when the window has a si ze of (0, 0). // Without it, we sometimes try to zoom when the window has a si ze of (0, 0).
Gtk.Application.Invoke (delegate { Gtk.Application.Invoke (delegate {
PintaCore.Actions.View.ZoomToWindow.Activate (); PintaCore.Actions.View.ZoomToWindow.Activate ();
PintaCore.Workspace.Invalidate (); PintaCore.Workspace.Invalidate ();
}); });
fileOpened = true; fileOpened = true;
} catch (UnauthorizedAccessException e) { } catch (UnauthorizedAccessException) {
ShowOpenFileErrorDialog (parent, file, Catalog.Ge ShowFilePermissionErrorDialog (parent, file);
tString ("Permission denied"), e.ToString ()); } catch (FormatException e) {
ShowUnsupportedFormatDialog (parent, file, e.Mess
age, e.ToString());
} catch (Exception e) { } catch (Exception e) {
ShowOpenFileErrorDialog (parent, file, e.Message, e.ToString ()); ShowOpenFileErrorDialog (parent, file, e.Message, e.ToString ());
} }
return fileOpened; return fileOpened;
} }
public void ResizeImage (int width, int height) public void ResizeImage (int width, int height)
{ {
ActiveDocument.ResizeImage (width, height); ActiveDocument.ResizeImage (width, height);
skipping to change at line 354 skipping to change at line 356
#endregion #endregion
private void ShowOpenFileErrorDialog (Window parent, string filename, st ring primaryText, string details) private void ShowOpenFileErrorDialog (Window parent, string filename, st ring primaryText, string details)
{ {
string markup = "<span weight=\"bold\" size=\"larger\">{0 }</span>\n\n{1}"; string markup = "<span weight=\"bold\" size=\"larger\">{0 }</span>\n\n{1}";
string secondaryText = string.Format (Catalog.GetString ( "Could not open file: {0}"), filename); string secondaryText = string.Format (Catalog.GetString ( "Could not open file: {0}"), filename);
string message = string.Format (markup, primaryText, seco ndaryText); string message = string.Format (markup, primaryText, seco ndaryText);
PintaCore.Chrome.ShowErrorDialog(parent, message, details ); PintaCore.Chrome.ShowErrorDialog(parent, message, details );
} }
#region Public Events private void ShowUnsupportedFormatDialog (Window parent, string f
ilename, 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 file formats:"));
var extensions = from format in PintaCore.System.ImageFor
mats.Formats
where format.Importer !=
null
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, seco
ndaryText);
PintaCore.Chrome.ShowUnsupportedFormatDialog(parent, mess
age, details);
}
private void ShowFilePermissionErrorDialog (Window parent, string
filename)
{
string markup = "<span weight=\"bold\" size=\"larger\">{0
}</span>\n\n{1}";
string primary = Catalog.GetString ("Failed to open image
");
// Translators: {0} is the name of a file that the user d
oes not have permission to open.
string secondary = string.Format(Catalog.GetString ("You
do not have access to '{0}'."), filename);
string message = string.Format (markup, primary, secondar
y);
var md = new MessageDialog (parent, DialogFlags.Modal, Me
ssageType.Error, ButtonsType.Ok, message);
md.Run ();
md.Destroy ();
}
#region Public Events
public event EventHandler ActiveDocumentChanged; public event EventHandler ActiveDocumentChanged;
public event EventHandler<DocumentEventArgs> DocumentCreated; public event EventHandler<DocumentEventArgs> DocumentCreated;
public event EventHandler<DocumentEventArgs> DocumentOpened; public event EventHandler<DocumentEventArgs> DocumentOpened;
public event EventHandler<DocumentEventArgs> DocumentClosed; public event EventHandler<DocumentEventArgs> DocumentClosed;
public event EventHandler SelectionChanged; public event EventHandler SelectionChanged;
#endregion #endregion
} }
} }
 End of changes. 4 change blocks. 
6 lines changed or deleted 57 lines changed or added

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