diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..aeef9da
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,26 @@
+# EditorConfig is awesome: http://EditorConfig.org
+
+# top-most EditorConfig file
+root = true
+
+# use tabs by default for everything
+[*.cs]
+indent_style = tab
+indent_size = 4
+tab_size = 4
+charset=utf-8
+csharp_new_line_before_open_brace = all
+
+# packages.config uses spaces
+[**\packages.config]
+indent_style = space
+indent_size = 2
+
+[*.{csproj,vbproj,proj,targets,props}]
+indent_style = space
+indent_size = 2
+tab_size = 2
+
+[*.yml]
+intent_style = space
+indent_size = 2
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..610a6b3
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,117 @@
+name: Build
+
+on:
+ push:
+ branches: [ main ]
+ tags: [ '*' ]
+ pull_request:
+ branches: [ main ]
+
+env:
+ DotNetVersion: "5.0.x"
+ BuildConfiguration: "Release"
+ BuildParameters: "Source/PabloDraw/PabloDraw.csproj /clp:NoSummary /p:Configuration=Release /p:BuildVersion=${{ github.run_id }} /p:BuildBranch=${{ github.ref }}"
+
+jobs:
+ build-windows:
+
+ runs-on: windows-latest
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: ${{ env.DotNetVersion }}
+
+ - run: dotnet publish ${{ env.BuildParameters }} -f net5.0-windows -r win-x64
+
+ - uses: actions/upload-artifact@v2
+ with:
+ name: pablodraw-windows
+ path: artifacts/bin/${{ env.BuildConfiguration }}/net5.0-windows/win-x64/publish/*
+
+ build-linux:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: ${{ env.DotNetVersion }}
+
+ - run: dotnet publish ${{ env.BuildParameters }} -f net5.0 -r linux-x64
+
+ - uses: actions/upload-artifact@v2
+ with:
+ name: pablodraw-linux
+ path: artifacts/bin/${{ env.BuildConfiguration }}/net5.0/linux-x64/publish/*
+
+ build-mac:
+
+ runs-on: macos-latest
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: ${{ env.DotNetVersion }}
+
+ - uses: maxim-lobanov/setup-xamarin@v1
+ with:
+ mono-version: latest
+ xamarin-mac-version: latest
+ xcode-version: latest
+
+ # - name: Import code signing certificate
+ # if: github.event_name != 'pull_request'
+ # uses: apple-actions/import-codesign-certs@v1
+ # with:
+ # p12-file-base64: ${{ secrets.DEVID_CERTIFICATE_P12 }}
+ # p12-password: ${{ secrets.DEVID_CERTIFICATE_P12_PASSWORD }}
+
+ # - name: Enable code signing
+ # if: github.event_name != 'pull_request'
+ # run: echo "BuildParameters=${{ env.BuildParameters }} /p:EnableCodeSignBuild=True" >> $GITHUB_ENV
+
+ # - name: Set notarization credentials
+ # if: startsWith(github.ref, 'refs/tags/')
+ # run: |
+ # xcrun altool --store-password-in-keychain-item "AC_PASSWORD" -u "${{ secrets.AC_USERNAME }}" -p "${{ secrets.AC_PASSWORD }}"
+ # echo "BuildParameters=${{ env.BuildParameters }} /p:EnableNotarizationBuild=True" >> $GITHUB_ENV
+
+ - run: dotnet build ${{ env.BuildParameters }} -f net5.0 -r osx-x64
+
+ - uses: actions/upload-artifact@v2
+ with:
+ name: pablodraw-mac
+ path: artifacts/bin/${{ env.BuildConfiguration }}/net5.0/osx-x64/PabloDraw.dmg
+
+ update-release:
+ needs: [ build-windows, build-mac ]
+ runs-on: ubuntu-latest
+ if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
+ steps:
+ - id: get_version
+ run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
+
+ - id: get_release
+ uses: bruceadams/get-release@v1.2.0
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - uses: actions/download-artifact@v2
+ with:
+ name: pablodraw
+
+ # - uses: actions/upload-release-asset@v1
+ # env:
+ # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ # with:
+ # upload_url: ${{ steps.get_release.outputs.upload_url }}
+ # asset_path:
+ # asset_name:
+ # asset_content_type: application/octet-stream
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..7e15fcb
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,27 @@
+{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": "PabloDraw",
+ "type": "coreclr",
+ "request": "launch",
+ "preLaunchTask": "build-pablodraw",
+ "osx": {
+ "program": "${workspaceFolder}/artifacts/bin/${config:var.BuildConfiguration}/net5.0/osx-x64/PabloDraw.app/Contents/MacOS/PabloDraw",
+ },
+ "windows": {
+ "program": "${workspaceFolder}/artifacts/bin/${config:var.BuildConfiguration}/net5.0-windows/win-x64/PabloDraw.exe",
+ },
+ "linux": {
+ "program": "${workspaceFolder}/artifacts/bin/${config:var.BuildConfiguration}/net5.0/linux-x64/PabloDraw",
+ },
+ "args": [],
+ "cwd": "${workspaceFolder}",
+ "stopAtEntry": false,
+ "console": "internalConsole"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..7477247
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,8 @@
+{
+ "vssolution.altSolutionFolders": [
+ "Source"
+ ],
+ "var": {
+ "BuildConfiguration": "Debug"
+ }
+}
\ No newline at end of file
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
new file mode 100644
index 0000000..de10880
--- /dev/null
+++ b/.vscode/tasks.json
@@ -0,0 +1,75 @@
+{
+ // See https://go.microsoft.com/fwlink/?LinkId=733558
+ // for the documentation about the tasks.json format
+ "version": "2.0.0",
+ "tasks": [
+ {
+ "label": "build",
+ "command": "dotnet",
+ "type": "shell",
+ "args": [
+ "build",
+ "${workspaceFolder}/Source/Pablo Desktop.sln",
+ "/p:Configuration=Debug",
+ "/p:Platform=Mac",
+ "/p:GenerateFullPaths=true",
+ "/consoleloggerparameters:NoSummary"
+ ],
+ "group": "build",
+ "presentation": {
+ "clear": true
+ },
+ "problemMatcher": "$msCompile"
+ },
+ {
+ "label": "build-pablodraw",
+ "command": "dotnet",
+ "type": "shell",
+ "args": [
+ "build",
+ "${workspaceFolder}/Source/PabloDraw/PabloDraw.csproj",
+ // "/p:BuildTarget=Linux",
+ "/p:Configuration=${config:var.BuildConfiguration}",
+ "/p:GenerateFullPaths=true",
+ "/consoleloggerparameters:NoSummary"
+ ],
+ "group": "build",
+ "presentation": {
+ "clear": true
+ },
+ "problemMatcher": "$msCompile"
+ },
+ {
+ "label": "publish-pablodraw",
+ "command": "dotnet",
+ "type": "shell",
+ "args": [
+ "publish",
+ "${workspaceFolder}/Source/PabloDraw/PabloDraw.csproj",
+ // "/p:BuildTarget=Linux",
+ "/p:Configuration=Release",
+ "/p:GenerateFullPaths=true",
+ "/consoleloggerparameters:NoSummary"
+ ],
+ "group": "build",
+ "presentation": {
+ "clear": true
+ },
+ "problemMatcher": "$msCompile"
+ },
+ {
+ "label": "run-published",
+ "type": "shell",
+ "osx": {
+ "command": "${workspaceFolder}/artifacts/bin/Release/net5.0/osx-x64/PabloDraw.app/Contents/MacOS/PabloDraw",
+ },
+ "windows": {
+ "command": "${workspaceFolder}/artifacts/bin/Release/net5.0-windows/win-x64/publish/PabloDraw.exe",
+ },
+ "linux": {
+ "command": "${workspaceFolder}/artifacts/bin/Release/net5.0/linux-x64/publish/PabloDraw",
+ },
+ "problemMatcher": [ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
index 0853656..2784717 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2017 Curtis Wensley
+Copyright (c) 2021 Curtis Wensley
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/Libraries/Mono.Nat b/Libraries/Mono.Nat
deleted file mode 160000
index b20141c..0000000
--- a/Libraries/Mono.Nat
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit b20141c5e28dfb59a7d01828955311229bda97ad
diff --git a/Libraries/extractprojects.sh b/Libraries/extractprojects.sh
deleted file mode 100755
index a27d9df..0000000
--- a/Libraries/extractprojects.sh
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/bin/bash
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
-function extract_csproj () {
- csprojdir=$1
- csproj=$4
- newdir=$2
- libdir=$3
- subdir="`echo $libdir/$csprojdir | sed 's/\\//\\\\\\\\/g'`"
- subdir="$subdir\\\\"
- if [[ -z "$5" ]]; then
- oldcsproj=$csproj
- else
- oldcsproj=$csproj
- csproj=$5
- fi
- csproj="$newdir/$csproj"
-
- mkdir -p "$newdir"
-
- rm -f "$csproj"
-
- cp "$DIR/$csprojdir/$oldcsproj" "$csproj"
-
- rep="s/<(Compile|EmbeddedResource|None) Include=\"(.+)\">(?=\s*)/<\1 Include=\"$subdir\2\">/g"
- #rep="s/<(Compile|EmbeddedResource|None) Include=\"(.+)\">(?!\s*)/<\1 Include=\"$subdir\2\">/g"
- perl -0pi -e "$rep" "$csproj"
-
- rep="s/<(Compile|EmbeddedResource|None) Include=\"(.+)\">(?!\s*)/<\1 Include=\"$subdir\2\">\n \2<\/Link>/g"
- #rep="s/<(Compile|EmbeddedResource|None) Include=\"(.+)\">\s*.+<\/Link>/<\1 Include=\"$subdir\2\">/g"
- perl -0pi -e "$rep" "$csproj"
-
- rep="s/<(Compile|EmbeddedResource|None) Include=\"(.+)\" \/>/<\1 Include=\"$subdir\2\">\n \2<\/Link>\n <\/\1>/"
- #rep="s/<(Compile|EmbeddedResource|None) Include=\"(.+)\" \/>/<\1 Include=\"$subdir\2\" \/>/"
- perl -pi -e "$rep" "$csproj"
-
- rep="s/<(OutputPath|DocumentationFile)>(.+)<\//<\1>$subdir\2<\//"
- perl -pi -e "$rep" "$csproj"
-
- rep="s/(?<=)/$subdir\2/g"
- perl -0pi -e "$rep" "$csproj"
-
- rep="s/((\s|.)*?)((\s|.)+?<\/HintPath>(\s|.)+?<\/Reference>)/\1$subdir\3/g"
- perl -0pi -e "$rep" "$csproj"
-}
-
-function replace_reference () {
- csproj=$1
- find_reference=$2
- replace_with=$3
-
- uuid=$(sed -n 's/.*\(.*\)<\/ProjectGuid>.*/\1/p' "$replace_with.csproj")
-
- rep="s/(\s|.)*?<\/Reference>/\n $uuid<\/Project>\n $replace_with<\/Name>\n <\/ProjectReference>/g"
- perl -0pi -e "$rep" "$csproj"
-}
-
-function replace_hint () {
- csprojdir=$1
- find_reference=$2
- newdir=$3
-
- rep="s/((\s|.)*?)([^<]+?)($find_reference[.]dll<\/HintPath>(\s|.)+?<\/Reference>)/\1$newdir\4/g"
- perl -0pi -e "$rep" "$csproj"
-}
-
-function remove_line () {
- file_name=$1
- remove_line=$2
-
- perl -0pi -e "$remove_line" "$file_name"
-}
-
-function convert_to_ios () {
- remove_line "$1" "s/.*v4\.0<\/TargetFrameworkVersion>.*\n//g"
- remove_line "$1" "s/(.*)(.*<\/ProjectGuid>)(.*\n)/\1\2\3\1{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}<\/ProjectTypeGuids>\3/g"
-}
-
-extract_csproj "lidgren/Lidgren.Network" "../Source/Lidgren.Network" "../../Libraries" "Lidgren.Network.csproj" "Lidgren.Network - iOS.csproj"
-convert_to_ios "../Source/Lidgren.Network/Lidgren.Network - iOS.csproj"
-extract_csproj "Mono.Nat/src/Mono.Nat" "../Source/Mono.Nat" "../../Libraries" "Mono.Nat.csproj" "Mono.Nat - iOS.csproj"
-convert_to_ios "../Source/Mono.Nat/Mono.Nat - iOS.csproj"
diff --git a/Libraries/lidgren b/Libraries/lidgren
deleted file mode 160000
index da7b4b8..0000000
--- a/Libraries/lidgren
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit da7b4b8042c72034075c04be140b5f749d0c109d
diff --git a/Source/Directory.Build.props b/Source/Directory.Build.props
index e135c03..d33c8ae 100644
--- a/Source/Directory.Build.props
+++ b/Source/Directory.Build.props
@@ -1,11 +1,13 @@
Picoe Software Solutions
- (c) 2006-2019 by Curtis Wensley aka Eto
+ (c) 2006-2021 by Curtis Wensley aka Eto
3.3.0-dev
$(MSBuildThisFileDirectory)..\
- $(BasePath)Artifacts\
+ $(BasePath)artifacts\
+
+ embedded
$(ArtifactsDir)obj\$(OS)\$(MSBuildProjectName)\
bin
@@ -13,5 +15,8 @@
$(ArtifactsDir)nuget\$(Configuration)\
PackageReference
+
+
+
\ No newline at end of file
diff --git a/Source/Directory.Build.targets b/Source/Directory.Build.targets
index 72939ce..296ecfa 100644
--- a/Source/Directory.Build.targets
+++ b/Source/Directory.Build.targets
@@ -2,7 +2,7 @@
-
+
diff --git a/Source/Pablo Desktop.sln b/Source/Pablo Desktop.sln
index 91d0e25..12e8f9c 100644
--- a/Source/Pablo Desktop.sln
+++ b/Source/Pablo Desktop.sln
@@ -9,8 +9,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pablo", "Pablo\Pablo.csproj
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pablo.Interface", "Pablo.Interface\Pablo.Interface.csproj", "{3FAACC7E-D156-4599-B0D1-6177AD78E8B1}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Nat", "..\Libraries\Mono.Nat\src\Mono.Nat\Mono.Nat.csproj", "{F5D74163-145F-47BF-83DC-D0E07249C6CA}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PabloDraw.Console", "PabloDraw.Console\PabloDraw.Console.csproj", "{0457895A-719B-47E9-84F3-356B2A1F8D3C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{88CCB819-8E11-429C-94D7-D5A27A671129}"
@@ -20,10 +18,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EmbedReferences.targets = EmbedReferences.targets
EndProjectSection
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lidgren.Network", "..\Libraries\lidgren\Lidgren.Network\Lidgren.Network.csproj", "{49BA1C69-6104-41AC-A5D8-B54FA9F696E8}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PabloDraw.Mac", "PabloDraw.Mac\PabloDraw.Mac.csproj", "{5590729F-3176-4A91-94E3-54F75DA2EB9D}"
-EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "PabloDraw.WindowsInstaller", "PabloDraw.WindowsInstaller\PabloDraw.WindowsInstaller.wixproj", "{38A42F6D-A417-45B0-8EC8-A700F31CBE26}"
EndProject
Global
@@ -58,14 +52,6 @@ Global
{3FAACC7E-D156-4599-B0D1-6177AD78E8B1}.Release|Any CPU.Build.0 = Release|Any CPU
{3FAACC7E-D156-4599-B0D1-6177AD78E8B1}.Release|Mac.ActiveCfg = Release|Any CPU
{3FAACC7E-D156-4599-B0D1-6177AD78E8B1}.Release|Mac.Build.0 = Release|Any CPU
- {F5D74163-145F-47BF-83DC-D0E07249C6CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F5D74163-145F-47BF-83DC-D0E07249C6CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F5D74163-145F-47BF-83DC-D0E07249C6CA}.Debug|Mac.ActiveCfg = Debug|Any CPU
- {F5D74163-145F-47BF-83DC-D0E07249C6CA}.Debug|Mac.Build.0 = Debug|Any CPU
- {F5D74163-145F-47BF-83DC-D0E07249C6CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F5D74163-145F-47BF-83DC-D0E07249C6CA}.Release|Any CPU.Build.0 = Release|Any CPU
- {F5D74163-145F-47BF-83DC-D0E07249C6CA}.Release|Mac.ActiveCfg = Release|Any CPU
- {F5D74163-145F-47BF-83DC-D0E07249C6CA}.Release|Mac.Build.0 = Release|Any CPU
{0457895A-719B-47E9-84F3-356B2A1F8D3C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0457895A-719B-47E9-84F3-356B2A1F8D3C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0457895A-719B-47E9-84F3-356B2A1F8D3C}.Debug|Mac.ActiveCfg = Debug|Any CPU
@@ -74,20 +60,6 @@ Global
{0457895A-719B-47E9-84F3-356B2A1F8D3C}.Release|Any CPU.Build.0 = Release|Any CPU
{0457895A-719B-47E9-84F3-356B2A1F8D3C}.Release|Mac.ActiveCfg = Release|Any CPU
{0457895A-719B-47E9-84F3-356B2A1F8D3C}.Release|Mac.Build.0 = Release|Any CPU
- {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Debug|Mac.ActiveCfg = Debug|Any CPU
- {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Debug|Mac.Build.0 = Debug|Any CPU
- {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Release|Any CPU.Build.0 = Release|Any CPU
- {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Release|Mac.ActiveCfg = Release|Any CPU
- {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Release|Mac.Build.0 = Release|Any CPU
- {5590729F-3176-4A91-94E3-54F75DA2EB9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {5590729F-3176-4A91-94E3-54F75DA2EB9D}.Debug|Mac.ActiveCfg = Debug|Any CPU
- {5590729F-3176-4A91-94E3-54F75DA2EB9D}.Debug|Mac.Build.0 = Debug|Any CPU
- {5590729F-3176-4A91-94E3-54F75DA2EB9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {5590729F-3176-4A91-94E3-54F75DA2EB9D}.Release|Mac.ActiveCfg = Release|Any CPU
- {5590729F-3176-4A91-94E3-54F75DA2EB9D}.Release|Mac.Build.0 = Release|Any CPU
{38A42F6D-A417-45B0-8EC8-A700F31CBE26}.Debug|Any CPU.ActiveCfg = Debug|x86
{38A42F6D-A417-45B0-8EC8-A700F31CBE26}.Debug|Mac.ActiveCfg = Debug|x86
{38A42F6D-A417-45B0-8EC8-A700F31CBE26}.Release|Any CPU.ActiveCfg = Release|x86
diff --git a/Source/Pablo.Interface/Actions/OpenFile.cs b/Source/Pablo.Interface/Actions/OpenFile.cs
index 42c63f3..682ba04 100644
--- a/Source/Pablo.Interface/Actions/OpenFile.cs
+++ b/Source/Pablo.Interface/Actions/OpenFile.cs
@@ -21,9 +21,9 @@ public OpenFile(Main main)
{
this.main = main;
base.ID = ActionID;
- this.MenuText = "&Open";
- this.ToolBarText = "Open";
- this.ToolTip = "Open a file";
+ this.MenuText = "&Open";
+ this.ToolBarText = "Open";
+ this.ToolTip = "Open a file";
this.Image = ImageCache.IconFromResource("Pablo.Interface.Icons.open.ico");
this.Shortcut = PabloCommand.CommonModifier | Keys.O;
this.Enabled = main.Client == null || main.Client.CurrentUser.Level >= Pablo.Network.UserLevel.Operator;
@@ -41,10 +41,10 @@ protected override void OnExecuted(EventArgs e)
{
var extensions = from ex in format.Extensions select "." + ex;
allFormats.AddRange (extensions);
- ofd.Filters.Add(new FileDialogFilter{ Name = format.Name, Extensions = extensions.ToArray () });
+ ofd.Filters.Add(new FileFilter{ Name = format.Name, Extensions = extensions.ToArray () });
}
}
- ofd.Filters.Insert(0, new FileDialogFilter{ Name = "All Formats", Extensions = allFormats.ToArray() });
+ ofd.Filters.Insert(0, new FileFilter{ Name = "All Formats", Extensions = allFormats.ToArray() });
var dr = ofd.ShowDialog(main);
if (dr == DialogResult.Ok)
diff --git a/Source/Pablo.Interface/Actions/Readme.cs b/Source/Pablo.Interface/Actions/Readme.cs
index 0f16acc..709fabe 100644
--- a/Source/Pablo.Interface/Actions/Readme.cs
+++ b/Source/Pablo.Interface/Actions/Readme.cs
@@ -1,6 +1,6 @@
using System;
-using System.IO;
-using System.Reflection;
+using System.IO;
+using System.Reflection;
using Eto.Forms;
namespace Pablo.Interface.Actions
@@ -20,6 +20,9 @@ public Readme(Main main)
protected override void OnExecuted(EventArgs e)
{
base.OnExecuted(e);
+ if (!main.PromptSave())
+ return;
+
using (var stream = typeof(Readme).Assembly.GetManifestResourceStream("Pablo.Interface.README.ans"))
{
main.LoadFile("README.ans", stream, hasSavePermissions: false, setFileList: false, editMode: false);
diff --git a/Source/Pablo.Interface/Dialogs/About.cs b/Source/Pablo.Interface/Dialogs/About.cs
index 3a1973c..bef9645 100644
--- a/Source/Pablo.Interface/Dialogs/About.cs
+++ b/Source/Pablo.Interface/Dialogs/About.cs
@@ -8,7 +8,7 @@ namespace Pablo.Interface.Dialogs
{
public class About : Dialog
{
- const string CopyRightText = @"PabloDraw is © 2013 by Curtis Wensley aka Eto
+ const string CopyRightText = @"PabloDraw is © 2006-2021 by Curtis Wensley aka Eto
Amiga raw font versions are © dMG/t!s^dS!
@@ -28,7 +28,7 @@ public About()
layout.BeginHorizontal();
layout.BeginVertical(new Padding(15, 20));
layout.Add(new ImageView
- {
+ {
Image = ImageCache.IconFromResource("Pablo.Interface.Icons.PabloDraw.ico"),
Size = new Size(128, 128)
}, yscale: true);
@@ -37,14 +37,14 @@ public About()
{
Text = "PabloDraw",
Font = Fonts.Sans(16, FontStyle.Bold),
- HorizontalAlign = HorizontalAlign.Center
+ TextAlignment = TextAlignment.Center
});
var version = Assembly.GetEntryAssembly().GetName().Version;
layout.Add(new Label
{
Text = string.Format("Version {0}", version),
- HorizontalAlign = HorizontalAlign.Center
+ TextAlignment = TextAlignment.Center
});
if (!Platform.IsMac)
@@ -74,8 +74,8 @@ public About()
Content = new Label
{
Text = CopyRightText,
- HorizontalAlign = HorizontalAlign.Center,
- VerticalAlign = VerticalAlign.Middle
+ TextAlignment = TextAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center
},
BackgroundColor = Colors.White
diff --git a/Source/Pablo.Interface/Dialogs/SauceInfoDialog.cs b/Source/Pablo.Interface/Dialogs/SauceInfoDialog.cs
index 57f2945..ac339d4 100644
--- a/Source/Pablo.Interface/Dialogs/SauceInfoDialog.cs
+++ b/Source/Pablo.Interface/Dialogs/SauceInfoDialog.cs
@@ -186,7 +186,7 @@ class MyLabel : Label
{
public MyLabel()
{
- VerticalAlign = VerticalAlign.Middle;
+ VerticalAlignment = VerticalAlignment.Center;
}
}
@@ -373,7 +373,7 @@ Control SaveButton()
static T LabelControl(TableLayout layout, T control, string label, int y)
where T: Control
{
- layout.Add(new Label{ Text = label, VerticalAlign = VerticalAlign.Middle }, 0, y);
+ layout.Add(new Label{ Text = label, VerticalAlignment = VerticalAlignment.Center }, 0, y);
layout.Add(control, 1, y);
return control;
}
diff --git a/Source/Pablo.Interface/Main.cs b/Source/Pablo.Interface/Main.cs
index 0859eec..6fecec3 100644
--- a/Source/Pablo.Interface/Main.cs
+++ b/Source/Pablo.Interface/Main.cs
@@ -15,868 +15,894 @@
namespace Pablo.Interface
{
- public class Main : Form, IClientDelegate, IClientSource
- {
- const string TITLE = "PabloDraw";
+ public class Main : Form, IClientDelegate, IClientSource
+ {
+ const string TITLE = "PabloDraw";
Handler handler;
- readonly FileList fileList;
- readonly Settings settings = new Settings();
- Server server;
- Client client;
- Format currentFormat;
- EtoFileInfo currentFile;
- readonly Splitter splitter;
- readonly PadPanel padpanel;
- bool shouldReload = true;
- bool lastEditMode;
- GenerateCommandArgs args;
-
- #region Events
-
- public event EventHandler ServerChanged;
-
- protected virtual void OnServerChanged(EventArgs e)
- {
- if (ServerChanged != null)
- ServerChanged(this, e);
- }
-
- public event EventHandler ClientChanged;
-
- protected virtual void OnClientChanged(EventArgs e)
- {
- if (ClientChanged != null)
- ClientChanged(this, e);
-
- if (handler != null)
- handler.Client = Client;
-
- GeneratePads();
- GenerateActions();
- }
-
- public event EventHandler DocumentChanged;
-
- protected virtual void OnDocumentChanged(EventArgs e)
- {
- if (DocumentChanged != null)
- DocumentChanged(this, e);
- }
-
- #endregion
-
- #region Properties
-
- public IEnumerable Commands
- {
- get
- {
- yield return new Actions.EditFile(this);
- yield return new Actions.NewFile(this);
- yield return new Actions.EditSauce(this);
-
- if (handler != null)
- foreach (var command in handler.Commands)
- yield return command;
- }
- }
-
- public IEnumerable ServerCommands
- {
- get
- {
- if (handler != null)
- foreach (var command in handler.ServerCommands)
- yield return command;
- }
- }
-
- public new Control Content
- {
- get { return padpanel.Content; }
- }
-
- public ChatPanel ChatPanel
- {
- get;
- private set;
- }
-
- public string SettingsFile
- {
- get
- {
- var dir = EtoEnvironment.GetFolderPath(EtoSpecialFolder.ApplicationSettings);
- dir = Path.Combine(dir, "PabloDraw");
- if (!Directory.Exists(dir))
- Directory.CreateDirectory(dir);
- return Path.Combine(dir, "PabloDraw.config");
- }
- }
-
- public Document Document
- {
- get { return handler != null ? handler.Document : null; }
- }
+ readonly FileList fileList;
+ readonly Settings settings = new Settings();
+ Server server;
+ Client client;
+ Format currentFormat;
+ EtoFileInfo currentFile;
+ readonly Splitter splitter;
+ readonly PadPanel padpanel;
+ bool shouldReload = true;
+ bool lastEditMode;
+ GenerateCommandArgs args;
- public Handler ViewHandler
- {
- get { return handler; }
- }
+ #region Events
- public FileList FileList
- {
- get { return fileList; }
- }
+ public event EventHandler ServerChanged;
- public Settings Settings
- {
- get { return settings; }
- }
+ protected virtual void OnServerChanged(EventArgs e)
+ {
+ if (ServerChanged != null)
+ ServerChanged(this, e);
+ }
- public Server Server
- {
- get { return server; }
- set
- {
- if (server != value)
- {
- server = value;
- OnServerChanged(EventArgs.Empty);
- }
- }
- }
-
- public Client Client
- {
- get { return client; }
- set
- {
- if (client != value)
- {
- client = value;
- if (client != null)
- {
- client.CurrentUserChanged += delegate
- {
- GenerateActions();
- GeneratePads();
- };
- client.Disconnected += delegate(object sender, DisconnectedArgs e)
- {
- Client = null;
- if (!string.IsNullOrEmpty(e.Reason))
- MessageBox.Show(this, e.Reason, "Disconnected from server");
- };
- }
- OnClientChanged(EventArgs.Empty);
- }
- }
- }
+ public event EventHandler ClientChanged;
- public event EventHandler EditModeChanged;
+ protected virtual void OnClientChanged(EventArgs e)
+ {
+ if (ClientChanged != null)
+ ClientChanged(this, e);
- protected virtual void OnEditModeChanged(EventArgs e)
- {
- if (EditModeChanged != null)
- EditModeChanged(this, e);
+ if (handler != null)
+ handler.Client = Client;
- SetDocument(Document);
+ GeneratePads();
+ GenerateActions();
+ }
- SetupEditMode(false, true);
- }
+ public event EventHandler DocumentChanged;
- void SetupEditMode(bool reload, bool focus)
- {
- if (lastEditMode != EditMode)
- {
- if (lastEditMode)
- Settings.EditFileSplit = splitter.Position;
- else
- Settings.FileSplit = splitter.Position;
+ protected virtual void OnDocumentChanged(EventArgs e)
+ {
+ if (DocumentChanged != null)
+ DocumentChanged(this, e);
+ }
- if (EditMode)
- {
- splitter.Position = Settings.EditFileSplit;
- if (reload)
- ReloadFile(false, true, false);
- }
- else
- {
- splitter.Position = Settings.FileSplit;
- if (reload)
- ReloadFile(false, false, false);
- }
- lastEditMode = EditMode;
- }
+ #endregion
- if (focus)
- {
- if (EditMode)
- Content.Focus();
- else
- FileList.Focus();
- }
- }
+ #region Properties
- public bool EditMode
- {
- get { return Document != null && Document.EditMode; }
- set
- {
- var doc = Document;
- if (doc != null && value != doc.EditMode)
- {
- var stream = loadingStream;
- if (stream != null)
- {
- doc.EditMode = value;
-
- var fileName = doc.FileName;
- SetDocument(null);
- stream.Seek(0, SeekOrigin.Begin);
- LoadFile(fileName, stream, doc.LoadedFormat, value, false, doc.HasSavePermission);
- stream.Dispose();
- loadingStream = null;
- }
- else
- doc.EditMode = value;
- OnEditModeChanged(EventArgs.Empty);
- }
- }
- }
-
- public bool EnableBackups
- {
- get { return settings.EnableBackups; }
- set { settings.EnableBackups = value; }
- }
-
- #endregion
-
- public void WriteXml()
- {
- try
- {
- if (EditMode)
- Settings.EditFileSplit = splitter.Position;
- else
- Settings.FileSplit = splitter.Position;
-
-
- var doc = new XmlDocument();
- var head = doc.CreateElement("pablo");
-
- Settings.WriteXml(head);
-
-
- var elem = doc.CreateElement("main");
- if (FileList.CurrentDirectory != null)
- {
- var dir = FileList.CurrentDirectory;
- while (dir is VirtualDirectoryInfo)
- {
- var file = ((VirtualDirectoryInfo)dir).FileInfo;
- if (file == null)
- break;
- dir = file.Directory;
- }
- elem.SetAttribute("path", dir.FullName);
- }
- head.AppendChild(elem);
-
- head.WriteChildXml("main-window", new WindowStateSaver(this));
+ public IEnumerable Commands
+ {
+ get
+ {
+ yield return new Actions.EditFile(this);
+ yield return new Actions.NewFile(this);
+ yield return new Actions.EditSauce(this);
+
+ if (handler != null)
+ foreach (var command in handler.Commands)
+ yield return command;
+ }
+ }
+
+ public IEnumerable ServerCommands
+ {
+ get
+ {
+ if (handler != null)
+ foreach (var command in handler.ServerCommands)
+ yield return command;
+ }
+ }
+
+ public new Control Content
+ {
+ get { return padpanel.Content; }
+ }
+
+ public ChatPanel ChatPanel
+ {
+ get;
+ private set;
+ }
+
+ public string SettingsFile
+ {
+ get
+ {
+ var dir = EtoEnvironment.GetFolderPath(EtoSpecialFolder.ApplicationSettings);
+ dir = Path.Combine(dir, "PabloDraw");
+ if (!Directory.Exists(dir))
+ Directory.CreateDirectory(dir);
+ return Path.Combine(dir, "PabloDraw.config");
+ }
+ }
+
+ public Document Document
+ {
+ get { return handler != null ? handler.Document : null; }
+ }
+
+ public Handler ViewHandler
+ {
+ get { return handler; }
+ }
+
+ public FileList FileList
+ {
+ get { return fileList; }
+ }
+
+ public Settings Settings
+ {
+ get { return settings; }
+ }
+
+ public Server Server
+ {
+ get { return server; }
+ set
+ {
+ if (server != value)
+ {
+ server = value;
+ OnServerChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public Client Client
+ {
+ get { return client; }
+ set
+ {
+ if (client != value)
+ {
+ client = value;
+ if (client != null)
+ {
+ client.CurrentUserChanged += delegate
+ {
+ GenerateActions();
+ GeneratePads();
+ };
+ client.Disconnected += delegate (object sender, DisconnectedArgs e)
+ {
+ Client = null;
+ if (!string.IsNullOrEmpty(e.Reason))
+ MessageBox.Show(this, e.Reason, "Disconnected from server");
+ };
+ }
+ OnClientChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public event EventHandler EditModeChanged;
+
+ protected virtual void OnEditModeChanged(EventArgs e)
+ {
+ if (EditModeChanged != null)
+ EditModeChanged(this, e);
+
+ SetDocument(Document);
+
+ SetupEditMode(false, true);
+ }
+
+ void SetupEditMode(bool reload, bool focus)
+ {
+ if (lastEditMode != EditMode)
+ {
+ if (lastEditMode)
+ Settings.EditFileSplit = splitter.Position;
+ else
+ Settings.FileSplit = splitter.Position;
+
+ if (EditMode)
+ {
+ splitter.Position = Settings.EditFileSplit;
+ if (reload)
+ ReloadFile(false, true, false);
+ }
+ else
+ {
+ splitter.Position = Settings.FileSplit;
+ if (reload)
+ ReloadFile(false, false, false);
+ }
+ lastEditMode = EditMode;
+ }
+
+ if (focus)
+ {
+ if (EditMode)
+ Content.Focus();
+ else
+ FileList.Focus();
+ }
+ }
+
+ public bool EditMode
+ {
+ get { return Document != null && Document.EditMode; }
+ set
+ {
+ var doc = Document;
+ if (doc != null && value != doc.EditMode)
+ {
+ var stream = loadingStream;
+ if (stream != null)
+ {
+ doc.EditMode = value;
+
+ var fileName = doc.FileName;
+ SetDocument(null);
+ stream.Seek(0, SeekOrigin.Begin);
+ LoadFile(fileName, stream, doc.LoadedFormat, value, false, doc.HasSavePermission);
+ stream.Dispose();
+ loadingStream = null;
+ }
+ else
+ doc.EditMode = value;
+ OnEditModeChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public bool EnableBackups
+ {
+ get { return settings.EnableBackups; }
+ set { settings.EnableBackups = value; }
+ }
+
+ #endregion
+
+ public void WriteXml()
+ {
+ try
+ {
+ if (EditMode)
+ Settings.EditFileSplit = splitter.Position;
+ else
+ Settings.FileSplit = splitter.Position;
- doc.AppendChild(head);
- doc.Save(SettingsFile);
- }
- catch (Exception ex)
- {
- Console.WriteLine("Error! {0}", ex);
- }
+ var doc = new XmlDocument();
+ var head = doc.CreateElement("pablo");
- }
+ Settings.WriteXml(head);
- class WindowStateSaver : IXmlReadable
- {
- public Window Window { get; private set; }
- public bool LoadMinimized { get; set; }
+ var elem = doc.CreateElement("main");
+ if (FileList.CurrentDirectory != null)
+ {
+ var dir = FileList.CurrentDirectory;
+ while (dir is VirtualDirectoryInfo)
+ {
+ var file = ((VirtualDirectoryInfo)dir).FileInfo;
+ if (file == null)
+ break;
+ dir = file.Directory;
+ }
+ elem.SetAttribute("path", dir.FullName);
+ }
+ head.AppendChild(elem);
- public bool LoadPosition { get; set; }
+ head.WriteChildXml("main-window", new WindowStateSaver(this));
- public WindowStateSaver(Window window)
- {
- this.Window = window;
- LoadPosition = true;
- }
- #region IXmlReadable implementation
+ doc.AppendChild(head);
+ doc.Save(SettingsFile);
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Error! {0}", ex);
+ }
- public void ReadXml(XmlElement element)
- {
- var startx = element.GetIntAttribute("startx");
- var starty = element.GetIntAttribute("starty");
- var width = element.GetIntAttribute("width");
- var height = element.GetIntAttribute("height");
+ }
- if (width != null && height != null && width > 0 && height > 0)
- {
- Window.Size = new Size(width.Value, height.Value);
- }
+ class WindowStateSaver : IXmlReadable
+ {
+ public Window Window { get; private set; }
- var state = element.GetEnumAttribute("state") ?? WindowState.Normal;
+ public bool LoadMinimized { get; set; }
- if (startx != null && starty != null && (LoadPosition || state != WindowState.Normal))
- {
- Window.Location = new Point(startx.Value, starty.Value);
- }
+ public bool LoadPosition { get; set; }
- if (state == WindowState.Maximized)
- Window.Maximize();
- else if (LoadMinimized && state == WindowState.Minimized)
- Window.Minimize();
- }
+ public WindowStateSaver(Window window)
+ {
+ this.Window = window;
+ LoadPosition = true;
+ }
- public void WriteXml(XmlElement element)
- {
- var restoreBounds = Window.RestoreBounds;
- element.SetAttribute("width", restoreBounds.Width);
- element.SetAttribute("height", restoreBounds.Height);
- if (LoadPosition || Window.WindowState != WindowState.Normal)
- {
- element.SetAttribute("startx", restoreBounds.X);
- element.SetAttribute("starty", restoreBounds.Y);
+ #region IXmlReadable implementation
- }
- element.SetAttribute("state", Window.WindowState);
- }
+ public void ReadXml(XmlElement element)
+ {
+ var startx = element.GetIntAttribute("startx");
+ var starty = element.GetIntAttribute("starty");
+ var width = element.GetIntAttribute("width");
+ var height = element.GetIntAttribute("height");
+
+ if (width != null && height != null && width > 0 && height > 0)
+ {
+ Window.Size = new Size(width.Value, height.Value);
+ }
+
+ var state = element.GetEnumAttribute("state") ?? WindowState.Normal;
+
+ if (startx != null && starty != null && (LoadPosition || state != WindowState.Normal))
+ {
+ Window.Location = new Point(startx.Value, starty.Value);
+ }
+
+ if (state == WindowState.Maximized)
+ Window.Maximize();
+ else if (LoadMinimized && state == WindowState.Minimized)
+ Window.Minimize();
+ }
+
+ public void WriteXml(XmlElement element)
+ {
+ var restoreBounds = Window.RestoreBounds;
+ element.SetAttribute("width", restoreBounds.Width);
+ element.SetAttribute("height", restoreBounds.Height);
+ if (LoadPosition || Window.WindowState != WindowState.Normal)
+ {
+ element.SetAttribute("startx", restoreBounds.X);
+ element.SetAttribute("starty", restoreBounds.Y);
+
+ }
+ element.SetAttribute("state", Window.WindowState);
+ }
+
+ #endregion
+ }
+
+ public void ReadXml()
+ {
+ if (File.Exists(SettingsFile))
+ {
+ var doc = new XmlDocument();
+ doc.Load(SettingsFile);
+ var head = (XmlElement)doc.SelectSingleNode("pablo");
- #endregion
- }
+ Settings.ReadXml(head);
- public void ReadXml()
- {
- if (File.Exists(SettingsFile))
- {
- var doc = new XmlDocument();
- doc.Load(SettingsFile);
- var head = (XmlElement)doc.SelectSingleNode("pablo");
+ var elem = (XmlElement)head.SelectSingleNode("main");
+ if (elem != null)
+ {
+ var dir = elem.GetAttribute("path");
+ if (Directory.Exists(dir))
+ FileList.Initialize(dir);
+ }
- Settings.ReadXml(head);
+ head.ReadChildXml("main-window", new WindowStateSaver(this));
+ }
+ }
- var elem = (XmlElement)head.SelectSingleNode("main");
- if (elem != null)
- {
- var dir = elem.GetAttribute("path");
- if (Directory.Exists(dir))
- FileList.Initialize(dir);
- }
+ public Main()
+ {
+ Title = TITLE;
+ Size = new Size(950, 650);
+ this.Style = "main";
- head.ReadChildXml("main-window", new WindowStateSaver(this));
- }
- }
+ this.Icon = ImageCache.IconFromResource("Pablo.Interface.Icons.PabloDraw.ico");
- public Main()
- {
- Title = TITLE;
- Size = new Size(950, 650);
- this.Style = "main";
-
- this.Icon = ImageCache.IconFromResource("Pablo.Interface.Icons.PabloDraw.ico");
+ padpanel = new PadPanel();
- padpanel = new PadPanel();
+ splitter = new Splitter();
- splitter = new Splitter();
+ fileList = new FileList(this);
+ fileList.Activated += delegate
+ {
+ if (fileList.SelectedFile != null)
+ {
+ currentFormat = null;
- fileList = new FileList(this);
- fileList.Activated += delegate
- {
- if (fileList.SelectedFile != null)
- {
- currentFormat = null;
-
ReloadFile(!fileList.SelectedFile.ReadOnly, true, true);
- }
- };
- fileList.SelectedIndexChanged += delegate
- {
- if (!this.EditMode)
- {
- if (fileList.SelectedFile != null)
- {
- currentFormat = null;
- ReloadFile(!fileList.SelectedFile.ReadOnly, false, false);
- }
- }
- };
- string initialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
- fileList.Initialize(initialDirectory);
-
-
- padpanel.Content = new Panel { BackgroundColor = Colors.Black };
- splitter.Panel1 = fileList;
- splitter.Panel2 = padpanel;
-
- base.Content = splitter;
-
- GenerateActions();
- ReadXml();
-
- splitter.Position = Settings.FileSplit;
- fileList.Focus();
- }
-
- protected override void OnKeyDown(KeyEventArgs e)
- {
- if (args != null)
- {
- var cmd = args.KeyboardCommands.FirstOrDefault(r => r.Shortcut == e.KeyData && r.Enabled);
- if (cmd != null)
- {
- cmd.Execute();
- e.Handled = true;
- }
- }
- base.OnKeyDown(e);
- }
-
- IEnumerable
\ No newline at end of file
diff --git a/Source/Pablo/Actions/SaveAs.cs b/Source/Pablo/Actions/SaveAs.cs
index a5d69ec..f4b9641 100644
--- a/Source/Pablo/Actions/SaveAs.cs
+++ b/Source/Pablo/Actions/SaveAs.cs
@@ -33,9 +33,9 @@ public static void Activate(Handler handler, bool setCurrent = false)
foreach (Format format in formats)
{
allFormats.AddRange(format.Extensions);
- ofd.Filters.Add(new FileDialogFilter{ Name = format.Name, Extensions = format.Extensions });
+ ofd.Filters.Add(new FileFilter{ Name = format.Name, Extensions = format.Extensions });
}
- ofd.Filters.Insert(0, new FileDialogFilter{ Name = "Auto Detect", Extensions = allFormats.ToArray() });
+ ofd.Filters.Insert(0, new FileFilter{ Name = "Auto Detect", Extensions = allFormats.ToArray() });
if (!handler.Generator.IsMac || setCurrent)
{
if (!string.IsNullOrEmpty(handler.Document.FileName) && handler.Document.HasSavePermission)
diff --git a/Source/Pablo/BGI/BGICanvas.cs b/Source/Pablo/BGI/BGICanvas.cs
index 5eb7e1f..2e7f8bd 100644
--- a/Source/Pablo/BGI/BGICanvas.cs
+++ b/Source/Pablo/BGI/BGICanvas.cs
@@ -2310,7 +2310,7 @@ public void UpdateRegion(IList rects, Graphics graphics = null)
return;
var platform = Platform.Instance;
- if (platform.IsWpf || platform.IsIos || platform.IsMac)
+ if (platform.IsWpf || platform.IsIos || platform.IsMac || platform.IsWinForms)
{
Application.Instance.AsyncInvoke(delegate
{
diff --git a/Source/Pablo/Document.cs b/Source/Pablo/Document.cs
index d440605..13b2b8d 100644
--- a/Source/Pablo/Document.cs
+++ b/Source/Pablo/Document.cs
@@ -31,14 +31,18 @@ public abstract class Document : IDisposable, INetworkReadWrite
public bool HasSavePermission { get; set; }
+ public bool IsLoading { get; private set; }
+
protected void OnStartLoad(EventArgs e)
{
+ IsLoading = true;
if (StartLoad != null)
StartLoad(this, e);
}
protected void OnLoaded(EventArgs e)
{
+ IsLoading = false;
if (Loaded != null)
Loaded(this, e);
}
diff --git a/Source/Pablo/Formats/Animated/AnimatedDocument.cs b/Source/Pablo/Formats/Animated/AnimatedDocument.cs
index 1314634..3307778 100644
--- a/Source/Pablo/Formats/Animated/AnimatedDocument.cs
+++ b/Source/Pablo/Formats/Animated/AnimatedDocument.cs
@@ -215,7 +215,7 @@ public void Stop()
if (loadingThread.IsAlive)
{
//Console.WriteLine ("Aborting thread..");
- loadingThread.Abort();
+ // loadingThread.Abort();
}
//threadKilledEvent.WaitOne ();
//threadKilledEvent.Set ();
diff --git a/Source/Pablo/Formats/Character/Actions/SetWidth.cs b/Source/Pablo/Formats/Character/Actions/SetWidth.cs
index f4eace2..cac33dc 100644
--- a/Source/Pablo/Formats/Character/Actions/SetWidth.cs
+++ b/Source/Pablo/Formats/Character/Actions/SetWidth.cs
@@ -13,9 +13,9 @@ public class SetWidth : PabloCommand
public SetWidth (CharacterHandler handler) : base(handler)
{
ID = ActionID;
- MenuText = "Set Canvas &Width...";
- ToolBarText = "Set Width";
- ToolTip = "Sets the canvas width";
+ MenuText = "Set Canvas &Size...";
+ ToolBarText = "Set Size";
+ ToolTip = "Sets the canvas size";
Image = ImageCache.IconFromResource("Pablo.Icons.setwidth.ico");
}
@@ -30,18 +30,18 @@ protected override void Execute (CommandExecuteArgs args)
CharacterHandler handler = base.Handler as CharacterHandler;
var size = handler.CurrentPage.Canvas.Size;
var dialog = new WidthDialog ();
- dialog.Width = size.Width;
+ dialog.CanvasSize = size;
var result = dialog.ShowModal (handler.Viewer as Control);
if (result == DialogResult.Ok) {
- DoResize (dialog.Width);
+ DoResize (dialog.CanvasSize);
}
}
- void DoResize(int width)
+ void DoResize(Size canvasSize)
{
CharacterHandler handler = base.Handler as CharacterHandler;
var size = handler.CurrentPage.Canvas.Size;
- size.Width = width;
+ size = canvasSize;
handler.CurrentPage.Canvas.ResizeCanvas (size, true, true);
var pos = handler.CursorPosition;
@@ -57,10 +57,10 @@ public override bool Send (SendCommandArgs args)
CharacterHandler handler = base.Handler as CharacterHandler;
var size = handler.CurrentPage.Canvas.Size;
var dialog = new WidthDialog ();
- dialog.Width = size.Width;
+ dialog.CanvasSize = size;
var result = dialog.ShowModal(handler.Viewer as Control);
if (result == DialogResult.Ok) {
- args.Message.WriteVariableInt32 (dialog.Width);
+ args.Message.Write (dialog.CanvasSize);
return true;
}
else
@@ -70,8 +70,8 @@ public override bool Send (SendCommandArgs args)
public override void Receive (ReceiveCommandArgs args)
{
base.Receive (args);
- int width = args.Message.ReadVariableInt32 ();
- DoResize (width);
+ var size = args.Message.ReadSize ();
+ DoResize (size);
}
}
}
diff --git a/Source/Pablo/Formats/Character/CharacterDocument.cs b/Source/Pablo/Formats/Character/CharacterDocument.cs
index 86b21c2..2c60825 100644
--- a/Source/Pablo/Formats/Character/CharacterDocument.cs
+++ b/Source/Pablo/Formats/Character/CharacterDocument.cs
@@ -105,7 +105,7 @@ public CharacterDocument(DocumentInfo info) : base(info)
defaultSize = new Size(80, EditSize);
defaultPalette = Palette.GetDosPalette();
Initialize(1, defaultSize);
-
+
Info.Use9xChanged += Info_Use9xChanged;
Info.SelectedFontChanged += Info_SelectedFontChanged;
SetFont(true);
@@ -160,6 +160,11 @@ void Initialize(int numPages, Size canvasSize)
for (int i = 0; i < numPages; i++)
{
var page = new Page(this, canvasSize, defaultFont, defaultPalette);
+ page.Canvas.Update += delegate
+ {
+ if (!IsLoading)
+ IsModified = true;
+ };
pages[i] = page;
}
}
@@ -167,7 +172,7 @@ void Initialize(int numPages, Size canvasSize)
public bool ResizeCanvas
{
get { return resizeCanvas; }
-
+
}
public override Size Size
@@ -183,7 +188,7 @@ public Page[] Pages
protected override void LoadingAnimated(Stream stream, Format format, Handler handler)
{
base.LoadingAnimated(stream, format, handler);
-
+
var canAnimate = true;
var charFormat = format as CharacterFormat;
if (charFormat != null)
@@ -228,9 +233,8 @@ protected override void LoadStream(Stream stream, Format format, Handler handler
resizeCanvas = true;
var charFormat = (CharacterFormat)format;
use9x = charFormat.Use9pxFont;
-
-
- IsModified = false;
+
+
if (Sauce != null)
{
var info = Sauce.TypeInfo as Sauce.Types.BaseText.DataTypeInfo;
@@ -251,12 +255,9 @@ protected override void LoadStream(Stream stream, Format format, Handler handler
SetFont(false, false);
Pages[0].Palette = defaultPalette;
Pages[0].Load(stream, charFormat, (CharacterHandler)handler, resizeCanvas);
-
+
UpdateCanvasSize(Pages[0], Info.AutoResize);
- Pages[0].Canvas.Update += delegate
- {
- IsModified = true;
- };
+ IsModified = false;
}
void UpdateCanvasSize(Page page, bool resizeNonEdit)
@@ -356,12 +357,12 @@ public override bool Send(SendCommandArgs args)
args.Message.WritePadBits();
using (var stream = new MemoryStream())
{
-
+
var type = new Types.Pablo(Info);
type.Save(stream, this);
stream.Flush();
stream.Seek(0, SeekOrigin.Begin);
-
+
args.Message.WriteStream(stream);
}
return true;
diff --git a/Source/Pablo/Formats/Character/CharacterHandler.cs b/Source/Pablo/Formats/Character/CharacterHandler.cs
index a7c790f..a22a800 100644
--- a/Source/Pablo/Formats/Character/CharacterHandler.cs
+++ b/Source/Pablo/Formats/Character/CharacterHandler.cs
@@ -571,6 +571,9 @@ void AddMoveAction(GenerateCommandArgs args, string id, string name, string tool
GenerateCommandArgs args;
+ // bug in Eto:
+ static Command s_DisabledCommand = new Command { Enabled = false };
+
public override void GenerateCommands(GenerateCommandArgs args)
{
base.GenerateCommands(args);
@@ -582,13 +585,13 @@ public override void GenerateCommands(GenerateCommandArgs args)
if (Generator.IsMac && control != null)
{
- control.MapPlatformCommand("cut", null);
- control.MapPlatformCommand("copy", null);
- control.MapPlatformCommand("paste", null);
- control.MapPlatformCommand("selectAll", null);
- control.MapPlatformCommand("delete", null);
- control.MapPlatformCommand("undo", null);
- control.MapPlatformCommand("redo", null);
+ control.MapPlatformCommand("cut", s_DisabledCommand);
+ control.MapPlatformCommand("copy", s_DisabledCommand);
+ control.MapPlatformCommand("paste", s_DisabledCommand);
+ control.MapPlatformCommand("selectAll", s_DisabledCommand);
+ control.MapPlatformCommand("delete", s_DisabledCommand);
+ control.MapPlatformCommand("undo", s_DisabledCommand);
+ control.MapPlatformCommand("redo", s_DisabledCommand);
}
var edit = args.Menu.Items.GetSubmenu("&Edit", 200);
diff --git a/Source/Pablo/Formats/Character/Controls/AttributeDialog.cs b/Source/Pablo/Formats/Character/Controls/AttributeDialog.cs
index da18f97..b7a41ca 100644
--- a/Source/Pablo/Formats/Character/Controls/AttributeDialog.cs
+++ b/Source/Pablo/Formats/Character/Controls/AttributeDialog.cs
@@ -1,4 +1,5 @@
using System;
+using System.ComponentModel;
using Eto.Drawing;
using Eto.Forms;
@@ -38,7 +39,7 @@ public AttributeDialog(CharacterHandler handler, Palette palette, Attribute attr
#if DESKTOP
this.Resizable = true;
#endif
-
+
TableLayout layout = new TableLayout(1, 2);
colours = new ColourSelection(palette, attribute);
@@ -52,15 +53,15 @@ public AttributeDialog(CharacterHandler handler, Palette palette, Attribute attr
Content = layout;
}
- protected override void OnLoadComplete (EventArgs e)
+ protected override void OnLoadComplete(EventArgs e)
{
- base.OnLoadComplete (e);
- colours.Focus ();
+ base.OnLoadComplete(e);
+ Application.Instance.AsyncInvoke(colours.Focus);
}
-
- protected override void OnClosed (EventArgs e)
+
+ protected override void OnClosing(CancelEventArgs e)
{
- base.OnClosed (e);
+ base.OnClosing(e);
handler.CharacterDocument.Info.AttributeDialogBounds = this.RestoreBounds;
handler.CharacterDocument.Info.AttributeDialogSize = this.ClientSize;
}
@@ -73,7 +74,8 @@ void colours_Selected(object sender, EventArgs e)
private Control GenerateButtons()
{
- TableLayout layout = new TableLayout(1,1) {
+ TableLayout layout = new TableLayout(1, 1)
+ {
Size = new Size(150, 28)
};
layout.Spacing = new Size(5, 5);
diff --git a/Source/Pablo/Formats/Character/Controls/BrushPad.cs b/Source/Pablo/Formats/Character/Controls/BrushPad.cs
index 59677de..fce6c55 100644
--- a/Source/Pablo/Formats/Character/Controls/BrushPad.cs
+++ b/Source/Pablo/Formats/Character/Controls/BrushPad.cs
@@ -33,7 +33,7 @@ public BrushPad(Tools.Brush tool)
var layout = new DynamicLayout { Padding = Padding.Empty, Spacing = Size.Empty };
- layout.Add(new Label { Text = "Brush", HorizontalAlign = HorizontalAlign.Center, Font = new Font(SystemFont.Default, 7) });
+ layout.Add(new Label { Text = "Brush", TextAlignment = TextAlignment.Center, Font = new Font(SystemFont.Default, 7) });
layout.AddCentered(GradientPreview(), Padding.Empty, Size.Empty);
diff --git a/Source/Pablo/Formats/Character/Controls/CharacterPad.cs b/Source/Pablo/Formats/Character/Controls/CharacterPad.cs
index 7ec032e..0e4840d 100644
--- a/Source/Pablo/Formats/Character/Controls/CharacterPad.cs
+++ b/Source/Pablo/Formats/Character/Controls/CharacterPad.cs
@@ -75,8 +75,8 @@ void CreateControls ()
var character = new FontTextBox (handler, new Size(1, 1));
var label = new Label{ };//Size = new Size (width - character.Size.Width, charHeight)};
- label.HorizontalAlign = HorizontalAlign.Right;
- label.VerticalAlign = VerticalAlign.Middle;
+ label.TextAlignment = TextAlignment.Right;
+ label.VerticalAlignment = VerticalAlignment.Center;
label.Text = string.Format ("F{0}", i + 1);
layout.Add (label);
//layout.Add (label, 0, i * charHeight);
diff --git a/Source/Pablo/Formats/Character/Controls/CharacterSelectPad.cs b/Source/Pablo/Formats/Character/Controls/CharacterSelectPad.cs
index 05be657..0424658 100644
--- a/Source/Pablo/Formats/Character/Controls/CharacterSelectPad.cs
+++ b/Source/Pablo/Formats/Character/Controls/CharacterSelectPad.cs
@@ -37,7 +37,7 @@ public CharacterSelectPad(ICharacterSelectSource tool)
var layout = new DynamicLayout { Padding = Padding.Empty, Spacing = Size.Empty };
- layout.Add(new Label { Text = "Char", HorizontalAlign = HorizontalAlign.Center, Font = new Font(SystemFont.Default, 7) });
+ layout.Add(new Label { Text = "Char", TextAlignment = TextAlignment.Center, Font = new Font(SystemFont.Default, 7) });
layout.AddCentered(GradientPreview(), Padding.Empty, Size.Empty);
diff --git a/Source/Pablo/Formats/Character/Controls/CharacterSetEditor.cs b/Source/Pablo/Formats/Character/Controls/CharacterSetEditor.cs
index 82022ce..33c94fa 100644
--- a/Source/Pablo/Formats/Character/Controls/CharacterSetEditor.cs
+++ b/Source/Pablo/Formats/Character/Controls/CharacterSetEditor.cs
@@ -19,17 +19,17 @@ public CharacterSetEditor(CharacterHandler handler)
this.CharacterHandler = handler;
this.Title = "Character Set Editor";
- var layout = new DynamicLayout
- {
- Padding = 6,
- Spacing = new Size(6, 6)
+ var layout = new DynamicLayout
+ {
+ Padding = 6,
+ Spacing = new Size(6, 6)
};
selected = CharacterHandler.CharacterSet;
layout.AddCentered(CharacterSelection(), xscale: true, yscale: true);
- layout.Add(new Label { Text = "Click a character above, then select the character below to change it", Size = new Size(100, 32), HorizontalAlign = HorizontalAlign.Center });
+ layout.Add(new Label { Text = "Click a character above, then select the character below to change it", Size = new Size(100, 32), TextAlignment = TextAlignment.Center });
layout.Add(Characters());
diff --git a/Source/Pablo/Formats/Character/Controls/ColourEditor.cs b/Source/Pablo/Formats/Character/Controls/ColourEditor.cs
index a33bfe0..4e0a1dc 100644
--- a/Source/Pablo/Formats/Character/Controls/ColourEditor.cs
+++ b/Source/Pablo/Formats/Character/Controls/ColourEditor.cs
@@ -102,11 +102,11 @@ public ColourEditor(CharacterHandler handler)
};
layout.Add(new Label
{
- Text = "Double click a colour to change it. Note that most formats only support up to 16 colours, except for Tundra and Ansi format",
+ Text = "Double click a colour to change it.\nNote that most formats only support up to 16 colours, except for Tundra and Ansi format.",
Wrap = WrapMode.Word,
TextAlignment = TextAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
- Width = 1, Height = Platform.IsWinForms ? 46 : -1
+ Width = 300
});
layout.BeginVertical(xscale: true, yscale: true);
diff --git a/Source/Pablo/Formats/Character/Controls/FlagsPad.cs b/Source/Pablo/Formats/Character/Controls/FlagsPad.cs
index 696bf23..f22f503 100644
--- a/Source/Pablo/Formats/Character/Controls/FlagsPad.cs
+++ b/Source/Pablo/Formats/Character/Controls/FlagsPad.cs
@@ -44,8 +44,8 @@ Control InsertLabel()
{
insertLabel = new Label
{
- HorizontalAlign = HorizontalAlign.Right,
- VerticalAlign = VerticalAlign.Middle
+ TextAlignment = TextAlignment.Right,
+ VerticalAlignment = VerticalAlignment.Center
};
return insertLabel;
}
@@ -55,8 +55,8 @@ Control FontLabel()
fontLabel = new Label
{
Wrap = WrapMode.None,
- HorizontalAlign = HorizontalAlign.Left,
- VerticalAlign = VerticalAlign.Middle
+ TextAlignment = TextAlignment.Left,
+ VerticalAlignment = VerticalAlignment.Center
};
#if DESKTOP
fontLabel.MouseDown += delegate
diff --git a/Source/Pablo/Formats/Character/Controls/PositionPad.cs b/Source/Pablo/Formats/Character/Controls/PositionPad.cs
index 582460d..3135ecd 100644
--- a/Source/Pablo/Formats/Character/Controls/PositionPad.cs
+++ b/Source/Pablo/Formats/Character/Controls/PositionPad.cs
@@ -22,8 +22,8 @@ public PositionPad (CharacterHandler handler)
}).MakeWeak(e => Handler.CursorPositionChanged -= e);
label = new Label{
- HorizontalAlign = HorizontalAlign.Right,
- VerticalAlign = VerticalAlign.Middle
+ TextAlignment = TextAlignment.Right,
+ VerticalAlignment = VerticalAlignment.Center
};
var layout = new DynamicLayout { Padding = new Padding(0, 5, 5, 5) };
diff --git a/Source/Pablo/Formats/Character/Controls/SizePad.cs b/Source/Pablo/Formats/Character/Controls/SizePad.cs
index 0d0dae6..a59a438 100644
--- a/Source/Pablo/Formats/Character/Controls/SizePad.cs
+++ b/Source/Pablo/Formats/Character/Controls/SizePad.cs
@@ -14,7 +14,7 @@ public SizePad (Tools.SizeTool tool)
var layout = new DynamicLayout { Padding = Padding.Empty };
layout.BeginVertical (Padding.Empty, Size.Empty);
- layout.Add (new Label{ Text = "Size", HorizontalAlign = HorizontalAlign.Center, Font = new Font (SystemFont.Default, 7)});
+ layout.Add (new Label{ Text = "Size", TextAlignment = TextAlignment.Center, Font = new Font (SystemFont.Default, 7)});
layout.Add (BrushSize ());
layout.EndVertical ();
Content = layout;
@@ -23,7 +23,7 @@ public SizePad (Tools.SizeTool tool)
Control BrushSize()
{
- var control = new NumericUpDown{
+ var control = new NumericStepper{
Font = new Font (SystemFont.Default, 8),
MinValue = 1,
MaxValue = 9,
diff --git a/Source/Pablo/Formats/Character/Controls/WidthDialog.cs b/Source/Pablo/Formats/Character/Controls/WidthDialog.cs
index 325cb07..5d03868 100644
--- a/Source/Pablo/Formats/Character/Controls/WidthDialog.cs
+++ b/Source/Pablo/Formats/Character/Controls/WidthDialog.cs
@@ -6,94 +6,107 @@ namespace Pablo.Formats.Character.Controls
{
public class WidthDialog : Dialog
{
- int width;
- TextBox widthControl;
-
- Control WidthControl ()
+ NumericStepper widthControl;
+ NumericStepper heightControl;
+
+ Control WidthControl()
{
- widthControl = new TextBox ();
- widthControl.TextChanged += delegate {
- int.TryParse (widthControl.Text, out width);
- };
+ widthControl = new NumericStepper { MinValue = 1, MaxValue = 5000 };
return widthControl;
}
-
- Control OkButton ()
+
+ Control HeightControl()
+ {
+ heightControl = new NumericStepper { MinValue = 1, MaxValue = 10000 };
+ return heightControl;
+ }
+
+ Control OkButton()
{
- var control = new Button{
+ var control = new Button
+ {
Text = "Ok"
};
- control.Click += delegate {
- if (int.TryParse (widthControl.Text, out width)) {
- if (width > 0 && width <= 5000) {
- Result = DialogResult.Ok;
- Close ();
- } else {
- MessageBox.Show(this, "Width must be a numeric value between 1 and 5000");
- }
- }
+ control.Click += delegate
+ {
+ Result = DialogResult.Ok;
+ Close();
};
this.DefaultButton = control;
return control;
}
-
- Control CancelButton ()
+
+ Control CancelButton()
{
- var control = new Button{
+ var control = new Button
+ {
Text = "Cancel"
};
- control.Click += delegate {
+ control.Click += delegate
+ {
Result = DialogResult.Cancel;
- Close ();
+ Close();
};
base.AbortButton = control;
return control;
}
-
- Control Buttons ()
+
+ Control Buttons()
{
- var layout = new TableLayout (3, 1);
- layout.Padding = Padding.Empty;
-
- layout.SetColumnScale (0);
-
- layout.Add (CancelButton (), 1, 0);
- layout.Add (OkButton (), 2, 0);
+ var layout = new TableLayout(3, 1);
+ layout.Spacing = new Size(5, 5);
+
+ layout.SetColumnScale(0);
+
+ layout.Add(CancelButton(), 1, 0);
+ layout.Add(OkButton(), 2, 0);
return layout;
}
-
- public int Width {
- get { return width; }
- set {
- width = value;
- widthControl.Text = width.ToString ();
+
+ public Size CanvasSize
+ {
+ get { return new Size((int)widthControl.Value, (int)heightControl.Value); }
+ set
+ {
+ widthControl.Value = value.Width;
+ heightControl.Value = value.Height;
}
}
-
- Control WidthRow ()
+
+ Control WidthRow()
{
- var layout = new TableLayout (2, 2);
+ var layout = new DynamicLayout();
layout.Padding = new Padding(20, 10, 20, 0);
-
- layout.Add (new Label{ Text = "Canvas Width", VerticalAlign = VerticalAlign.Middle }, 0, 0);
- layout.Add (WidthControl (), 1, 0, true, false);
+
+ layout.BeginHorizontal();
+ layout.AddSpace();
+ layout.Add(new Label { Text = "Canvas Size", VerticalAlignment = VerticalAlignment.Center });
+ layout.Add(WidthControl());
+ layout.Add(HeightControl());
+ layout.AddSpace();
+
+ layout.EndHorizontal();
+
return layout;
}
-
- public WidthDialog ()
+
+ public WidthDialog()
{
//this.ClientSize = new Size (350, 160);
-
- var toplayout = new TableLayout (1, 3);
- toplayout.Padding = new Padding (10);
-
- toplayout.Add (new Label{
- Text = "Set the width of the canvas.\nNote that ANSI and ASCII are usually maximum 80 columns,\nand BIN (Binary) files are usually 160 characters.\nAnything larger that 500 wide may cause PabloDraw to become slow or unresponsive.",
- VerticalAlign = VerticalAlign.Middle,
- HorizontalAlign = HorizontalAlign.Center
- }, 0, 0, true, true);
- toplayout.Add (WidthRow (), 0, 1);
- toplayout.Add (Buttons (), 0, 2);
+
+ var toplayout = new DynamicLayout();
+ toplayout.Padding = new Padding(10);
+ toplayout.Spacing = new Size(5, 5);
+
+ toplayout.Add(new Label
+ {
+ Text = "Set the size of the canvas.\nNote that ANSI and ASCII are usually maximum 80 columns,\nand BIN (Binary) files are usually 160 characters.\nAnything larger that 500 wide may cause PabloDraw to become slow or unresponsive.",
+ Wrap = WrapMode.Word,
+ VerticalAlignment = VerticalAlignment.Center,
+ TextAlignment = TextAlignment.Center
+ }, yscale: true);
+ toplayout.Add(WidthRow());
+ toplayout.Add(Buttons());
Content = toplayout;
}
diff --git a/Source/Pablo/Formats/Rip/Controls/ColourEditor.cs b/Source/Pablo/Formats/Rip/Controls/ColourEditor.cs
index ea51bb6..075a051 100644
--- a/Source/Pablo/Formats/Rip/Controls/ColourEditor.cs
+++ b/Source/Pablo/Formats/Rip/Controls/ColourEditor.cs
@@ -166,7 +166,7 @@ Slider CreateSlider ()
var slider = new Slider{
MinValue = 0,
MaxValue = 3,
- Orientation = SliderOrientation.Vertical,
+ Orientation = Orientation.Vertical,
TickFrequency = 1
};
slider.ValueChanged += HandleSliderValueChanged;
diff --git a/Source/Pablo/Formats/Rip/Controls/FontStylePad.cs b/Source/Pablo/Formats/Rip/Controls/FontStylePad.cs
index 5c97fda..0ce2a09 100644
--- a/Source/Pablo/Formats/Rip/Controls/FontStylePad.cs
+++ b/Source/Pablo/Formats/Rip/Controls/FontStylePad.cs
@@ -14,7 +14,7 @@ public class FontStylePad : Panel
ImageButton vertical;
ImageButton horizontal;
BGICanvas canvas;
- NumericUpDown fontSize;
+ NumericStepper fontSize;
public FontStylePad(RipHandler handler)
{
@@ -22,7 +22,7 @@ public FontStylePad(RipHandler handler)
var layout = new DynamicLayout { Padding = Padding.Empty };
layout.BeginVertical(Padding.Empty, Size.Empty);
- layout.Add(new Label { Text = "Font Size", HorizontalAlign = HorizontalAlign.Center, Font = new Font(SystemFont.Default, 7) });
+ layout.Add(new Label { Text = "Font Size", TextAlignment = TextAlignment.Center, Font = new Font(SystemFont.Default, 7) });
layout.Add(FontSize());
layout.EndVertical();
@@ -152,7 +152,7 @@ Control FillStyleButton()
Control FontSize()
{
- var control = fontSize = new NumericUpDown
+ var control = fontSize = new NumericStepper
{
MinValue = 1,
MaxValue = 10,
diff --git a/Source/Pablo/Formats/Rip/RipHandler.cs b/Source/Pablo/Formats/Rip/RipHandler.cs
index 88c1f0c..d3391df 100644
--- a/Source/Pablo/Formats/Rip/RipHandler.cs
+++ b/Source/Pablo/Formats/Rip/RipHandler.cs
@@ -5,6 +5,7 @@
using System.Collections.Generic;
using Eto;
using System.Linq;
+using System.IO;
namespace Pablo.Formats.Rip
{
@@ -129,8 +130,7 @@ public RipHandler(RipDocument doc) : base(doc)
protected override void OnZoomChanged(EventArgs e)
{
base.OnZoomChanged(e);
- if (BGI != null)
- BGI.Scale = new SizeF(1 / this.ZoomRatio.Width, 1 / this.ZoomRatio.Height);
+ EnsureBGIScale();
}
public RipDocument RipDocument
@@ -245,7 +245,7 @@ private void actionDos_CheckedChanged(object sender, EventArgs e)
var action = (CheckCommand)sender;
RipDocument.Info.DosAspect = action.Checked;
OnSizeChanged(EventArgs.Empty);
- BGI.Scale = new SizeF(1 / this.ZoomRatio.Width, 1 / this.ZoomRatio.Height);
+ EnsureBGIScale();
}
public override void OnMouseDown(MouseEventArgs e)
@@ -298,6 +298,18 @@ public override void OnKeyDown(KeyEventArgs e)
base.OnKeyDown(e);
}
+ public override void PreLoad(Stream stream, Format format)
+ {
+ base.PreLoad(stream, format);
+ EnsureBGIScale();
+ }
+
+ void EnsureBGIScale()
+ {
+ if (BGI != null)
+ BGI.Scale = new SizeF(1 / ZoomRatio.Width, 1 / ZoomRatio.Height);
+ }
+
public override void Loaded()
{
base.Loaded();
diff --git a/Source/Pablo/Formats/Rip/Tools/Bezier.cs b/Source/Pablo/Formats/Rip/Tools/Bezier.cs
index 4927edb..383fba7 100644
--- a/Source/Pablo/Formats/Rip/Tools/Bezier.cs
+++ b/Source/Pablo/Formats/Rip/Tools/Bezier.cs
@@ -24,7 +24,7 @@ public override Keys Accelerator {
}
public override Eto.Drawing.Image Image {
- get {
+ get {
return ImageCache.BitmapFromResource("Pablo.Formats.Rip.Icons.Bezier.png");
}
}
@@ -195,8 +195,8 @@ public override Control GeneratePad ()
layout.Add (new Controls.LineStylePad (Handler, true));
var font = new Font (SystemFont.Default, 7);
- layout.Add (new Label{ Text = "Segments", Font = font, HorizontalAlign = HorizontalAlign.Center });
- var segmentBox = new NumericUpDown{
+ layout.Add (new Label{ Text = "Segments", Font = font, TextAlignment = TextAlignment.Center });
+ var segmentBox = new NumericStepper{
Font = new Font (SystemFont.Default, 8),
Value = segments,
MinValue = 1,
diff --git a/Source/Pablo/Formats/Rip/Tools/PixelBrush.cs b/Source/Pablo/Formats/Rip/Tools/PixelBrush.cs
index ec54b9a..2868d00 100644
--- a/Source/Pablo/Formats/Rip/Tools/PixelBrush.cs
+++ b/Source/Pablo/Formats/Rip/Tools/PixelBrush.cs
@@ -37,7 +37,7 @@ bool EnableForegroundBackground (Keys modifiers, bool useForeground)
return (modifiers == Keys.Alt) ^ useForeground;
}
- public override Eto.Drawing.Image Image {
+ public override Eto.Drawing.Image Image {
get { return ImageCache.BitmapFromResource("Pablo.Formats.Rip.Icons.Brush.png"); }
}
@@ -131,7 +131,7 @@ public override Control GeneratePad ()
layout.BeginVertical (Padding.Empty);
layout.BeginHorizontal ();
- var b = new ImageButton{
+ var b = new ImageButton{
Image = ImageCache.BitmapFromResource("Pablo.Formats.Rip.Icons.Brush-Multi.png"),
Toggle = true,
Pressed = enableMulti
@@ -149,8 +149,8 @@ public override Control GeneratePad ()
var updownfont = new Font (SystemFont.Default, 8);
layout.BeginVertical(Padding.Empty, Size.Empty);
- layout.Add(new Label { Text = "Width", Font = font, HorizontalAlign = HorizontalAlign.Center });
- var widthBox = new NumericUpDown{
+ layout.Add(new Label { Text = "Width", Font = font, TextAlignment = TextAlignment.Center });
+ var widthBox = new NumericStepper{
Font = updownfont,
Value = width,
MinValue = 1,
@@ -163,8 +163,8 @@ public override Control GeneratePad ()
layout.Add (widthBox);
layout.EndBeginVertical(Padding.Empty, Size.Empty);
- layout.Add (new Label{ Text = "Density", Font = font, HorizontalAlign = HorizontalAlign.Center});
- var pointsBox = new NumericUpDown{
+ layout.Add (new Label{ Text = "Density", Font = font, TextAlignment = TextAlignment.Center});
+ var pointsBox = new NumericStepper{
Font = updownfont,
Value = points,
MinValue = 1,
diff --git a/Source/Pablo/Network/Server.cs b/Source/Pablo/Network/Server.cs
index aaf17fb..53a444d 100644
--- a/Source/Pablo/Network/Server.cs
+++ b/Source/Pablo/Network/Server.cs
@@ -15,7 +15,7 @@ namespace Pablo.Network
{
public class Server : Network
{
- public const int VERSION = 7;
+ public const int VERSION = 8;
bool mappedPort;
NetServer server;
static INatDevice natdevice;
@@ -110,8 +110,8 @@ public void Start()
natdevice = null;
}
NatUtility.DeviceFound += HandleNatUtilityDeviceFound;
- NatUtility.DeviceLost += HandleDeviceLost;
- NatUtility.UnhandledException += HandleNatUtilityUnhandledException;
+ // NatUtility.DeviceLost += HandleDeviceLost;
+ // NatUtility.UnhandledException += HandleNatUtilityUnhandledException;
NatUtility.StartDiscovery();
}
/**/
@@ -184,8 +184,8 @@ public void Stop()
{
NatUtility.StopDiscovery();
NatUtility.DeviceFound -= HandleNatUtilityDeviceFound;
- NatUtility.UnhandledException -= HandleNatUtilityUnhandledException;
- NatUtility.DeviceLost -= HandleDeviceLost;
+ // NatUtility.UnhandledException -= HandleNatUtilityUnhandledException;
+ // NatUtility.DeviceLost -= HandleDeviceLost;
}
server.Shutdown("Server shutdown by host");
diff --git a/Source/Pablo/Pablo.csproj b/Source/Pablo/Pablo.csproj
index 031466a..5c191f0 100644
--- a/Source/Pablo/Pablo.csproj
+++ b/Source/Pablo/Pablo.csproj
@@ -21,12 +21,10 @@
-
+
-
-
-
-
-
+
+
+
\ No newline at end of file
diff --git a/Source/Pablo/Sauce/Types/BaseFileType/Admin.cs b/Source/Pablo/Sauce/Types/BaseFileType/Admin.cs
index 2b24c1d..a450408 100644
--- a/Source/Pablo/Sauce/Types/BaseFileType/Admin.cs
+++ b/Source/Pablo/Sauce/Types/BaseFileType/Admin.cs
@@ -76,7 +76,7 @@ protected virtual void CreateControls()
if (DataType.HasFileType && fileTypes.Count > 1)
{
Layout.BeginHorizontal();
- Layout.Add(new Label { Text = "File Type", VerticalAlign = VerticalAlign.Middle });
+ Layout.Add(new Label { Text = "File Type", VerticalAlignment = VerticalAlignment.Center });
Layout.AddAutoSized(FileTypeComboBox());
Layout.EndHorizontal();
}
diff --git a/Source/Pablo/Sauce/Types/BaseText/Admin.cs b/Source/Pablo/Sauce/Types/BaseText/Admin.cs
index a232060..4aaf4ac 100644
--- a/Source/Pablo/Sauce/Types/BaseText/Admin.cs
+++ b/Source/Pablo/Sauce/Types/BaseText/Admin.cs
@@ -18,7 +18,7 @@ protected override void CreateControls()
base.CreateControls();
if (DataType.HasFontName)
{
- Layout.AddRow(new Label { Text = "Font Name", VerticalAlign = VerticalAlign.Middle }, FontName());
+ Layout.AddRow(new Label { Text = "Font Name", VerticalAlignment = VerticalAlignment.Center }, FontName());
}
}
diff --git a/Source/Pablo/Sauce/Types/Binary/Admin.cs b/Source/Pablo/Sauce/Types/Binary/Admin.cs
index e0b0c25..08ccdc2 100644
--- a/Source/Pablo/Sauce/Types/Binary/Admin.cs
+++ b/Source/Pablo/Sauce/Types/Binary/Admin.cs
@@ -15,7 +15,7 @@ protected override void CreateControls()
{
base.CreateControls();
Layout.BeginHorizontal ();
- Layout.Add (new Label{ Text = "Binary Width", VerticalAlign = VerticalAlign.Middle });
+ Layout.Add (new Label{ Text = "Binary Width", VerticalAlignment = VerticalAlignment.Center });
Layout.Add (WidthControl ());
Layout.EndHorizontal ();
}
diff --git a/Source/Pablo/Sauce/Types/Character/Admin.cs b/Source/Pablo/Sauce/Types/Character/Admin.cs
index 30d3154..b6fc418 100644
--- a/Source/Pablo/Sauce/Types/Character/Admin.cs
+++ b/Source/Pablo/Sauce/Types/Character/Admin.cs
@@ -17,11 +17,11 @@ protected override void CreateControls()
if (DataType.HasDimensions)
{
Layout.BeginHorizontal();
- Layout.Add(new Label { Text = "Width", VerticalAlign = VerticalAlign.Middle });
+ Layout.Add(new Label { Text = "Width", VerticalAlignment = VerticalAlignment.Center });
Layout.BeginVertical(Eto.Drawing.Padding.Empty);
Layout.BeginHorizontal();
Layout.Add(WidthControl(), xscale: true);
- Layout.Add(new Label { Text = "Height", VerticalAlign = VerticalAlign.Middle });
+ Layout.Add(new Label { Text = "Height", VerticalAlignment = VerticalAlignment.Center });
Layout.Add(HeightControl(), xscale: true);
Layout.EndHorizontal();
Layout.EndVertical();
@@ -29,13 +29,13 @@ protected override void CreateControls()
}
if (DataType.HasNumberOfColors)
{
- Layout.AddRow(new Label { Text = "Number of Colors", VerticalAlign = VerticalAlign.Middle }, NumberOfColors());
+ Layout.AddRow(new Label { Text = "Number of Colors", VerticalAlignment = VerticalAlignment.Center }, NumberOfColors());
}
}
Control WidthControl()
{
- var control = new NumericUpDown
+ var control = new NumericStepper
{
MinValue = 0,
MaxValue = ushort.MaxValue,
@@ -51,7 +51,7 @@ Control WidthControl()
Control HeightControl()
{
- var control = new NumericUpDown
+ var control = new NumericStepper
{
//Text = DataType.Height > 0 ? DataType.Height.ToString() : string.Empty
MinValue = 0,
@@ -67,7 +67,7 @@ Control HeightControl()
Control NumberOfColors()
{
- var control = new NumericUpDown
+ var control = new NumericStepper
{
MinValue = 0,
MaxValue = ushort.MaxValue,
@@ -91,7 +91,7 @@ protected override void OnFileTypeChanged(EventArgs e)
if (!DataType.HasNumberOfColors)
{
DataType.NumberOfColors = 0;
- }
+ }
RecreateLayout();
}
}
diff --git a/Source/PabloDraw.Console/PabloDraw.Console.csproj b/Source/PabloDraw.Console/PabloDraw.Console.csproj
index a09651f..1b41177 100644
--- a/Source/PabloDraw.Console/PabloDraw.Console.csproj
+++ b/Source/PabloDraw.Console/PabloDraw.Console.csproj
@@ -11,13 +11,13 @@
True
-
-
-
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/Source/PabloDraw.Mac/AssemblyInfo.cs b/Source/PabloDraw.Mac/AssemblyInfo.cs
deleted file mode 100644
index 5b33656..0000000
--- a/Source/PabloDraw.Mac/AssemblyInfo.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-//
-[assembly: AssemblyTitle("PabloDraw")]
-[assembly: AssemblyDescription("PabloDraw for Mac")]
diff --git a/Source/PabloDraw.Mac/Assets.xcassets/Contents.json b/Source/PabloDraw.Mac/Assets.xcassets/Contents.json
deleted file mode 100644
index 4caf392..0000000
--- a/Source/PabloDraw.Mac/Assets.xcassets/Contents.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "info" : {
- "version" : 1,
- "author" : "xcode"
- }
-}
\ No newline at end of file
diff --git a/Source/PabloDraw.Mac/PabloDraw.Mac.csproj b/Source/PabloDraw.Mac/PabloDraw.Mac.csproj
deleted file mode 100644
index e6fc7f6..0000000
--- a/Source/PabloDraw.Mac/PabloDraw.Mac.csproj
+++ /dev/null
@@ -1,229 +0,0 @@
-
-
-
- Debug
- AnyCPU
- {5590729F-3176-4A91-94E3-54F75DA2EB9D}
- {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- Exe
- PabloDraw
- PabloDraw
- Resources
- v2.0
- Xamarin.Mac
- True
-
-
- true
- full
- false
- ..\..\Artifacts\bin\Debug\xammac
- DEBUG;
- prompt
- 4
- false
- Developer ID Application
- false
- false
- false
- true
- true
- HttpClientHandler
- None
- x86_64
- Developer ID Installer
- other,rare,west
- true
- None
- true
-
-
- pdbonly
- true
- ..\..\Artifacts\bin\Release\xammac
-
-
- prompt
- 4
- true
- true
- true
- true
- true
- true
- SdkOnly
- HttpClientHandler
- x86_64
- Developer ID Application
- Developer ID Installer
- other,rare,west
- true
- None
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Code
-
-
-
-
- {35DBE6BB-B46D-4AE9-8156-FBFC6EC2BB69}
- Pablo
-
-
- {3FAACC7E-D156-4599-B0D1-6177AD78E8B1}
- Pablo.Interface
-
-
-
-
-
-
-
-
- 2.5.0-rc.4
-
-
- 0.24.0
-
-
-
-
-
-
- Properties\VersionInfo.cs
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Source/PabloDraw.WindowsInstaller/PabloDraw.WindowsInstaller.wixproj b/Source/PabloDraw.WindowsInstaller/PabloDraw.WindowsInstaller.wixproj
index 4dadd68..ab3f095 100644
--- a/Source/PabloDraw.WindowsInstaller/PabloDraw.WindowsInstaller.wixproj
+++ b/Source/PabloDraw.WindowsInstaller/PabloDraw.WindowsInstaller.wixproj
@@ -11,13 +11,13 @@
Package
- ..\..\Artifacts\bin\$(Configuration)\net47
- ..\..\Artifacts\obj\$(OS)\$(Configuration)\
+ ..\..\artifacts\bin\$(Configuration)\net47
+ ..\..\artifacts\obj\$(OS)\$(Configuration)\
Debug
- ..\..\Artifacts\bin\$(Configuration)\net47
- ..\..\Artifacts\obj\$(OS)\$(Configuration)\
+ ..\..\artifacts\bin\$(Configuration)\net47
+ ..\..\artifacts\obj\$(OS)\$(Configuration)\
@@ -48,9 +48,9 @@
-->
-
+
$(DefineConstants);AssemblyVersion=$(AssemblyVersion)
-
+
\ No newline at end of file
diff --git a/Source/PabloDraw.WindowsInstaller/Product.wxs b/Source/PabloDraw.WindowsInstaller/Product.wxs
index 0841efd..2a67f39 100644
--- a/Source/PabloDraw.WindowsInstaller/Product.wxs
+++ b/Source/PabloDraw.WindowsInstaller/Product.wxs
@@ -6,32 +6,35 @@
-
+
-
-
+
-
+
+
+
+
-
+
-
-
-
+
+
+
@@ -39,7 +42,7 @@
-
+
@@ -54,11 +57,70 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -66,11 +128,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/Source/PabloDraw.Mac/AppDelegate.cs b/Source/PabloDraw/AppDelegate.cs
similarity index 97%
rename from Source/PabloDraw.Mac/AppDelegate.cs
rename to Source/PabloDraw/AppDelegate.cs
index 4e7ee74..053da2d 100644
--- a/Source/PabloDraw.Mac/AppDelegate.cs
+++ b/Source/PabloDraw/AppDelegate.cs
@@ -1,8 +1,9 @@
-using System;
+#if MAC
+using System;
using Eto.Forms;
using Pablo.Interface;
-#if __UNIFIED__
+#if XAMMAC
using AppKit;
using ObjCRuntime;
using Foundation;
@@ -65,3 +66,4 @@ public override bool OpenFileWithoutUI (NSObject sender, string filename)
}
}
+#endif
\ No newline at end of file
diff --git a/Source/PabloDraw.Mac/Entitlements.plist b/Source/PabloDraw/Entitlements.plist
similarity index 100%
rename from Source/PabloDraw.Mac/Entitlements.plist
rename to Source/PabloDraw/Entitlements.plist
diff --git a/Source/PabloDraw/Icon.icns b/Source/PabloDraw/Icon.icns
deleted file mode 100644
index 99bcdba..0000000
Binary files a/Source/PabloDraw/Icon.icns and /dev/null differ
diff --git a/Source/PabloDraw.Mac/Info.plist b/Source/PabloDraw/Info.plist
similarity index 100%
rename from Source/PabloDraw.Mac/Info.plist
rename to Source/PabloDraw/Info.plist
diff --git a/Source/PabloDraw.Mac/Startup.cs b/Source/PabloDraw/MacStyles.cs
similarity index 93%
rename from Source/PabloDraw.Mac/Startup.cs
rename to Source/PabloDraw/MacStyles.cs
index 5f49729..17983f8 100644
--- a/Source/PabloDraw.Mac/Startup.cs
+++ b/Source/PabloDraw/MacStyles.cs
@@ -1,3 +1,4 @@
+#if MAC
using Eto;
using Eto.Drawing;
using Eto.Mac;
@@ -26,18 +27,8 @@
namespace PabloDraw
{
- public static class Startup
+ public static class MacStyles
{
- static void Main(string[] args)
- {
- AddStyles();
-
- var app = new Pablo.Interface.PabloApplication(new Eto.Mac.Platform());
-
- //ApplicationHandler.Instance.AppDelegate = new AppDelegate();
- app.Run();
- }
-
enum NSActivityOptions : ulong
{
IdleDisplaySleepDisabled = (1 << 40),
@@ -63,8 +54,10 @@ enum NSActivityOptions : ulong
static NSObject activityToken;
static NSString ActivityReason { get { return new NSString("networking"); } }
- static void AddStyles()
+ public static void Apply()
{
+ Style.Add(null, h => h.AppDelegate = new AppDelegate());
+
Style.Add(null, ctl => ctl.ClientChanged += (sender, e) =>
{
if (NSProcessInfo.ProcessInfo.RespondsToSelector(Selector.FromHandle(selBeginActivity)))
@@ -129,3 +122,5 @@ static void AddStyles()
}
}
+
+#endif
\ No newline at end of file
diff --git a/Source/PabloDraw.Mac/PabloDraw-Document.icns b/Source/PabloDraw/PabloDraw-Document.icns
similarity index 100%
rename from Source/PabloDraw.Mac/PabloDraw-Document.icns
rename to Source/PabloDraw/PabloDraw-Document.icns
diff --git a/Source/PabloDraw/PabloDraw-Document.ico b/Source/PabloDraw/PabloDraw-Document.ico
new file mode 100644
index 0000000..50f410f
Binary files /dev/null and b/Source/PabloDraw/PabloDraw-Document.ico differ
diff --git a/Source/PabloDraw.Mac/PabloDraw-nonglossy.icns b/Source/PabloDraw/PabloDraw-nonglossy.icns
similarity index 100%
rename from Source/PabloDraw.Mac/PabloDraw-nonglossy.icns
rename to Source/PabloDraw/PabloDraw-nonglossy.icns
diff --git a/Source/PabloDraw/PabloDraw.csproj b/Source/PabloDraw/PabloDraw.csproj
index e29bbdf..bb47883 100644
--- a/Source/PabloDraw/PabloDraw.csproj
+++ b/Source/PabloDraw/PabloDraw.csproj
@@ -1,30 +1,92 @@
+
+
+ Windows
+ Mac
+ Linux
+
+
- net47
WinExe
PabloDraw.ico
- DESKTOP
PabloDraw
PabloDraw
- AnyCPU
- True
-
-
-
-
-
+
+
+ net5.0
+ bin/$(Configuration)/generic
+
+
+
+ net5.0-windows
+ win-x64
+
+ WINDOWS
+ True
+ true
+
+
+
+ net5.0
+ linux-x64
+ LINUX
+
+
+
+ net5.0
+ osx-x64
+ MAC
+
+
+ True
+
+
+
+
+
+ $(DefineConstants);DESKTOP
+
+
+
+ True
+ True
+ True
+
+
+
+
+
+
+
-
-
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Source/PabloDraw.Mac/PabloDraw.icns b/Source/PabloDraw/PabloDraw.icns
similarity index 100%
rename from Source/PabloDraw.Mac/PabloDraw.icns
rename to Source/PabloDraw/PabloDraw.icns
diff --git a/Source/PabloDraw/PabloDraw.sln b/Source/PabloDraw/PabloDraw.sln
deleted file mode 100644
index bcf06c5..0000000
--- a/Source/PabloDraw/PabloDraw.sln
+++ /dev/null
@@ -1,20 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PabloDraw", "PabloDraw.csproj", "{9A72B697-8DA3-4A52-9E6B-05DEEEA23AD2}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Release|Any CPU = Release|Any CPU
- Debug|Any CPU = Debug|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {9A72B697-8DA3-4A52-9E6B-05DEEEA23AD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {9A72B697-8DA3-4A52-9E6B-05DEEEA23AD2}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {9A72B697-8DA3-4A52-9E6B-05DEEEA23AD2}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {9A72B697-8DA3-4A52-9E6B-05DEEEA23AD2}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(MonoDevelopProperties) = preSolution
- StartupItem = PabloDraw.csproj
- EndGlobalSection
-EndGlobal
diff --git a/Source/PabloDraw/Program.cs b/Source/PabloDraw/Program.cs
index a842d48..4a3273f 100644
--- a/Source/PabloDraw/Program.cs
+++ b/Source/PabloDraw/Program.cs
@@ -2,6 +2,10 @@
using Pablo;
using Pablo.Network;
using Eto;
+using System.Text;
+using Eto.Forms;
+using Eto.Drawing;
+using System.IO;
namespace PabloDraw
{
@@ -10,91 +14,162 @@ public static class Program
public static void Run()
{
- var command = new CommandLine(Environment.CommandLine);
-
- var platform = command.GetValue("platform", "p");
- //#if DEBUG
- // use winforms by default on windows
- if (platform == null && EtoEnvironment.Platform.IsWindows)
- platform = "win";
- //#endif
- if (!string.IsNullOrEmpty(platform))
+ try
{
- try
+ AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionReporter;
+ Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
+
+ var command = new CommandLine(Environment.CommandLine);
+
+ var platform = command.GetValue("platform", "p");
+
+#if SPECIFY_PLATFORM
+ //#if DEBUG
+ // use winforms by default on windows
+ if (platform == null && EtoEnvironment.Platform.IsWindows)
+ platform = "win";
+ //#endif
+ if (!string.IsNullOrEmpty(platform))
{
- switch (platform.ToLowerInvariant())
+ try
+ {
+ switch (platform.ToLowerInvariant())
+ {
+ case "direct2d":
+ case "d2d":
+ Platform.Initialize(Platforms.Direct2D);
+ break;
+ case "gtk":
+ case "gtk2":
+ Platform.Initialize(Platforms.Gtk2);
+ break;
+ case "gtk3":
+ Platform.Initialize(Platforms.Gtk);
+ break;
+ case "winforms":
+ case "win":
+ Platform.Initialize(Platforms.WinForms);
+ break;
+ case "wpf":
+ Platform.Initialize(Platforms.Wpf);
+ break;
+ default:
+ throw new ArgumentOutOfRangeException("platform", platform, "Platform is not recognized. Must be one of (gtk|winforms|wpf)");
+ }
+ }
+ catch (Exception ex)
{
- case "direct2d":
- case "d2d":
- Platform.Initialize(Platforms.Direct2D);
- break;
- case "gtk":
- case "gtk2":
- Platform.Initialize(Platforms.Gtk2);
- break;
- case "gtk3":
- Platform.Initialize(Platforms.Gtk);
- break;
- case "winforms":
- case "win":
- Platform.Initialize(Platforms.WinForms);
- break;
- case "wpf":
- Platform.Initialize(Platforms.Wpf);
- break;
- default:
- throw new ArgumentOutOfRangeException("platform", platform, "Platform is not recognized. Must be one of (gtk|winforms|wpf)");
+ Console.WriteLine("Error initializing platform: {0}", ex);
}
}
- catch (Exception ex)
+#elif WINDOWS
+ Platform.Initialize(new Eto.WinForms.Platform());
+#elif LINUX
+ Platform.Initialize(new Eto.GtkSharp.Platform());
+#elif MAC
+ Platform.Initialize(new Eto.Mac.Platform());
+ MacStyles.Apply();
+#endif
+
+ if (Platform.Detect.IsWinForms)
{
- Console.WriteLine("Error initializing platform: {0}", ex);
+ //Eto.WinForms.Forms.ApplicationHandler.BubbleMouseEvents = false;
+ }
+ if (EtoEnvironment.Platform.IsMono)
+ {
+ // enforce case insensitivity
+ Environment.SetEnvironmentVariable("MONO_IOMAP", "case");
}
- }
- if (Platform.Detect.IsWinForms)
- {
- //Eto.WinForms.Forms.ApplicationHandler.BubbleMouseEvents = false;
- }
- if (EtoEnvironment.Platform.IsLinux)
- {
- // enforce case insensitivity
- Environment.SetEnvironmentVariable("MONO_IOMAP", "case");
- }
+ var app = new Pablo.Interface.PabloApplication();
- var app = new Pablo.Interface.PabloApplication();
+ string fileName = command.GetValue("file", "f") ?? command.GenericCommand;
+ bool? editMode = null;
- string fileName = command.GetValue("file", "f") ?? command.GenericCommand;
+ // if (string.IsNullOrEmpty(fileName))
+ // {
+ // var activationArguments = AppDomain.CurrentDomain.SetupInformation.ActivationArguments;
+ // if (activationArguments != null)
+ // {
+ // var args = activationArguments.ActivationData;
+ // if (args != null && args.Length > 0)
+ // {
+ // if (!args[0].EndsWith(".application", StringComparison.InvariantCultureIgnoreCase))
+ // fileName = args[0];
+ // }
+ // }
+ // }
+ if (string.IsNullOrEmpty(fileName))
+ {
+ fileName = command.GetValue("edit", "e");
+ editMode = true;
+ }
- if (string.IsNullOrEmpty(fileName))
- {
- var activationArguments = AppDomain.CurrentDomain.SetupInformation.ActivationArguments;
- if (activationArguments != null)
+ if (!string.IsNullOrEmpty(fileName))
{
- var args = activationArguments.ActivationData;
- if (args != null && args.Length > 0)
+ app.Initialized += delegate
{
- if (!args[0].EndsWith(".application", StringComparison.InvariantCultureIgnoreCase))
- fileName = args[0];
- }
+ //ClickOnceUpdate.CheckForUpdate ();
+ app.Main.LoadFile(fileName, true, editMode: editMode);
+ };
}
+ /*
+ else {
+ app.Initialized += delegate
+ {
+ ClickOnceUpdate.CheckForUpdate ();
+ };
+ }*/
+ app.Run();
}
- if (!string.IsNullOrEmpty(fileName))
+ catch (FileNotFoundException ex)
{
- app.Initialized += delegate
- {
- //ClickOnceUpdate.CheckForUpdate ();
- app.Main.LoadFile(fileName, true);
- };
+ Console.WriteLine($"FileNotFound: {ex.FileName}");
+ MessageBox.Show($"{ex.ToString()}");
+ throw;
}
- /*
- else {
- app.Initialized += delegate
- {
- ClickOnceUpdate.CheckForUpdate ();
- };
- }*/
- app.Run();
+ }
+
+ private static void UnhandledExceptionReporter(object sender, System.UnhandledExceptionEventArgs e)
+ {
+ if (Application.Instance == null)
+ ShowErrorDialog(e.ExceptionObject);
+ else
+ Application.Instance.Invoke(() => ShowErrorDialog(e.ExceptionObject));
+ }
+
+ static void ShowErrorDialog(object exceptionObject)
+ {
+ var dlg = new Dialog();
+ dlg.Resizable = true;
+ dlg.Title = "Error";
+
+ var textArea = new TextArea { ReadOnly = true, Size = new Size(400, 300), Wrap = false };
+ textArea.Text = Convert.ToString(exceptionObject);
+
+ var quitButton = new Button { Text = "Quit" };
+ quitButton.Click += (sender, e) => dlg.Close();
+
+ var copyButton = new Button { Text = "Copy to clipboard" };
+ copyButton.Click += (sender, e) => new Clipboard().Text = textArea.Text;
+
+ var reportButton = new Button { Text = "Report Issue" };
+ reportButton.Click += (sender, e) => Application.Instance.Open("https://github.com/cwensley/pablodraw/issues/new/choose");
+
+ var label = new Label { Text = "PabloDraw encountered an error and will now close.\nPlease report this by copying the error below and pasting into an issue on GitHub.", TextAlignment = TextAlignment.Center };
+
+ var layout = new DynamicLayout { Padding = 10, Spacing = new Size(5, 5) };
+
+ layout.AddSeparateRow(label);
+ layout.Add(textArea, yscale: true);
+
+ dlg.Content = layout;
+
+ dlg.PositiveButtons.Add(quitButton);
+ dlg.PositiveButtons.Add(reportButton);
+ dlg.PositiveButtons.Add(copyButton);
+
+ dlg.ShowModal();
}
}
diff --git a/Source/PabloDraw/Startup.cs b/Source/PabloDraw/Startup.cs
index 5c75a7d..753f94b 100644
--- a/Source/PabloDraw/Startup.cs
+++ b/Source/PabloDraw/Startup.cs
@@ -7,7 +7,7 @@ public static class Startup
[STAThread]
static void Main()
{
- EmbedReferences.Init();
+ // EmbedReferences.Init();
Program.Run();
}
}
diff --git a/Source/PabloDraw/app.config b/Source/PabloDraw/app.config
deleted file mode 100644
index ea2e0ce..0000000
--- a/Source/PabloDraw/app.config
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-