Revise plugins
This commit is contained in:
parent
9eeac1c782
commit
0b1e3732c4
29 changed files with 566 additions and 167 deletions
22
KnownPlugins.json
Normal file
22
KnownPlugins.json
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
[
|
||||
{
|
||||
"Name": "MatterControl Cloud Services",
|
||||
"TypeName": "MatterHackers.MatterControl.Plugins.CloudServices.CloudServicesPlugin"
|
||||
},
|
||||
{
|
||||
"Name": "MatterControl Authentication",
|
||||
"TypeName": "MatterHackers.MatterControl.Plugins.AuthenticationPlugin.AuthenticationPlugin"
|
||||
},
|
||||
{
|
||||
"Name": "Editor Tools",
|
||||
"TypeName": "MatterHackers.Plugins.EditorTools.EditorToolsPlugin"
|
||||
},
|
||||
{
|
||||
"Name": "Firmware Updater",
|
||||
"TypeName": "MatterHackers.MatterControl.Plugins.MarlinFirmwareUpdatePlugin.MarlinFirmwareUpdatePlugin"
|
||||
},
|
||||
{
|
||||
"Name": "Print Notifications",
|
||||
"TypeName": "MatterHackers.MatterControl.Plugins.PrintNotifications.PrintNotificationPlugin"
|
||||
},
|
||||
]
|
||||
37
MatterControl.Common/Extensibility/IApplicationPlugin.cs
Normal file
37
MatterControl.Common/Extensibility/IApplicationPlugin.cs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
Copyright (c) 2019, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
namespace MatterHackers.MatterControl.Extensibility
|
||||
{
|
||||
public interface IApplicationPlugin
|
||||
{
|
||||
PluginInfo MetaData { get; }
|
||||
void Initialize();
|
||||
}
|
||||
}
|
||||
40
MatterControl.Common/Extensibility/PluginInfo.cs
Normal file
40
MatterControl.Common/Extensibility/PluginInfo.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
Copyright (c) 2019, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
namespace MatterHackers.MatterControl.Extensibility
|
||||
{
|
||||
public class PluginInfo
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string UUID { get; set; }
|
||||
public string About { get; set; }
|
||||
public string Developer { get; set; }
|
||||
public string Url { get; set; }
|
||||
}
|
||||
}
|
||||
143
MatterControl.Common/Extensibility/PluginManager.cs
Normal file
143
MatterControl.Common/Extensibility/PluginManager.cs
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
/*
|
||||
Copyright (c) 2019, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.UI;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace MatterHackers.MatterControl.Extensibility
|
||||
{
|
||||
public class PluginManager
|
||||
{
|
||||
private string pluginStateFile = "DisabledPlugins.json";
|
||||
private string knownPluginsFile = "KnownPlugins.json";
|
||||
|
||||
public PluginManager()
|
||||
{
|
||||
if (File.Exists(pluginStateFile))
|
||||
{
|
||||
try
|
||||
{
|
||||
this.Disabled = JsonConvert.DeserializeObject<HashSet<string>>(File.ReadAllText(pluginStateFile));
|
||||
}
|
||||
catch
|
||||
{
|
||||
this.Disabled = new HashSet<string>();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Disabled = new HashSet<string>();
|
||||
}
|
||||
|
||||
if (File.Exists(knownPluginsFile))
|
||||
{
|
||||
try
|
||||
{
|
||||
this.KnownPlugins = JsonConvert.DeserializeObject<List<PluginState>>(File.ReadAllText(knownPluginsFile));
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
var plugins = new List<IApplicationPlugin>();
|
||||
|
||||
foreach (var containerType in PluginFinder.FindTypes<IApplicationPlugin>().Where(type => Disabled.Contains(type.FullName) == false))
|
||||
{
|
||||
try
|
||||
{
|
||||
plugins.Add(Activator.CreateInstance(containerType) as IApplicationPlugin);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
Console.WriteLine("Error constructing plugin: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
this.Plugins = plugins;
|
||||
|
||||
/*
|
||||
// Uncomment to generate new KnownPlugins.json file
|
||||
KnownPlugins = plugins.Where(p => p.MetaData != null).Select(p => new PluginState { TypeName = p.GetType().FullName, Name = p.MetaData.Name }).ToList();
|
||||
|
||||
File.WriteAllText(
|
||||
Path.Combine("..", "..", "knownPlugins.json"),
|
||||
JsonConvert.SerializeObject(KnownPlugins, Formatting.Indented)); */
|
||||
|
||||
}
|
||||
|
||||
public List<IApplicationPlugin> Plugins { get; }
|
||||
|
||||
public List<PluginState> KnownPlugins { get; }
|
||||
|
||||
public class PluginState
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string TypeName { get; set; }
|
||||
//public bool Enabled { get; set; }
|
||||
//public bool UpdateAvailable { get; set; }
|
||||
}
|
||||
|
||||
public HashSet<string> Disabled { get; }
|
||||
|
||||
public void Disable(string typeName) => Disabled.Add(typeName);
|
||||
|
||||
public void Enable(string typeName) => Disabled.Remove(typeName);
|
||||
|
||||
public void Save()
|
||||
{
|
||||
File.WriteAllText(
|
||||
pluginStateFile,
|
||||
JsonConvert.SerializeObject(Disabled, Formatting.Indented));
|
||||
}
|
||||
|
||||
public void InitializePlugins(SystemWindow systemWindow)
|
||||
{
|
||||
foreach (var plugin in this.Plugins)
|
||||
{
|
||||
plugin.Initialize();
|
||||
}
|
||||
}
|
||||
|
||||
public class MatterControlPluginItem
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Url { get; set; }
|
||||
public string Version { get; set; }
|
||||
public DateTime ReleaseDate { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2018, Lars Brubaker, John Lewin
|
||||
Copyright (c) 2019, Lars Brubaker, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -43,7 +43,6 @@ namespace MatterHackers.MatterControl
|
|||
bool IsNetworkConnected();
|
||||
void InitPluginFinder();
|
||||
GuiWidget GetConnectDevicePage(object printer);
|
||||
void FindAndInstantiatePlugins(SystemWindow systemWindow);
|
||||
void ProcessCommandline();
|
||||
void PlatformInit(Action<string> reporter);
|
||||
void GenerateLocalizationValidationFile();
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<Company>MatterHackers Inc.</Company>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
@ -10,4 +11,4 @@
|
|||
<ProjectReference Include="..\Submodules\agg-sharp\Gui\Gui.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
@ -35,6 +35,7 @@ using System.Runtime.InteropServices;
|
|||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Platform;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using MatterHackers.MatterControl.Extensibility;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
namespace MatterHackers.SerialPortCommunication.FrostedSerial
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ namespace MatterHackers.SerialPortCommunication.FrostedSerial
|
|||
void Dispose();
|
||||
}
|
||||
|
||||
internal enum SerialSignal
|
||||
public enum SerialSignal
|
||||
{
|
||||
None = 0,
|
||||
Cd = 1, // Carrier detect
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
namespace MatterHackers.SerialPortCommunication.FrostedSerial
|
||||
{
|
||||
public interface IFrostedSerialPortFactory
|
||||
{
|
||||
bool IsWindows { get; }
|
||||
|
||||
bool SerialPortAlreadyOpen(string portName);
|
||||
|
||||
IFrostedSerialPort Create(string serialPortName);
|
||||
IFrostedSerialPort CreateAndOpen(string serialPortName, int baudRate, bool DtrEnableOnConnect);
|
||||
}
|
||||
}
|
||||
|
|
@ -11,6 +11,10 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MatterControl.Common\MatterControl.Common.csproj">
|
||||
<Project>{2af30557-fc50-4de3-ad1c-7eb57131a9c5}</Project>
|
||||
<Name>MatterControl.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Submodules\agg-sharp\agg\Agg.csproj">
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Submodules\agg-sharp\Localizations\Localizations.csproj" />
|
||||
|
|
|
|||
|
|
@ -62,14 +62,14 @@
|
|||
<Project>{f1653f20-d47d-4f29-8c55-3c835542af5f}</Project>
|
||||
<Name>Community.CsharpSqlite</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\MatterControl.Common\MatterControl.Common.csproj">
|
||||
<Project>{2af30557-fc50-4de3-ad1c-7eb57131a9c5}</Project>
|
||||
<Name>MatterControl.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\MatterControlLib\MatterControlLib.csproj">
|
||||
<Project>{D557B079-612F-467F-AE0D-3F77BCD627F7}</Project>
|
||||
<Name>MatterControlLib</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\PluginSystem\MatterControlPluginSystem.csproj">
|
||||
<Project>{865172a0-a1a9-49c2-9386-f2fdb4e141b7}</Project>
|
||||
<Name>MatterControlPluginSystem</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Submodules\agg-sharp\agg\Agg.csproj">
|
||||
<Project>{657dbc6d-c3ea-4398-a3fa-ddb73c14f71b}</Project>
|
||||
<Name>Agg</Name>
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ using MatterHackers.Agg;
|
|||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.Agg.Platform;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.MatterControl.PluginSystem;
|
||||
using MatterHackers.MatterControl.PrinterControls.PrinterConnections;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
|
|
@ -91,14 +90,6 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
}
|
||||
|
||||
public void FindAndInstantiatePlugins(SystemWindow systemWindow)
|
||||
{
|
||||
foreach (MatterControlPlugin plugin in PluginFinder.CreateInstancesOf<MatterControlPlugin>())
|
||||
{
|
||||
plugin.Initialize(systemWindow);
|
||||
}
|
||||
}
|
||||
|
||||
public void ProcessCommandline()
|
||||
{
|
||||
var commandLineArgs = Environment.GetCommandLineArgs();
|
||||
|
|
|
|||
|
|
@ -65,6 +65,9 @@
|
|||
<None Include="StaticData\OEMSettings\OEMUrls.json" />
|
||||
<None Include="StaticData\OEMSettings\Printers.json" />
|
||||
<None Include="StaticData\OEMSettings\Settings.json" />
|
||||
<None Include="KnownPlugins.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="Community.CsharpSqlite\Community.CsharpSqlite.csproj">
|
||||
|
|
@ -103,6 +106,8 @@
|
|||
<Project>{b0aed568-8796-42b9-baa9-ebc796134e78}</Project>
|
||||
<Name>MatterSlice</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="MatterControl.Common\MatterControl.Common.csproj">
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="609_Boolean_bin.dll">
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27130.2010
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.28516.95
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tesselate", "Submodules\agg-sharp\Tesselate\Tesselate.csproj", "{AE37DE1F-22F7-49EE-8732-FC6BC8DC58D9}"
|
||||
EndProject
|
||||
|
|
@ -36,8 +36,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "clipper_library", "Submodul
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MarchingSquares", "Submodules\agg-sharp\MarchingSquares\MarchingSquares.csproj", "{DF6845CD-64C6-4263-8357-DA8066855739}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MatterControlPluginSystem", "PluginSystem\MatterControlPluginSystem.csproj", "{865172A0-A1A9-49C2-9386-F2FDB4E141B7}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Launcher", "Launcher\Launcher.csproj", "{3DF4CB3D-9A03-4256-9A81-70523AAD828B}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "agg-sharp", "agg-sharp", "{2AB9B589-5C98-4C05-BBEA-F97DAE168EAB}"
|
||||
|
|
@ -96,6 +94,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Typography.One", "Submodule
|
|||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Typography.OpenFont", "Submodules\agg-sharp\Typography.OpenFont\Typography.OpenFont.shproj", "{235A071B-8D06-40AE-A5C5-B1CE59715EE9}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MatterControl.Common", "MatterControl.Common\MatterControl.Common.csproj", "{50505F12-985B-4C5F-8DAB-D5BEA734CD51}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||
Submodules\agg-sharp\Typography.OpenFont\Typography.OpenFont.projitems*{235a071b-8d06-40ae-a5c5-b1ce59715ee9}*SharedItemsImports = 13
|
||||
|
|
@ -222,14 +222,6 @@ Global
|
|||
{DF6845CD-64C6-4263-8357-DA8066855739}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DF6845CD-64C6-4263-8357-DA8066855739}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{DF6845CD-64C6-4263-8357-DA8066855739}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{865172A0-A1A9-49C2-9386-F2FDB4E141B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{865172A0-A1A9-49C2-9386-F2FDB4E141B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{865172A0-A1A9-49C2-9386-F2FDB4E141B7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{865172A0-A1A9-49C2-9386-F2FDB4E141B7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{865172A0-A1A9-49C2-9386-F2FDB4E141B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{865172A0-A1A9-49C2-9386-F2FDB4E141B7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{865172A0-A1A9-49C2-9386-F2FDB4E141B7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{865172A0-A1A9-49C2-9386-F2FDB4E141B7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{3DF4CB3D-9A03-4256-9A81-70523AAD828B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3DF4CB3D-9A03-4256-9A81-70523AAD828B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3DF4CB3D-9A03-4256-9A81-70523AAD828B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
|
|
@ -414,6 +406,14 @@ Global
|
|||
{07F53C22-F178-4A25-963F-11DB59024ACA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{07F53C22-F178-4A25-963F-11DB59024ACA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{07F53C22-F178-4A25-963F-11DB59024ACA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{50505F12-985B-4C5F-8DAB-D5BEA734CD51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{50505F12-985B-4C5F-8DAB-D5BEA734CD51}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{50505F12-985B-4C5F-8DAB-D5BEA734CD51}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{50505F12-985B-4C5F-8DAB-D5BEA734CD51}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{50505F12-985B-4C5F-8DAB-D5BEA734CD51}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{50505F12-985B-4C5F-8DAB-D5BEA734CD51}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{50505F12-985B-4C5F-8DAB-D5BEA734CD51}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{50505F12-985B-4C5F-8DAB-D5BEA734CD51}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
@ -433,7 +433,6 @@ Global
|
|||
{036BCCBA-52D8-457C-84AE-8821F209FE4A} = {2AB9B589-5C98-4C05-BBEA-F97DAE168EAB}
|
||||
{9B062971-A88E-4A3D-B3C9-12B78D15FA66} = {2AB9B589-5C98-4C05-BBEA-F97DAE168EAB}
|
||||
{DF6845CD-64C6-4263-8357-DA8066855739} = {2AB9B589-5C98-4C05-BBEA-F97DAE168EAB}
|
||||
{865172A0-A1A9-49C2-9386-F2FDB4E141B7} = {FED00F38-E911-45E1-A788-26980E84C3D6}
|
||||
{3DF4CB3D-9A03-4256-9A81-70523AAD828B} = {FED00F38-E911-45E1-A788-26980E84C3D6}
|
||||
{990A9AD3-B6A4-407B-9DFC-9C722AF7C9B9} = {FED00F38-E911-45E1-A788-26980E84C3D6}
|
||||
{04667764-DC7B-4B95-AEF6-B4E6C87A54E9} = {2AB9B589-5C98-4C05-BBEA-F97DAE168EAB}
|
||||
|
|
@ -457,6 +456,7 @@ Global
|
|||
{D8861CF8-C506-472B-8A57-632BD6CA6496} = {2AB9B589-5C98-4C05-BBEA-F97DAE168EAB}
|
||||
{07F53C22-F178-4A25-963F-11DB59024ACA} = {2AB9B589-5C98-4C05-BBEA-F97DAE168EAB}
|
||||
{235A071B-8D06-40AE-A5C5-B1CE59715EE9} = {2AB9B589-5C98-4C05-BBEA-F97DAE168EAB}
|
||||
{50505F12-985B-4C5F-8DAB-D5BEA734CD51} = {FED00F38-E911-45E1-A788-26980E84C3D6}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {42D74E06-00EA-43D2-A05B-9BEAD4A2C8A0}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ namespace MatterHackers.MatterControl
|
|||
using MatterHackers.MatterControl.ConfigurationPage.PrintLeveling;
|
||||
using MatterHackers.MatterControl.DesignTools;
|
||||
using MatterHackers.MatterControl.DesignTools.Operations;
|
||||
using MatterHackers.MatterControl.Extensibility;
|
||||
using MatterHackers.MatterControl.Library;
|
||||
using MatterHackers.MatterControl.PartPreviewWindow;
|
||||
using MatterHackers.MatterControl.PartPreviewWindow.View3D;
|
||||
|
|
@ -267,7 +268,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public IEnumerable<PrinterConfig> ActivePrinters => this.Workspaces.Where(w => w.Printer != null).Select(w => w.Printer);
|
||||
|
||||
private Dictionary<Type, HashSet<IObject3DEditor>> objectEditorsByType;
|
||||
public ExtensionsConfig Extensions { get; }
|
||||
|
||||
public PopupMenu GetActionMenuForSceneItem(IObject3D selectedItem, InteractiveScene scene, bool addInSubmenu, IEnumerable<NodeOperation> nodeOperations = null)
|
||||
{
|
||||
|
|
@ -1069,6 +1070,10 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
this.RebuildSceneOperations(this.Theme);
|
||||
|
||||
this.Extensions = new ExtensionsConfig(this.Library);
|
||||
this.Extensions.Register(new ImageEditor());
|
||||
this.Extensions.Register(new PublicPropertyEditor());
|
||||
|
||||
HelpArticle helpArticle = null;
|
||||
|
||||
string helpPath = Path.Combine("OEMSettings", "toc.json");
|
||||
|
|
@ -1475,26 +1480,6 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
this.InitializeLibrary();
|
||||
|
||||
HashSet<IObject3DEditor> mappedEditors;
|
||||
objectEditorsByType = new Dictionary<Type, HashSet<IObject3DEditor>>();
|
||||
|
||||
// Initialize plugins, passing the MatterControl assembly as the only non-dll instance
|
||||
//PluginFinder.Initialize(Assembly.GetExecutingAssembly());
|
||||
|
||||
foreach (IObject3DEditor editor in PluginFinder.CreateInstancesOf<IObject3DEditor>())
|
||||
{
|
||||
foreach (Type type in editor.SupportedTypes())
|
||||
{
|
||||
if (!objectEditorsByType.TryGetValue(type, out mappedEditors))
|
||||
{
|
||||
mappedEditors = new HashSet<IObject3DEditor>();
|
||||
objectEditorsByType.Add(type, mappedEditors);
|
||||
}
|
||||
|
||||
mappedEditors.Add(editor);
|
||||
}
|
||||
}
|
||||
|
||||
this.Graph.PrimaryOperations.Add(typeof(ImageObject3D), new List<NodeOperation> { this.Graph.Operations["ImageConverter"], this.Graph.Operations["ImageToPath"], });
|
||||
this.Graph.PrimaryOperations.Add(typeof(ImageToPathObject3D), new List<NodeOperation> { this.Graph.Operations["LinearExtrude"], this.Graph.Operations["SmoothPath"], this.Graph.Operations["InflatePath"] });
|
||||
this.Graph.PrimaryOperations.Add(typeof(SmoothPathObject3D), new List<NodeOperation> { this.Graph.Operations["LinearExtrude"], this.Graph.Operations["InflatePath"] });
|
||||
|
|
@ -1643,29 +1628,6 @@ namespace MatterHackers.MatterControl
|
|||
return false;
|
||||
}
|
||||
|
||||
public HashSet<IObject3DEditor> GetEditorsForType(Type selectedItemType)
|
||||
{
|
||||
HashSet<IObject3DEditor> mappedEditors;
|
||||
objectEditorsByType.TryGetValue(selectedItemType, out mappedEditors);
|
||||
|
||||
if (mappedEditors == null)
|
||||
{
|
||||
foreach (var kvp in objectEditorsByType)
|
||||
{
|
||||
var editorType = kvp.Key;
|
||||
|
||||
if (editorType.IsAssignableFrom(selectedItemType)
|
||||
&& selectedItemType != typeof(Object3D))
|
||||
{
|
||||
mappedEditors = kvp.Value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return mappedEditors;
|
||||
}
|
||||
|
||||
public void Shutdown()
|
||||
{
|
||||
// Ensure all threads shutdown gracefully on close
|
||||
|
|
@ -1721,7 +1683,6 @@ namespace MatterHackers.MatterControl
|
|||
return TypeFaceCache[Name];
|
||||
}
|
||||
|
||||
|
||||
private static TypeFace titilliumTypeFace = null;
|
||||
public static TypeFace TitilliumTypeFace
|
||||
{
|
||||
|
|
@ -1736,7 +1697,6 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static string LoadCachedFile(string cacheKey, string cacheScope)
|
||||
{
|
||||
string cachePath = CacheablePath(cacheScope, cacheKey);
|
||||
|
|
@ -2629,6 +2589,23 @@ If you experience adhesion problems, please re-run leveling."
|
|||
});
|
||||
}
|
||||
|
||||
private static PluginManager pluginManager = null;
|
||||
|
||||
public static PluginManager Plugins
|
||||
{
|
||||
get
|
||||
{
|
||||
// PluginManager initialization must occur late, after the config is loaded and after localization libraries
|
||||
// have occurred, which currently is driven by MatterControlApplication init
|
||||
if (pluginManager == null)
|
||||
{
|
||||
pluginManager = new PluginManager();
|
||||
}
|
||||
|
||||
return pluginManager;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Archives MCX and validates GCode results before starting a print operation
|
||||
/// </summary>
|
||||
|
|
@ -3544,7 +3521,7 @@ If you experience adhesion problems, please re-run leveling."
|
|||
}
|
||||
|
||||
reporter?.Invoke(0.3, (loading != null) ? loading : "Plugins");
|
||||
AppContext.Platform.FindAndInstantiatePlugins(systemWindow);
|
||||
ApplicationController.Plugins.InitializePlugins(systemWindow);
|
||||
|
||||
reporter?.Invoke(0.4, (loading != null) ? loading : "MainView");
|
||||
applicationController.MainView = new MainViewWidget(applicationController.Theme);
|
||||
|
|
|
|||
116
MatterControlLib/ApplicationView/ExtensionsConfig.cs
Normal file
116
MatterControlLib/ApplicationView/ExtensionsConfig.cs
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
/*
|
||||
Copyright (c) 2018, Lars Brubaker, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly: InternalsVisibleTo("MatterControl.Tests")]
|
||||
[assembly: InternalsVisibleTo("MatterControl.AutomationTests")]
|
||||
[assembly: InternalsVisibleTo("CloudServices.Tests")]
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.MatterControl.Library;
|
||||
using MatterHackers.MatterControl.PartPreviewWindow;
|
||||
using MatterHackers.MeshVisualizer;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
public class ExtensionsConfig
|
||||
{
|
||||
private List<IInteractionVolumeProvider> _iaVolumeProviders = new List<IInteractionVolumeProvider>();
|
||||
|
||||
private LibraryConfig libraryConfig;
|
||||
|
||||
//private List<IObject3DEditor> _IObject3DEditorProviders = new List<IObject3DEditor>()
|
||||
//{
|
||||
// new IntersectionEditor(),
|
||||
// new SubtractEditor(),
|
||||
// new SubtractAndReplace()
|
||||
//};
|
||||
|
||||
public ExtensionsConfig(LibraryConfig libraryConfig)
|
||||
{
|
||||
this.libraryConfig = libraryConfig;
|
||||
|
||||
objectEditorsByType = new Dictionary<Type, HashSet<IObject3DEditor>>();
|
||||
}
|
||||
|
||||
private void MapTypesToEditor(IObject3DEditor editor)
|
||||
{
|
||||
foreach (Type type in editor.SupportedTypes())
|
||||
{
|
||||
if (!objectEditorsByType.TryGetValue(type, out HashSet<IObject3DEditor> mappedEditors))
|
||||
{
|
||||
mappedEditors = new HashSet<IObject3DEditor>();
|
||||
objectEditorsByType.Add(type, mappedEditors);
|
||||
}
|
||||
|
||||
mappedEditors.Add(editor);
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<IInteractionVolumeProvider> IAVolumeProviders => _iaVolumeProviders;
|
||||
|
||||
public void Register(IInteractionVolumeProvider volumeProvider)
|
||||
{
|
||||
_iaVolumeProviders.Add(volumeProvider);
|
||||
}
|
||||
public void Register(IObject3DEditor object3DEditor)
|
||||
{
|
||||
this.MapTypesToEditor(object3DEditor);
|
||||
}
|
||||
|
||||
private Dictionary<Type, HashSet<IObject3DEditor>> objectEditorsByType;
|
||||
|
||||
public HashSet<IObject3DEditor> GetEditorsForType(Type selectedItemType)
|
||||
{
|
||||
HashSet<IObject3DEditor> mappedEditors;
|
||||
objectEditorsByType.TryGetValue(selectedItemType, out mappedEditors);
|
||||
|
||||
if (mappedEditors == null)
|
||||
{
|
||||
foreach (var kvp in objectEditorsByType)
|
||||
{
|
||||
var editorType = kvp.Key;
|
||||
|
||||
if (editorType.IsAssignableFrom(selectedItemType)
|
||||
&& selectedItemType != typeof(Object3D))
|
||||
{
|
||||
mappedEditors = kvp.Value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return mappedEditors;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
Copyright (c) 2019, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.ConfigurationPage;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
public class PluginsPage : DialogPage
|
||||
{
|
||||
public PluginsPage()
|
||||
{
|
||||
this.AnchorAll();
|
||||
|
||||
this.HeaderText = this.WindowTitle = "MatterControl Plugins".Localize();
|
||||
|
||||
var contentScroll = new ScrollableWidget(true);
|
||||
contentScroll.ScrollArea.HAnchor |= HAnchor.Stretch;
|
||||
contentScroll.ScrollArea.VAnchor = VAnchor.Fit;
|
||||
contentScroll.AnchorAll();
|
||||
|
||||
var formContainer = new FlowLayoutWidget(FlowDirection.TopToBottom)
|
||||
{
|
||||
HAnchor = HAnchor.Stretch
|
||||
};
|
||||
|
||||
// TODO: Move to instance
|
||||
var plugins = ApplicationController.Plugins;
|
||||
|
||||
foreach (var plugin in plugins.KnownPlugins)
|
||||
{
|
||||
// Touch Screen Mode
|
||||
formContainer.AddChild(
|
||||
new SettingsItem(
|
||||
plugin.Name,
|
||||
theme,
|
||||
new SettingsItem.ToggleSwitchConfig()
|
||||
{
|
||||
Checked = !plugins.Disabled.Contains(plugin.TypeName),
|
||||
ToggleAction = (itemChecked) =>
|
||||
{
|
||||
if (itemChecked)
|
||||
{
|
||||
plugins.Enable(plugin.TypeName);
|
||||
}
|
||||
else
|
||||
{
|
||||
plugins.Disable(plugin.TypeName);
|
||||
}
|
||||
}
|
||||
},
|
||||
enforceGutter: false));
|
||||
}
|
||||
|
||||
contentScroll.AddChild(formContainer);
|
||||
|
||||
contentRow.AddChild(contentScroll);
|
||||
|
||||
var saveButton = theme.CreateDialogButton("Save".Localize());
|
||||
saveButton.Click += (s,e) =>
|
||||
{
|
||||
ApplicationController.Plugins.Save();
|
||||
this.DialogWindow.CloseOnIdle();
|
||||
};
|
||||
|
||||
this.AddPageAction(saveButton);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -27,14 +27,7 @@ of the authors and should not be interpreted as representing official policies,
|
|||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.MatterControl.PluginSystem;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
// finish a, b, t
|
||||
|
||||
namespace MatterHackers.MatterControl.Plugins.BrailleBuilder
|
||||
{
|
||||
public static class BrailleGrade2Mapping
|
||||
|
|
|
|||
|
|
@ -631,7 +631,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
}
|
||||
// Use known IObject3D editors
|
||||
else if (propertyValue is IObject3D item
|
||||
&& ApplicationController.Instance.GetEditorsForType(property.PropertyType)?.FirstOrDefault() is IObject3DEditor iObject3DEditor)
|
||||
&& ApplicationController.Instance.Extensions.GetEditorsForType(property.PropertyType)?.FirstOrDefault() is IObject3DEditor iObject3DEditor)
|
||||
{
|
||||
rowContainer = iObject3DEditor.Create(item, theme);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ namespace MatterHackers.MatterControl
|
|||
MatterHackers.Agg.ImageProcessing.InvertLightness.AssertDebugNotDefined();
|
||||
MatterHackers.Localizations.TranslationMap.AssertDebugNotDefined();
|
||||
MatterHackers.MarchingSquares.MarchingSquaresByte.AssertDebugNotDefined();
|
||||
MatterHackers.MatterControl.PluginSystem.MatterControlPlugin.AssertDebugNotDefined();
|
||||
MatterHackers.MatterSlice.MatterSlice.AssertDebugNotDefined();
|
||||
MatterHackers.RenderOpenGl.GLMeshTrianglePlugin.AssertDebugNotDefined();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MatterControl.Common\MatterControl.Common.csproj" />
|
||||
<ProjectReference Include="..\MatterControl.OpenGL\MatterControl.OpenGL.csproj" />
|
||||
<ProjectReference Include="..\MatterControl.Printing\MatterControl.Printing.csproj" />
|
||||
<ProjectReference Include="..\Submodules\agg-sharp\clipper_library\clipper_library.csproj" />
|
||||
|
|
@ -77,7 +78,6 @@
|
|||
<ProjectReference Include="..\Submodules\agg-sharp\Tesselate\Tesselate.csproj" />
|
||||
<ProjectReference Include="..\Submodules\agg-sharp\RenderOpenGl\RenderOpenGl.csproj" />
|
||||
<ProjectReference Include="..\Submodules\agg-sharp\PolygonMesh\PolygonMesh.csproj" />
|
||||
<ProjectReference Include="..\PluginSystem\MatterControlPluginSystem.csproj" />
|
||||
<ProjectReference Include="..\Submodules\agg-sharp\Localizations\Localizations.csproj" />
|
||||
<ProjectReference Include="..\Submodules\agg-sharp\agg\Agg.csproj" />
|
||||
<ProjectReference Include="..\Submodules\MatterSlice\MatterSliceLib\MatterSliceLib.csproj" />
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
editorSectionWidget.Text = selectedItem.Name ?? selectedItemType.Name;
|
||||
|
||||
HashSet<IObject3DEditor> mappedEditors = ApplicationController.Instance.GetEditorsForType(selectedItemType);
|
||||
HashSet<IObject3DEditor> mappedEditors = ApplicationController.Instance.Extensions.GetEditorsForType(selectedItemType);
|
||||
|
||||
var undoBuffer = sceneContext.Scene.UndoBuffer;
|
||||
|
||||
|
|
@ -309,7 +309,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
if (instance is IObject3D object3D)
|
||||
{
|
||||
if (ApplicationController.Instance.GetEditorsForType(object3D.GetType())?.FirstOrDefault() is IObject3DEditor editor)
|
||||
if (ApplicationController.Instance.Extensions.GetEditorsForType(object3D.GetType())?.FirstOrDefault() is IObject3DEditor editor)
|
||||
{
|
||||
ShowObjectEditor((editor, object3D, object3D.Name), selectedItem, allowOperations: allowOperations);
|
||||
}
|
||||
|
|
@ -346,7 +346,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
else
|
||||
{
|
||||
if (ApplicationController.Instance.GetEditorsForType(item.GetType())?.FirstOrDefault() is IObject3DEditor editor)
|
||||
if (ApplicationController.Instance.Extensions.GetEditorsForType(item.GetType())?.FirstOrDefault() is IObject3DEditor editor)
|
||||
{
|
||||
ShowObjectEditor((editor, item, item.Name), selectedItem, allowOperations: allowOperations);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
using DataConverters3D;
|
||||
using MatterHackers.Agg.Platform;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.MatterControl.Library;
|
||||
|
||||
public class ImageEditor : IObject3DEditor
|
||||
{
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ using MatterHackers.Agg.Transform;
|
|||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Agg.VertexSource;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.MatterControl.Extensibility;
|
||||
using MatterHackers.RayTracer;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
|
|
@ -195,11 +196,8 @@ namespace MatterHackers.MeshVisualizer
|
|||
double SnapGridDistance { get; }
|
||||
}
|
||||
|
||||
public class InteractionVolumePlugin
|
||||
public interface IInteractionVolumeProvider
|
||||
{
|
||||
public virtual InteractionVolume CreateInteractionVolume(IInteractionVolumeContext context)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
IEnumerable<InteractionVolume> Create(IInteractionVolumeContext context);
|
||||
}
|
||||
}
|
||||
|
|
@ -45,6 +45,7 @@ using MatterHackers.DataConverters3D;
|
|||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.CustomWidgets;
|
||||
using MatterHackers.MatterControl.DesignTools;
|
||||
using MatterHackers.MatterControl.Extensibility;
|
||||
using MatterHackers.MatterControl.Library;
|
||||
using MatterHackers.MatterControl.PrinterControls.PrinterConnections;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
|
|
@ -353,10 +354,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
interactionVolumes.Add(new SelectionShadow(this.InteractionLayer));
|
||||
interactionVolumes.Add(new SnappingIndicators(this.InteractionLayer, this.CurrentSelectInfo));
|
||||
|
||||
var interactionVolumePlugins = PluginFinder.CreateInstancesOf<InteractionVolumePlugin>();
|
||||
foreach (InteractionVolumePlugin plugin in interactionVolumePlugins)
|
||||
// Add IAVolumeProviderPlugins
|
||||
foreach (var ivProvider in ApplicationController.Instance.Extensions.IAVolumeProviders)
|
||||
{
|
||||
interactionVolumes.Add(plugin.CreateInteractionVolume(this.InteractionLayer));
|
||||
interactionVolumes.AddRange(ivProvider.Create(this.InteractionLayer));
|
||||
}
|
||||
|
||||
meshViewerWidget.AfterDraw += AfterDraw3DContent;
|
||||
|
|
|
|||
|
|
@ -77,9 +77,11 @@ namespace MatterHackers.MatterControl
|
|||
// Camera Monitoring
|
||||
bool hasCamera = true || ApplicationSettings.Instance.get(ApplicationSettingsKey.HardwareHasCamera) == "true";
|
||||
|
||||
var configureIcon = AggContext.StaticData.LoadIcon("fa-cog_16.png", IconColor.Raw);
|
||||
|
||||
var previewButton = new IconButton(configureIcon, theme)
|
||||
{
|
||||
ToolTipText = "Configure Camera View".Localize()
|
||||
ToolTipText = "Preview".Localize()
|
||||
};
|
||||
previewButton.Click += (s, e) =>
|
||||
{
|
||||
|
|
@ -362,6 +364,28 @@ namespace MatterHackers.MatterControl
|
|||
theme),
|
||||
advancedPanel);
|
||||
|
||||
#if DEBUG
|
||||
var configurePluginsButton = new IconButton(configureIcon, theme)
|
||||
{
|
||||
ToolTipText = "Configure Plugins".Localize(),
|
||||
Margin = 0
|
||||
};
|
||||
configurePluginsButton.Click += (s, e) =>
|
||||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
DialogWindow.Show<PluginsPage>();
|
||||
});
|
||||
};
|
||||
|
||||
this.AddSettingsRow(
|
||||
new SettingsItem(
|
||||
"Plugins".Localize(),
|
||||
configurePluginsButton,
|
||||
theme),
|
||||
advancedPanel);
|
||||
#endif
|
||||
|
||||
advancedPanel.Children<SettingsItem>().First().Border = new BorderDouble(0, 1);
|
||||
|
||||
// Enforce consistent SectionWidget spacing and last child borders
|
||||
|
|
|
|||
|
|
@ -1,59 +0,0 @@
|
|||
using MatterHackers.Agg.UI;
|
||||
using System;
|
||||
|
||||
namespace MatterHackers.MatterControl.PluginSystem
|
||||
{
|
||||
public class MatterControlPlugin
|
||||
{
|
||||
/// <summary>
|
||||
/// Each plugin that is found will be instantiated and passed the main application widget.
|
||||
/// It is then up to the plugin to do whatever initialization or registration that it requires.
|
||||
/// </summary>
|
||||
/// <param name="application"></param>
|
||||
public virtual void Initialize(GuiWidget application)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return a json string representing plugin information
|
||||
/// {
|
||||
/// "Name": "MatterHackers Test Plugin",
|
||||
/// "UUID": "22cf8c90-66c3-11e3-949a-0800200c9a66",
|
||||
/// "About": "This is a sample plugin info that shows some of the expected values that can be present in a plugin info.",
|
||||
/// "Developer": "MatterHackers, Inc."
|
||||
/// "URL": "https://www.matterhackers.com"
|
||||
/// }
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual string GetPluginInfoJSon()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public static GuiWidget FindNamedWidgetRecursive(GuiWidget root, string name)
|
||||
{
|
||||
foreach (GuiWidget child in root.Children)
|
||||
{
|
||||
if (child.Name == name)
|
||||
{
|
||||
return child;
|
||||
}
|
||||
|
||||
GuiWidget foundWidget = FindNamedWidgetRecursive(child, name);
|
||||
if (foundWidget != null)
|
||||
{
|
||||
return foundWidget;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void AssertDebugNotDefined()
|
||||
{
|
||||
#if DEBUG
|
||||
throw new Exception("DEBUG is defined and should not be!");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -75,6 +75,10 @@
|
|||
<None Include="app.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\MatterControl.Common\MatterControl.Common.csproj">
|
||||
<Project>{2af30557-fc50-4de3-ad1c-7eb57131a9c5}</Project>
|
||||
<Name>MatterControl.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\MatterControl.Printing\MatterControl.Printing.csproj">
|
||||
<Project>{97d5ade3-c1b4-4b46-8a3e-718a4f7f079f}</Project>
|
||||
<Name>MatterControl.Printing</Name>
|
||||
|
|
@ -87,10 +91,6 @@
|
|||
<Project>{D557B079-612F-467F-AE0D-3F77BCD627F7}</Project>
|
||||
<Name>MatterControlLib</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\PluginSystem\MatterControlPluginSystem.csproj">
|
||||
<Project>{865172a0-a1a9-49c2-9386-f2fdb4e141b7}</Project>
|
||||
<Name>MatterControlPluginSystem</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Submodules\agg-sharp\agg\Agg.csproj">
|
||||
<Project>{657dbc6d-c3ea-4398-a3fa-ddb73c14f71b}</Project>
|
||||
<Name>Agg</Name>
|
||||
|
|
|
|||
|
|
@ -83,6 +83,10 @@
|
|||
<Project>{f1653f20-d47d-4f29-8c55-3c835542af5f}</Project>
|
||||
<Name>Community.CsharpSqlite</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\MatterControl.Common\MatterControl.Common.csproj">
|
||||
<Project>{2af30557-fc50-4de3-ad1c-7eb57131a9c5}</Project>
|
||||
<Name>MatterControl.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\MatterControl.Printing\MatterControl.Printing.csproj">
|
||||
<Project>{97d5ade3-c1b4-4b46-8a3e-718a4f7f079f}</Project>
|
||||
<Name>MatterControl.Printing</Name>
|
||||
|
|
@ -95,10 +99,6 @@
|
|||
<Project>{D557B079-612F-467F-AE0D-3F77BCD627F7}</Project>
|
||||
<Name>MatterControlLib</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\PluginSystem\MatterControlPluginSystem.csproj">
|
||||
<Project>{865172a0-a1a9-49c2-9386-f2fdb4e141b7}</Project>
|
||||
<Name>MatterControlPluginSystem</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Submodules\agg-sharp\agg\Agg.csproj">
|
||||
<Project>{657dbc6d-c3ea-4398-a3fa-ddb73c14f71b}</Project>
|
||||
<Name>Agg</Name>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue