fixed more scaling issues

This commit is contained in:
Lars Brubaker 2020-08-04 14:56:27 -07:00
parent 73599ba022
commit 9df2078d0d
26 changed files with 56 additions and 38 deletions

View file

@ -60,7 +60,7 @@ namespace MatterHackers.MatterControl
this.AddChild(new HorizontalSpacer());
checkUpdateButton = new IconButton(AggContext.StaticData.LoadIcon("fa-refresh_14.png", theme.InvertIcons), theme)
checkUpdateButton = new IconButton(AggContext.StaticData.LoadIcon("fa-refresh_14.png", 14, 14, theme.InvertIcons), theme)
{
ToolTipText = "Check for Update".Localize(),
BackgroundColor = theme.MinimalShade,

View file

@ -65,7 +65,7 @@ namespace MatterHackers.MatterControl.ActionBar
this.MakeScrollable = false;
this.AlignToRightEdge = true;
ImageWidget = new ImageWidget(AggContext.StaticData.LoadIcon("hotend.png", theme.InvertIcons))
ImageWidget = new ImageWidget(AggContext.StaticData.LoadIcon("hotend.png", 14, 14, theme.InvertIcons))
{
VAnchor = VAnchor.Center,
Margin = new BorderDouble(right: 5)

View file

@ -56,7 +56,7 @@ namespace MatterHackers.MatterControl.ActionBar
this.DisplayCurrentTemperature();
this.ToolTipText = "Bed Temperature".Localize();
this.ImageWidget.Image = AggContext.StaticData.LoadIcon("bed.png", theme.InvertIcons);
this.ImageWidget.Image = AggContext.StaticData.LoadIcon("bed.png", 16, 16, theme.InvertIcons);
this.PopupContent = this.GetPopupContent(ApplicationController.Instance.MenuTheme);

View file

@ -3045,7 +3045,7 @@ namespace MatterHackers.MatterControl
internal void GetViewOptionButtons(GuiWidget parent, ISceneContext sceneContext, PrinterConfig printer, ThemeConfig theme)
{
var bedButton = new RadioIconButton(AggContext.StaticData.LoadIcon("bed.png", theme.InvertIcons), theme)
var bedButton = new RadioIconButton(AggContext.StaticData.LoadIcon("bed.png", 16, 16, theme.InvertIcons), theme)
{
Name = "Bed Button",
ToolTipText = "Show Print Bed".Localize(),
@ -3065,7 +3065,7 @@ namespace MatterHackers.MatterControl
Func<bool> buildHeightValid = () => sceneContext.BuildHeight > 0;
var printAreaButton = new RadioIconButton(AggContext.StaticData.LoadIcon("print_area.png", theme.InvertIcons), theme)
var printAreaButton = new RadioIconButton(AggContext.StaticData.LoadIcon("print_area.png", 16, 16, theme.InvertIcons), theme)
{
Name = "Bed Button",
ToolTipText = buildHeightValid() ? "Show Print Area".Localize() : "Define printer build height to enable",

View file

@ -60,7 +60,7 @@ namespace MatterHackers.MatterControl
};
this.AddChild(row);
row.AddChild(new IconButton(AggContext.StaticData.LoadIcon("mh-app-logo.png", theme.InvertIcons), theme)
row.AddChild(new IconButton(AggContext.StaticData.LoadIcon("mh-app-logo.png", 16, 16, theme.InvertIcons), theme)
{
VAnchor = VAnchor.Center,
Margin = theme.ButtonSpacing,

View file

@ -322,7 +322,7 @@ namespace MatterHackers.MatterControl
static CalibrationPad()
{
activeIcon = AggContext.StaticData.LoadIcon("fa-check_16.png", true);
activeIcon = AggContext.StaticData.LoadIcon("fa-check_16.png", 16, 16, true);
inactiveIcon = new ImageBuffer(16, 16);
}

View file

@ -54,8 +54,8 @@ namespace MatterHackers.MatterControl.CustomWidgets
public ExpandCheckboxButton(string text, ThemeConfig theme, int pointSize = 11, bool expandable = true)
{
arrowRight = AggContext.StaticData.LoadIcon("fa-angle-right_12.png", theme.InvertIcons);
arrowDown = AggContext.StaticData.LoadIcon("fa-angle-down_12.png", theme.InvertIcons);
arrowRight = AggContext.StaticData.LoadIcon("fa-angle-right_12.png", 12, 12, theme.InvertIcons);
arrowDown = AggContext.StaticData.LoadIcon("fa-angle-down_12.png", 12, 12, theme.InvertIcons);
imageButton = new IconButton(arrowRight, theme)
{

View file

@ -260,7 +260,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
public class IconViewItem : ListViewItemBase
{
private static ImageBuffer loadingImage = AggContext.StaticData.LoadIcon("IC_32x32.png");
private static ImageBuffer loadingImage = AggContext.StaticData.LoadIcon("IC_32x32.png", 32, 32);
internal static int ItemPadding = 0;

View file

@ -60,7 +60,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
var buttonGroup = new ObservableCollection<GuiWidget>();
speedsButton = new RadioIconButton(AggContext.StaticData.LoadIcon("speeds.png", theme.InvertIcons), theme)
speedsButton = new RadioIconButton(AggContext.StaticData.LoadIcon("speeds.png", 16, 16, theme.InvertIcons), theme)
{
SiblingRadioButtonList = buttonGroup,
Name = "Speeds Button",
@ -73,7 +73,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
buttonPanel.AddChild(speedsButton);
materialsButton = new RadioIconButton(AggContext.StaticData.LoadIcon("materials.png", theme.InvertIcons), theme)
materialsButton = new RadioIconButton(AggContext.StaticData.LoadIcon("materials.png", 16, 16, theme.InvertIcons), theme)
{
SiblingRadioButtonList = buttonGroup,
Name = "Materials Button",
@ -86,7 +86,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
buttonPanel.AddChild(materialsButton);
noColorButton = new RadioIconButton(AggContext.StaticData.LoadIcon("no-color.png", theme.InvertIcons), theme)
noColorButton = new RadioIconButton(AggContext.StaticData.LoadIcon("no-color.png", 16, 16, theme.InvertIcons), theme)
{
SiblingRadioButtonList = buttonGroup,
Name = "No Color Button",

View file

@ -35,7 +35,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
public class HelpSearchResultRow : SettingsRow
{
public HelpSearchResultRow(HelpSearchResult searchResult, ThemeConfig theme)
: base(searchResult.Name, null, theme, AggContext.StaticData.LoadIcon("fa-text-file_16.png"), fullRowSelect: true)
: base(searchResult.Name, null, theme, AggContext.StaticData.LoadIcon("fa-text-file_16.png", 16, 16), fullRowSelect: true)
{
this.SearchResult = searchResult;

View file

@ -34,6 +34,7 @@ using MatterHackers.Agg.UI;
using MatterHackers.MatterControl.CustomWidgets;
using MatterHackers.MatterControl.Library;
using MatterHackers.VectorMath;
using ObjParser;
namespace MatterHackers.MatterControl.PartPreviewWindow
{
@ -144,6 +145,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
Name = "LibraryView",
// Drop containers
ContainerFilter = (container) => false,
// HAnchor = HAnchor.Fit,
HAnchor = HAnchor.Absolute,
VAnchor = VAnchor.Stretch,
AllowContextMenu = false,
@ -155,8 +157,20 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
VAnchor = VAnchor.Fit | VAnchor.Top
},
};
// favoritesBar.ScrollArea.HAnchor = HAnchor.Fit;
favoritesBar.ListContentView.HAnchor = HAnchor.Fit;
leftBar.AddChild(favoritesBar);
void UpdateWidth(object s, EventArgs e)
{
if (s is GuiWidget widget)
{
favoritesBar.Width = widget.Width;
}
}
favoritesBar.ListContentView.BoundsChanged += UpdateWidth;
favoritesBar.ScrollArea.VAnchor = VAnchor.Fit;
var expandedImage = AggContext.StaticData.LoadIcon("expand.png", 16, 16, theme.InvertIcons);
@ -171,18 +185,22 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
Width = theme.ButtonHeight - 6 * GuiWidget.DeviceScale
};
expandBarButton.Click += (s, e) => UiThread.RunOnIdle(() =>
expandBarButton.Click += (s, e) => UiThread.RunOnIdle(async () =>
{
expanded = !expanded;
// remove from the one we are deleting
favoritesBar.ListContentView.BoundsChanged -= UpdateWidth;
UserSettings.Instance.set(UserSettingsKey.FavoritesBarExpansion, expanded ? "1" : "0");
favoritesBar.ListContentView = new IconView(theme, expanded ? 48 * GuiWidget.DeviceScale : 24 * GuiWidget.DeviceScale);
favoritesBar.Width = expanded ? 55 * GuiWidget.DeviceScale : 33 * GuiWidget.DeviceScale;
favoritesBar.ListContentView.HAnchor = HAnchor.Fit;
// add to the one we created
favoritesBar.ListContentView.BoundsChanged += UpdateWidth;
expandBarButton.SetIcon(expanded ? collapsedImage : expandedImage);
expandBarButton.Invalidate();
favoritesBar.Reload().ConfigureAwait(false);
await favoritesBar.Reload();
UpdateWidth(favoritesBar.ListContentView, null);
});
leftBar.AddChild(expandBarButton);

View file

@ -864,7 +864,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
}
timeContainer.AddChild(new ImageWidget(AggContext.StaticData.LoadIcon("fa-clock_24.png", theme.InvertIcons))
timeContainer.AddChild(new ImageWidget(AggContext.StaticData.LoadIcon("fa-clock_24.png", 24, 24, theme.InvertIcons))
{
VAnchor = VAnchor.Center
});

View file

@ -42,7 +42,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
this.HAnchor = HAnchor.Fit;
this.VAnchor = VAnchor.Fit;
this.AddChild(new IconButton(AggContext.StaticData.LoadIcon("web.png", theme.InvertIcons), theme)
this.AddChild(new IconButton(AggContext.StaticData.LoadIcon("web.png", 16, 16, theme.InvertIcons), theme)
{
Selectable = false
});

View file

@ -103,7 +103,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
IconButton resumeButton = null;
var pauseButton = new IconButton(AggContext.StaticData.LoadIcon("fa-pause_12.png", theme.InvertIcons), theme)
var pauseButton = new IconButton(AggContext.StaticData.LoadIcon("fa-pause_12.png", 12, 12, theme.InvertIcons), theme)
{
Margin = theme.ButtonSpacing,
Enabled = taskDetails.Options?.PauseAction != null,
@ -139,7 +139,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
};
topRow.AddChild(pauseButton);
resumeButton = new IconButton(AggContext.StaticData.LoadIcon("fa-play_12.png", theme.InvertIcons), theme)
resumeButton = new IconButton(AggContext.StaticData.LoadIcon("fa-play_12.png", 12, 12, theme.InvertIcons), theme)
{
Visible = false,
Margin = theme.ButtonSpacing,
@ -154,7 +154,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
};
topRow.AddChild(resumeButton);
var stopButton = new IconButton(AggContext.StaticData.LoadIcon("fa-stop_12.png", theme.InvertIcons), theme)
var stopButton = new IconButton(AggContext.StaticData.LoadIcon("fa-stop_12.png", 12, 12, theme.InvertIcons), theme)
{
Margin = theme.ButtonSpacing,
Name = "Stop Task Button",

View file

@ -102,7 +102,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
if (searchResults.Children.Count == 0)
{
searchResults.AddChild(new SettingsRow("No results found".Localize(), null, theme, AggContext.StaticData.LoadIcon("StatusInfoTip_16x.png").SetPreMultiply()));
searchResults.AddChild(new SettingsRow("No results found".Localize(), null, theme, AggContext.StaticData.LoadIcon("StatusInfoTip_16x.png", 16, 16).SetPreMultiply()));
}
// Add top border to first child

View file

@ -255,7 +255,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
this.TabBar.ActionArea.AddChild(tabTrailer);
var plusTabButton = new NewTabButton(AggContext.StaticData.LoadIcon("fa-plus_12.png", theme.InvertIcons), theme)
var plusTabButton = new NewTabButton(AggContext.StaticData.LoadIcon("fa-plus_12.png", 12, 12, theme.InvertIcons), theme)
{
Height = 20,
};

View file

@ -66,7 +66,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
// put in white and black buttons
colorRow.AddChild(MakeColorButton(grayLevel[rowIndex], scaledButtonSize, buttonSpacing, colorChanged));
switch(rowIndex)
switch (rowIndex)
{
case 0:
var resetButton = new IconButton(AggContext.StaticData.LoadIcon("transparent_grid.png"), theme)
@ -130,7 +130,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
public override Color BackgroundColor
{
get => (this.Enabled) ? base.BackgroundColor : this.DisabledColor;
get => this.Enabled ? base.BackgroundColor : this.DisabledColor;
set
{
base.BackgroundColor = value;
@ -172,7 +172,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
public static Color ToGrayscale(this Color color)
{
int y = (color.red * 77) + (color.green * 151) + (color.blue * 28);
int gray = (y >> 8);
int gray = y >> 8;
return new Color(gray, gray, gray, 255);
}

View file

@ -357,7 +357,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
DialogWindow.Show(new PrinterCalibrationWizard(printer, theme));
});
}),
Icon = AggContext.StaticData.LoadIcon("compass.png", theme.InvertIcons)
Icon = AggContext.StaticData.LoadIcon("compass.png", 16, 16, theme.InvertIcons)
},
new ActionSeparator(),
new NamedAction()

View file

@ -238,7 +238,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
titleAndTreeView.AddChild(treeView);
workspaceName.ActionArea.AddChild(
new IconButton(AggContext.StaticData.LoadIcon("fa-angle-right_12.png", theme.InvertIcons), theme)
new IconButton(AggContext.StaticData.LoadIcon("fa-angle-right_12.png", 12, 12, theme.InvertIcons), theme)
{
Enabled = false
},
@ -286,7 +286,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
};
this.InteractionLayer.AddChild(viewOptionsBar);
var homeButton = new IconButton(AggContext.StaticData.LoadIcon("fa-home_16.png", theme.InvertIcons), theme)
var homeButton = new IconButton(AggContext.StaticData.LoadIcon("fa-home_16.png", 16, 16, theme.InvertIcons), theme)
{
VAnchor = VAnchor.Absolute,
ToolTipText = "Reset View".Localize(),

View file

@ -59,7 +59,7 @@ namespace MatterHackers.MatterControl.PrinterControls
null,
theme));
var runWizardButton = new IconButton(AggContext.StaticData.LoadIcon("compass.png", theme.InvertIcons), theme)
var runWizardButton = new IconButton(AggContext.StaticData.LoadIcon("compass.png", 16, 16, theme.InvertIcons), theme)
{
VAnchor = VAnchor.Center,
Margin = theme.ButtonSpacing,

View file

@ -128,7 +128,7 @@ namespace MatterHackers.MatterControl.PrinterControls
Margin = new BorderDouble(bottom: 10)
};
var homeIcon = new IconButton(AggContext.StaticData.LoadIcon("fa-home_16.png", theme.InvertIcons), theme)
var homeIcon = new IconButton(AggContext.StaticData.LoadIcon("fa-home_16.png", 16, 16, theme.InvertIcons), theme)
{
ToolTipText = "Home X, Y and Z".Localize(),
BackgroundColor = theme.MinimalShade,

View file

@ -40,7 +40,7 @@ namespace MatterHackers.MatterControl
this.HelpArticle = helpArticle;
this.Text = helpArticle.Name;
this.Tag = helpArticle;
this.Image = AggContext.StaticData.LoadIcon("fa-text-file_16.png");
this.Image = AggContext.StaticData.LoadIcon("fa-text-file_16.png", 16, 16);
}
public HelpArticle HelpArticle { get; }

View file

@ -453,7 +453,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
this.HAnchor = HAnchor.Fit;
this.Padding = new BorderDouble(left: 5);
exclamation = AggContext.StaticData.LoadIcon("exclamation.png");
exclamation = AggContext.StaticData.LoadIcon("exclamation.png", 4, 12);
this.Border = new BorderDouble(bottom: 1);
}

View file

@ -103,7 +103,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
unregisterEvents?.Invoke(null, null);
};
var configureIcon = new IconButton(AggContext.StaticData.LoadIcon("fa-cog_16.png", theme.InvertIcons), theme)
var configureIcon = new IconButton(AggContext.StaticData.LoadIcon("fa-cog_16.png", 16, 16, theme.InvertIcons), theme)
{
VAnchor = VAnchor.Center,
Margin = theme.ButtonSpacing,

View file

@ -64,7 +64,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
var widget = new FlowLayoutWidget();
widget.AddChild(dropdownList);
refreshButton = new IconButton(AggContext.StaticData.LoadIcon("fa-refresh_14.png", theme.InvertIcons), theme)
refreshButton = new IconButton(AggContext.StaticData.LoadIcon("fa-refresh_14.png", 14, 14, theme.InvertIcons), theme)
{
Margin = new BorderDouble(left: 5)
};

View file

@ -39,7 +39,7 @@ namespace Markdig.Renderers.Agg
this.VAnchor = VAnchor.Fit;
this.HAnchor = HAnchor.Stretch;
base.AddChild(new ImageWidget(AggContext.StaticData.LoadIcon("bullet.png", theme.InvertIcons))
base.AddChild(new ImageWidget(AggContext.StaticData.LoadIcon("bullet.png", 16, 16, theme.InvertIcons))
{
Margin = new BorderDouble(top: 1, left: 10),
VAnchor = VAnchor.Top,