commit
ff638037fd
19 changed files with 169 additions and 46 deletions
|
|
@ -546,7 +546,7 @@ namespace MatterHackers.MatterControl
|
|||
// check permission to a purchase
|
||||
public Func<string, bool> UserHasPermissionToId { get; set; }
|
||||
|
||||
public Func<IObject3D, string> GetUnlockPage { get; set; }
|
||||
public Func<IObject3D, ThemeConfig, (string url, GuiWidget markdownWidget)> GetUnlockData { get; set; }
|
||||
|
||||
private static ApplicationController globalInstance;
|
||||
|
||||
|
|
@ -2304,9 +2304,31 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public DragDropData DragDropData { get; set; } = new DragDropData();
|
||||
|
||||
public string ShortProductName => "MatterControl";
|
||||
public string ShortProductName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.IsMatterControlPro())
|
||||
{
|
||||
return "MatterControl Pro";
|
||||
}
|
||||
|
||||
public string ProductName => "MatterHackers: MatterControl";
|
||||
return "MatterControl";
|
||||
}
|
||||
}
|
||||
|
||||
public string ProductName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.IsMatterControlPro())
|
||||
{
|
||||
return "MatterControl Pro Edition";
|
||||
}
|
||||
|
||||
return "MatterHackers: MatterControl";
|
||||
}
|
||||
}
|
||||
|
||||
public void SwitchToPurchasedLibrary()
|
||||
{
|
||||
|
|
@ -3615,11 +3637,14 @@ Support and tutorials:
|
|||
{
|
||||
timer = Stopwatch.StartNew();
|
||||
|
||||
// set the default font
|
||||
AggContext.DefaultFont = ApplicationController.GetTypeFace(NamedTypeFace.Nunito_Regular);
|
||||
AggContext.DefaultFontBold = ApplicationController.GetTypeFace(NamedTypeFace.Nunito_Bold);
|
||||
AggContext.DefaultFontItalic = ApplicationController.GetTypeFace(NamedTypeFace.Nunito_Italic);
|
||||
AggContext.DefaultFontBoldItalic = ApplicationController.GetTypeFace(NamedTypeFace.Nunito_Bold_Italic);
|
||||
if (false)
|
||||
{
|
||||
// set the default font
|
||||
AggContext.DefaultFont = ApplicationController.GetTypeFace(NamedTypeFace.Nunito_Regular);
|
||||
AggContext.DefaultFontBold = ApplicationController.GetTypeFace(NamedTypeFace.Nunito_Bold);
|
||||
AggContext.DefaultFontItalic = ApplicationController.GetTypeFace(NamedTypeFace.Nunito_Italic);
|
||||
AggContext.DefaultFontBoldItalic = ApplicationController.GetTypeFace(NamedTypeFace.Nunito_Bold_Italic);
|
||||
}
|
||||
|
||||
var systemWindow = new RootSystemWindow(width, height);
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ namespace MatterHackers.MatterControl.DataStorage
|
|||
|
||||
public virtual void Commit()
|
||||
{
|
||||
//Assumes that autoincremented ids start with 1
|
||||
// Assumes that autoincremented ids start with 1
|
||||
if (this.Id == 0)
|
||||
{
|
||||
TryHandleInsert();
|
||||
|
|
@ -210,7 +210,7 @@ namespace MatterHackers.MatterControl.DataStorage
|
|||
|
||||
public string DeviceToken { get; set; }
|
||||
|
||||
//Auto connect to printer (if available)
|
||||
// Auto connect to printer (if available)
|
||||
public string DeviceType { get; set; }
|
||||
|
||||
// all the data about print leveling
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ namespace MatterHackers.MatterControl.Library
|
|||
|
||||
public string Name => "Builder";
|
||||
|
||||
public bool Unlocked { get; } = true;
|
||||
|
||||
private string compilerPath = UserSettings.Instance.get(UserSettingsKey.OpenScadPath) ?? "/usr/bin/openscad";
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
Polygon_Percent
|
||||
}
|
||||
|
||||
public override bool Persistable => ApplicationController.Instance.UserHasPermission(this);
|
||||
|
||||
public ReductionMode Mode { get; set; } = ReductionMode.Polygon_Percent;
|
||||
|
||||
[ReadOnly(true)]
|
||||
|
|
@ -26,6 +26,8 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
Name = "Repair".Localize();
|
||||
}
|
||||
|
||||
public override bool Persistable => ApplicationController.Instance.UserHasPermission(this);
|
||||
|
||||
[Description("Make all the faces have a consistent orientation.")]
|
||||
public bool FaceOrientation { get; set; } = true;
|
||||
|
||||
|
|
@ -33,6 +33,7 @@ using System.ComponentModel;
|
|||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using Markdig.Agg;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.Agg.Platform;
|
||||
|
|
@ -98,8 +99,6 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
public string Name => "Property Editor";
|
||||
|
||||
public bool Unlocked { get; } = true;
|
||||
|
||||
public IEnumerable<Type> SupportedTypes() => new Type[] { typeof(IObject3D) };
|
||||
|
||||
private static readonly Type[] allowedTypes =
|
||||
|
|
@ -863,15 +862,22 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
public static void AddUnlockLinkIfRequired(IObject3D item, GuiWidget editControlsContainer, ThemeConfig theme)
|
||||
{
|
||||
var unlockUrl = ApplicationController.Instance.GetUnlockPage?.Invoke(item);
|
||||
var unlockdata = ApplicationController.Instance.GetUnlockData?.Invoke(item, theme);
|
||||
if (!item.Persistable
|
||||
&& !string.IsNullOrEmpty(unlockUrl))
|
||||
&& unlockdata != null
|
||||
&& !string.IsNullOrEmpty(unlockdata.Value.url))
|
||||
{
|
||||
editControlsContainer.AddChild(GetUnlockRow(theme, unlockUrl));
|
||||
if (unlockdata.Value.markdownWidget != null)
|
||||
{
|
||||
unlockdata.Value.markdownWidget.VAnchor = VAnchor.Fit;
|
||||
editControlsContainer.AddChild(unlockdata.Value.markdownWidget);
|
||||
}
|
||||
|
||||
editControlsContainer.AddChild(GetUnlockRow(theme, unlockdata.Value.url));
|
||||
}
|
||||
}
|
||||
|
||||
public static GuiWidget GetUnlockRow(ThemeConfig theme, string unlockLinkUrl)
|
||||
public static GuiWidget GetUnlockRow(ThemeConfig theme, string url)
|
||||
{
|
||||
var detailsLink = new TextIconButton("Unlock".Localize(), AggContext.StaticData.LoadIcon("locked.png", 16, 16, theme.InvertIcons), theme)
|
||||
{
|
||||
|
|
@ -880,7 +886,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
};
|
||||
detailsLink.Click += (s, e) =>
|
||||
{
|
||||
ApplicationController.Instance.LaunchBrowser(unlockLinkUrl);
|
||||
ApplicationController.Instance.LaunchBrowser(url);
|
||||
};
|
||||
theme.ApplyPrimaryActionStyle(detailsLink);
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab
|
|||
{
|
||||
markdownWidget.Markdown = markDown;
|
||||
});
|
||||
});
|
||||
},
|
||||
true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -473,7 +473,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
base.OnDraw(graphics2D);
|
||||
|
||||
AggContext.DefaultFont.ShowDebugInfo(graphics2D);
|
||||
// AggContext.DefaultFont.ShowDebugInfo(graphics2D);
|
||||
}
|
||||
|
||||
private void ShowUpdateAvailableAnimation()
|
||||
|
|
|
|||
|
|
@ -46,8 +46,6 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
public class ImageEditor : IObject3DEditor
|
||||
{
|
||||
bool IObject3DEditor.Unlocked => true;
|
||||
|
||||
string IObject3DEditor.Name => "Image Editor";
|
||||
|
||||
IEnumerable<Type> IObject3DEditor.SupportedTypes() => new[] { typeof(ImageObject3D) };
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
public interface IObject3DEditor
|
||||
{
|
||||
bool Unlocked { get; }
|
||||
string Name { get; }
|
||||
IEnumerable<Type> SupportedTypes();
|
||||
GuiWidget Create(IObject3D item, UndoBuffer undoBuffer, ThemeConfig theme);
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
this.MinimumSize = minSize;
|
||||
|
||||
this.Title = $"MatterHackers: MatterControl {version}";
|
||||
this.Title = $"{ApplicationController.Instance.ProductName} {version}";
|
||||
if (OemSettings.Instance.WindowTitleExtra != null && OemSettings.Instance.WindowTitleExtra.Trim().Length > 0)
|
||||
{
|
||||
this.Title += $" - {OemSettings.Instance.WindowTitleExtra}";
|
||||
|
|
|
|||
|
|
@ -1,10 +1,37 @@
|
|||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.MatterControl.SettingsManagement;
|
||||
/*
|
||||
Copyright (c) 2020, 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.Collections.Generic;
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using System.Linq;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.MatterControl.SettingsManagement;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
|
|
@ -21,13 +48,18 @@ namespace MatterHackers.MatterControl
|
|||
public class ApplicationSettings
|
||||
{
|
||||
public static string ValidFileExtensions { get; } = ".STL;.AMF;.OBJ";
|
||||
|
||||
public static string LibraryMeshFileExtensions { get; } = ".stl,.obj,.amf,.mcx";
|
||||
|
||||
public static string LibraryFilterFileExtensions { get; } = LibraryMeshFileExtensions + ",.gcode";
|
||||
|
||||
public static string OpenPrintableFileParams { get; } = "STL, AMF, OBJ, GCODE, MCX|*.stl;*.amf;*.obj;*.gcode;*.mcx";
|
||||
|
||||
public static string OpenDesignFileParams { get; } = "STL, AMF, OBJ, GCODE, MCX|*.stl;*.amf;*.obj;*.gcode;*.mcx";
|
||||
|
||||
private static ApplicationSettings globalInstance = null;
|
||||
public Dictionary<string, SystemSetting> settingsDictionary;
|
||||
|
||||
public Dictionary<string, SystemSetting> SettingsDictionary { get; set; }
|
||||
|
||||
public static ApplicationSettings Instance
|
||||
{
|
||||
|
|
@ -131,14 +163,15 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
|
||||
allocatedCount++;
|
||||
}
|
||||
while (!string.IsNullOrEmpty(clientToken));
|
||||
|
||||
} while (!string.IsNullOrEmpty(clientToken));
|
||||
return allocatedClientTokens;
|
||||
}
|
||||
|
||||
private HashSet<string> GetRunningClientTokens()
|
||||
{
|
||||
var runningClientTokens = new HashSet<string>();
|
||||
var runningClientTokens = new HashSet<string>();
|
||||
|
||||
// Only deserialize if greater than one
|
||||
if (ApplicationController.ApplicationInstanceCount > 1)
|
||||
|
|
@ -188,41 +221,43 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
allocatedCount++;
|
||||
|
||||
} while (!firstEmptySlot);
|
||||
}
|
||||
while (!firstEmptySlot);
|
||||
}
|
||||
|
||||
public string get(string key)
|
||||
{
|
||||
string result;
|
||||
if (settingsDictionary == null)
|
||||
if (SettingsDictionary == null)
|
||||
{
|
||||
globalInstance.LoadData();
|
||||
}
|
||||
|
||||
if (settingsDictionary.ContainsKey(key))
|
||||
if (SettingsDictionary.ContainsKey(key))
|
||||
{
|
||||
result = settingsDictionary[key].Value;
|
||||
result = SettingsDictionary[key].Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void set(string key, string value)
|
||||
{
|
||||
SystemSetting setting;
|
||||
if (settingsDictionary.ContainsKey(key))
|
||||
if (SettingsDictionary.ContainsKey(key))
|
||||
{
|
||||
setting = settingsDictionary[key];
|
||||
setting = SettingsDictionary[key];
|
||||
}
|
||||
else
|
||||
{
|
||||
setting = new SystemSetting();
|
||||
setting.Name = key;
|
||||
|
||||
settingsDictionary[key] = setting;
|
||||
SettingsDictionary[key] = setting;
|
||||
}
|
||||
|
||||
setting.Value = value;
|
||||
|
|
@ -231,16 +266,16 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
private void LoadData()
|
||||
{
|
||||
settingsDictionary = new Dictionary<string, SystemSetting>();
|
||||
SettingsDictionary = new Dictionary<string, SystemSetting>();
|
||||
foreach (SystemSetting s in GetApplicationSettings())
|
||||
{
|
||||
settingsDictionary[s.Name] = s;
|
||||
SettingsDictionary[s.Name] = s;
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<SystemSetting> GetApplicationSettings()
|
||||
{
|
||||
//Retrieve SystemSettings from the Datastore
|
||||
// Retrieve SystemSettings from the Datastore
|
||||
return Datastore.Instance.dbSQLite.Query<SystemSetting>("SELECT * FROM SystemSetting;");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,12 +200,18 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
}
|
||||
|
||||
public static void RetrieveText(string uriToLoad, Action<string> updateResult)
|
||||
public static void RetrieveText(string uriToLoad, Action<string> updateResult, bool checkStaticData = false)
|
||||
{
|
||||
var longHash = uriToLoad.GetLongHashCode();
|
||||
|
||||
var textFileName = ApplicationController.CacheablePath("Text", longHash.ToString() + ".txt");
|
||||
|
||||
// change to a path that makes it easy to collect up all the text we want to ship with MC
|
||||
if (checkStaticData)
|
||||
{
|
||||
textFileName = ApplicationController.CacheablePath("TextWebCache", longHash.ToString() + ".txt");
|
||||
}
|
||||
|
||||
string fileText = null;
|
||||
if (File.Exists(textFileName))
|
||||
{
|
||||
|
|
@ -218,9 +224,20 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
}
|
||||
}
|
||||
else // check if it is in the shipping data for the application
|
||||
else // We could not find it in the cache. Check if it is in static data.
|
||||
{
|
||||
|
||||
if (File.Exists(textFileName))
|
||||
{
|
||||
try
|
||||
{
|
||||
textFileName = AggContext.StaticData.ReadAllText(Path.Combine("TextWebCache", longHash.ToString() + ".txt"));
|
||||
fileText = File.ReadAllText(textFileName);
|
||||
updateResult?.Invoke(fileText);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Task.Run(async () =>
|
||||
|
|
|
|||
8
StaticData/TextWebCache/14370143712707808004.txt
Normal file
8
StaticData/TextWebCache/14370143712707808004.txt
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
## Reduce is Locked
|
||||
|
||||
To Unlock upgrade to MatterControl Pro:
|
||||
|
||||
MatterControl Pro includes:
|
||||
- Professional support provided by MatterHackers
|
||||
- Unlimited storage of your designs in Cloud Library
|
||||
- Expanding set of Pro Design Tools
|
||||
8
StaticData/TextWebCache/16850359717535514059.txt
Normal file
8
StaticData/TextWebCache/16850359717535514059.txt
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
## Gear is Locked
|
||||
|
||||
To Unlock upgrade to MatterControl Pro:
|
||||
|
||||
MatterControl Pro includes:
|
||||
- Professional support provided by MatterHackers
|
||||
- Unlimited storage of your designs in Cloud Library
|
||||
- Expanding set of Pro Design Tools
|
||||
7
StaticData/TextWebCache/6348908994093189185.txt
Normal file
7
StaticData/TextWebCache/6348908994093189185.txt
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Upgrade to [MatterControl Pro](https://www.matterhackers.com/admin/product-preview/ag1zfm1oLXBscy1wcm9kchsLEg5Qcm9kdWN0TGlzdGluZxiAgIC_65WICww)
|
||||
|
||||
MatterControl Pro includes:
|
||||
- All the great features of MatterControl
|
||||
- Professional support provided by MatterHackers
|
||||
- Unlimited storage of your designs in Cloud Library
|
||||
- Access to the expanding set of Pro features
|
||||
8
StaticData/TextWebCache/6961625565010039837.txt
Normal file
8
StaticData/TextWebCache/6961625565010039837.txt
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
## Hollow Out is Locked
|
||||
|
||||
To Unlock upgrade to MatterControl Pro:
|
||||
|
||||
MatterControl Pro includes:
|
||||
- Professional support provided by MatterHackers
|
||||
- Unlimited storage of your designs in Cloud Library
|
||||
- Expanding set of Pro Design Tools
|
||||
8
StaticData/TextWebCache/7534963483184316047.txt
Normal file
8
StaticData/TextWebCache/7534963483184316047.txt
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
## Repair is Locked
|
||||
|
||||
To Unlock upgrade to MatterControl Pro:
|
||||
|
||||
MatterControl Pro includes:
|
||||
- Professional support provided by MatterHackers
|
||||
- Unlimited storage of your designs in Cloud Library
|
||||
- Expanding set of Pro Design Tools
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit e9eee6d8b662a49481b83d5ce66b03d59b7f3b23
|
||||
Subproject commit 929a7968c8099e1eea33f5128cb60701f0200eca
|
||||
Loading…
Add table
Add a link
Reference in a new issue