Skip to content

Commit

Permalink
improve macos support
Browse files Browse the repository at this point in the history
  • Loading branch information
piersdeseilligny committed Jan 4, 2021
1 parent c063211 commit da6657b
Show file tree
Hide file tree
Showing 21 changed files with 534 additions and 56 deletions.
1 change: 1 addition & 0 deletions Metacolor.Editor.Mac/Metacolor.Editor.Mac.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<ItemGroup>
<PackageReference Include="Eto.Platform.Mac64" Version="2.5.8" />
<PackageReference Include="Packaging.Targets" Version="0.1.189" />
<PackageReference Include="Eto.Forms" Version="2.5.8" />
</ItemGroup>

</Project>
24 changes: 24 additions & 0 deletions Metacolor.Editor.Mac/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
using System;
using System.IO;
using Eto.Forms;
using Eto.Mac.Drawing;
using Metacolor.Editor.Classes;
using MonoMac.AppKit;
using MonoMac.CoreGraphics;
using static System.Environment;

namespace Metacolor.Editor.Mac
{
Expand All @@ -9,7 +14,26 @@ class MainClass
[STAThread]
public static void Main(string[] args)
{
Eto.Style.Add<BitmapHandler>("template", h =>
{
var sourceImage = h.Control;
sourceImage.Template = true;
/*h.Control = NSImage.ImageWithSize(sourceImage.Size, false, rect =>
{
//sourceImage.DrawInRect(rect, CGRect.Empty, NSCompositingOperation.SourceOver, 1f);
//NSColor.Blue.Set();
// NSGraphics.RectFill(rect, NSCompositingOperation.SourceAtop);
return true;
});*/
});
StartupArgs startup = new StartupArgs() { OpenWithFiles = args };
// Use DoNotVerify in case LocalApplicationData doesn’t exist.
string appData = Path.Combine(Environment.GetFolderPath(SpecialFolder.LocalApplicationData, SpecialFolderOption.DoNotVerify), "metacolor.editor");
// Ensure the directory and all its parents exist.
Directory.CreateDirectory(appData);
startup.SettingsDirectory = appData;
new Application(Eto.Platforms.Mac64).Run(new MainForm(startup));
}
}
Expand Down
24 changes: 24 additions & 0 deletions Metacolor.Editor.XamMac/AppDelegate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using AppKit;
using Foundation;

namespace Hello_Mac
{
[Register ("AppDelegate")]
public class AppDelegate : NSApplicationDelegate
{
public AppDelegate ()
{
}

public override void DidFinishLaunching (NSNotification notification)
{
// Insert code here to initialize your application
}

public override void WillTerminate (NSNotification notification)
{
// Insert code here to tear down your application
}
}
}

6 changes: 6 additions & 0 deletions Metacolor.Editor.XamMac/Entitlements.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http:https://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</dict>
</plist>
32 changes: 32 additions & 0 deletions Metacolor.Editor.XamMac/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http:https://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>Metacolor.Editor</string>
<key>CFBundleIdentifier</key>
<string>com.piersdeseilligny.metacoloreditor</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>10.11</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>NSHumanReadableCopyright</key>
<string>kmullins</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSMainStoryboardFile</key>
<string>Main</string>
<key>XSAppIconAssets</key>
<string>Resources/Images.xcassets/AppIcons.appiconset</string>
</dict>
</plist>
24 changes: 24 additions & 0 deletions Metacolor.Editor.XamMac/Main.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.IO;
using AppKit;
using Eto.Forms;
using Metacolor.Editor;
using Metacolor.Editor.Classes;
using static System.Environment;

namespace Metacolor.Editor.XamMac
{
static class MainClass
{
static void Main (string[] args)
{
StartupArgs startup = new StartupArgs() { OpenWithFiles = args };
// Use DoNotVerify in case LocalApplicationData doesn’t exist.
string appData = Path.Combine(GetFolderPath(SpecialFolder.LocalApplicationData, SpecialFolderOption.DoNotVerify), "metacolor.editor");
// Ensure the directory and all its parents exist.
Directory.CreateDirectory(appData);
startup.SettingsDirectory = appData;
new Application(Eto.Platforms.XamMac2).Run(new MainForm(startup));
}
}
}
112 changes: 112 additions & 0 deletions Metacolor.Editor.XamMac/Metacolor.Editor.XamMac.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http:https://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Eto.Platform.XamMac2.2.5.8\build\Eto.Platform.XamMac2.props" Condition="Exists('..\packages\Eto.Platform.XamMac2.2.5.8\build\Eto.Platform.XamMac2.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectTypeGuids>{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>{F033B3F8-3C6D-456C-A942-379275590451}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Metacolor.Editor.XamMac</RootNamespace>
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
<AssemblyName>MetacolorEditor</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetFrameworkIdentifier>Xamarin.Mac</TargetFrameworkIdentifier>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<Profiling>true</Profiling>
<UseRefCounting>true</UseRefCounting>
<UseSGen>true</UseSGen>
<IncludeMonoRuntime>false</IncludeMonoRuntime>
<CreatePackage>false</CreatePackage>
<CodeSigningKey>Mac Developer</CodeSigningKey>
<EnableCodeSigning>false</EnableCodeSigning>
<EnablePackageSigning>false</EnablePackageSigning>
<AOTMode>None</AOTMode>
<HttpClientHandler>NSUrlSessionHandler</HttpClientHandler>
<PackageSigningKey>3rd Party Mac Developer Installer</PackageSigningKey>
<LinkMode>None</LinkMode>
<XamMacArch>x86_64</XamMacArch>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<LinkMode>SdkOnly</LinkMode>
<Profiling>false</Profiling>
<UseRefCounting>true</UseRefCounting>
<UseSGen>true</UseSGen>
<IncludeMonoRuntime>true</IncludeMonoRuntime>
<CreatePackage>true</CreatePackage>
<CodeSigningKey>Mac Developer</CodeSigningKey>
<EnableCodeSigning>true</EnableCodeSigning>
<EnablePackageSigning>false</EnablePackageSigning>
<PackageSigningKey>3rd Party Mac Developer Installer</PackageSigningKey>
<AOTMode>None</AOTMode>
<HttpClientHandler>NSUrlSessionHandler</HttpClientHandler>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.Mac" />
<Reference Include="Eto">
<HintPath>..\packages\Eto.Forms.2.5.8\lib\netstandard2.0\Eto.dll</HintPath>
</Reference>
<Reference Include="Eto.XamMac2">
<HintPath>..\packages\Eto.Platform.XamMac2.2.5.8\lib\xamarinmac20\Eto.XamMac2.dll</HintPath>
</Reference>
<Reference Include="System.Drawing.Common.dll" />
<Reference Include="Portable.Xaml">
<HintPath>..\packages\Portable.Xaml.0.24.0\lib\netstandard2.0\Portable.Xaml.dll</HintPath>
</Reference>
<Reference Include="Eto.Serialization.Xaml">
<HintPath>..\packages\Eto.Serialization.Xaml.2.5.8\lib\netstandard2.0\Eto.Serialization.Xaml.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\netstandard2.0\Newtonsoft.Json.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\Contents.json" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-128.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-128%402x.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-16.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-16%402x.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-256.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-256%402x.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-32.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-32%402x.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-512.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-512%402x.png" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
<None Include="Entitlements.plist" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Metacolor.Editor\Metacolor.Editor.csproj">
<Project>{39A1C69D-B329-402E-BC43-A72E369F902A}</Project>
<Name>Metacolor.Editor</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
<Import Project="..\packages\Eto.Forms.2.5.8\build\Eto.Forms.targets" Condition="Exists('..\packages\Eto.Forms.2.5.8\build\Eto.Forms.targets')" />
<Import Project="..\packages\Eto.Platform.XamMac2.2.5.8\build\Eto.Platform.XamMac2.targets" Condition="Exists('..\packages\Eto.Platform.XamMac2.2.5.8\build\Eto.Platform.XamMac2.targets')" />
<Import Project="..\packages\Eto.Serialization.Xaml.2.5.8\build\Eto.Serialization.Xaml.targets" Condition="Exists('..\packages\Eto.Serialization.Xaml.2.5.8\build\Eto.Serialization.Xaml.targets')" />
</Project>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit da6657b

Please sign in to comment.