diff --git a/ConfigurationPage/ConfigurationPage.cs b/ConfigurationPage/ConfigurationPage.cs index d835facc7..bec082f3a 100644 --- a/ConfigurationPage/ConfigurationPage.cs +++ b/ConfigurationPage/ConfigurationPage.cs @@ -117,15 +117,11 @@ namespace MatterHackers.MatterControl } Button restartButton; - Dictionary languageDict; private void AddLanguageControls(FlowLayoutWidget controlsTopToBottomLayout) { - CreateLanguageDict(); - DisableableWidget container = new DisableableWidget(); - GroupBox languageControlsGroupBox = new GroupBox(LocalizedString.Get("Language Settings")); languageControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; languageControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; @@ -137,22 +133,7 @@ namespace MatterHackers.MatterControl FlowLayoutWidget controlsContainer = new FlowLayoutWidget(); controlsContainer.HAnchor = HAnchor.ParentLeftRight; - string languageCode = UserSettings.Instance.get("Language"); - string languageVerbose = "Default"; - - foreach(KeyValuePair entry in languageDict) - { - if (languageCode == entry.Value) - { - languageVerbose = entry.Key; - } - } - - LanguageSelector languageSelector = new LanguageSelector(languageVerbose); - foreach (KeyValuePair entry in languageDict) - { - languageSelector.AddItem(entry.Key,entry.Value); - } + LanguageSelector languageSelector = new LanguageSelector(); languageSelector.Margin = new BorderDouble(0); languageSelector.SelectionChanged += new EventHandler(LanguageDropList_SelectionChanged); @@ -182,22 +163,17 @@ namespace MatterHackers.MatterControl UiThread.RunOnIdle((state) => { //horrible hack - to be replaced - MatterControlApplication app = (MatterControlApplication)this.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent; + GuiWidget parent = this; + while (parent as MatterControlApplication == null) + { + parent = parent.Parent; + } + MatterControlApplication app = parent as MatterControlApplication; app.RestartOnClose = true; app.Close(); }); } - private void CreateLanguageDict() - { - languageDict = new Dictionary(); - languageDict["Default"] = "EN"; - languageDict["English"] = "EN"; - languageDict["Español"] = "ES"; - languageDict["Français"] = "FR"; - languageDict["Deutsch"] = "DE"; - } - private void LanguageDropList_SelectionChanged(object sender, EventArgs e) { string languageCode = ((DropDownList)sender).SelectedLabel; diff --git a/ConfigurationPage/LanguageSelector.cs b/ConfigurationPage/LanguageSelector.cs index 8fbdf4136..8c43a3ee3 100644 --- a/ConfigurationPage/LanguageSelector.cs +++ b/ConfigurationPage/LanguageSelector.cs @@ -10,17 +10,15 @@ using MatterHackers.VectorMath; using MatterHackers.MatterControl.DataStorage; using MatterHackers.Localizations; - namespace MatterHackers.MatterControl { public class LanguageSelector : StyledDropDownList - { + { + Dictionary languageDict; - public LanguageSelector(string selection) - : base(selection) + public LanguageSelector() + : base("Default") { - - //string pathToModels = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "PrinterSettings", manufacturer); //if (Directory.Exists(pathToModels)) //{ @@ -32,7 +30,34 @@ namespace MatterHackers.MatterControl //} this.MinimumSize = new Vector2(this.LocalBounds.Width, this.LocalBounds.Height); + + CreateLanguageDict(); + + string languageCode = UserSettings.Instance.get("Language"); + + foreach (KeyValuePair entry in languageDict) + { + AddItem(entry.Key, entry.Value); + } + + foreach (KeyValuePair entry in languageDict) + { + if (languageCode == entry.Value) + { + SelectedLabel = entry.Key; + break; + } + } + } + + private void CreateLanguageDict() + { + languageDict = new Dictionary(); + languageDict["Default"] = "EN"; + languageDict["English"] = "EN"; + languageDict["Español"] = "ES"; + languageDict["Français"] = "FR"; + languageDict["Deutsch"] = "DE"; } } - } diff --git a/Launcher/Launcher.cs b/Launcher/Launcher.cs new file mode 100644 index 000000000..14744064e --- /dev/null +++ b/Launcher/Launcher.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Linq; +using System.Text; +using System.IO; +using System.Diagnostics; + +namespace MatterHackers.MatterControl.Launcher +{ + public class LauncherApp + { + public LauncherApp() + { + } + + [STAThread] + public static void Main(string[] args) + { + if (args.Length == 2 && File.Exists(args[0])) + { + ProcessStartInfo runAppLauncherStartInfo = new ProcessStartInfo(); + runAppLauncherStartInfo.FileName = args[0]; + + int timeToWait = 0; + int.TryParse(args[1], out timeToWait); + + Stopwatch waitTime = new Stopwatch(); + waitTime.Start(); + while (waitTime.ElapsedMilliseconds < timeToWait) + { + } + + Process.Start(runAppLauncherStartInfo); + } + } + } +} diff --git a/Launcher/Launcher.csproj b/Launcher/Launcher.csproj new file mode 100644 index 000000000..c7401dcc9 --- /dev/null +++ b/Launcher/Launcher.csproj @@ -0,0 +1,50 @@ + + + + Release + AnyCPU + 8.0.50727 + 2.0 + Exe + bin\Release\ + Properties + MatterHackers.MatterControl.Launcher + Launcher + + + + + 2.0 + 0.8.2 + + + True + full + False + bin\Debug\ + DEBUG;TRACE + prompt + 4 + True + AnyCPU + + + pdbonly + True + TRACE + prompt + 4 + True + AnyCPU + + + + + + + + + + + + \ No newline at end of file diff --git a/MatterControl.csproj b/MatterControl.csproj index 38fc1d61f..eff377183 100644 --- a/MatterControl.csproj +++ b/MatterControl.csproj @@ -316,6 +316,10 @@ {AE37DE1F-22F7-49EE-8732-FC6BC8DC58D9} Tesselate + + {3DF4CB3D-9A03-4256-9A81-70523AAD828B} + Launcher + {990A9AD3-B6A4-407B-9DFC-9C722AF7C9B9} InfInstaller diff --git a/MatterControl.sln b/MatterControl.sln index e0ac77f0b..609afede1 100644 --- a/MatterControl.sln +++ b/MatterControl.sln @@ -58,6 +58,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OutlineCreator", "..\Matter EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MatterSlice", "..\MatterSlice\MatterSlice.csproj", "{C46CA728-DD2F-4DD1-971A-AAA89D9DFF95}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Launcher", "Launcher\Launcher.csproj", "{3DF4CB3D-9A03-4256-9A81-70523AAD828B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -224,6 +226,12 @@ Global {C46CA728-DD2F-4DD1-971A-AAA89D9DFF95}.Release|Any CPU.ActiveCfg = Release|Any CPU {C46CA728-DD2F-4DD1-971A-AAA89D9DFF95}.Release|Any CPU.Build.0 = Release|Any CPU {C46CA728-DD2F-4DD1-971A-AAA89D9DFF95}.Release|x86.ActiveCfg = Release|Any CPU + {3DF4CB3D-9A03-4256-9A81-70523AAD828B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3DF4CB3D-9A03-4256-9A81-70523AAD828B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3DF4CB3D-9A03-4256-9A81-70523AAD828B}.Debug|x86.ActiveCfg = Debug|Any CPU + {3DF4CB3D-9A03-4256-9A81-70523AAD828B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3DF4CB3D-9A03-4256-9A81-70523AAD828B}.Release|Any CPU.Build.0 = Release|Any CPU + {3DF4CB3D-9A03-4256-9A81-70523AAD828B}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/MatterControlApplication.cs b/MatterControlApplication.cs index eadd37549..f14c7145e 100644 --- a/MatterControlApplication.cs +++ b/MatterControlApplication.cs @@ -322,6 +322,19 @@ namespace MatterHackers.MatterControl Datastore.Instance.Exit(); PrinterCommunication.Instance.HaltConnectionThread(); SlicingQueue.Instance.ShutDownSlicingThread(); + if (RestartOnClose) + { + string appPathAndFile = System.Reflection.Assembly.GetExecutingAssembly().Location; + string pathToAppFolder = Path.GetDirectoryName(appPathAndFile); + + ProcessStartInfo runAppLauncherStartInfo = new ProcessStartInfo(); + runAppLauncherStartInfo.Arguments = "\"{0}\" \"{1}\"".FormatWith(appPathAndFile, 1000); + runAppLauncherStartInfo.FileName = Path.Combine(pathToAppFolder, "Launcher.exe"); + runAppLauncherStartInfo.WindowStyle = ProcessWindowStyle.Hidden; + runAppLauncherStartInfo.CreateNoWindow = true; + + Process.Start(runAppLauncherStartInfo); + } base.OnClosed(e); } diff --git a/StaticData/Translations/Master.txt b/StaticData/Translations/Master.txt index 9890882e8..0ccb37324 100644 --- a/StaticData/Translations/Master.txt +++ b/StaticData/Translations/Master.txt @@ -1932,3 +1932,6 @@ Translated:You cannot move any lower. This position on your bed is too low for t English:Edit Preset Translated:Edit Preset +English:Slice-Engine +Translated:Slice-Engine + diff --git a/StaticData/Translations/de/Translation.txt b/StaticData/Translations/de/Translation.txt index 2ddacc37a..b662e96ac 100644 --- a/StaticData/Translations/de/Translation.txt +++ b/StaticData/Translations/de/Translation.txt @@ -1816,3 +1816,123 @@ Translated:MatterContol English:Saving to Parts Sheet Translated:Saving to Parts Sheet +English:The default temperature to set the bed to. Can sometimes be overriden on the first layer. Set to 0 to eliminate bed temperature commands. +Translated:The default temperature to set the bed to. Can sometimes be overriden on the first layer. Set to 0 to eliminate bed temperature commands. + +English:The default temperature to set the extruder to. Can sometimes be overriden on the first layer. +Translated:The default temperature to set the extruder to. Can sometimes be overriden on the first layer. + +English:Macro Editor +Translated:Macro Editor + +English:Macro Presets +Translated:Macro Presets + +English:Edit Macro +Translated:Edit Macro + +English:Macro Name +Translated:Macro Name + +English:Give your macro a name +Translated:Give your macro a name + +English:Macro Commands +Translated:Macro Commands + +English:This should be in 'Gcode' +Translated:This should be in 'Gcode' + +English:3D Printer Setup +Translated:3D Printer Setup + +English:Give your printer a name. +Translated:Give your printer a name. + +English:Select Make +Translated:Select Make + +English:Select the printer manufacturer +Translated:Select the printer manufacturer + +English:Select the printer model +Translated:Select the printer model + +English:Save & Continue +Translated:Save & Continue + +English:MatterControl will now attempt to auto-detect printer. +Translated:MatterControl will now attempt to auto-detect printer. + +English:Disconnect printer +Translated:Disconnect printer + +English:if currently connected +Translated:if currently connected + +English:Press +Translated:Press + +English:Continue +Translated:Continue + +English:Manual Configuration +Translated:Manual Configuration + +English:Setup Manual Configuration +Translated:Setup Manual Configuration + +English:or +Translated:or + +English:Skip Printer Connection +Translated:Skip Printer Connection + +English:You can either +Translated:You can either + +English:You can also +Translated:You can also + +English:Extruder Temperature Settings +Translated:Extruder Temperature Settings + +English:Temperature Shortcut Presets +Translated:Temperature Shortcut Presets + +English:Label +Translated:Label + +English:Preset +Translated:Preset + +English:Max Temp. +Translated:Max Temp. + +English:Bed Temperature Settings +Translated:Bed Temperature Settings + +English:Movement Speeds +Translated:Movement Speeds + +English:Extruder +Translated:Extruder + +English:Power on and connect printer +Translated:Power on and connect printer + +English:Attempting to connect +Translated:Attempting to connect + +English:Connection succeeded +Translated:Connection succeeded + +English:You cannot move any lower. This position on your bed is too low for the extruder to reach. You need to raise your bed, or adjust your limits to allow the extruder to go lower. +Translated:You cannot move any lower. This position on your bed is too low for the extruder to reach. You need to raise your bed, or adjust your limits to allow the extruder to go lower. + +English:Edit Preset +Translated:Edit Preset + +English:Slice-Engine +Translated:Slice-Engine + diff --git a/StaticData/Translations/readme.txt b/StaticData/Translations/readme.txt index 30303082d..85ab9790a 100644 --- a/StaticData/Translations/readme.txt +++ b/StaticData/Translations/readme.txt @@ -5,4 +5,7 @@ should appear at the bottom of that file. There is a folder for each langage. The names of these folders match the ISO 639 standard which can be found at: -http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes \ No newline at end of file +http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes + +Special thanks to: +Filip Bartoszek - original German Translation \ No newline at end of file