Remove redundant helper method

This commit is contained in:
John Lewin 2017-12-15 14:55:10 -08:00
parent 8111ac9c9f
commit 494c2b6d82
6 changed files with 18 additions and 20 deletions

View file

@ -386,7 +386,7 @@ namespace MatterHackers.MatterControl
this.Library.RegisterRootProvider(
new DynamicContainerLink(
() => "Downloads".Localize(),
LibraryProviderHelpers.LoadInvertIcon("FileDialog", "download_folder.png"),
AggContext.StaticData.LoadIcon(Path.Combine("FileDialog", "download_folder.png")),
() => new FileSystemContainer(ApplicationDataStorage.Instance.DownloadsDirectory)
{
UseIncrementedNameDuringTypeChange = true
@ -396,7 +396,7 @@ namespace MatterHackers.MatterControl
this.Library.RegisterRootProvider(
new DynamicContainerLink(
() => "Calibration Parts".Localize(),
LibraryProviderHelpers.LoadInvertIcon("FileDialog", "folder.png"),
AggContext.StaticData.LoadIcon(Path.Combine("FileDialog", "folder.png")),
() => new CalibrationPartsContainer())
{
IsReadOnly = true
@ -405,7 +405,7 @@ namespace MatterHackers.MatterControl
this.Library.RegisterRootProvider(
new DynamicContainerLink(
() => "Print Queue".Localize(),
LibraryProviderHelpers.LoadInvertIcon("FileDialog", "queue_folder.png"),
AggContext.StaticData.LoadIcon(Path.Combine("FileDialog", "queue_folder.png")),
() => new PrintQueueContainer()));
var rootLibraryCollection = Datastore.Instance.dbSQLite.Table<PrintItemCollection>().Where(v => v.Name == "_library").Take(1).FirstOrDefault();
@ -414,7 +414,7 @@ namespace MatterHackers.MatterControl
this.Library.RegisterRootProvider(
new DynamicContainerLink(
() => "Local Library".Localize(),
LibraryProviderHelpers.LoadInvertIcon("FileDialog", "library_folder.png"),
AggContext.StaticData.LoadIcon(Path.Combine("FileDialog", "library_folder.png")),
() => new SqliteLibraryContainer(rootLibraryCollection.Id)));
}
@ -422,7 +422,7 @@ namespace MatterHackers.MatterControl
this.Library.RegisterRootProvider(
new DynamicContainerLink(
() => "Print History".Localize(),
LibraryProviderHelpers.LoadInvertIcon("FileDialog", "folder.png"),
AggContext.StaticData.LoadIcon(Path.Combine("FileDialog", "folder.png")),
() => new PrintHistoryContainer())
{
IsReadOnly = true
@ -433,7 +433,7 @@ namespace MatterHackers.MatterControl
// Add each path defined in the CustomLibraryFolders file as a new FileSystemContainerItem
foreach (string directory in File.ReadLines(ApplicationDataStorage.Instance.CustomLibraryFoldersPath))
{
if (Directory.Exists(directory))
//if (Directory.Exists(directory))
{
this.Library.RegisterRootProvider(
new FileSystemContainer.DirectoryContainerLink(directory)
@ -447,7 +447,7 @@ namespace MatterHackers.MatterControl
this.Library.RegisterRootProvider(
new DynamicContainerLink(
() => "SD Card".Localize(),
LibraryProviderHelpers.LoadInvertIcon("FileDialog", "sd_folder.png"),
AggContext.StaticData.LoadIcon(Path.Combine("FileDialog", "sd_folder.png")),
() => new SDCardContainer(),
() =>
{
@ -466,7 +466,7 @@ namespace MatterHackers.MatterControl
this.Library.RegisterRootProvider(
new DynamicContainerLink(
() => "Plating History".Localize(),
LibraryProviderHelpers.LoadInvertIcon("FileDialog", "folder.png"),
AggContext.StaticData.LoadIcon(Path.Combine("FileDialog", "folder.png")),
() => ApplicationController.Instance.Library.PlatingHistory));
}

View file

@ -150,7 +150,7 @@ namespace MatterHackers.MatterControl
}
}
public ImageBuffer DefaultImage => LibraryProviderHelpers.LoadInvertIcon("mesh.png");
public ImageBuffer DefaultImage => AggContext.StaticData.LoadIcon("mesh.png");
private static bool MeshIsTooBigToLoad(string fileLocation)
{

View file

@ -39,12 +39,6 @@ namespace MatterHackers.MatterControl.Library
{
public static class LibraryProviderHelpers
{
public static ImageBuffer LoadInvertIcon(params string[] pathSegments)
{
return AggContext.StaticData.LoadIcon(Path.Combine(pathSegments)); //.InvertLightness();
}
public static void RenderCentered(this Graphics2D graphics2D, ImageBuffer imageBuffer, double width, double height)
{
int targetWidth = graphics2D.DestImage.Width;

View file

@ -29,10 +29,12 @@ either expressed or implied, of the FreeBSD Project.
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using MatterHackers.Agg;
using MatterHackers.Agg.Image;
using MatterHackers.Agg.Platform;
using MatterHackers.Agg.UI;
using MatterHackers.Localizations;
@ -78,7 +80,7 @@ namespace MatterHackers.MatterControl.Library
public override Task<ImageBuffer> GetThumbnail(ILibraryItem item, int width, int height)
{
bool largeIcon = width > 50 || height > 50;
var thumbnail = LibraryProviderHelpers.LoadInvertIcon(largeIcon ? "icon_sd_card_115x115.png" : "icon_sd_card_50x50.png");
var thumbnail = AggContext.StaticData.LoadIcon(Path.Combine(largeIcon ? "icon_sd_card_115x115.png" : "icon_sd_card_50x50.png"));
return Task.FromResult(thumbnail);
}

View file

@ -32,6 +32,7 @@ using System.IO;
using System.Linq;
using System.Threading.Tasks;
using MatterHackers.Agg.Image;
using MatterHackers.Agg.Platform;
namespace MatterHackers.MatterControl.Library
{
@ -41,7 +42,7 @@ namespace MatterHackers.MatterControl.Library
static LocalZipContainerLink()
{
thumbnail = LibraryProviderHelpers.LoadInvertIcon("FileDialog", "folder_zip.png");
thumbnail = AggContext.StaticData.LoadIcon(System.IO.Path.Combine("FileDialog", "folder_zip.png"));
}
public bool IsReadOnly { get; } = false;

View file

@ -32,6 +32,7 @@ using System.IO;
using System.Threading.Tasks;
using MatterHackers.Agg;
using MatterHackers.Agg.Image;
using MatterHackers.Agg.Platform;
using MatterHackers.Agg.UI;
using MatterHackers.Agg.VertexSource;
using MatterHackers.MatterControl.Library;
@ -42,9 +43,9 @@ namespace MatterHackers.MatterControl.CustomWidgets
{
public class ListViewItemBase : GuiWidget
{
private static ImageBuffer defaultFolderIcon = LibraryProviderHelpers.LoadInvertIcon("FileDialog", "folder.png");
private static ImageBuffer defaultItemIcon = LibraryProviderHelpers.LoadInvertIcon("FileDialog", "file.png");
private static ImageBuffer generatingThumbnailIcon = LibraryProviderHelpers.LoadInvertIcon("building_thumbnail_40x40.png");
private static ImageBuffer defaultFolderIcon = AggContext.StaticData.LoadIcon(Path.Combine("FileDialog", "folder.png"));
private static ImageBuffer defaultItemIcon = AggContext.StaticData.LoadIcon(Path.Combine("FileDialog", "file.png"));
private static ImageBuffer generatingThumbnailIcon = AggContext.StaticData.LoadIcon(Path.Combine("building_thumbnail_40x40.png"));
protected ListViewItem listViewItem;
protected View3DWidget view3DWidget;