Migrate StyledDropDownList to Agg

This commit is contained in:
John Lewin 2016-06-03 18:11:51 -07:00
parent c5dac76ff9
commit d27db87a65
14 changed files with 39 additions and 96 deletions

View file

@ -30,7 +30,7 @@ namespace MatterHackers.MatterControl.AboutPage
TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory();
LinkButtonFactory linkButtonFactory = new LinkButtonFactory();
string pathToStableBuildFeatures;
StyledDropDownList releaseOptionsDropList;
DropDownList releaseOptionsDropList;
FlowLayoutWidget additionalInfoContainer;
TextWidget stableInfoLabel;
TextWidget alphaInfoLabel;
@ -72,7 +72,7 @@ namespace MatterHackers.MatterControl.AboutPage
feedLabel.VAnchor = VAnchor.ParentCenter;
feedLabel.Margin = new BorderDouble(left: 5);
releaseOptionsDropList = new StyledDropDownList("Development", maxHeight: 200);
releaseOptionsDropList = new DropDownList("Development", maxHeight: 200);
releaseOptionsDropList.HAnchor = HAnchor.ParentLeftRight;
MenuItem releaseOptionsDropDownItem = releaseOptionsDropList.AddItem("Stable".Localize(), "release");
@ -108,7 +108,7 @@ namespace MatterHackers.MatterControl.AboutPage
additionalInfoContainer.HAnchor = HAnchor.ParentLeftRight;
additionalInfoContainer.Padding = new BorderDouble(left: 6, top: 6);
string aboutUpdateChannel = "Changing your update channnel will change the version of MatterControl \nthat you recieve when updating:";
string aboutUpdateChannel = "Changing your update channel will change the version of MatterControl \nthat you receive when updating:";
updateChannelLabel = new TextWidget(aboutUpdateChannel);
updateChannelLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
updateChannelLabel.HAnchor = HAnchor.ParentLeftRight;
@ -211,7 +211,7 @@ namespace MatterHackers.MatterControl.AboutPage
{
//getAdditionalFeedInfo();
string releaseCode = ((StyledDropDownList)sender).SelectedValue;
string releaseCode = ((DropDownList)sender).SelectedValue;
if (releaseCode != UserSettings.Instance.get("UpdateFeedType"))
{
UserSettings.Instance.set("UpdateFeedType", releaseCode);

View file

@ -40,7 +40,7 @@ using System;
namespace MatterHackers.MatterControl
{
public class PrinterSelector : StyledDropDownList
public class PrinterSelector : DropDownList
{
public event EventHandler AddPrinter;

View file

@ -47,7 +47,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
{
private Button languageRestartButton;
private Button configureUpdateFeedButton;
public StyledDropDownList releaseOptionsDropList;
public DropDownList releaseOptionsDropList;
private string cannotRestartWhilePrintIsActiveMessage;
private string cannotRestartWhileActive;
@ -217,7 +217,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
FlowLayoutWidget optionsContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
optionsContainer.Margin = new BorderDouble(bottom: 6);
StyledDropDownList interfaceOptionsDropList = new StyledDropDownList("Development", maxHeight: 200);
DropDownList interfaceOptionsDropList = new DropDownList("Development", maxHeight: 200);
interfaceOptionsDropList.HAnchor = HAnchor.ParentLeftRight;
optionsContainer.AddChild(interfaceOptionsDropList);
@ -237,7 +237,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
interfaceOptionsDropList.SelectedValue = UserSettings.Instance.get("ApplicationDisplayMode");
interfaceOptionsDropList.SelectionChanged += (sender, e) =>
{
string releaseCode = ((StyledDropDownList)sender).SelectedValue;
string releaseCode = ((DropDownList)sender).SelectedValue;
if (releaseCode != UserSettings.Instance.get("ApplicationDisplayMode"))
{
UserSettings.Instance.set("ApplicationDisplayMode", releaseCode);
@ -266,7 +266,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
FlowLayoutWidget optionsContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
optionsContainer.Margin = new BorderDouble(bottom: 6);
StyledDropDownList interfaceModeDropList = new StyledDropDownList("Standard", maxHeight: 200);
DropDownList interfaceModeDropList = new DropDownList("Standard", maxHeight: 200);
interfaceModeDropList.HAnchor = HAnchor.ParentLeftRight;
optionsContainer.AddChild(interfaceModeDropList);
@ -302,7 +302,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
FlowLayoutWidget optionsContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
optionsContainer.Margin = new BorderDouble(bottom: 6);
releaseOptionsDropList = new StyledDropDownList("Development", maxHeight: 200);
releaseOptionsDropList = new DropDownList("Development", maxHeight: 200);
releaseOptionsDropList.HAnchor = HAnchor.ParentLeftRight;
optionsContainer.AddChild(releaseOptionsDropList);
@ -431,7 +431,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
FlowLayoutWidget optionsContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
optionsContainer.Margin = new BorderDouble(bottom: 6);
StyledDropDownList interfaceOptionsDropList = new StyledDropDownList("Development", maxHeight: 200);
DropDownList interfaceOptionsDropList = new DropDownList("Development", maxHeight: 200);
interfaceOptionsDropList.HAnchor = HAnchor.ParentLeftRight;
optionsContainer.AddChild(interfaceOptionsDropList);
@ -451,7 +451,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
interfaceOptionsDropList.SelectedValue = UserSettings.Instance.get("ThumbnailRenderingMode");
interfaceOptionsDropList.SelectionChanged += (sender, e) =>
{
string thumbnailRenderingMode = ((StyledDropDownList)sender).SelectedValue;
string thumbnailRenderingMode = ((DropDownList)sender).SelectedValue;
if (thumbnailRenderingMode != UserSettings.Instance.get("ThumbnailRenderingMode"))
{
UserSettings.Instance.set("ThumbnailRenderingMode", thumbnailRenderingMode);
@ -532,7 +532,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
private void InterfaceModeDropList_SelectionChanged(object sender, EventArgs e)
{
string isSimpleMode = ((StyledDropDownList)sender).SelectedValue;
string isSimpleMode = ((DropDownList)sender).SelectedValue;
if (isSimpleMode == "True")
{
UserSettings.Instance.Fields.IsSimpleMode = true;
@ -545,7 +545,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
private void ReleaseOptionsDropList_SelectionChanged(object sender, EventArgs e)
{
string releaseCode = ((StyledDropDownList)sender).SelectedValue;
string releaseCode = ((DropDownList)sender).SelectedValue;
if (releaseCode != UserSettings.Instance.get("UpdateFeedType"))
{
UserSettings.Instance.set("UpdateFeedType", releaseCode);
@ -554,7 +554,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
private void LanguageDropList_SelectionChanged(object sender, EventArgs e)
{
string languageCode = ((DropDownList)sender).SelectedValue;
string languageCode = ((Agg.UI.DropDownList)sender).SelectedValue;
if (languageCode != UserSettings.Instance.get("Language"))
{
UserSettings.Instance.set("Language", languageCode);

View file

@ -1,9 +1,10 @@
using MatterHackers.VectorMath;
using MatterHackers.Agg.UI;
using MatterHackers.VectorMath;
using System.Collections.Generic;
namespace MatterHackers.MatterControl
{
public class LanguageSelector : StyledDropDownList
public class LanguageSelector : DropDownList
{
private Dictionary<string, string> languageDict;

View file

@ -144,7 +144,7 @@ namespace MatterHackers.MatterControl
private void LanguageDropList_SelectionChanged(object sender, EventArgs e)
{
string languageCode = ((DropDownList)sender).SelectedLabel;
string languageCode = ((Agg.UI.DropDownList)sender).SelectedLabel;
if (languageCode != UserSettings.Instance.get("Language"))
{
UserSettings.Instance.set("Language", languageCode);
@ -165,7 +165,7 @@ namespace MatterHackers.MatterControl
FlowLayoutWidget controlsContainer = new FlowLayoutWidget();
controlsContainer.HAnchor |= HAnchor.ParentCenter;
var releaseOptionsDropList = new StyledDropDownList("Development");
var releaseOptionsDropList = new DropDownList("Development");
releaseOptionsDropList.Margin = new BorderDouble(0, 3);
MenuItem releaseOptionsDropDownItem = releaseOptionsDropList.AddItem("Release", "release");
@ -203,7 +203,7 @@ namespace MatterHackers.MatterControl
private void ReleaseOptionsDropList_SelectionChanged(object sender, EventArgs e)
{
string releaseCode = ((StyledDropDownList)sender).SelectedValue;
string releaseCode = ((DropDownList)sender).SelectedValue;
if (releaseCode != UserSettings.Instance.get("UpdateFeedType"))
{
UserSettings.Instance.set("UpdateFeedType", releaseCode);

View file

@ -1,57 +0,0 @@
/*
Copyright (c) 2015, Kevin Pope
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 MatterHackers.Agg;
using MatterHackers.Agg.UI;
namespace MatterHackers.MatterControl
{
public class StyledDropDownList : DropDownList
{
private static RGBA_Bytes whiteSemiTransparent = new RGBA_Bytes(255, 255, 255, 100);
private static RGBA_Bytes whiteTransparent = new RGBA_Bytes(255, 255, 255, 0);
public StyledDropDownList(string noSelectionString, Direction direction = Direction.Down, double maxHeight = 0, bool useLeftIcons = false)
: base(noSelectionString, whiteTransparent, whiteSemiTransparent, direction, maxHeight, useLeftIcons)
{
this.TextColor = ActiveTheme.Instance.PrimaryTextColor;
this.MenuItemsBorderWidth = 1;
this.MenuItemsBackgroundColor = RGBA_Bytes.White;
this.MenuItemsBorderColor = ActiveTheme.Instance.SecondaryTextColor;
this.MenuItemsPadding = new BorderDouble(10, 8, 10, 12);
this.MenuItemsBackgroundHoverColor = ActiveTheme.Instance.PrimaryAccentColor;
this.MenuItemsTextHoverColor = RGBA_Bytes.Black;
this.MenuItemsTextColor = RGBA_Bytes.Black;
this.BorderWidth = 1;
this.BorderColor = ActiveTheme.Instance.SecondaryTextColor;
this.HoverColor = whiteSemiTransparent;
this.BackgroundColor = new RGBA_Bytes(255, 255, 255, 0);
}
}
}

View file

@ -307,7 +307,6 @@
<Compile Include="CustomWidgets\PrintProgressBarWidget.cs" />
<Compile Include="Queue\OptionsMenu\ExportToSdCardFeedbackWindow.cs" />
<Compile Include="CustomWidgets\SlidePanelWidget.cs" />
<Compile Include="CustomWidgets\StyledDropDownList.cs" />
<Compile Include="ControlElements\StyledMessageBoxWindow.cs" />
<Compile Include="CustomWidgets\WizardControl.cs" />
<Compile Include="DataStorage\SQLiteCommon.cs" />

View file

@ -554,7 +554,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
container.AddChild(snapGridLabel);
StyledDropDownList selectableOptions = new StyledDropDownList("Custom", Direction.Up)
DropDownList selectableOptions = new DropDownList("Custom", Direction.Up)
{
VAnchor = VAnchor.ParentCenter | VAnchor.FitToChildren,
};

View file

@ -37,7 +37,7 @@ using System.Linq;
namespace MatterHackers.MatterControl
{
public class BoundDropList : StyledDropDownList
public class BoundDropList : DropDownList
{
private List<KeyValuePair<string, string>> listSource;

View file

@ -136,7 +136,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
return container;
}
private FlowLayoutWidget CreateSelectionContainer(string labelText, string validationMessage, DropDownList selector)
private FlowLayoutWidget CreateSelectionContainer(string labelText, string validationMessage, Agg.UI.DropDownList selector)
{
var sectionLabel = new TextWidget(labelText, 0, 0, 12)
{
@ -172,7 +172,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
private void ManufacturerDropList_SelectionChanged(object sender, EventArgs e)
{
ActivePrinter.Make = ((DropDownList)sender).SelectedValue;
ActivePrinter.Make = ((Agg.UI.DropDownList)sender).SelectedValue;
ActivePrinter.Model = null;
List<string> printers;
@ -192,7 +192,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{
UiThread.RunOnIdle(() =>
{
StyledDropDownList dropList = (StyledDropDownList) sender;
DropDownList dropList = (DropDownList) sender;
ActivePrinter.Model = dropList.SelectedLabel;
SetElementVisibility();
@ -201,7 +201,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
// Use ManufacturerDropList.SelectedLabel instead of ActivePrinter.Make to ensure the mapped Unicode values are picked up
string mappedMakeText = printerManufacturerSelector.SelectedLabel;
string printerInputName = String.Format("{0} {1}", mappedMakeText, this.ActivePrinter.Model);
string printerInputName = string.Format("{0} {1}", mappedMakeText, this.ActivePrinter.Model);
var names = ActiveSliceSettings.ProfileData.Profiles.Where(p => p.Name.StartsWith(printerInputName)).Select(p => p.Name).ToList();
if (!names.Contains(printerInputName))
{
@ -215,7 +215,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
do
{
possiblePrinterName = String.Format("{0} ({1})", printerInputName, printerModelCount++);
possiblePrinterName = string.Format("{0} ({1})", printerInputName, printerModelCount++);
} while (names.Contains(possiblePrinterName));
printerNameInput.Text = possiblePrinterName;

View file

@ -49,7 +49,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
private Button editButton;
private NamedSettingsLayers layerType;
private StyledDropDownList dropDownList;
private DropDownList dropDownList;
private int extruderIndex; //For multiple materials
@ -195,9 +195,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
});
}
private StyledDropDownList CreateDropdown()
private DropDownList CreateDropdown()
{
var dropDownList = new StyledDropDownList("- default -", maxHeight: 300, useLeftIcons: true)
var dropDownList = new DropDownList("- default -", maxHeight: 300, useLeftIcons: true)
{
HAnchor = HAnchor.ParentLeftRight,
MenuItemsPadding = new BorderDouble(10, 4, 10, 6),
@ -278,7 +278,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
}
}
public class SliceEngineSelector : StyledDropDownList
public class SliceEngineSelector : DropDownList
{
public SliceEngineSelector(string label)
: base(label)

View file

@ -10,7 +10,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
public DropDownMenu sliceOptionsMenuDropList;
private const string SliceSettingsLevelEntry = "SliceSettingsLevel";
private const string SliceSettingsShowHelpEntry = "SliceSettingsShowHelp";
private StyledDropDownList settingsDetailSelector;
private DropDownList settingsDetailSelector;
private CheckBox showHelpBox;
private TupleList<string, Func<bool>> slicerOptionsMenuItems;
@ -31,7 +31,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
this.AddChild(showHelpBox);
settingsDetailSelector = new StyledDropDownList("Basic", maxHeight: 200);
settingsDetailSelector = new DropDownList("Basic", maxHeight: 200);
settingsDetailSelector.Name = "User Level Dropdown";
settingsDetailSelector.AddItem("Basic".Localize(), "Simple");
settingsDetailSelector.AddItem("Standard".Localize(), "Intermediate");

View file

@ -1114,7 +1114,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
// bind to a context that will place it in the SliceSetting view but it binds its values to a machine
// specific dictionary key that is not exposed in the UI. At runtime we lookup and store to "MatterControl.<machine>.ComPort"
// ensuring that a single printer can be shared across different devices and we'll select the correct ComPort in each case
var selectableOptions = new StyledDropDownList("None", maxHeight: 200)
var selectableOptions = new DropDownList("None", maxHeight: 200)
{
ToolTipText = settingData.HelpText,
Margin = new BorderDouble()
@ -1167,7 +1167,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
case OrganizerSettingsData.DataEditTypes.LIST:
{
var selectableOptions = new StyledDropDownList("None", maxHeight: 200)
var selectableOptions = new DropDownList("None", maxHeight: 200)
{
ToolTipText = settingData.HelpText,
Margin = new BorderDouble()
@ -1466,7 +1466,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
return container;
}
private void AddComMenuItems(OrganizerSettingsData settingData, SettingsRow settingsRow, StyledDropDownList selectableOptions)
private void AddComMenuItems(OrganizerSettingsData settingData, SettingsRow settingsRow, DropDownList selectableOptions)
{
selectableOptions.MenuItems.Clear();
string machineSpecificComPortValue = ActiveSliceSettings.Instance.ComPort();
@ -1535,7 +1535,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
string sliceSettingValue = GetActiveValue(settingData.SlicerConfigName, layerCascade);
FlowLayoutWidget totalContent = new FlowLayoutWidget();
StyledDropDownList selectableOptions = new StyledDropDownList("Custom", maxHeight: 200);
DropDownList selectableOptions = new DropDownList("Custom", maxHeight: 200);
selectableOptions.Margin = new BorderDouble(0, 0, 10, 0);
foreach (QuickMenuNameValue nameValue in settingData.QuickMenuSettings)

@ -1 +1 @@
Subproject commit 48146f6266d90835c98a10df1533650e78cf47c5
Subproject commit 00bb607805ce790b1c2f7505d7e2a42ba2658347