Add Library tab, replace PrintLibrary widget with Favorites bar
This commit is contained in:
parent
7159d78592
commit
b67d3ad691
52 changed files with 2467 additions and 389 deletions
|
|
@ -49,8 +49,15 @@ namespace MatterHackers.MatterControl.Library
|
|||
private Func<ILibraryContainer> containerCreator;
|
||||
private Func<bool> visibilityResolver;
|
||||
private Func<string> nameResolver;
|
||||
private ImageBuffer microIcon;
|
||||
|
||||
public DynamicContainerLink(Func<string> nameResolver, ImageBuffer thumbnail, Func<ILibraryContainer> creator = null, Func<bool> visibilityResolver = null)
|
||||
public DynamicContainerLink(Func<string> nameResolver, ImageBuffer microIcon, ImageBuffer thumbnail, Func<ILibraryContainer> creator = null, Func<bool> visibilityResolver = null)
|
||||
: this (nameResolver, thumbnail, creator, visibilityResolver)
|
||||
{
|
||||
this.microIcon = microIcon;
|
||||
}
|
||||
|
||||
private DynamicContainerLink(Func<string> nameResolver, ImageBuffer thumbnail, Func<ILibraryContainer> creator = null, Func<bool> visibilityResolver = null)
|
||||
{
|
||||
this.thumbnail = thumbnail?.SetPreMultiply();
|
||||
this.nameResolver = nameResolver;
|
||||
|
|
@ -69,6 +76,11 @@ namespace MatterHackers.MatterControl.Library
|
|||
|
||||
public Task<ImageBuffer> GetThumbnail(int width, int height)
|
||||
{
|
||||
if (width < 24 && height < 24)
|
||||
{
|
||||
return Task.FromResult(microIcon?.AlphaToPrimaryAccent());
|
||||
}
|
||||
|
||||
//return Task.FromResult(thumbnail);
|
||||
return Task.FromResult(thumbnail?.AlphaToPrimaryAccent());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,10 @@ namespace MatterHackers.MatterControl.Library
|
|||
private ILibraryContainer activeContainer;
|
||||
|
||||
private static ImageBuffer defaultFolderIcon = AggContext.StaticData.LoadIcon(Path.Combine("Library", "folder.png")).SetPreMultiply();
|
||||
private static ImageBuffer defaultFolderIconx20 = AggContext.StaticData.LoadIcon(Path.Combine("Library", "folder_20x20.png")).SetPreMultiply();
|
||||
|
||||
private static ImageBuffer defaultItemIcon = AggContext.StaticData.LoadIcon(Path.Combine("Library", "file.png"));
|
||||
private static ImageBuffer defaultItemIconx20 = AggContext.StaticData.LoadIcon(Path.Combine("Library", "file_20x20.png"));
|
||||
|
||||
public LibraryConfig()
|
||||
{
|
||||
|
|
@ -261,7 +264,21 @@ namespace MatterHackers.MatterControl.Library
|
|||
if (thumbnail == null)
|
||||
{
|
||||
// Use the listview defaults
|
||||
thumbnail = ((libraryItem is ILibraryContainerLink) ? defaultFolderIcon : defaultItemIcon).AlphaToPrimaryAccent();
|
||||
if (thumbHeight < 24 && thumbWidth < 24)
|
||||
{
|
||||
thumbnail = ((libraryItem is ILibraryContainerLink) ? defaultFolderIconx20 : defaultItemIconx20); ;
|
||||
|
||||
//if (!theme.InvertIcons)
|
||||
//{
|
||||
// thumbnail = thumbnail.InvertLightness();
|
||||
//}
|
||||
|
||||
thumbnail = thumbnail.MultiplyWithPrimaryAccent();
|
||||
}
|
||||
else
|
||||
{
|
||||
thumbnail = ((libraryItem is ILibraryContainerLink) ? defaultFolderIcon : defaultItemIcon).AlphaToPrimaryAccent();
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Resolve and implement
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
this.ChildContainers.Add(
|
||||
new DynamicContainerLink(
|
||||
() => "Local Library".Localize(),
|
||||
AggContext.StaticData.LoadIcon(Path.Combine("Library", "library_20x20.png")),
|
||||
AggContext.StaticData.LoadIcon(Path.Combine("Library", "library_folder.png")),
|
||||
() => new SqliteLibraryContainer(rootLibraryCollection.Id)));
|
||||
}
|
||||
|
|
@ -56,6 +57,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
this.ChildContainers.Add(
|
||||
new DynamicContainerLink(
|
||||
() => "Calibration Parts".Localize(),
|
||||
AggContext.StaticData.LoadIcon(Path.Combine("Library", "folder_20x20.png")),
|
||||
AggContext.StaticData.LoadIcon(Path.Combine("Library", "folder.png")),
|
||||
() => new CalibrationPartsContainer())
|
||||
{
|
||||
|
|
@ -65,6 +67,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
this.ChildContainers.Add(
|
||||
new DynamicContainerLink(
|
||||
() => "Print Queue".Localize(),
|
||||
AggContext.StaticData.LoadIcon(Path.Combine("Library", "queue_20x20.png")),
|
||||
AggContext.StaticData.LoadIcon(Path.Combine("Library", "queue_folder.png")),
|
||||
() => new PrintQueueContainer()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ either expressed or implied, of the FreeBSD Project.
|
|||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using MatterHackers.Agg.Platform;
|
||||
using MatterHackers.Localizations;
|
||||
|
||||
namespace MatterHackers.MatterControl.Library
|
||||
|
|
@ -46,7 +48,8 @@ namespace MatterHackers.MatterControl.Library
|
|||
this.ChildContainers.Add(
|
||||
new DynamicContainerLink(
|
||||
() => "Plating History".Localize(),
|
||||
null,
|
||||
AggContext.StaticData.LoadIcon(Path.Combine("Library", "history_20x20.png")),
|
||||
AggContext.StaticData.LoadIcon(Path.Combine("Library", "history_folder.png")),
|
||||
() => new PlatingHistoryContainer())
|
||||
{
|
||||
IsReadOnly = true
|
||||
|
|
@ -55,7 +58,8 @@ namespace MatterHackers.MatterControl.Library
|
|||
this.ChildContainers.Add(
|
||||
new DynamicContainerLink(
|
||||
() => "Part History".Localize(),
|
||||
null,
|
||||
AggContext.StaticData.LoadIcon(Path.Combine("Library", "history_20x20.png")),
|
||||
AggContext.StaticData.LoadIcon(Path.Combine("Library", "history_folder.png")),
|
||||
() => new PartHistoryContainer())
|
||||
{
|
||||
IsReadOnly = true
|
||||
|
|
@ -64,7 +68,8 @@ namespace MatterHackers.MatterControl.Library
|
|||
this.ChildContainers.Add(
|
||||
new DynamicContainerLink(
|
||||
() => "Print History".Localize(),
|
||||
null,
|
||||
AggContext.StaticData.LoadIcon(Path.Combine("Library", "history_20x20.png")),
|
||||
AggContext.StaticData.LoadIcon(Path.Combine("Library", "history_folder.png")),
|
||||
() => new PrintHistoryContainer())
|
||||
{
|
||||
IsReadOnly = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue