Index: Core/Common/src/Core.Common.Gui/ColorTheme.cs =================================================================== diff -u --- Core/Common/src/Core.Common.Gui/ColorTheme.cs (revision 0) +++ Core/Common/src/Core.Common.Gui/ColorTheme.cs (revision c27aa10e3d9924c856ba3ed81ca12c96a56fe635) @@ -0,0 +1,23 @@ +using System; +using Core.Common.Gui.Properties; + +namespace Core.Common.Gui +{ + public enum ColorTheme + { + Dark, + Light, + Metro, + Aero, + VS2010, + Generic + } + + public static class ColorThemeExtensions + { + public static string Localized(this ColorTheme theme) + { + return Resources.ResourceManager.GetString(Enum.GetName(typeof(ColorTheme), theme)); + } + } +} \ No newline at end of file Index: Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj =================================================================== diff -u -r5dc6b11ada2c7d2e4ca14413b1ddca577ba34d08 -rc27aa10e3d9924c856ba3ed81ca12c96a56fe635 --- Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj (.../Core.Common.Gui.csproj) (revision 5dc6b11ada2c7d2e4ca14413b1ddca577ba34d08) +++ Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj (.../Core.Common.Gui.csproj) (revision c27aa10e3d9924c856ba3ed81ca12c96a56fe635) @@ -115,8 +115,10 @@ + + @@ -289,6 +291,7 @@ + MessageWindowData.xsd @@ -390,7 +393,7 @@ - SettingsSingleFileGenerator + PublicSettingsSingleFileGenerator Settings.Designer.cs Index: Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs =================================================================== diff -u -r5dc6b11ada2c7d2e4ca14413b1ddca577ba34d08 -rc27aa10e3d9924c856ba3ed81ca12c96a56fe635 --- Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs (.../MainWindow.xaml.cs) (revision 5dc6b11ada2c7d2e4ca14413b1ddca577ba34d08) +++ Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs (.../MainWindow.xaml.cs) (revision c27aa10e3d9924c856ba3ed81ca12c96a56fe635) @@ -869,7 +869,8 @@ { AddRecentlyOpenedProjectsToFileMenu(); - SetColorTheme((string) Gui.UserSettings["colorTheme"]); + SetColorTheme((ColorTheme) Gui.UserSettings["colorTheme"]); + FileManualButton.IsEnabled = File.Exists(Gui.FixedSettings.ManualFilePath); // TODO: Enable as soon as relevant/implemented @@ -1023,7 +1024,7 @@ return new GeneralOptionsControl { UserSettings = Gui.UserSettings, - ColorTheme = (string) Gui.UserSettings["colorTheme"], + ColorTheme = (ColorTheme) Gui.UserSettings["colorTheme"], OnAcceptChanges = ApplyColorTheme }; } @@ -1033,29 +1034,29 @@ SetColorTheme(control.ColorTheme); } - private void SetColorTheme(string colorTheme) + private void SetColorTheme(ColorTheme colorTheme) { - if (colorTheme == "Dark" && !(DockingManager.Theme is ExpressionDarkTheme)) + if (colorTheme == ColorTheme.Dark && !(DockingManager.Theme is ExpressionDarkTheme)) { DockingManager.Theme = new ExpressionDarkTheme(); } - else if (colorTheme == "Light" && !(DockingManager.Theme is ExpressionLightTheme)) + else if (colorTheme == ColorTheme.Light && !(DockingManager.Theme is ExpressionLightTheme)) { DockingManager.Theme = new ExpressionLightTheme(); } - else if (colorTheme == "Metro" && !(DockingManager.Theme is MetroTheme)) + else if (colorTheme == ColorTheme.Metro && !(DockingManager.Theme is MetroTheme)) { DockingManager.Theme = new MetroTheme(); } - else if (colorTheme == "Aero" && !(DockingManager.Theme is AeroTheme)) + else if (colorTheme == ColorTheme.Aero && !(DockingManager.Theme is AeroTheme)) { DockingManager.Theme = new AeroTheme(); } - else if (colorTheme == "VS2010" && !(DockingManager.Theme is VS2010Theme)) + else if (colorTheme == ColorTheme.VS2010 && !(DockingManager.Theme is VS2010Theme)) { DockingManager.Theme = new VS2010Theme(); } - else if (colorTheme == "Generic" && !(DockingManager.Theme is GenericTheme)) + else if (colorTheme == ColorTheme.Generic && !(DockingManager.Theme is GenericTheme)) { DockingManager.Theme = new GenericTheme(); } Index: Core/Common/src/Core.Common.Gui/Forms/OptionsDialog/ColorThemeItem.cs =================================================================== diff -u --- Core/Common/src/Core.Common.Gui/Forms/OptionsDialog/ColorThemeItem.cs (revision 0) +++ Core/Common/src/Core.Common.Gui/Forms/OptionsDialog/ColorThemeItem.cs (revision c27aa10e3d9924c856ba3ed81ca12c96a56fe635) @@ -0,0 +1,11 @@ +namespace Core.Common.Gui.Forms.OptionsDialog +{ + /// + /// Used for localizing the items in the theme selection combo box. + /// + public class ColorThemeItem + { + public ColorTheme Theme { get; set; } + public string DisplayName { get; set; } + } +} \ No newline at end of file Index: Core/Common/src/Core.Common.Gui/Forms/OptionsDialog/GeneralOptionsControl.Designer.cs =================================================================== diff -u -reee6c7815d1e418eac38c1c552fb279c0887ef55 -rc27aa10e3d9924c856ba3ed81ca12c96a56fe635 --- Core/Common/src/Core.Common.Gui/Forms/OptionsDialog/GeneralOptionsControl.Designer.cs (.../GeneralOptionsControl.Designer.cs) (revision eee6c7815d1e418eac38c1c552fb279c0887ef55) +++ Core/Common/src/Core.Common.Gui/Forms/OptionsDialog/GeneralOptionsControl.Designer.cs (.../GeneralOptionsControl.Designer.cs) (revision c27aa10e3d9924c856ba3ed81ca12c96a56fe635) @@ -61,13 +61,6 @@ // this.comboBoxTheme.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBoxTheme.FormattingEnabled = true; - this.comboBoxTheme.Items.AddRange(new object[] { - resources.GetString("comboBoxTheme.Items"), - resources.GetString("comboBoxTheme.Items1"), - resources.GetString("comboBoxTheme.Items2"), - resources.GetString("comboBoxTheme.Items3"), - resources.GetString("comboBoxTheme.Items4"), - resources.GetString("comboBoxTheme.Items5")}); resources.ApplyResources(this.comboBoxTheme, "comboBoxTheme"); this.comboBoxTheme.Name = "comboBoxTheme"; this.comboBoxTheme.SelectedIndexChanged += new System.EventHandler(this.comboBoxTheme_SelectedIndexChanged); Index: Core/Common/src/Core.Common.Gui/Forms/OptionsDialog/GeneralOptionsControl.cs =================================================================== diff -u -r622c20f6fc0b693b67a3e57b2ece939823002c62 -rc27aa10e3d9924c856ba3ed81ca12c96a56fe635 --- Core/Common/src/Core.Common.Gui/Forms/OptionsDialog/GeneralOptionsControl.cs (.../GeneralOptionsControl.cs) (revision 622c20f6fc0b693b67a3e57b2ece939823002c62) +++ Core/Common/src/Core.Common.Gui/Forms/OptionsDialog/GeneralOptionsControl.cs (.../GeneralOptionsControl.cs) (revision c27aa10e3d9924c856ba3ed81ca12c96a56fe635) @@ -1,4 +1,5 @@ using System; +using System.Collections.ObjectModel; using System.Configuration; using System.Security.Permissions; using System.Windows.Forms; @@ -16,6 +17,7 @@ public GeneralOptionsControl() { InitializeComponent(); + SetColorThemeOptions(); } public ApplicationSettingsBase UserSettings @@ -30,15 +32,15 @@ } } - public string ColorTheme + public ColorTheme ColorTheme { get { - return (string) comboBoxTheme.SelectedItem; + return (ColorTheme) comboBoxTheme.SelectedValue; } set { - comboBoxTheme.SelectedItem = value; + comboBoxTheme.SelectedValue = value; } } @@ -75,6 +77,22 @@ SetSettingsValuesToControls(); } + private void SetColorThemeOptions() + { + var colorThemeItems = new Collection(); + foreach (var theme in (ColorTheme[]) Enum.GetValues(typeof(ColorTheme))) + { + colorThemeItems.Add(new ColorThemeItem + { + Theme = theme, + DisplayName = theme.Localized() + }); + } + comboBoxTheme.DataSource = colorThemeItems; + comboBoxTheme.ValueMember = "Theme"; + comboBoxTheme.DisplayMember = "DisplayName"; + } + /// /// Safe call because of linkdemand /// @@ -191,7 +209,7 @@ private void RadioButtonCompactNotationCheckedChanged(object sender, EventArgs e) { - lblDecimalsOrSignificants.Text = radioButtonCompactNotation.Checked ? Resources.GeneralOptionsControl_RadioButtonCompactNotationCheckedChanged_Significant_digits: Resources.GeneralOptionsControl_RadioButtonCompactNotationCheckedChanged_Decimal_places; + lblDecimalsOrSignificants.Text = radioButtonCompactNotation.Checked ? Resources.GeneralOptionsControl_RadioButtonCompactNotationCheckedChanged_Significant_digits : Resources.GeneralOptionsControl_RadioButtonCompactNotationCheckedChanged_Decimal_places; UpdateRealNumberFormattingSample(); } Index: Core/Common/src/Core.Common.Gui/Forms/OptionsDialog/GeneralOptionsControl.resx =================================================================== diff -u -r83b9621346f7f3ca887096468de965815eb609ac -rc27aa10e3d9924c856ba3ed81ca12c96a56fe635 --- Core/Common/src/Core.Common.Gui/Forms/OptionsDialog/GeneralOptionsControl.resx (.../GeneralOptionsControl.resx) (revision 83b9621346f7f3ca887096468de965815eb609ac) +++ Core/Common/src/Core.Common.Gui/Forms/OptionsDialog/GeneralOptionsControl.resx (.../GeneralOptionsControl.resx) (revision c27aa10e3d9924c856ba3ed81ca12c96a56fe635) @@ -121,24 +121,6 @@ GrowAndShrink - - Licht - - - Donker - - - Metro - - - Aero - - - VS2010 - - - Generiek - 83, 45 @@ -468,9 +450,9 @@ 0 - + True - + 6, 13 Index: Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs =================================================================== diff -u -r85af6861f16df8c5d57e3e39d0d2874e7bd16b8e -rc27aa10e3d9924c856ba3ed81ca12c96a56fe635 --- Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 85af6861f16df8c5d57e3e39d0d2874e7bd16b8e) +++ Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision c27aa10e3d9924c856ba3ed81ca12c96a56fe635) @@ -98,6 +98,15 @@ } /// + /// Looks up a localized string similar to Aero. + /// + public static string Aero { + get { + return ResourceManager.GetString("Aero", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Ringtoets wordt gestart.... /// public static string App_App_Starting_Ringtoets { @@ -686,6 +695,15 @@ } /// + /// Looks up a localized string similar to Donker. + /// + public static string Dark { + get { + return ResourceManager.GetString("Dark", resourceCulture); + } + } + + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// public static System.Drawing.Bitmap data_item { @@ -1077,6 +1095,15 @@ } /// + /// Looks up a localized string similar to Generiek. + /// + public static string Generic { + get { + return ResourceManager.GetString("Generic", resourceCulture); + } + } + + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// public static System.Drawing.Bitmap graphhs { @@ -1323,6 +1350,15 @@ } /// + /// Looks up a localized string similar to Licht. + /// + public static string Light { + get { + return ResourceManager.GetString("Light", resourceCulture); + } + } + + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// public static System.Drawing.Bitmap link { @@ -1503,6 +1539,15 @@ } /// + /// Looks up a localized string similar to Metro. + /// + public static string Metro { + get { + return ResourceManager.GetString("Metro", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Nieuw project succesvol geopend.. /// public static string New_project_successfully_opened { @@ -2534,6 +2579,15 @@ } /// + /// Looks up a localized string similar to VS2010. + /// + public static string VS2010 { + get { + return ResourceManager.GetString("VS2010", resourceCulture); + } + } + + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// public static System.Drawing.Bitmap WebInsertHyperlinkHS { Index: Core/Common/src/Core.Common.Gui/Properties/Resources.resx =================================================================== diff -u -r85af6861f16df8c5d57e3e39d0d2874e7bd16b8e -rc27aa10e3d9924c856ba3ed81ca12c96a56fe635 --- Core/Common/src/Core.Common.Gui/Properties/Resources.resx (.../Resources.resx) (revision 85af6861f16df8c5d57e3e39d0d2874e7bd16b8e) +++ Core/Common/src/Core.Common.Gui/Properties/Resources.resx (.../Resources.resx) (revision c27aa10e3d9924c856ba3ed81ca12c96a56fe635) @@ -902,4 +902,28 @@ Er ging iets fout bij het ophalen van de NodePresenters van alle plugins. + + Licht + Used for displaying ColorTheme.Light in combo box. + + + Donker + Used for displaying ColorTheme.Dark in combo box. + + + Metro + Used for displaying ColorTheme.Metro in combo box. + + + Aero + Used for displaying ColorTheme.Aero in combo box. + + + VS2010 + Used for displaying ColorTheme.VS2010 in combo box. + + + Generiek + Used for displaying ColorTheme.Generic in combo box. + \ No newline at end of file Index: Core/Common/src/Core.Common.Gui/Properties/Settings.Designer.cs =================================================================== diff -u -rec61b187052d8d8ae6cddd3fc1d0546608d9b0c2 -rc27aa10e3d9924c856ba3ed81ca12c96a56fe635 --- Core/Common/src/Core.Common.Gui/Properties/Settings.Designer.cs (.../Settings.Designer.cs) (revision ec61b187052d8d8ae6cddd3fc1d0546608d9b0c2) +++ Core/Common/src/Core.Common.Gui/Properties/Settings.Designer.cs (.../Settings.Designer.cs) (revision c27aa10e3d9924c856ba3ed81ca12c96a56fe635) @@ -214,9 +214,9 @@ [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("Generic")] - public string colorTheme { + public global::Core.Common.Gui.ColorTheme colorTheme { get { - return ((string)(this["colorTheme"])); + return ((global::Core.Common.Gui.ColorTheme)(this["colorTheme"])); } set { this["colorTheme"] = value; Index: Core/Common/src/Core.Common.Gui/Properties/Settings.settings =================================================================== diff -u -rec61b187052d8d8ae6cddd3fc1d0546608d9b0c2 -rc27aa10e3d9924c856ba3ed81ca12c96a56fe635 --- Core/Common/src/Core.Common.Gui/Properties/Settings.settings (.../Settings.settings) (revision ec61b187052d8d8ae6cddd3fc1d0546608d9b0c2) +++ Core/Common/src/Core.Common.Gui/Properties/Settings.settings (.../Settings.settings) (revision c27aa10e3d9924c856ba3ed81ca12c96a56fe635) @@ -50,7 +50,7 @@ G5 - + Generic Index: Core/Common/src/Core.Common.Gui/app.config =================================================================== diff -u --- Core/Common/src/Core.Common.Gui/app.config (revision 0) +++ Core/Common/src/Core.Common.Gui/app.config (revision c27aa10e3d9924c856ba3ed81ca12c96a56fe635) @@ -0,0 +1,51 @@ + + + + +
+ + + + + + True + + + + + + False + + + 50 + + + 50 + + + 1024 + + + 768 + + + Startpagina + + + True + + + True + + + False + + + G5 + + + Generic + + + + \ No newline at end of file Index: Core/Common/test/Core.Common.Gui.Test/Core.Common.Gui.Test.csproj =================================================================== diff -u -re392d6abff8f363ed6fbcef2b7ddd1dd54c77348 -rc27aa10e3d9924c856ba3ed81ca12c96a56fe635 --- Core/Common/test/Core.Common.Gui.Test/Core.Common.Gui.Test.csproj (.../Core.Common.Gui.Test.csproj) (revision e392d6abff8f363ed6fbcef2b7ddd1dd54c77348) +++ Core/Common/test/Core.Common.Gui.Test/Core.Common.Gui.Test.csproj (.../Core.Common.Gui.Test.csproj) (revision c27aa10e3d9924c856ba3ed81ca12c96a56fe635) @@ -60,6 +60,8 @@ + + Index: Core/Common/test/Core.Common.Gui.Test/Forms/OptionsDialog/ColorThemeTest.cs =================================================================== diff -u --- Core/Common/test/Core.Common.Gui.Test/Forms/OptionsDialog/ColorThemeTest.cs (revision 0) +++ Core/Common/test/Core.Common.Gui.Test/Forms/OptionsDialog/ColorThemeTest.cs (revision c27aa10e3d9924c856ba3ed81ca12c96a56fe635) @@ -0,0 +1,62 @@ +using System; +using System.Collections.ObjectModel; +using System.Linq; +using Core.Common.Gui.Properties; +using NUnit.Framework; + +namespace Core.Common.Gui.Test.Forms.OptionsDialog +{ + [TestFixture] + public class ColorThemeTest + { + [Test] + public void ColorTheme_Values_HasSix() + { + // Call & Assert + Assert.AreEqual(6, Enum.GetValues(typeof(ColorTheme)).Length); + } + + [Test] + public void ColorTheme_GetNames_HasSix() + { + // Setup + var nameList = new[] + { + "Dark", + "Light", + "Metro", + "Aero", + "VS2010", + "Generic" + }; + + // Call & Assert + CollectionAssert.AreEqual(nameList, Enum.GetNames(typeof(ColorTheme))); + } + + [Test] + public void Localized_ForEveryItem_ExpectedTranslatedString() + { + // Setup + var nameList = new[] + { + Resources.Dark, + Resources.Light, + Resources.Metro, + Resources.Aero, + Resources.VS2010, + Resources.Generic + }; + var translations = new Collection(); + + // Call + foreach(ColorTheme item in Enum.GetValues(typeof(ColorTheme))) + { + translations.Add(item.Localized()); + } + + // Assert + CollectionAssert.AreEqual(nameList, translations); + } + } +} \ No newline at end of file Index: Core/Common/test/Core.Common.Gui.Test/Forms/OptionsDialog/GeneralOptionsControlTest.cs =================================================================== diff -u --- Core/Common/test/Core.Common.Gui.Test/Forms/OptionsDialog/GeneralOptionsControlTest.cs (revision 0) +++ Core/Common/test/Core.Common.Gui.Test/Forms/OptionsDialog/GeneralOptionsControlTest.cs (revision c27aa10e3d9924c856ba3ed81ca12c96a56fe635) @@ -0,0 +1,36 @@ +using System.Windows.Forms; +using Core.Common.Gui.Forms.OptionsDialog; +using NUnit.Framework; + +namespace Core.Common.Gui.Test.Forms.OptionsDialog +{ + [TestFixture] + public class GeneralOptionsControlTest + { + [Test] + public void GivenGeneralOptionsControlCreated_WhenRetrievingOptionsItems_ThenOptionsShouldBeTranslated() + { + using (var control = new GeneralOptionsControl()) + { + var subControl = (ComboBox)control.Controls.Find("comboBoxTheme", true)[0]; + + Assert.AreEqual(6, subControl.Items.Count); + + var localizedThemes = new[] + { + "Donker", + "Licht", + "Metro", + "Aero", + "VS2010", + "Generiek" + }; + for (var i = 0; i < subControl.Items.Count; i++) + { + var themeItem = (ColorThemeItem) subControl.Items[i]; + Assert.AreEqual(localizedThemes[i], themeItem.DisplayName); + } + } + } + } +} \ No newline at end of file