Merge pull request #1 from gregory-diaz/my-branch

More Localization
This commit is contained in:
Lars Brubaker 2014-02-04 15:11:20 -08:00
commit 6c4f4800f3
11 changed files with 108 additions and 55 deletions

View file

@ -1,9 +1,18 @@
<Properties> <Properties>
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" ActiveRuntime="Mono 2.10.6" /> <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
<MonoDevelop.Ide.Workbench> <MonoDevelop.Ide.Workbench ActiveDocument="SliceConfiguration\SliceSettingsWidget.cs">
<Files> <Files>
<File FileName="MatterControlApplication.cs" Line="164" Column="10" /> <File FileName="MatterControlApplication.cs" Line="1" Column="1" />
<File FileName="..\agg-sharp\OpenGlGui\TrackballTumbleWidget.cs" Line="1" Column="1" /> <File FileName="..\agg-sharp\OpenGlGui\TrackballTumbleWidget.cs" Line="1" Column="1" />
<File FileName="Localizations\LocalizedString.cs" Line="1" Column="1" />
<File FileName="MainSlidePanel.cs" Line="1" Column="1" />
<File FileName="WidescreenPanel.cs" Line="1" Column="1" />
<File FileName="SliceConfiguration\SettingsControlBar.cs" Line="34" Column="10" />
<File FileName="SliceConfiguration\ActiveSliceSettings.cs" Line="514" Column="109" />
<File FileName="SliceConfiguration\SliceSettingsLayerSelector.cs" Line="1" Column="1" />
<File FileName="SliceConfiguration\SliceSettingsOrganizer.cs" Line="286" Column="36" />
<File FileName="SliceConfiguration\SliceSettingsWidget.cs" Line="449" Column="118" />
<File FileName="PartPreviewWindow\GcodeViewBasic.cs" Line="1" Column="1" />
</Files> </Files>
</MonoDevelop.Ide.Workbench> </MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.DebuggingService.Breakpoints> <MonoDevelop.Ide.DebuggingService.Breakpoints>

View file

@ -46,6 +46,7 @@ using MatterHackers.GCodeVisualizer;
using MatterHackers.MatterControl.DataStorage; using MatterHackers.MatterControl.DataStorage;
using MatterHackers.MatterControl; using MatterHackers.MatterControl;
using MatterHackers.MatterControl.PrintQueue; using MatterHackers.MatterControl.PrintQueue;
using MatterHackers.Localizations;
namespace MatterHackers.MatterControl.PartPreviewWindow namespace MatterHackers.MatterControl.PartPreviewWindow
{ {
@ -100,7 +101,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
buttonBottomPanel.Padding = new BorderDouble(3, 3); buttonBottomPanel.Padding = new BorderDouble(3, 3);
buttonBottomPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; buttonBottomPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
generateGCodeButton = textImageButtonFactory.Generate("Generate"); generateGCodeButton = textImageButtonFactory.Generate(new LocalizedString("Generate").Translated);
generateGCodeButton.Click += new ButtonBase.ButtonEventHandler(generateButton_Click); generateGCodeButton.Click += new ButtonBase.ButtonEventHandler(generateButton_Click);
buttonBottomPanel.AddChild(generateGCodeButton); buttonBottomPanel.AddChild(generateGCodeButton);
@ -108,7 +109,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
layerSelectionButtonsPannel.HAnchor = HAnchor.ParentLeftRight; layerSelectionButtonsPannel.HAnchor = HAnchor.ParentLeftRight;
layerSelectionButtonsPannel.Padding = new BorderDouble(0); layerSelectionButtonsPannel.Padding = new BorderDouble(0);
closeButton = textImageButtonFactory.Generate("Close"); closeButton = textImageButtonFactory.Generate(new LocalizedString("Close").Translated);
layerSelectionButtonsPannel.AddChild(closeButton); layerSelectionButtonsPannel.AddChild(closeButton);
@ -117,7 +118,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
gcodeDispalyWidget = new GuiWidget(HAnchor.ParentLeftRight, Agg.UI.VAnchor.ParentBottomTop); gcodeDispalyWidget = new GuiWidget(HAnchor.ParentLeftRight, Agg.UI.VAnchor.ParentBottomTop);
string startingMessage = "Loading GCode..."; string startingMessage = new LocalizedString("Loading GCode...").Translated;
if (Path.GetExtension(printItem.FileLocation).ToUpper() == ".GCODE") if (Path.GetExtension(printItem.FileLocation).ToUpper() == ".GCODE")
{ {
gcodeDispalyWidget.AddChild(CreateGCodeViewWidget(printItem.FileLocation)); gcodeDispalyWidget.AddChild(CreateGCodeViewWidget(printItem.FileLocation));
@ -133,7 +134,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
} }
else else
{ {
startingMessage = "Press 'generate' to view layers"; startingMessage = "Press 'generate' to view layers";
} }
if (File.Exists(gcodePathAndFileName) && gcodeFileIsComplete) if (File.Exists(gcodePathAndFileName) && gcodeFileIsComplete)
@ -361,7 +362,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
layerInfoContainer.HAnchor = HAnchor.ParentLeftRight; layerInfoContainer.HAnchor = HAnchor.ParentLeftRight;
layerInfoContainer.Padding = new BorderDouble(5); layerInfoContainer.Padding = new BorderDouble(5);
layerInfoContainer.AddChild(new TextWidget("Layer Number:", textColor: RGBA_Bytes.White)); layerInfoContainer.AddChild(new TextWidget("Layer Number:", textColor: RGBA_Bytes.White));
layerInfoContainer.AddChild(new TextWidget("Layer Height:", textColor: RGBA_Bytes.White)); layerInfoContainer.AddChild(new TextWidget("Layer Height:", textColor: RGBA_Bytes.White));
layerInfoContainer.AddChild(new TextWidget("Num GCodes:", textColor: RGBA_Bytes.White)); layerInfoContainer.AddChild(new TextWidget("Num GCodes:", textColor: RGBA_Bytes.White));
layerInfoContainer.AddChild(new TextWidget("Filament Used:", textColor: RGBA_Bytes.White)); layerInfoContainer.AddChild(new TextWidget("Filament Used:", textColor: RGBA_Bytes.White));

View file

@ -38,6 +38,7 @@ using MatterHackers.Agg.UI;
using MatterHackers.VectorMath; using MatterHackers.VectorMath;
using MatterHackers.Agg.Image; using MatterHackers.Agg.Image;
using MatterHackers.MatterControl.DataStorage; using MatterHackers.MatterControl.DataStorage;
using MatterHackers.Localizations;
namespace MatterHackers.MatterControl.PrintLibrary namespace MatterHackers.MatterControl.PrintLibrary
{ {
@ -58,7 +59,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
public PluginChooserWindow() public PluginChooserWindow()
: base(360, 300) : base(360, 300)
{ {
Title = "Installed Plugins"; Title = new LocalizedString("Installed Plugins").Translated;
FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
topToBottom.AnchorAll(); topToBottom.AnchorAll();
@ -70,7 +71,8 @@ namespace MatterHackers.MatterControl.PrintLibrary
headerRow.Padding = new BorderDouble(0, 3, 0, 3); headerRow.Padding = new BorderDouble(0, 3, 0, 3);
{ {
TextWidget elementHeader = new TextWidget(string.Format("Select a Design Tool:"), pointSize: 14); string elementHeaderLbl = new LocalizedString ("Select a Design Tool:").Translated;
TextWidget elementHeader = new TextWidget(string.Format(elementHeaderLbl), pointSize: 14);
elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor; elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor;
elementHeader.HAnchor = HAnchor.ParentLeftRight; elementHeader.HAnchor = HAnchor.ParentLeftRight;
elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom; elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom;
@ -145,7 +147,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
//ShowAsSystemWindow(); //ShowAsSystemWindow();
Button cancelPresetsButton = textImageButtonFactory.Generate("Cancel"); Button cancelPresetsButton = textImageButtonFactory.Generate(new LocalizedString("Cancel").Translated);
cancelPresetsButton.Click += (sender, e) => { Close(); }; cancelPresetsButton.Click += (sender, e) => { Close(); };
FlowLayoutWidget buttonRow = new FlowLayoutWidget(); FlowLayoutWidget buttonRow = new FlowLayoutWidget();

View file

@ -81,6 +81,7 @@ namespace MatterHackers.MatterControl.PrintQueue
{ {
string labelName = textInfo.ToTitleCase(PrintItemWrapper.Name); string labelName = textInfo.ToTitleCase(PrintItemWrapper.Name);
labelName = labelName.Replace('_', ' '); labelName = labelName.Replace('_', ' ');
labelName = new LocalizedString (labelName).Translated;
partLabel = new TextWidget(labelName, pointSize: 14); partLabel = new TextWidget(labelName, pointSize: 14);
partLabel.TextColor = WidgetTextColor; partLabel.TextColor = WidgetTextColor;
partLabel.MinimumSize = new Vector2(1, 16); partLabel.MinimumSize = new Vector2(1, 16);

View file

@ -38,16 +38,16 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
contentRow.AddChild(printerComPortContainer); contentRow.AddChild(printerComPortContainer);
{ {
//Construct buttons //Construct buttons
nextButton = textImageButtonFactory.Generate("Done"); nextButton = textImageButtonFactory.Generate(new LocalizedString("Done").Translated);
nextButton.Click += new ButtonBase.ButtonEventHandler(NextButton_Click); nextButton.Click += new ButtonBase.ButtonEventHandler(NextButton_Click);
nextButton.Visible = false; nextButton.Visible = false;
connectButton = textImageButtonFactory.Generate("Connect"); connectButton = textImageButtonFactory.Generate(new LocalizedString("Connect").Translated);
connectButton.Click += new ButtonBase.ButtonEventHandler(ConnectButton_Click); connectButton.Click += new ButtonBase.ButtonEventHandler(ConnectButton_Click);
PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents); PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
refreshButton = textImageButtonFactory.Generate("Refresh"); refreshButton = textImageButtonFactory.Generate(new LocalizedString("Refresh").Translated);
refreshButton.Click += new ButtonBase.ButtonEventHandler(RefreshButton_Click); refreshButton.Click += new ButtonBase.ButtonEventHandler(RefreshButton_Click);
GuiWidget hSpacer = new GuiWidget(); GuiWidget hSpacer = new GuiWidget();
@ -207,7 +207,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{ {
printerComPortHelpLink.Visible = false; printerComPortHelpLink.Visible = false;
printerComPortError.TextColor = RGBA_Bytes.Red; printerComPortError.TextColor = RGBA_Bytes.Red;
printerComPortError.Text = "Uh-oh! Could not connect to printer."; printerComPortError.Text = new LocalizedString("Uh-oh! Could not connect to printer.").Translated;
connectButton.Visible = true; connectButton.Visible = true;
nextButton.Visible = false; nextButton.Visible = false;
} }
@ -216,7 +216,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{ {
printerComPortHelpLink.Visible = false; printerComPortHelpLink.Visible = false;
printerComPortError.TextColor = RGBA_Bytes.White; printerComPortError.TextColor = RGBA_Bytes.White;
printerComPortError.Text = "Connection succeeded!"; printerComPortError.Text = new LocalizedString("Connection succeeded!").Translated;
nextButton.Visible = true; nextButton.Visible = true;
connectButton.Visible = false; connectButton.Visible = false;
} }
@ -264,7 +264,9 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
this.ActivePrinter.Commit(); this.ActivePrinter.Commit();
printerComPortHelpLink.Visible = false; printerComPortHelpLink.Visible = false;
printerComPortError.TextColor = RGBA_Bytes.White; printerComPortError.TextColor = RGBA_Bytes.White;
printerComPortError.Text = "Attempting to connect..."; string printerComPortErrorLbl = new LocalizedString("Attempting to connect").Translated;
string printerComPortErrorLblFull = string.Format("{0}...",printerComPortErrorLbl);
printerComPortError.Text = printerComPortErrorLblFull;
PrinterCommunication.Instance.ActivePrinter = this.ActivePrinter; PrinterCommunication.Instance.ActivePrinter = this.ActivePrinter;
PrinterCommunication.Instance.ConnectToActivePrinter(); PrinterCommunication.Instance.ConnectToActivePrinter();
connectButton.Visible = false; connectButton.Visible = false;
@ -293,7 +295,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
return button.PortValue; return button.PortValue;
} }
} }
throw new Exception("Could not find a selected button."); throw new Exception(new LocalizedString("Could not find a selected button.").Translated);
} }
} }
} }

View file

@ -56,12 +56,18 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
printerMessageOne.HAnchor = HAnchor.ParentLeftRight; printerMessageOne.HAnchor = HAnchor.ParentLeftRight;
printerMessageOne.Margin = elementMargin; printerMessageOne.Margin = elementMargin;
TextWidget printerMessageTwo = new TextWidget(new LocalizedString("1.) Disconnect printer (if currently connected).").Translated, 0, 0, 12); string printerMessageTwoTxt = new LocalizedString("Disconnect printer").Translated;
string printerMessageTwoTxtEnd = new LocalizedString("if currently connected").Translated;
string printerMessageTwoTxtFull = string.Format ("1.) {0} ({1}).", printerMessageTwoTxt, printerMessageTwoTxtEnd);
TextWidget printerMessageTwo = new TextWidget(printerMessageTwoTxtFull, 0, 0, 12);
printerMessageTwo.TextColor = RGBA_Bytes.White; printerMessageTwo.TextColor = RGBA_Bytes.White;
printerMessageTwo.HAnchor = HAnchor.ParentLeftRight; printerMessageTwo.HAnchor = HAnchor.ParentLeftRight;
printerMessageTwo.Margin = elementMargin; printerMessageTwo.Margin = elementMargin;
TextWidget printerMessageThree = new TextWidget(new LocalizedString("2.) Press 'Continue'.").Translated, 0, 0, 12); string printerMessageThreeTxt = new LocalizedString("Press").Translated;
string printerMessageThreeTxtEnd = new LocalizedString ("Continue").Translated;
string printerMessageThreeFull = string.Format ("2.) {0} '{1}'.", printerMessageThreeTxt, printerMessageThreeTxtEnd);
TextWidget printerMessageThree = new TextWidget(printerMessageThreeFull, 0, 0, 12);
printerMessageThree.TextColor = RGBA_Bytes.White; printerMessageThree.TextColor = RGBA_Bytes.White;
printerMessageThree.HAnchor = HAnchor.ParentLeftRight; printerMessageThree.HAnchor = HAnchor.ParentLeftRight;
printerMessageThree.Margin = elementMargin; printerMessageThree.Margin = elementMargin;

View file

@ -13,6 +13,7 @@ using MatterHackers.PolygonMesh;
using MatterHackers.RenderOpenGl; using MatterHackers.RenderOpenGl;
using MatterHackers.VectorMath; using MatterHackers.VectorMath;
using MatterHackers.MatterControl.DataStorage; using MatterHackers.MatterControl.DataStorage;
using MatterHackers.Localizations;
namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{ {
@ -33,11 +34,11 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
contentRow.AddChild(createPrinterConnectionMessageContainer()); contentRow.AddChild(createPrinterConnectionMessageContainer());
{ {
//Construct buttons //Construct buttons
nextButton = textImageButtonFactory.Generate("Done"); nextButton = textImageButtonFactory.Generate(new LocalizedString("Done").Translated);
nextButton.Click += new ButtonBase.ButtonEventHandler(NextButton_Click); nextButton.Click += new ButtonBase.ButtonEventHandler(NextButton_Click);
nextButton.Visible = false; nextButton.Visible = false;
connectButton = textImageButtonFactory.Generate("Connect"); connectButton = textImageButtonFactory.Generate(new LocalizedString("Connect").Translated);
connectButton.Click += new ButtonBase.ButtonEventHandler(ConnectButton_Click); connectButton.Click += new ButtonBase.ButtonEventHandler(ConnectButton_Click);
PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents); PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
@ -70,28 +71,40 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
container.Margin = new BorderDouble(5); container.Margin = new BorderDouble(5);
BorderDouble elementMargin = new BorderDouble(top: 5); BorderDouble elementMargin = new BorderDouble(top: 5);
TextWidget printerMessageOne = new TextWidget("MatterControl will now attempt to auto-detect printer.", 0, 0, 10); string printerMessageOneText = new LocalizedString ("MatterControl will now attempt to auto-detect printer.").Translated;
TextWidget printerMessageOne = new TextWidget(printerMessageOneText, 0, 0, 10);
printerMessageOne.Margin = new BorderDouble(0, 10, 0, 5); printerMessageOne.Margin = new BorderDouble(0, 10, 0, 5);
printerMessageOne.TextColor = RGBA_Bytes.White; printerMessageOne.TextColor = RGBA_Bytes.White;
printerMessageOne.HAnchor = HAnchor.ParentLeftRight; printerMessageOne.HAnchor = HAnchor.ParentLeftRight;
printerMessageOne.Margin = elementMargin; printerMessageOne.Margin = elementMargin;
TextWidget printerMessageTwo = new TextWidget("1.) Disconnect printer (if currently connected).", 0, 0, 12); string printerMessageTwoTxtBeg = new LocalizedString ("Disconnect printer").Translated;
string printerMessageTwoTxtEnd = new LocalizedString ("if currently connected").Translated;
string printerMessageTwoTxtFull = string.Format ("1.) {0} ({1}).", printerMessageTwoTxtBeg, printerMessageTwoTxtEnd);
TextWidget printerMessageTwo = new TextWidget(printerMessageTwoTxtFull, 0, 0, 12);
printerMessageTwo.TextColor = RGBA_Bytes.White; printerMessageTwo.TextColor = RGBA_Bytes.White;
printerMessageTwo.HAnchor = HAnchor.ParentLeftRight; printerMessageTwo.HAnchor = HAnchor.ParentLeftRight;
printerMessageTwo.Margin = elementMargin; printerMessageTwo.Margin = elementMargin;
TextWidget printerMessageThree = new TextWidget("2.) Press 'Continue'.", 0, 0, 12); string printerMessageThreeTxtBeg = new LocalizedString ("Press").Translated;
string printerMessageThreeTxtEnd = new LocalizedString ("Continue").Translated;
string printerMessageThreeTxtFull = string.Format ("2.) {0} '{1}'.", printerMessageThreeTxtBeg, printerMessageThreeTxtEnd);
TextWidget printerMessageThree = new TextWidget(printerMessageThreeTxtFull, 0, 0, 12);
printerMessageThree.TextColor = RGBA_Bytes.White; printerMessageThree.TextColor = RGBA_Bytes.White;
printerMessageThree.HAnchor = HAnchor.ParentLeftRight; printerMessageThree.HAnchor = HAnchor.ParentLeftRight;
printerMessageThree.Margin = elementMargin; printerMessageThree.Margin = elementMargin;
TextWidget printerMessageFour = new TextWidget("3.) Power on and connect printer.", 0, 0, 12); string printerMessageFourBeg = new LocalizedString ("Power on and connect printer").Translated;
string printerMessageFourFull = string.Format ("3.) {0}.", printerMessageFourBeg);
TextWidget printerMessageFour = new TextWidget(printerMessageFourFull, 0, 0, 12);
printerMessageFour.TextColor = RGBA_Bytes.White; printerMessageFour.TextColor = RGBA_Bytes.White;
printerMessageFour.HAnchor = HAnchor.ParentLeftRight; printerMessageFour.HAnchor = HAnchor.ParentLeftRight;
printerMessageFour.Margin = elementMargin; printerMessageFour.Margin = elementMargin;
TextWidget printerMessageFive = new TextWidget("4.) Press 'Connect'.", 0, 0, 12); string printerMessageFiveTxtBeg = new LocalizedString ("Press").Translated;
string printerMessageFiveTxtEnd = new LocalizedString ("Connect").Translated;
string printerMessageFiveTxtFull = string.Format ("4.) {0} '{1}'.", printerMessageFiveTxtBeg, printerMessageFiveTxtEnd);
TextWidget printerMessageFive = new TextWidget(printerMessageFiveTxtFull, 0, 0, 12);
printerMessageFive.TextColor = RGBA_Bytes.White; printerMessageFive.TextColor = RGBA_Bytes.White;
printerMessageFive.HAnchor = HAnchor.ParentLeftRight; printerMessageFive.HAnchor = HAnchor.ParentLeftRight;
printerMessageFive.Margin = elementMargin; printerMessageFive.Margin = elementMargin;
@ -99,7 +112,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
GuiWidget vSpacer = new GuiWidget(); GuiWidget vSpacer = new GuiWidget();
vSpacer.VAnchor = VAnchor.ParentBottomTop; vSpacer.VAnchor = VAnchor.ParentBottomTop;
Button manualLink = linkButtonFactory.Generate("Manual Configuration"); Button manualLink = linkButtonFactory.Generate(new LocalizedString("Manual Configuration").Translated);
manualLink.Margin = new BorderDouble(0, 5); manualLink.Margin = new BorderDouble(0, 5);
manualLink.Click += new ButtonBase.ButtonEventHandler(ManualLink_Click); manualLink.Click += new ButtonBase.ButtonEventHandler(ManualLink_Click);
@ -148,13 +161,16 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
if (candidatePort == null) if (candidatePort == null)
{ {
printerErrorMessage.TextColor = RGBA_Bytes.Red; printerErrorMessage.TextColor = RGBA_Bytes.Red;
printerErrorMessage.Text = "Oops! Printer could not be detected."; string printerErrorMessageLblFull = new LocalizedString ("Oops! Printer could not be detected ").Translated;
printerErrorMessage.Text = printerErrorMessageLblFull;
} }
else else
{ {
ActivePrinter.ComPort = candidatePort; ActivePrinter.ComPort = candidatePort;
printerErrorMessage.TextColor = RGBA_Bytes.White; printerErrorMessage.TextColor = RGBA_Bytes.White;
printerErrorMessage.Text = "Attempting to connect..."; string printerErrorMessageLblTwo = new LocalizedString ("Attempting to connect").Translated;
string printerErrorMessageLblTwoFull = string.Format("{0}...",printerErrorMessageLblTwo);
printerErrorMessage.Text = printerErrorMessageLblTwoFull;
this.ActivePrinter.Commit(); this.ActivePrinter.Commit();
PrinterCommunication.Instance.ActivePrinter = this.ActivePrinter; PrinterCommunication.Instance.ActivePrinter = this.ActivePrinter;
PrinterCommunication.Instance.ConnectToActivePrinter(); PrinterCommunication.Instance.ConnectToActivePrinter();
@ -178,7 +194,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
void onConnectionFailed() void onConnectionFailed()
{ {
printerErrorMessage.TextColor = RGBA_Bytes.Red; printerErrorMessage.TextColor = RGBA_Bytes.Red;
printerErrorMessage.Text = "Uh-oh! Could not connect to printer."; printerErrorMessage.Text = new LocalizedString("Uh-oh! Could not connect to printer.").Translated;
connectButton.Visible = true; connectButton.Visible = true;
nextButton.Visible = false; nextButton.Visible = false;
} }
@ -186,7 +202,9 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
void onConnectionSuccess() void onConnectionSuccess()
{ {
printerErrorMessage.TextColor = RGBA_Bytes.White; printerErrorMessage.TextColor = RGBA_Bytes.White;
printerErrorMessage.Text = "Connection succeeded!"; string printerErrorMessageLblThree = new LocalizedString ("Connection succeeded").Translated;
string printerErrorMessageLblThreeFull = string.Format ("{0}!", printerErrorMessageLblThree);
printerErrorMessage.Text = printerErrorMessageLblThreeFull;
nextButton.Visible = true; nextButton.Visible = true;
connectButton.Visible = false; connectButton.Visible = false;
} }

View file

@ -10,6 +10,7 @@ using MatterHackers.Agg.UI;
using MatterHackers.VectorMath; using MatterHackers.VectorMath;
using MatterHackers.MatterControl.ContactForm; using MatterHackers.MatterControl.ContactForm;
using MatterHackers.MatterControl.DataStorage; using MatterHackers.MatterControl.DataStorage;
using MatterHackers.Localizations;
namespace MatterHackers.MatterControl namespace MatterHackers.MatterControl
{ {
@ -510,7 +511,7 @@ namespace MatterHackers.MatterControl
{ {
string error = "'Layer Height' must be less than or equal to the 'Nozzle Diameter'."; string error = "'Layer Height' must be less than or equal to the 'Nozzle Diameter'.";
string details = string.Format("Layer Height = {0}\nNozzle Diameter = {1}", LayerHeight, NozzleDiameter); string details = string.Format("Layer Height = {0}\nNozzle Diameter = {1}", LayerHeight, NozzleDiameter);
string location = "Location: 'Advanced Controls' -> 'Slice Settings' -> 'Print' -> 'Layers/Perimeters'"; string location = "Location: 'Advanced Controls' -> 'Slice Settings' -> 'Print' -> 'Layers/Perimeters'";
StyledMessageBox.ShowMessageBox(string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error"); StyledMessageBox.ShowMessageBox(string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error");
return false; return false;
} }

View file

@ -11,6 +11,7 @@ using Newtonsoft.Json.Utilities;
using MatterHackers.Agg; using MatterHackers.Agg;
using MatterHackers.Agg.UI; using MatterHackers.Agg.UI;
using MatterHackers.VectorMath; using MatterHackers.VectorMath;
using MatterHackers.Localizations;
namespace MatterHackers.MatterControl namespace MatterHackers.MatterControl
{ {
@ -51,7 +52,11 @@ namespace MatterHackers.MatterControl
settingsStatusLabelContainer.VAnchor |= VAnchor.ParentTop; settingsStatusLabelContainer.VAnchor |= VAnchor.ParentTop;
settingsStatusLabelContainer.Margin = new BorderDouble(0); settingsStatusLabelContainer.Margin = new BorderDouble(0);
{ {
TextWidget settingsStatusLabel = new TextWidget(string.Format("Active Settings:"), pointSize: 10); string activeSettingsLabelText = new LocalizedString ("Active Settings:").Translated;
string activeSettingsLabelTextFull = string.Format ("{0}:", activeSettingsLabelText);
TextWidget settingsStatusLabel = new TextWidget(string.Format(activeSettingsLabelTextFull), pointSize: 10);
settingsStatusLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; settingsStatusLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
settingsStatusDescription = new TextWidget("", pointSize: 14); settingsStatusDescription = new TextWidget("", pointSize: 14);
@ -70,19 +75,19 @@ namespace MatterHackers.MatterControl
settingsStatusLabelContainer.AddChild(unsavedChangesIndicator); settingsStatusLabelContainer.AddChild(unsavedChangesIndicator);
} }
saveButton = textImageButtonFactory.Generate("Save"); saveButton = textImageButtonFactory.Generate(new LocalizedString("Save").Translated);
saveButton.VAnchor = VAnchor.ParentTop; saveButton.VAnchor = VAnchor.ParentTop;
saveButton.Visible = false; saveButton.Visible = false;
saveButton.Margin = new BorderDouble(0, 0, 0, 10); saveButton.Margin = new BorderDouble(0, 0, 0, 10);
saveButton.Click += new ButtonBase.ButtonEventHandler(saveButton_Click); saveButton.Click += new ButtonBase.ButtonEventHandler(saveButton_Click);
revertbutton = textImageButtonFactory.Generate("Revert"); revertbutton = textImageButtonFactory.Generate(new LocalizedString("Revert").Translated);
revertbutton.VAnchor = VAnchor.ParentTop; revertbutton.VAnchor = VAnchor.ParentTop;
revertbutton.Visible = false; revertbutton.Visible = false;
revertbutton.Margin = new BorderDouble(0,0,0,10); revertbutton.Margin = new BorderDouble(0,0,0,10);
revertbutton.Click += new ButtonBase.ButtonEventHandler(revertbutton_Click); revertbutton.Click += new ButtonBase.ButtonEventHandler(revertbutton_Click);
SliceOptionsMenuDropList = new DropDownMenu("Options "); SliceOptionsMenuDropList = new DropDownMenu(new LocalizedString("Options ").Translated);
SliceOptionsMenuDropList.Margin = new BorderDouble(top: 11); SliceOptionsMenuDropList.Margin = new BorderDouble(top: 11);
SliceOptionsMenuDropList.VAnchor |= VAnchor.ParentTop; SliceOptionsMenuDropList.VAnchor |= VAnchor.ParentTop;
SliceOptionsMenuDropList.HoverColor = new RGBA_Bytes(0, 0, 0, 50); SliceOptionsMenuDropList.HoverColor = new RGBA_Bytes(0, 0, 0, 50);
@ -97,7 +102,9 @@ namespace MatterHackers.MatterControl
sliceEngineContainer.Margin = new BorderDouble(0,0,10,0); sliceEngineContainer.Margin = new BorderDouble(0,0,10,0);
sliceEngineContainer.VAnchor |= VAnchor.ParentTop; sliceEngineContainer.VAnchor |= VAnchor.ParentTop;
{ {
TextWidget sliceEngineLabel = new TextWidget(string.Format("Slice Engine:"), pointSize: 10); string sliceEngineLabelText = new LocalizedString ("Slice Engine").Translated;
string sliceEngineLabelTextFull = string.Format ("{0}:", sliceEngineLabelText);
TextWidget sliceEngineLabel = new TextWidget(string.Format(sliceEngineLabelTextFull), pointSize: 10);
sliceEngineLabel.Margin = new BorderDouble(0); sliceEngineLabel.Margin = new BorderDouble(0);
sliceEngineLabel.HAnchor = HAnchor.ParentLeft; sliceEngineLabel.HAnchor = HAnchor.ParentLeft;
sliceEngineLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; sliceEngineLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
@ -204,7 +211,7 @@ namespace MatterHackers.MatterControl
//Set the name and callback function of the menu items //Set the name and callback function of the menu items
slicerOptionsMenuItems = new TupleList<string, Func<bool>> slicerOptionsMenuItems = new TupleList<string, Func<bool>>
{ {
{"Import", ImportQueueMenu_Click}, {"Import", ImportQueueMenu_Click},
{"Export", ExportQueueMenu_Click}, {"Export", ExportQueueMenu_Click},
}; };

View file

@ -13,6 +13,7 @@ using MatterHackers.Agg;
using MatterHackers.Agg.UI; using MatterHackers.Agg.UI;
using MatterHackers.VectorMath; using MatterHackers.VectorMath;
using MatterHackers.MatterControl.DataStorage; using MatterHackers.MatterControl.DataStorage;
using MatterHackers.Localizations;
namespace MatterHackers.MatterControl namespace MatterHackers.MatterControl
{ {
@ -62,7 +63,7 @@ namespace MatterHackers.MatterControl
this.SlicerConfigName = slicerConfigName; this.SlicerConfigName = slicerConfigName;
this.PresentationName = presentationName; this.PresentationName = presentationName;
this.DataEditType = dataEditType; this.DataEditType = dataEditType;
this.HelpText = helpText; this.HelpText = new LocalizedString(helpText).Translated;
} }
} }
@ -192,10 +193,10 @@ namespace MatterHackers.MatterControl
return instance; return instance;
} }
} }
SliceSettingsOrganizer() SliceSettingsOrganizer()
{ {
string layouts = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "SliceSettings", "Layouts.txt"); string layouts = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "SliceSettings", "Layouts.txt");
string properties = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "SliceSettings", "Properties.txt"); string properties = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "SliceSettings", "Properties.txt");
LoadAndParseSettingsFiles(properties, layouts); LoadAndParseSettingsFiles(properties, layouts);
@ -259,7 +260,7 @@ namespace MatterHackers.MatterControl
sw.Close(); sw.Close();
} }
void LoadAndParseSettingsFiles(string properties, string layouts) void LoadAndParseSettingsFiles(string properties, string layout)
{ {
{ {
string propertiesFileContents = ""; string propertiesFileContents = "";
@ -282,14 +283,14 @@ namespace MatterHackers.MatterControl
} }
{ {
string layoutFileContents = ""; string layoutFileContents = "";
using (FileStream fileStream = new FileStream(layouts, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) using (FileStream fileStream = new FileStream(layout, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{ {
using (StreamReader layoutReader = new StreamReader(fileStream)) using (StreamReader layoutReader = new StreamReader(fileStream))
{ {
layoutFileContents = layoutReader.ReadToEnd(); layoutFileContents = layoutReader.ReadToEnd();
} }
} }
OrganizerUserLevel userLevelToAddTo = null; OrganizerUserLevel userLevelToAddTo = null;
OrganizerCategory categoryToAddTo = null; OrganizerCategory categoryToAddTo = null;

View file

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -38,7 +38,7 @@ namespace MatterHackers.MatterControl
public UiState(SliceSettingsWidget settingsToCopy) public UiState(SliceSettingsWidget settingsToCopy)
{ {
showHelp = settingsToCopy.ShowingHelp; showHelp = settingsToCopy.ShowingHelp;
userLevel = settingsToCopy.UserLevel; userLevel = settingsToCopy.UserLevel;
settingsToCopy.CurrentlyActiveCategory(out selectedCategory.index, out selectedCategory.name); settingsToCopy.CurrentlyActiveCategory(out selectedCategory.index, out selectedCategory.name);
settingsToCopy.CurrentlyActiveGroup(out selectedGroup.index, out selectedGroup.name); settingsToCopy.CurrentlyActiveGroup(out selectedGroup.index, out selectedGroup.name);
@ -103,10 +103,10 @@ namespace MatterHackers.MatterControl
{ {
int minSettingNameWidth = 220; int minSettingNameWidth = 220;
showHelpBox = new CheckBox("Show Help"); showHelpBox = new CheckBox(new LocalizedString("Show Help").Translated);
showHelpBox.Checked = uiState.showHelp; showHelpBox.Checked = uiState.showHelp;
showAllDetails = new CheckBox("Show All Settings"); showAllDetails = new CheckBox(new LocalizedString("Show All Settings").Translated);
showAllDetails.Checked = uiState.userLevel == "Advanced"; showAllDetails.Checked = uiState.userLevel == "Advanced";
FlowLayoutWidget pageTopToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom, vAnchor: Agg.UI.VAnchor.ParentTop); FlowLayoutWidget pageTopToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom, vAnchor: Agg.UI.VAnchor.ParentTop);
@ -140,7 +140,8 @@ namespace MatterHackers.MatterControl
for (int categoryIndex = 0; categoryIndex < SliceSettingsOrganizer.Instance.UserLevels[UserLevel].CategoriesList.Count; categoryIndex++) for (int categoryIndex = 0; categoryIndex < SliceSettingsOrganizer.Instance.UserLevels[UserLevel].CategoriesList.Count; categoryIndex++)
{ {
OrganizerCategory category = SliceSettingsOrganizer.Instance.UserLevels[UserLevel].CategoriesList[categoryIndex]; OrganizerCategory category = SliceSettingsOrganizer.Instance.UserLevels[UserLevel].CategoriesList[categoryIndex];
TabPage categoryPage = new TabPage(category.Name); string categoryPageLbl = new LocalizedString (category.Name).Translated;
TabPage categoryPage = new TabPage(categoryPageLbl);
SimpleTextTabWidget textTabWidget = new SimpleTextTabWidget(categoryPage, 16, SimpleTextTabWidget textTabWidget = new SimpleTextTabWidget(categoryPage, 16,
ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes()); ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes());
categoryPage.AnchorAll(); categoryPage.AnchorAll();
@ -205,7 +206,7 @@ namespace MatterHackers.MatterControl
showHelpBox.Cursor = Cursors.Hand; showHelpBox.Cursor = Cursors.Hand;
showHelpBox.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(RebuildSlicerSettings); showHelpBox.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(RebuildSlicerSettings);
categoryTabs.TabBar.AddChild(showHelpBox); categoryTabs.TabBar.AddChild(showHelpBox);
} }
pageTopToBottomLayout.AddChild(categoryTabs); pageTopToBottomLayout.AddChild(categoryTabs);
@ -286,7 +287,8 @@ namespace MatterHackers.MatterControl
foreach (OrganizerGroup group in category.GroupsList) foreach (OrganizerGroup group in category.GroupsList)
{ {
tabIndexForItem = 0; tabIndexForItem = 0;
TabPage groupTabPage = new TabPage(group.Name); string groupTabLbl = new LocalizedString (group.Name).Translated;
TabPage groupTabPage = new TabPage(groupTabLbl);
SimpleTextTabWidget groupTabWidget = new SimpleTextTabWidget(groupTabPage, 14, SimpleTextTabWidget groupTabWidget = new SimpleTextTabWidget(groupTabPage, 14,
ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes()); ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes());
@ -319,7 +321,8 @@ namespace MatterHackers.MatterControl
if (addedSettingToSubGroup) if (addedSettingToSubGroup)
{ {
needToAddSubGroup = true; needToAddSubGroup = true;
GroupBox groupBox = new GroupBox(subGroup.Name); string groupBoxLbl = new LocalizedString (subGroup.Name).Translated;
GroupBox groupBox = new GroupBox (groupBoxLbl);
groupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; groupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor;
groupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; groupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
groupBox.AddChild(topToBottomSettings); groupBox.AddChild(topToBottomSettings);
@ -360,6 +363,7 @@ namespace MatterHackers.MatterControl
allText.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay; allText.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay;
double helpPointSize = 10; double helpPointSize = 10;
string[] wrappedText = TypeFacePrinter.WrapText(settingInfo.HelpText, textRegionWidth - allText.Padding.Width, helpPointSize); string[] wrappedText = TypeFacePrinter.WrapText(settingInfo.HelpText, textRegionWidth - allText.Padding.Width, helpPointSize);
foreach(string line in wrappedText) foreach(string line in wrappedText)
{ {
@ -449,6 +453,7 @@ namespace MatterHackers.MatterControl
{ {
string convertedNewLines = settingData.PresentationName.Replace("\\n ", "\n"); string convertedNewLines = settingData.PresentationName.Replace("\\n ", "\n");
convertedNewLines = convertedNewLines.Replace("\\n", "\n"); convertedNewLines = convertedNewLines.Replace("\\n", "\n");
convertedNewLines = new LocalizedString (convertedNewLines).Translated;
TextWidget settingName = new TextWidget(convertedNewLines); TextWidget settingName = new TextWidget(convertedNewLines);
settingName.TextColor = ActiveTheme.Instance.PrimaryTextColor; settingName.TextColor = ActiveTheme.Instance.PrimaryTextColor;
settingName.Width = minSettingNameWidth; settingName.Width = minSettingNameWidth;