diff --git a/dlpView/DLPViewCanvas.cs b/dlpView/DLPViewCanvas.cs index fdf925d..710d064 100644 --- a/dlpView/DLPViewCanvas.cs +++ b/dlpView/DLPViewCanvas.cs @@ -161,7 +161,7 @@ void OnExpose(object sender, ExposeEventArgs args) pNew = Zoom * scale * pNew; pNew += (Vector2f)pixC; pNew += translate + Zoom*Translate; - pNew.y = canvas.ClipBounds.Height - pNew.y; + pNew.y = canvas.LocalClipBounds.Height - pNew.y; return pNew; }; Func mapToSkiaF = (pOrig) => { diff --git a/dlpView/app.config b/dlpView/app.config index d91795e..09fab0a 100644 --- a/dlpView/app.config +++ b/dlpView/app.config @@ -1,11 +1,11 @@ - + - - + + - + diff --git a/dlpView/dlpViewer.csproj b/dlpView/dlpViewer.csproj index be51647..8b167ff 100644 --- a/dlpView/dlpViewer.csproj +++ b/dlpView/dlpViewer.csproj @@ -46,17 +46,17 @@ - - ..\packages\SkiaSharp.1.56.2\lib\net45\SkiaSharp.dll - True + + ..\packages\SkiaSharp.1.60.2\lib\net45\SkiaSharp.dll - - ..\packages\SkiaSharp.Views.1.56.2\lib\net45\SkiaSharp.Views.Desktop.dll - True + + ..\packages\SkiaSharp.Views.1.60.2\lib\net45\SkiaSharp.Views.Desktop.dll - - ..\packages\SkiaSharp.Views.1.56.2\lib\net45\SkiaSharp.Views.WPF.dll - True + + ..\packages\SkiaSharp.Views.1.60.2\lib\net45\SkiaSharp.Views.Gtk.dll + + + ..\packages\SkiaSharp.Views.1.60.2\lib\net45\SkiaSharp.Views.WPF.dll @@ -120,11 +120,11 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + \ No newline at end of file diff --git a/dlpView/packages.config b/dlpView/packages.config index 9edf00f..14e9c9f 100644 --- a/dlpView/packages.config +++ b/dlpView/packages.config @@ -1,6 +1,6 @@  - - + + \ No newline at end of file diff --git a/geometry3Sharp b/geometry3Sharp index c171e65..d6debfb 160000 --- a/geometry3Sharp +++ b/geometry3Sharp @@ -1 +1 @@ -Subproject commit c171e655a1f327d8cc29858a048d44a62aa2744c +Subproject commit d6debfbea844b8552c1a252842f98a0a1b289a7d diff --git a/gsGCode b/gsGCode index 66b1172..790bced 160000 --- a/gsGCode +++ b/gsGCode @@ -1 +1 @@ -Subproject commit 66b117201fa38353face69f8dc907f5328f418be +Subproject commit 790bced842286088a9992db23b76f88e055b0931 diff --git a/gsSlicer b/gsSlicer index 3036990..c0ee41d 160000 --- a/gsSlicer +++ b/gsSlicer @@ -1 +1 @@ -Subproject commit 30369906bcb47c16c9356c1b870d3382fafce692 +Subproject commit c0ee41d8fbcb2cd70c50c9d31d44010877f9f662 diff --git a/sliceViewGTK/GtkUtil.cs b/sliceViewGTK/GtkUtil.cs new file mode 100644 index 0000000..d07b813 --- /dev/null +++ b/sliceViewGTK/GtkUtil.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.IO; +using g3; + +namespace SliceViewer +{ + public static class GtkUtil + { + /// + /// Fix some issues w/ GtkSharp DLLs on windows. + /// see: https://github.com/picoe/Eto/issues/442 + /// https://forums.xamarin.com/discussion/15568/unable-to-load-dll-libgtk-win32-2-0-0-dll + /// https://forums.xamarin.com/discussion/2091/cannot-run-gtk-project + /// https://github.com/mono/monodevelop/commit/ad672ce79a50ce844398ae30cce8005163e41d0e + /// + public static bool CheckWindowsGtk() + { + if (Util.IsRunningOnMono()) + return true; + + string location = null; + Version version = null; + Version minVersion = new Version(2, 12, 22); + using (var key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Xamarin\GtkSharp\InstallFolder")) { + if (key != null) + location = key.GetValue(null) as string; + } + using (var key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Xamarin\GtkSharp\Version")) { + if (key != null) + Version.TryParse(key.GetValue(null) as string, out version); + } + //TODO: check build version of GTK# dlls in GAC + if (version == null || version < minVersion || location == null || !File.Exists(Path.Combine(location, "bin", "libgtk-win32-2.0-0.dll"))) { + Console.WriteLine("Did not find required GTK# installation"); + // string url = "http://monodevelop.com/Download"; + // string caption = "Fatal Error"; + // string message = + // "{0} did not find the required version of GTK#. Please click OK to open the download page, where " + + // "you can download and install the latest version."; + // if (DisplayWindowsOkCancelMessage ( + // string.Format (message, BrandingService.ApplicationName, url), caption) + // ) { + // Process.Start (url); + // } + return false; + } + Console.WriteLine("Found GTK# version " + version); + var path = Path.Combine(location, @"bin"); + Console.WriteLine("SetDllDirectory(\"{0}\") ", path); + try { + if (SetDllDirectory(path)) { + return true; + } + } catch (EntryPointNotFoundException) { + } + // this shouldn't happen unless something is weird in Windows + Console.WriteLine("Unable to set GTK+ dll directory"); + return true; + } + + [System.Runtime.InteropServices.DllImport("kernel32.dll", CharSet = System.Runtime.InteropServices.CharSet.Unicode, SetLastError = true)] + [return: System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Bool)] + static extern bool SetDllDirectory(string lpPathName); + } + + +} + diff --git a/sliceViewGTK/PanZoomCanvas2D.cs b/sliceViewGTK/PanZoomCanvas2D.cs index 1d76460..764e668 100644 --- a/sliceViewGTK/PanZoomCanvas2D.cs +++ b/sliceViewGTK/PanZoomCanvas2D.cs @@ -74,7 +74,7 @@ void OnExpose(object sender, ExposeEventArgs args) pNew = Zoom * scale * pNew; pNew += (Vector2f)pixC; pNew += translate + Zoom * PixelTranslate; - pNew.y = canvas.ClipBounds.Height - pNew.y; + pNew.y = canvas.LocalClipBounds.Height - pNew.y; return pNew; }; diff --git a/sliceViewGTK/SliceViewCanvas.cs b/sliceViewGTK/SliceViewCanvas.cs index 26723fc..ef988e5 100644 --- a/sliceViewGTK/SliceViewCanvas.cs +++ b/sliceViewGTK/SliceViewCanvas.cs @@ -306,7 +306,7 @@ private void DrawFill(ToolpathSet pathSetIn, SKCanvas baseCanvas) { SKColor fillColor = SkiaUtil.Color(255, 0, 255, 255); - SKRect bounds = baseCanvas.ClipBounds; + SKRect bounds = baseCanvas.LocalClipBounds; SKBitmap blitBitmap = new SKBitmap(PixelDimensions.x, PixelDimensions.y, SkiaUtil.ColorType(), SKAlphaType.Premul); IntPtr len; diff --git a/sliceViewGTK/SliceViewer.csproj b/sliceViewGTK/SliceViewer.csproj index 0da7589..3cbb09f 100644 --- a/sliceViewGTK/SliceViewer.csproj +++ b/sliceViewGTK/SliceViewer.csproj @@ -45,17 +45,17 @@ - - ..\packages\SkiaSharp.1.56.2\lib\net45\SkiaSharp.dll - True + + ..\packages\SkiaSharp.1.60.2\lib\net45\SkiaSharp.dll - - ..\packages\SkiaSharp.Views.1.56.2\lib\net45\SkiaSharp.Views.Desktop.dll - True + + ..\packages\SkiaSharp.Views.1.60.2\lib\net45\SkiaSharp.Views.Desktop.dll - - ..\packages\SkiaSharp.Views.1.56.2\lib\net45\SkiaSharp.Views.WPF.dll - True + + ..\packages\SkiaSharp.Views.1.60.2\lib\net45\SkiaSharp.Views.Gtk.dll + + + ..\packages\SkiaSharp.Views.1.60.2\lib\net45\SkiaSharp.Views.WPF.dll @@ -83,6 +83,7 @@ + @@ -126,22 +127,19 @@ - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - copy $(SolutionDir)bin\gpx.exe $(TargetDir) - - + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + \ No newline at end of file diff --git a/sliceViewGTK/SliceViewerMain.cs b/sliceViewGTK/SliceViewerMain.cs index 2231234..723484d 100644 --- a/sliceViewGTK/SliceViewerMain.cs +++ b/sliceViewGTK/SliceViewerMain.cs @@ -27,6 +27,8 @@ class MainClass public static void Main(string[] args) { + GtkUtil.CheckWindowsGtk(); + ExceptionManager.UnhandledException += delegate (UnhandledExceptionArgs expArgs) { Console.WriteLine(expArgs.ExceptionObject.ToString()); expArgs.ExitApplication = true; diff --git a/sliceViewGTK/app.config b/sliceViewGTK/app.config index d91795e..09fab0a 100644 --- a/sliceViewGTK/app.config +++ b/sliceViewGTK/app.config @@ -1,11 +1,11 @@ - + - - + + - + diff --git a/sliceViewGTK/packages.config b/sliceViewGTK/packages.config index 9edf00f..14e9c9f 100644 --- a/sliceViewGTK/packages.config +++ b/sliceViewGTK/packages.config @@ -1,6 +1,6 @@  - - + + \ No newline at end of file