Merge branch 'master' of https://github.com/MatterHackers/MatterControl
This commit is contained in:
commit
76012aeef9
10 changed files with 159 additions and 94 deletions
|
|
@ -35,6 +35,7 @@ using MatterHackers.MatterControl.PrinterCommunication;
|
|||
using MatterHackers.MatterControl.PrinterControls.PrinterConnections;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MatterHackers.MatterControl.ActionBar
|
||||
|
|
@ -133,19 +134,17 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
{
|
||||
HAnchor = HAnchor.ParentLeftRight,
|
||||
};
|
||||
printerSelector = new PrinterSelector();
|
||||
printerSelector.HAnchor = HAnchor.ParentLeftRight;
|
||||
printerSelector.Cursor = Cursors.Hand;
|
||||
|
||||
int rightMarginForWideScreenMode = ApplicationController.Instance.WidescreenMode ? 6 : 0;
|
||||
printerSelector = new PrinterSelector()
|
||||
{
|
||||
HAnchor = HAnchor.ParentLeftRight,
|
||||
Cursor = Cursors.Hand,
|
||||
Margin = new BorderDouble(0, 6, rightMarginForWideScreenMode, 3)
|
||||
};
|
||||
printerSelector.AddPrinter += (s, e) => WizardWindow.Show();
|
||||
if (ApplicationController.Instance.WidescreenMode)
|
||||
{
|
||||
printerSelector.Margin = new BorderDouble(0, 6, 0, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
printerSelector.Margin = new BorderDouble(0, 6, 6, 3);
|
||||
}
|
||||
printerSelectorAndEditButton.AddChild(printerSelector);
|
||||
|
||||
Button editButton = TextImageButtonFactory.GetThemedEditButton();
|
||||
editButton.VAnchor = VAnchor.ParentCenter;
|
||||
editButton.Click += UiNavigation.GoToEditPrinter_Click;
|
||||
|
|
@ -153,7 +152,6 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
this.AddChild(printerSelectorAndEditButton);
|
||||
|
||||
this.AddChild(resetConnectionButton);
|
||||
//this.AddChild(CreateOptionsMenu());
|
||||
}
|
||||
|
||||
protected override void AddHandlers()
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ using MatterHackers.MatterControl.PrinterControls.PrinterConnections;
|
|||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using MatterHackers.VectorMath;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
|
|
@ -44,21 +45,16 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
public event EventHandler AddPrinter;
|
||||
|
||||
private EventHandler unregisterEvents;
|
||||
|
||||
public PrinterSelector() : base("Printers".Localize() + "... ", useLeftIcons: true)
|
||||
{
|
||||
//Add the menu items to the menu itself
|
||||
foreach (var printer in ActiveSliceSettings.ProfileData.Profiles)
|
||||
{
|
||||
this.AddItem(printer.Name, printer.Id.ToString());
|
||||
}
|
||||
Rebuild();
|
||||
|
||||
if (ActiveSliceSettings.Instance != null)
|
||||
{
|
||||
this.SelectedValue = ActiveSliceSettings.Instance.ID;
|
||||
}
|
||||
|
||||
ImageBuffer plusImage = StaticData.Instance.LoadIcon("icon_plus.png", 32, 32);
|
||||
this.AddItem(plusImage, "Add New Printer...", "new");
|
||||
this.AddItem(
|
||||
StaticData.Instance.LoadIcon("icon_plus.png", 32, 32),
|
||||
"Add New Printer...",
|
||||
"new");
|
||||
|
||||
this.SelectionChanged += (s, e) =>
|
||||
{
|
||||
|
|
@ -75,6 +71,46 @@ namespace MatterHackers.MatterControl
|
|||
ActiveSliceSettings.SwitchToProfile(printerID);
|
||||
}
|
||||
};
|
||||
|
||||
SliceSettingsWidget.SettingChanged.RegisterEvent(SettingChanged, ref unregisterEvents);
|
||||
}
|
||||
|
||||
public void Rebuild()
|
||||
{
|
||||
this.MenuItems.Clear();
|
||||
|
||||
//Add the menu items to the menu itself
|
||||
foreach (var printer in ActiveSliceSettings.ProfileData.Profiles)
|
||||
{
|
||||
this.AddItem(printer.Name, printer.Id.ToString());
|
||||
}
|
||||
|
||||
if (ActiveSliceSettings.Instance != null)
|
||||
{
|
||||
this.SelectedValue = ActiveSliceSettings.Instance.ID;
|
||||
this.mainControlText.Text = ActiveSliceSettings.Instance.Name();
|
||||
}
|
||||
}
|
||||
|
||||
private void SettingChanged(object sender, EventArgs e)
|
||||
{
|
||||
string settingsName = (e as StringEventArgs)?.Data;
|
||||
if (settingsName != null && settingsName == "MatterControl.PrinterName")
|
||||
{
|
||||
var profileInfo = ActiveSliceSettings.ProfileData.Profiles.Where(p => p.Id == ActiveSliceSettings.Instance.ID).FirstOrDefault();
|
||||
if (profileInfo != null)
|
||||
{
|
||||
profileInfo.Name = ActiveSliceSettings.Instance.Name();
|
||||
}
|
||||
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnClosed(EventArgs e)
|
||||
{
|
||||
unregisterEvents?.Invoke(this, null);
|
||||
base.OnClosed(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@ namespace MatterHackers.MatterControl.DataStorage.ClassicDB
|
|||
foreach (var collection in collections)
|
||||
{
|
||||
var settingsDictionary = LoadSettings(collection);
|
||||
layeredProfile.MaterialLayers[collection.Name] = new SettingsLayer(settingsDictionary);
|
||||
layeredProfile.MaterialLayers.Add(new SettingsLayer(settingsDictionary));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -161,7 +161,7 @@ namespace MatterHackers.MatterControl.DataStorage.ClassicDB
|
|||
foreach (var collection in collections)
|
||||
{
|
||||
var settingsDictionary = LoadSettings(collection);
|
||||
layeredProfile.QualityLayers[collection.Name] = new SettingsLayer(settingsDictionary);
|
||||
layeredProfile.QualityLayers.Add(new SettingsLayer(settingsDictionary));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace MatterHackers.MatterControl.Queue.OptionsMenu
|
|||
new PrintItemAction()
|
||||
{
|
||||
SingleItemOnly = false,
|
||||
Title = "Create Combine...",
|
||||
Title = "Merge...",
|
||||
Action = (items, queueDataWidget) =>
|
||||
{
|
||||
List<QueueRowItem> allRowItems = new List<QueueRowItem>(items);
|
||||
|
|
|
|||
|
|
@ -248,7 +248,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
internal static void AcquireNewProfile(string make, string model, string printerName)
|
||||
{
|
||||
string guid = Guid.NewGuid().ToString();
|
||||
|
|
@ -292,15 +291,11 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
}
|
||||
|
||||
// Copy OemProfile presets into user layers
|
||||
foreach(var layer in layeredProfile.OemProfile.MaterialLayers)
|
||||
{
|
||||
layeredProfile.MaterialLayers[layer.Key] = layer.Value;
|
||||
}
|
||||
layeredProfile.MaterialLayers.AddRange(layeredProfile.OemProfile.MaterialLayers);
|
||||
layeredProfile.QualityLayers.AddRange(layeredProfile.OemProfile.QualityLayers);
|
||||
|
||||
foreach (var layer in layeredProfile.OemProfile.QualityLayers)
|
||||
{
|
||||
layeredProfile.QualityLayers[layer.Key] = layer.Value;
|
||||
}
|
||||
layeredProfile.OemProfile.MaterialLayers.Clear();
|
||||
layeredProfile.OemProfile.QualityLayers.Clear();
|
||||
|
||||
layeredProfile.Save();
|
||||
|
||||
|
|
|
|||
|
|
@ -46,10 +46,27 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
public static class ProfileMigrations
|
||||
{
|
||||
public static string MigrateDocument(string filePath, int fromVersion)
|
||||
public static string MigrateDocument(string filePath, int fromVersion = -1)
|
||||
{
|
||||
var jObject = JObject.Parse(File.ReadAllText(filePath));
|
||||
|
||||
if (fromVersion < 201606081)
|
||||
{
|
||||
JObject materialLayers, qualityLayers;
|
||||
|
||||
materialLayers = jObject["MaterialLayers"] as JObject;
|
||||
jObject["MaterialLayers"] = new JArray(materialLayers.Properties().ToList().Select(layer => layer.Value).ToArray());
|
||||
|
||||
qualityLayers = jObject["QualityLayers"] as JObject;
|
||||
jObject["QualityLayers"] = new JArray(qualityLayers.Properties().ToList().Select(layer => layer.Value).ToArray());
|
||||
|
||||
var oemProfile = jObject["OemProfile"] as JObject;
|
||||
oemProfile.Property("MaterialLayers").Remove();
|
||||
oemProfile.Property("QualityLayers").Remove();
|
||||
|
||||
jObject["DocumentVersion"] = 201606081;
|
||||
}
|
||||
|
||||
if (fromVersion < 201605131)
|
||||
{
|
||||
var materialLayers = jObject["MaterialLayers"] as JObject;
|
||||
|
|
@ -109,7 +126,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
public string ID { get; set; }
|
||||
|
||||
public static int LatestVersion { get; } = 201605132;
|
||||
// Latest version should be 2016|06|08|1
|
||||
// Year|month|day|versionForDay (to support multiple revisions on a given day)
|
||||
public static int LatestVersion { get; } = 201606081;
|
||||
|
||||
[JsonIgnore]
|
||||
internal SettingsLayer QualityLayer { get; private set; }
|
||||
|
|
@ -134,33 +153,19 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
public OemProfile OemProfile { get; set; }
|
||||
|
||||
internal SettingsLayer GetMaterialLayer(string key)
|
||||
internal SettingsLayer GetMaterialLayer(string layerID)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key))
|
||||
if (string.IsNullOrEmpty(layerID))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Find the first matching layer in either the user or the OEM layers
|
||||
SettingsLayer layer = null;
|
||||
if (!MaterialLayers.TryGetValue(key, out layer))
|
||||
{
|
||||
OemProfile.MaterialLayers.TryGetValue(key, out layer);
|
||||
}
|
||||
|
||||
return layer;
|
||||
return MaterialLayers.Where(layer => layer.ID == layerID).FirstOrDefault();
|
||||
}
|
||||
|
||||
internal SettingsLayer GetQualityLayer(string key)
|
||||
internal SettingsLayer GetQualityLayer(string layerID)
|
||||
{
|
||||
// Find the first matching layer in either the user or the OEM layers
|
||||
SettingsLayer layer = null;
|
||||
if (key != null && !QualityLayers.TryGetValue(key, out layer))
|
||||
{
|
||||
OemProfile.QualityLayers.TryGetValue(key, out layer);
|
||||
}
|
||||
|
||||
return layer;
|
||||
return QualityLayers.Where(layer => layer.ID == layerID).FirstOrDefault();
|
||||
}
|
||||
|
||||
public string ActiveMaterialKey
|
||||
|
|
@ -187,7 +192,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
{
|
||||
SetActiveValue("MatterControl.ActiveQualityKey", value);
|
||||
QualityLayer = GetQualityLayer(value);
|
||||
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
|
@ -248,15 +252,16 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
internal static LayeredProfile LoadFile(string printerProfilePath)
|
||||
{
|
||||
var layeredProfile = JsonConvert.DeserializeObject<LayeredProfile>(File.ReadAllText(printerProfilePath));
|
||||
if (layeredProfile.DocumentVersion < LayeredProfile.LatestVersion)
|
||||
{
|
||||
printerProfilePath = ProfileMigrations.MigrateDocument(printerProfilePath, layeredProfile.DocumentVersion);
|
||||
var jObject = JObject.Parse(File.ReadAllText(printerProfilePath));
|
||||
int documentVersion = (int) jObject?.GetValue("DocumentVersion")?.Value<int>();
|
||||
|
||||
// Reload the document with the new schema
|
||||
layeredProfile = JsonConvert.DeserializeObject<LayeredProfile>(File.ReadAllText(printerProfilePath));
|
||||
if (documentVersion < LayeredProfile.LatestVersion)
|
||||
{
|
||||
printerProfilePath = ProfileMigrations.MigrateDocument(printerProfilePath, documentVersion);
|
||||
}
|
||||
|
||||
// Reload the document with the new schema
|
||||
var layeredProfile = JsonConvert.DeserializeObject<LayeredProfile>(File.ReadAllText(printerProfilePath));
|
||||
layeredProfile.DocumentPath = printerProfilePath;
|
||||
|
||||
return layeredProfile;
|
||||
|
|
@ -266,13 +271,13 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
/// <summary>
|
||||
/// Should contain both user created and oem specified material layers
|
||||
/// </summary>
|
||||
public Dictionary<string, SettingsLayer> MaterialLayers { get; } = new Dictionary<string, SettingsLayer>();
|
||||
public List<SettingsLayer> MaterialLayers { get; } = new List<SettingsLayer>();
|
||||
|
||||
// TODO: Hookup OEM layers
|
||||
/// <summary>
|
||||
/// Should contain both user created and oem specified quality layers
|
||||
/// </summary>
|
||||
public Dictionary<string, SettingsLayer> QualityLayers { get; } = new Dictionary<string, SettingsLayer>();
|
||||
public List<SettingsLayer> QualityLayers { get; } = new List<SettingsLayer>();
|
||||
|
||||
///<summary>
|
||||
///Returns the settings value at the 'top' of the stack
|
||||
|
|
@ -376,11 +381,11 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
/// <summary>
|
||||
/// List of Material presets from OEM
|
||||
/// </summary>
|
||||
public Dictionary<string, SettingsLayer> MaterialLayers { get; } = new Dictionary<string, SettingsLayer>();
|
||||
public List<SettingsLayer> MaterialLayers { get; } = new List<SettingsLayer>();
|
||||
|
||||
/// <summary>
|
||||
/// List of Quality presets from OEM
|
||||
/// </summary>
|
||||
public Dictionary<string, SettingsLayer> QualityLayers { get; } = new Dictionary<string, SettingsLayer>();
|
||||
public List<SettingsLayer> QualityLayers { get; } = new List<SettingsLayer>();
|
||||
}
|
||||
}
|
||||
|
|
@ -105,9 +105,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
// Commit
|
||||
}
|
||||
|
||||
public Dictionary<string, SettingsLayer> MaterialLayers => layeredProfile.MaterialLayers;
|
||||
public List<SettingsLayer> MaterialLayers => layeredProfile.MaterialLayers;
|
||||
|
||||
public Dictionary<string, SettingsLayer> QualityLayers => layeredProfile.QualityLayers;
|
||||
public List<SettingsLayer> QualityLayers => layeredProfile.QualityLayers;
|
||||
|
||||
public class SettingsConverter
|
||||
{
|
||||
|
|
|
|||
|
|
@ -102,13 +102,15 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
{
|
||||
if (ApplicationController.Instance.EditMaterialPresetsWindow == null)
|
||||
{
|
||||
string presetsKey = ActiveSliceSettings.Instance.MaterialPresetKey(extruderIndex);
|
||||
if (string.IsNullOrEmpty(presetsKey))
|
||||
string presetsID = ActiveSliceSettings.Instance.MaterialPresetKey(extruderIndex);
|
||||
if (string.IsNullOrEmpty(presetsID))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var presetsContext = new PresetsContext(ActiveSliceSettings.Instance.MaterialLayers, presetsKey)
|
||||
var layerToEdit = ActiveSliceSettings.Instance.MaterialLayers.Where(layer => layer.ID == presetsID).FirstOrDefault();
|
||||
|
||||
var presetsContext = new PresetsContext(ActiveSliceSettings.Instance.MaterialLayers, layerToEdit)
|
||||
{
|
||||
LayerType = NamedSettingsLayers.Material,
|
||||
SetAsActive = (materialKey) =>
|
||||
|
|
@ -136,13 +138,15 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
{
|
||||
if (ApplicationController.Instance.EditQualityPresetsWindow == null)
|
||||
{
|
||||
string presetsKey = ActiveSliceSettings.Instance.ActiveQualityKey;
|
||||
if (string.IsNullOrEmpty(presetsKey))
|
||||
string presetsID = ActiveSliceSettings.Instance.ActiveQualityKey;
|
||||
if (string.IsNullOrEmpty(presetsID))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var presetsContext = new PresetsContext(ActiveSliceSettings.Instance.QualityLayers, presetsKey)
|
||||
var layerToEdit = ActiveSliceSettings.Instance.QualityLayers.Where(layer => layer.ID == presetsID).FirstOrDefault();
|
||||
|
||||
var presetsContext = new PresetsContext(ActiveSliceSettings.Instance.QualityLayers, layerToEdit)
|
||||
{
|
||||
LayerType = NamedSettingsLayers.Quality,
|
||||
SetAsActive = (qualityKey) => ActiveSliceSettings.Instance.ActiveQualityKey = qualityKey
|
||||
|
|
@ -212,12 +216,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
var listSource = (layerType == NamedSettingsLayers.Material) ? ActiveSliceSettings.Instance.MaterialLayers : ActiveSliceSettings.Instance.QualityLayers;
|
||||
foreach (var layer in listSource)
|
||||
{
|
||||
if (string.IsNullOrEmpty(layer.Value.Name))
|
||||
{
|
||||
layer.Value.Name = layer.Key;
|
||||
}
|
||||
|
||||
MenuItem menuItem = dropDownList.AddItem(layer.Value.Name, layer.Value.ID);
|
||||
MenuItem menuItem = dropDownList.AddItem(layer.Name, layer.ID);
|
||||
menuItem.Selected += MenuItem_Selected;
|
||||
}
|
||||
|
||||
|
|
@ -228,13 +227,13 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
if (layerType == NamedSettingsLayers.Quality)
|
||||
{
|
||||
newLayer.Name = "Quality" + ActiveSliceSettings.Instance.QualityLayers.Count;
|
||||
ActiveSliceSettings.Instance.QualityLayers[newLayer.Name] = newLayer;
|
||||
ActiveSliceSettings.Instance.QualityLayers.Add(newLayer);
|
||||
ActiveSliceSettings.Instance.ActiveQualityKey = newLayer.ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
newLayer.Name = "Material" + ActiveSliceSettings.Instance.MaterialLayers.Count;
|
||||
ActiveSliceSettings.Instance.MaterialLayers[newLayer.Name] = newLayer;
|
||||
ActiveSliceSettings.Instance.MaterialLayers.Add(newLayer);
|
||||
ActiveSliceSettings.Instance.ActiveMaterialKey = newLayer.ID;
|
||||
ActiveSliceSettings.Instance.SetMaterialPreset(this.extruderIndex, newLayer.Name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,18 +43,15 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
{
|
||||
public class PresetsContext
|
||||
{
|
||||
public Dictionary<string, SettingsLayer> PresetsDictionary { get; }
|
||||
public List<SettingsLayer> PresetLayers { get; }
|
||||
public SettingsLayer PersistenceLayer { get; set; }
|
||||
public Action<string> SetAsActive { get; set; }
|
||||
public NamedSettingsLayers LayerType { get; set; }
|
||||
|
||||
private string presetsKey;
|
||||
|
||||
public PresetsContext(Dictionary<string, SettingsLayer> parentDictionary, string presetsKey)
|
||||
public PresetsContext(List<SettingsLayer> settingsLayers, SettingsLayer activeLayer)
|
||||
{
|
||||
this.presetsKey = presetsKey;
|
||||
this.PersistenceLayer = parentDictionary[presetsKey];
|
||||
this.PresetsDictionary = parentDictionary;
|
||||
this.PersistenceLayer = activeLayer;
|
||||
this.PresetLayers = settingsLayers;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -198,11 +195,11 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
string sanitizedName = numberMatch.Replace(presetNameInput.Text, "").Trim();
|
||||
string newProfileName = GetNonCollidingName(sanitizedName, presetsContext.PresetsDictionary.Values.Select(preset => preset.Name));
|
||||
string newProfileName = GetNonCollidingName(sanitizedName, presetsContext.PresetLayers.Select(preset => preset.ValueOrDefault("MatterControl.LayerName")));
|
||||
|
||||
var clonedLayer = presetsContext.PersistenceLayer.Clone();
|
||||
clonedLayer.Name = newProfileName;
|
||||
presetsContext.PresetsDictionary[clonedLayer.ID] = clonedLayer;
|
||||
presetsContext.PresetLayers.Add(clonedLayer);
|
||||
|
||||
presetsContext.SetAsActive(clonedLayer.ID);
|
||||
presetsContext.PersistenceLayer = clonedLayer;
|
||||
|
|
|
|||
|
|
@ -122,6 +122,22 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
private bool RestoreAllSettingsMenu_Click()
|
||||
{
|
||||
string warningMessage = "Resetting to default values will remove your current overrides and restore your original printer settings.\r\nAre you sure you want to continue?";
|
||||
StyledMessageBox.ShowMessageBox(
|
||||
revertSettings =>
|
||||
{
|
||||
if (revertSettings)
|
||||
{
|
||||
// TODO: We should offer to export the settings before the purge
|
||||
ActiveSliceSettings.Instance.UserLayer.Clear();
|
||||
ActiveSliceSettings.Instance.SaveChanges();
|
||||
ApplicationController.Instance.ReloadAdvancedControlsPanel();
|
||||
}
|
||||
},
|
||||
warningMessage.Localize(),
|
||||
"Revert Settings".Localize(),
|
||||
StyledMessageBox.MessageType.YES_NO);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -132,7 +148,10 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
{
|
||||
{ "Import".Localize(), ImportSettingsMenu_Click },
|
||||
{ "Export".Localize(), ExportSettingsMenu_Click },
|
||||
{ "Restore All".Localize(), RestoreAllSettingsMenu_Click },
|
||||
{ "Reset to defaults".Localize(), RestoreAllSettingsMenu_Click },
|
||||
#if DEBUG
|
||||
{ "Bake Overrides".Localize(), BakeOverrides_Click },
|
||||
#endif
|
||||
};
|
||||
|
||||
//Add the menu items to the menu itself
|
||||
|
|
@ -142,6 +161,22 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
}
|
||||
}
|
||||
|
||||
private bool BakeOverrides_Click()
|
||||
{
|
||||
var activeSettings = ActiveSliceSettings.Instance;
|
||||
foreach(var keyValue in activeSettings.UserLayer)
|
||||
{
|
||||
activeSettings.OemLayer[keyValue.Key] = keyValue.Value;
|
||||
}
|
||||
|
||||
activeSettings.UserLayer.Clear();
|
||||
activeSettings.SaveChanges();
|
||||
|
||||
ApplicationController.Instance.ReloadAdvancedControlsPanel();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void SettingsDetail_SelectionChanged(object sender, EventArgs e)
|
||||
{
|
||||
RebuildSlicerSettings(null, null);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue