From c6d38c9c09f3f4ee3dbf5f2ed4199a3861eb519c Mon Sep 17 00:00:00 2001 From: John Lewin Date: Wed, 8 Nov 2017 08:07:55 -0800 Subject: [PATCH] Remove deprecated LocalizedString.Get method --- CustomWidgets/WizardControl.cs | 3 +-- LocalizedString.cs | 10 ++-------- PrinterControls/ControlWidgets/MovementControls.cs | 2 +- PrinterControls/EditLevelingSettingsWindow.cs | 5 ++--- PrinterControls/EditManualMovementSpeedsWindow.cs | 5 ++--- SlicerConfiguration/SliceSettingsOrganizer.cs | 6 +++--- 6 files changed, 11 insertions(+), 20 deletions(-) diff --git a/CustomWidgets/WizardControl.cs b/CustomWidgets/WizardControl.cs index 4b2fa4daf..3a38a0c14 100644 --- a/CustomWidgets/WizardControl.cs +++ b/CustomWidgets/WizardControl.cs @@ -69,8 +69,7 @@ namespace MatterHackers.MatterControl headerRow.Padding = new BorderDouble(0, 3, 0, 3); { - string titleString = LocalizedString.Get("Title Stuff".Localize()); - stepDescriptionWidget = new TextWidget(titleString, pointSize: 14 * extraTextScaling); + stepDescriptionWidget = new TextWidget("", pointSize: 14 * extraTextScaling); stepDescriptionWidget.AutoExpandBoundsToText = true; stepDescriptionWidget.TextColor = ActiveTheme.Instance.PrimaryTextColor; stepDescriptionWidget.HAnchor = HAnchor.Stretch; diff --git a/LocalizedString.cs b/LocalizedString.cs index 9c011334d..30af03dec 100644 --- a/LocalizedString.cs +++ b/LocalizedString.cs @@ -1,5 +1,5 @@ /* -Copyright (c) 2014, Lars Brubaker +Copyright (c) 2017, Lars Brubaker, John Lewin All rights reserved. Redistribution and use in source and binary forms, with or without @@ -27,7 +27,6 @@ of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ -using MatterHackers.Agg.Platform; using MatterHackers.MatterControl; namespace MatterHackers.Localizations @@ -62,11 +61,6 @@ namespace MatterHackers.Localizations } } - public static string Get(string englishText) - { - return MatterControlTranslationMap.Translate(englishText); - } - public static void ResetTranslationMap() { MatterControlTranslationMap = new TranslationMap("Translations", UserSettings.Instance.Language); @@ -74,7 +68,7 @@ namespace MatterHackers.Localizations public static string Localize(this string englishString) { - return Get(englishString); + return MatterControlTranslationMap.Translate(englishString); } } } \ No newline at end of file diff --git a/PrinterControls/ControlWidgets/MovementControls.cs b/PrinterControls/ControlWidgets/MovementControls.cs index 2e91cc703..2435146ed 100644 --- a/PrinterControls/ControlWidgets/MovementControls.cs +++ b/PrinterControls/ControlWidgets/MovementControls.cs @@ -52,7 +52,7 @@ namespace MatterHackers.MatterControl.PrinterControls private Button homeYButton; private Button homeZButton; internal JogControls jogControls; - + // Provides a list of DisableableWidgets controls that can be toggled on/off at runtime internal List DisableableWidgets = new List(); diff --git a/PrinterControls/EditLevelingSettingsWindow.cs b/PrinterControls/EditLevelingSettingsWindow.cs index 3c938cb07..6cbfd439c 100644 --- a/PrinterControls/EditLevelingSettingsWindow.cs +++ b/PrinterControls/EditLevelingSettingsWindow.cs @@ -51,7 +51,7 @@ namespace MatterHackers.MatterControl var textImageButtonFactory = ApplicationController.Instance.Theme.ButtonFactory; AlwaysOnTopOfMain = true; - Title = LocalizedString.Get("Leveling Settings".Localize()); + Title = "Leveling Settings".Localize(); FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottom.AnchorAll(); @@ -63,8 +63,7 @@ namespace MatterHackers.MatterControl headerRow.Padding = new BorderDouble(0, 3, 0, 3); { - string movementSpeedsLabel = LocalizedString.Get("Sampled Positions".Localize()); - TextWidget elementHeader = new TextWidget(string.Format("{0}:", movementSpeedsLabel), pointSize: 14); + var elementHeader = new TextWidget("Sampled Positions".Localize() + ":", pointSize: 14); elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor; elementHeader.HAnchor = HAnchor.Stretch; elementHeader.VAnchor = Agg.UI.VAnchor.Bottom; diff --git a/PrinterControls/EditManualMovementSpeedsWindow.cs b/PrinterControls/EditManualMovementSpeedsWindow.cs index f7c1989ce..cce2db578 100644 --- a/PrinterControls/EditManualMovementSpeedsWindow.cs +++ b/PrinterControls/EditManualMovementSpeedsWindow.cs @@ -51,7 +51,7 @@ namespace MatterHackers.MatterControl var buttonFactory = ApplicationController.Instance.Theme.ButtonFactory; AlwaysOnTopOfMain = true; - Title = LocalizedString.Get(windowTitle); + Title = windowTitle; FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottom.AnchorAll(); @@ -63,8 +63,7 @@ namespace MatterHackers.MatterControl headerRow.Padding = new BorderDouble(0, 3, 0, 3); { - string movementSpeedsLabel = LocalizedString.Get("Movement Speeds Presets".Localize()); - TextWidget elementHeader = new TextWidget(string.Format("{0}:", movementSpeedsLabel), pointSize: 14); + var elementHeader = new TextWidget("Movement Speeds Presets".Localize() + ":", pointSize: 14); elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor; elementHeader.HAnchor = HAnchor.Stretch; elementHeader.VAnchor = Agg.UI.VAnchor.Bottom; diff --git a/SlicerConfiguration/SliceSettingsOrganizer.cs b/SlicerConfiguration/SliceSettingsOrganizer.cs index 007499ab6..e99f80a56 100644 --- a/SlicerConfiguration/SliceSettingsOrganizer.cs +++ b/SlicerConfiguration/SliceSettingsOrganizer.cs @@ -73,7 +73,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration public bool ResetAtEndOfPrint { get; set; } = false; public bool RebuildGCodeOnChange { get; set; } = true; - + public bool ReloadUiWhenChanged { get; set; } = false; public SliceSettingData(string slicerConfigName, string presentationName, DataEditTypes dataEditType, string extraSettings = "", string helpText = "") @@ -85,7 +85,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration this.SlicerConfigName = slicerConfigName; this.PresentationName = presentationName; this.DataEditType = dataEditType; - this.HelpText = LocalizedString.Get(helpText); + this.HelpText = helpText.Localize(); } } @@ -106,7 +106,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration public string Name { get; } public List SubGroupsList { get; set; } = new List(); - + public OrganizerGroup(string displayName) { this.Name = displayName;