Merge pull request #3874 from jlewin/master
Remove RunOnIdle in InventoryTreeView constructor
This commit is contained in:
commit
e420771e41
14 changed files with 204 additions and 170 deletions
|
|
@ -152,6 +152,12 @@ namespace MatterHackers.MatterControl
|
|||
if (File.Exists(ProfileManager.Instance.ProfileThemeSetPath))
|
||||
{
|
||||
themeset = JsonConvert.DeserializeObject<ThemeSet>(File.ReadAllText(ProfileManager.Instance.ProfileThemeSetPath));
|
||||
|
||||
// If the serialized format is older than the current format, null and fall back to latest default below
|
||||
if (themeset.SchemeVersion != ThemeSet.LatestSchemeVersion)
|
||||
{
|
||||
themeset = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
|
@ -159,7 +165,7 @@ namespace MatterHackers.MatterControl
|
|||
if (themeset == null)
|
||||
{
|
||||
var themeProvider = ThemeProviders.Values.First();
|
||||
themeset = themeProvider.GetTheme(themeProvider.ThemeNames.First(), themeProvider.DefaultColor);
|
||||
themeset = themeProvider.GetTheme(themeProvider.ThemeNames.First());
|
||||
}
|
||||
|
||||
DefaultThumbView.ThumbColor = new Color(themeset.Theme.Colors.PrimaryTextColor, 30);
|
||||
|
|
@ -199,28 +205,6 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
}
|
||||
|
||||
public class ThemeSet
|
||||
{
|
||||
public string ThemeID { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public ThemeConfig Theme { get; set; }
|
||||
|
||||
public ThemeConfig MenuTheme { get; set; }
|
||||
|
||||
public List<Color> AccentColors { get; set; } = new List<Color>();
|
||||
|
||||
public void SetAccentColor(Color accentColor)
|
||||
{
|
||||
this.Theme.PrimaryAccentColor = accentColor;
|
||||
this.Theme.AccentMimimalOverlay = accentColor.WithAlpha(90);
|
||||
|
||||
this.MenuTheme.PrimaryAccentColor = accentColor;
|
||||
this.MenuTheme.AccentMimimalOverlay = accentColor.WithAlpha(90);
|
||||
}
|
||||
}
|
||||
|
||||
public class ApplicationController
|
||||
{
|
||||
public HelpArticle HelpArticles { get; set; }
|
||||
|
|
|
|||
|
|
@ -37,50 +37,45 @@ namespace MatterHackers.MatterControl
|
|||
using MatterHackers.Agg.Platform;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
public class SerializedTheme : IColorTheme
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public Color DefaultColor { get; set; }
|
||||
|
||||
public IEnumerable<string> ThemeNames { get; set; }
|
||||
|
||||
public ThemeSet GetTheme(string mode, Color accentColor)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class DirectoryTheme : IColorTheme
|
||||
{
|
||||
private string path;
|
||||
|
||||
public DirectoryTheme()
|
||||
{
|
||||
}
|
||||
|
||||
public DirectoryTheme(string directory)
|
||||
{
|
||||
var themeSetData = JsonConvert.DeserializeObject<SerializedTheme>(
|
||||
AggContext.StaticData.ReadAllText(Path.Combine(directory, "theme.json")));
|
||||
|
||||
path = directory;
|
||||
|
||||
this.Name = Path.GetFileName(directory);
|
||||
this.ThemeNames = AggContext.StaticData.GetFiles(directory).Where(p => Path.GetFileName(p) != "theme.json").Select(p => Path.GetFileNameWithoutExtension(p)).ToArray();
|
||||
|
||||
this.DefaultColor = themeSetData.DefaultColor;
|
||||
}
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public Color DefaultColor { get; }
|
||||
|
||||
public IEnumerable<string> ThemeNames { get; }
|
||||
|
||||
public ThemeSet GetTheme(string themeName, Color accentColor)
|
||||
{
|
||||
ThemeSet themeset = null;
|
||||
var themeset = this.LoadTheme(themeName);
|
||||
themeset.SetAccentColor(accentColor);
|
||||
|
||||
return themeset;
|
||||
}
|
||||
|
||||
public ThemeSet GetTheme(string themeName)
|
||||
{
|
||||
var themeset = this.LoadTheme(themeName);
|
||||
themeset.SetAccentColor(themeset.AccentColors.First());
|
||||
|
||||
return themeset;
|
||||
}
|
||||
|
||||
private ThemeSet LoadTheme(string themeName)
|
||||
{
|
||||
ThemeSet themeset;
|
||||
try
|
||||
{
|
||||
themeset = JsonConvert.DeserializeObject<ThemeSet>(
|
||||
|
|
@ -92,8 +87,9 @@ namespace MatterHackers.MatterControl
|
|||
AggContext.StaticData.ReadAllText(Path.Combine(path, this.ThemeNames.First() + ".json")));
|
||||
}
|
||||
|
||||
// Set SchemaVersion at construction time
|
||||
themeset.SchemeVersion = ThemeSet.LatestSchemeVersion;
|
||||
themeset.ThemeID = themeName;
|
||||
themeset.SetAccentColor(accentColor);
|
||||
|
||||
return themeset;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,9 +36,11 @@ namespace MatterHackers.MatterControl
|
|||
public interface IColorTheme
|
||||
{
|
||||
string Name { get; }
|
||||
Color DefaultColor { get; }
|
||||
|
||||
ThemeSet GetTheme(string mode);
|
||||
|
||||
ThemeSet GetTheme(string mode, Color accentColor);
|
||||
|
||||
IEnumerable<string> ThemeNames { get; }
|
||||
}
|
||||
}
|
||||
63
MatterControlLib/ApplicationView/Themes/ThemeSet.cs
Normal file
63
MatterControlLib/ApplicationView/Themes/ThemeSet.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
Copyright (c) 2018, 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 MatterHackers.Agg;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
public class ThemeSet
|
||||
{
|
||||
public static int LatestSchemeVersion { get; } = 20181023;
|
||||
|
||||
public string ThemeID { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public ThemeConfig Theme { get; set; }
|
||||
|
||||
public ThemeConfig MenuTheme { get; set; }
|
||||
|
||||
public List<Color> AccentColors { get; set; } = new List<Color>();
|
||||
|
||||
public void SetAccentColor(Color accentColor)
|
||||
{
|
||||
this.Theme.PrimaryAccentColor = accentColor;
|
||||
this.Theme.AccentMimimalOverlay = accentColor.WithAlpha(90);
|
||||
|
||||
this.MenuTheme.PrimaryAccentColor = accentColor;
|
||||
this.MenuTheme.AccentMimimalOverlay = accentColor.WithAlpha(90);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The latest version of the theme file format. When changed, the clients state becomes invalid and will require a reset to the new theme format
|
||||
/// </summary>
|
||||
public int SchemeVersion { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -95,8 +95,6 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
colorSelector.RebuildColorButtons();
|
||||
|
||||
this.CreateThemeModeButtons();
|
||||
|
||||
this.PreviewTheme(_themeProvider.DefaultColor);
|
||||
}
|
||||
}
|
||||
private void CreateThemeModeButtons()
|
||||
|
|
@ -138,7 +136,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
}
|
||||
else
|
||||
{
|
||||
themeset = provider.GetTheme(themeName, provider.DefaultColor);
|
||||
themeset = provider.GetTheme(themeName);
|
||||
}
|
||||
|
||||
previewContainer.AddChild(new ThemePreviewButton(themeset, this)
|
||||
|
|
|
|||
|
|
@ -51,107 +51,104 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
public InventoryTreeView(ThemeConfig theme)
|
||||
: base (theme)
|
||||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
rootColumn = new FlowLayoutWidget(FlowDirection.TopToBottom)
|
||||
{
|
||||
rootColumn = new FlowLayoutWidget(FlowDirection.TopToBottom)
|
||||
{
|
||||
HAnchor = HAnchor.Stretch,
|
||||
VAnchor = VAnchor.Fit
|
||||
};
|
||||
this.AddChild(rootColumn);
|
||||
HAnchor = HAnchor.Stretch,
|
||||
VAnchor = VAnchor.Fit
|
||||
};
|
||||
this.AddChild(rootColumn);
|
||||
|
||||
// Printers
|
||||
printersNode = new TreeNode(theme)
|
||||
{
|
||||
Text = "Printers".Localize(),
|
||||
HAnchor = HAnchor.Stretch,
|
||||
AlwaysExpandable = true,
|
||||
Image = AggContext.StaticData.LoadIcon("printer.png", 16, 16, theme.InvertIcons)
|
||||
};
|
||||
printersNode.TreeView = this;
|
||||
// Printers
|
||||
printersNode = new TreeNode(theme)
|
||||
{
|
||||
Text = "Printers".Localize(),
|
||||
HAnchor = HAnchor.Stretch,
|
||||
AlwaysExpandable = true,
|
||||
Image = AggContext.StaticData.LoadIcon("printer.png", 16, 16, theme.InvertIcons)
|
||||
};
|
||||
printersNode.TreeView = this;
|
||||
|
||||
var forcedHeight = 20;
|
||||
var mainRow = printersNode.Children.FirstOrDefault();
|
||||
mainRow.HAnchor = HAnchor.Stretch;
|
||||
mainRow.AddChild(new HorizontalSpacer());
|
||||
var forcedHeight = 20;
|
||||
var mainRow = printersNode.Children.FirstOrDefault();
|
||||
mainRow.HAnchor = HAnchor.Stretch;
|
||||
mainRow.AddChild(new HorizontalSpacer());
|
||||
|
||||
// add in the create printer button
|
||||
var createPrinter = new IconButton(AggContext.StaticData.LoadIcon("md-add-circle_18.png", 18, 18, theme.InvertIcons), theme)
|
||||
{
|
||||
Name = "Create Printer",
|
||||
VAnchor = VAnchor.Center,
|
||||
Margin = theme.ButtonSpacing.Clone(left: theme.ButtonSpacing.Right),
|
||||
ToolTipText = "Create Printer".Localize(),
|
||||
Height = forcedHeight,
|
||||
Width = forcedHeight
|
||||
};
|
||||
// add in the create printer button
|
||||
var createPrinter = new IconButton(AggContext.StaticData.LoadIcon("md-add-circle_18.png", 18, 18, theme.InvertIcons), theme)
|
||||
{
|
||||
Name = "Create Printer",
|
||||
VAnchor = VAnchor.Center,
|
||||
Margin = theme.ButtonSpacing.Clone(left: theme.ButtonSpacing.Right),
|
||||
ToolTipText = "Create Printer".Localize(),
|
||||
Height = forcedHeight,
|
||||
Width = forcedHeight
|
||||
};
|
||||
|
||||
createPrinter.Click += (s, e) => UiThread.RunOnIdle(() =>
|
||||
createPrinter.Click += (s, e) => UiThread.RunOnIdle(() =>
|
||||
{
|
||||
if (ApplicationController.Instance.ActivePrinter.Connection.PrinterIsPrinting
|
||||
|| ApplicationController.Instance.ActivePrinter.Connection.PrinterIsPaused)
|
||||
{
|
||||
if (ApplicationController.Instance.ActivePrinter.Connection.PrinterIsPrinting
|
||||
|| ApplicationController.Instance.ActivePrinter.Connection.PrinterIsPaused)
|
||||
{
|
||||
StyledMessageBox.ShowMessageBox("Please wait until the print has finished and try again.".Localize(), "Can't add printers while printing".Localize());
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogWindow.Show(PrinterSetup.GetBestStartPage(PrinterSetup.StartPageOptions.ShowMakeModel));
|
||||
}
|
||||
});
|
||||
mainRow.AddChild(createPrinter);
|
||||
StyledMessageBox.ShowMessageBox("Please wait until the print has finished and try again.".Localize(), "Can't add printers while printing".Localize());
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogWindow.Show(PrinterSetup.GetBestStartPage(PrinterSetup.StartPageOptions.ShowMakeModel));
|
||||
}
|
||||
});
|
||||
mainRow.AddChild(createPrinter);
|
||||
|
||||
// add in the import printer button
|
||||
var importPrinter = new IconButton(AggContext.StaticData.LoadIcon("md-import_18.png", 18, 18, theme.InvertIcons), theme)
|
||||
{
|
||||
VAnchor = VAnchor.Center,
|
||||
Margin = theme.ButtonSpacing,
|
||||
ToolTipText = "Import Printer".Localize(),
|
||||
Height = forcedHeight,
|
||||
Width = forcedHeight
|
||||
};
|
||||
importPrinter.Click += (s, e) => UiThread.RunOnIdle(() =>
|
||||
{
|
||||
AggContext.FileDialogs.OpenFileDialog(
|
||||
new OpenFileDialogParams(
|
||||
"settings files|*.ini;*.printer;*.slice"),
|
||||
(result) =>
|
||||
// add in the import printer button
|
||||
var importPrinter = new IconButton(AggContext.StaticData.LoadIcon("md-import_18.png", 18, 18, theme.InvertIcons), theme)
|
||||
{
|
||||
VAnchor = VAnchor.Center,
|
||||
Margin = theme.ButtonSpacing,
|
||||
ToolTipText = "Import Printer".Localize(),
|
||||
Height = forcedHeight,
|
||||
Width = forcedHeight
|
||||
};
|
||||
importPrinter.Click += (s, e) => UiThread.RunOnIdle(() =>
|
||||
{
|
||||
AggContext.FileDialogs.OpenFileDialog(
|
||||
new OpenFileDialogParams(
|
||||
"settings files|*.ini;*.printer;*.slice"),
|
||||
(result) =>
|
||||
{
|
||||
if (!string.IsNullOrEmpty(result.FileName)
|
||||
&& File.Exists(result.FileName))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(result.FileName)
|
||||
&& File.Exists(result.FileName))
|
||||
//simpleTabs.RemoveTab(simpleTabs.ActiveTab);
|
||||
if (ProfileManager.ImportFromExisting(result.FileName))
|
||||
{
|
||||
//simpleTabs.RemoveTab(simpleTabs.ActiveTab);
|
||||
if (ProfileManager.ImportFromExisting(result.FileName))
|
||||
{
|
||||
string importPrinterSuccessMessage = "You have successfully imported a new printer profile. You can find '{0}' in your list of available printers.".Localize();
|
||||
DialogWindow.Show(
|
||||
new ImportSucceeded(
|
||||
importPrinterSuccessMessage.FormatWith(Path.GetFileNameWithoutExtension(result.FileName))));
|
||||
}
|
||||
else
|
||||
{
|
||||
StyledMessageBox.ShowMessageBox("Oops! Settings file '{0}' did not contain any settings we could import.".Localize().FormatWith(Path.GetFileName(result.FileName)), "Unable to Import".Localize());
|
||||
}
|
||||
string importPrinterSuccessMessage = "You have successfully imported a new printer profile. You can find '{0}' in your list of available printers.".Localize();
|
||||
DialogWindow.Show(
|
||||
new ImportSucceeded(
|
||||
importPrinterSuccessMessage.FormatWith(Path.GetFileNameWithoutExtension(result.FileName))));
|
||||
}
|
||||
});
|
||||
});
|
||||
mainRow.AddChild(importPrinter);
|
||||
else
|
||||
{
|
||||
StyledMessageBox.ShowMessageBox("Oops! Settings file '{0}' did not contain any settings we could import.".Localize().FormatWith(Path.GetFileName(result.FileName)), "Unable to Import".Localize());
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
mainRow.AddChild(importPrinter);
|
||||
|
||||
rootColumn.AddChild(printersNode);
|
||||
rootColumn.AddChild(printersNode);
|
||||
|
||||
InventoryTreeView.RebuildPrintersList(printersNode, theme);
|
||||
this.Invalidate();
|
||||
InventoryTreeView.RebuildPrintersList(printersNode, theme);
|
||||
this.Invalidate();
|
||||
|
||||
// Filament
|
||||
var materialsNode = new TreeNode(theme)
|
||||
{
|
||||
Text = "Materials".Localize(),
|
||||
AlwaysExpandable = true,
|
||||
Image = AggContext.StaticData.LoadIcon("filament.png", 16, 16, theme.InvertIcons)
|
||||
};
|
||||
materialsNode.TreeView = this;
|
||||
// Filament
|
||||
var materialsNode = new TreeNode(theme)
|
||||
{
|
||||
Text = "Materials".Localize(),
|
||||
AlwaysExpandable = true,
|
||||
Image = AggContext.StaticData.LoadIcon("filament.png", 16, 16, theme.InvertIcons)
|
||||
};
|
||||
materialsNode.TreeView = this;
|
||||
|
||||
rootColumn.AddChild(materialsNode);
|
||||
}, 1);
|
||||
rootColumn.AddChild(materialsNode);
|
||||
|
||||
PrinterSettings.SettingChanged.RegisterEvent((s, e) =>
|
||||
{
|
||||
|
|
@ -169,8 +166,6 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
}
|
||||
}, ref unregisterEvents);
|
||||
|
||||
|
||||
|
||||
PrinterSettings.SettingChanged.RegisterEvent((s, e) =>
|
||||
{
|
||||
string settingsName = (e as StringEventArgs)?.Data;
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
private OverflowBar navBar;
|
||||
private GuiWidget searchButton;
|
||||
|
||||
public PrintLibraryWidget(PartPreviewContent partPreviewContent, ThemeConfig theme)
|
||||
public PrintLibraryWidget(PartPreviewContent partPreviewContent, ThemeConfig theme, PopupMenuButton popupMenuButton)
|
||||
{
|
||||
this.theme = theme;
|
||||
this.partPreviewContent = partPreviewContent;
|
||||
|
|
@ -172,12 +172,15 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
};
|
||||
toolbar.AddChild(showFolders);
|
||||
|
||||
var openButton = new TextButton("Open", theme)
|
||||
var openButton = new TextIconButton("Open".Localize(), AggContext.StaticData.LoadIcon("fa-folder-open_16.png", 16, 16, theme.InvertIcons), theme)
|
||||
{
|
||||
Margin = theme.ButtonSpacing,
|
||||
ToolTipText = "Open File".Localize()
|
||||
};
|
||||
openButton.Click += (s, e) =>
|
||||
{
|
||||
popupMenuButton.CloseMenu();
|
||||
|
||||
var extensionsWithoutPeriod = new HashSet<string>(ApplicationSettings.OpenDesignFileParams.Split('|').First().Split(',').Select(t => t.Trim().Trim('.')));
|
||||
|
||||
foreach (var extension in ApplicationController.Instance.Library.ContentProviders.Keys)
|
||||
|
|
@ -200,7 +203,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
{
|
||||
ViewControls3D.LoadAndAddPartsToPlate(this, openParams.FileNames, ApplicationController.Instance.DragDropData.SceneContext);
|
||||
});
|
||||
});
|
||||
}, .1);
|
||||
};
|
||||
|
||||
toolbar.AddChild(openButton);
|
||||
|
|
|
|||
|
|
@ -289,8 +289,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
}
|
||||
|
||||
tabControl.SelectedTabKey = tabKey;
|
||||
|
||||
var brandMenu = new BrandMenuButton(theme)
|
||||
{
|
||||
HAnchor = HAnchor.Fit,
|
||||
|
|
@ -307,6 +305,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
this.CreatePartTab(workspace);
|
||||
}
|
||||
|
||||
tabControl.SelectedTabKey = tabKey;
|
||||
|
||||
UpdateControlData.Instance.UpdateStatusChanged.RegisterEvent((s, e) =>
|
||||
{
|
||||
SetLinkButtonsVisibility(s, new StringEventArgs("Unknown"));
|
||||
|
|
|
|||
|
|
@ -326,6 +326,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
private Dictionary<string, NamedAction> InitWorkspaceActions()
|
||||
{
|
||||
bool invertIcons = ApplicationController.Instance.MenuTheme.InvertIcons;
|
||||
|
||||
return new Dictionary<string, NamedAction>()
|
||||
{
|
||||
{
|
||||
|
|
@ -334,7 +336,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
ID = "Insert",
|
||||
Title = "Insert".Localize(),
|
||||
Icon = AggContext.StaticData.LoadIcon("cube.png", 16, 16, theme.InvertIcons),
|
||||
Icon = AggContext.StaticData.LoadIcon("cube.png", 16, 16, invertIcons),
|
||||
Action = () =>
|
||||
{
|
||||
var extensionsWithoutPeriod = new HashSet<string>(ApplicationSettings.OpenDesignFileParams.Split('|').First().Split(',').Select(s => s.Trim().Trim('.')));
|
||||
|
|
@ -411,7 +413,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
ID = "Export",
|
||||
Title = "Export".Localize(),
|
||||
Icon = AggContext.StaticData.LoadIcon("cube_export.png", 16, 16),
|
||||
Icon = AggContext.StaticData.LoadIcon("cube_export.png", 16, 16, invertIcons),
|
||||
Action = () =>
|
||||
{
|
||||
UiThread.RunOnIdle(async () =>
|
||||
|
|
|
|||
|
|
@ -542,7 +542,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
var systemWindow = this.Parents<SystemWindow>().FirstOrDefault();
|
||||
|
||||
var printLibraryWidget = new PrintLibraryWidget(partPreviewContent, theme)
|
||||
var printLibraryWidget = new PrintLibraryWidget(partPreviewContent, theme, libraryPopup)
|
||||
{
|
||||
HAnchor = HAnchor.Stretch,
|
||||
VAnchor = VAnchor.Absolute,
|
||||
|
|
@ -561,14 +561,21 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
void systemWindownMouseDown(object s2, MouseEventArgs mouseEvent)
|
||||
{
|
||||
// MouseUp on our SystemWindow outside of our bounds should call close
|
||||
var resizeContainerMousePosition = verticalResizeContainer.TransformFromScreenSpace(mouseEvent.Position);
|
||||
bool mouseUpOnWidget = resizeContainerMousePosition.X >= 0 && resizeContainerMousePosition.X <= verticalResizeContainer.Width
|
||||
&& resizeContainerMousePosition.Y >= 0 && resizeContainerMousePosition.Y <= verticalResizeContainer.Height;
|
||||
|
||||
if (!mouseUpOnWidget)
|
||||
if (verticalResizeContainer.Parent != null)
|
||||
{
|
||||
// MouseUp on our SystemWindow outside of our bounds should call close
|
||||
var resizeContainerMousePosition = verticalResizeContainer.TransformFromScreenSpace(mouseEvent.Position);
|
||||
bool mouseUpOnWidget = resizeContainerMousePosition.X >= 0 && resizeContainerMousePosition.X <= verticalResizeContainer.Width
|
||||
&& resizeContainerMousePosition.Y >= 0 && resizeContainerMousePosition.Y <= verticalResizeContainer.Height;
|
||||
|
||||
if (!mouseUpOnWidget)
|
||||
{
|
||||
libraryPopup.CloseMenu();
|
||||
systemWindow.MouseDown -= systemWindownMouseDown;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
libraryPopup.CloseMenu();
|
||||
systemWindow.MouseDown -= systemWindownMouseDown;
|
||||
}
|
||||
};
|
||||
|
|
@ -661,7 +668,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
if (filesToLoad != null && filesToLoad.Length > 0)
|
||||
{
|
||||
|
||||
await Task.Run(() => loadAndAddPartsToPlate(filesToLoad, sceneContext));
|
||||
|
||||
if (originatingWidget.HasBeenClosed)
|
||||
|
|
|
|||
BIN
StaticData/Icons/fa-folder-open_16.png
Normal file
BIN
StaticData/Icons/fa-folder-open_16.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 294 B |
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"DefaultMode": "Dark",
|
||||
"DefaultColor": "#cb4b16",
|
||||
"Colors": ["#b58900", "#cb4b16", "#dc322f", "#d33682", "#6c71c4", "#268bd2", "#2aa198", "#859900"]
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"DefaultMode": "Dark",
|
||||
"DefaultColor": "#ac193dff",
|
||||
"Colors": ["#ac193dff", "#dc4fadff", "#ff8119ff", "#008a17ff", "#004b8bff", "#008299ff", "#5db2ffff", "#4617b4ff", "#8c0095ff", "#585858ff"]
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"DefaultMode": "Dark",
|
||||
"DefaultColor": "#b58900",
|
||||
"Colors": ["#b58900", "#cb4b16", "#dc322f", "#d33682", "#6c71c4", "#268bd2", "#2aa198", "#859900"]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue