public object Clone() { var settings = new LayoutSettings(); settings.Assign(this); return(settings); }
public void Assign(LayoutSettings settings) { TextColor = settings.TextColor; BackgroundColor = settings.BackgroundColor; BackgroundColor2 = settings.BackgroundColor2; ThinSeparatorsColor = settings.ThinSeparatorsColor; SeparatorsColor = settings.SeparatorsColor; PersonalBestColor = settings.PersonalBestColor; AheadGainingTimeColor = settings.AheadGainingTimeColor; AheadLosingTimeColor = settings.AheadLosingTimeColor; BehindGainingTimeColor = settings.BehindGainingTimeColor; BehindLosingTimeColor = settings.BehindLosingTimeColor; BestSegmentColor = settings.BestSegmentColor; UseRainbowColor = settings.UseRainbowColor; NotRunningColor = settings.NotRunningColor; PausedColor = settings.PausedColor; ShadowsColor = settings.ShadowsColor; TimerFont = settings.TimerFont.Clone() as Font; TimesFont = settings.TimesFont.Clone() as Font; TextFont = settings.TextFont.Clone() as Font; ShowBestSegments = settings.ShowBestSegments; AlwaysOnTop = settings.AlwaysOnTop; AntiAliasing = settings.AntiAliasing; DropShadows = settings.DropShadows; Opacity = settings.Opacity; BackgroundType = settings.BackgroundType; BackgroundImage = settings.BackgroundImage; ImageOpacity = settings.ImageOpacity; ImageBlur = settings.ImageBlur; }
public void Assign(LayoutSettings settings) { TextColor = settings.TextColor; BackgroundColor = settings.BackgroundColor; BackgroundColor2 = settings.BackgroundColor2; ThinSeparatorsColor = settings.ThinSeparatorsColor; SeparatorsColor = settings.SeparatorsColor; PersonalBestColor = settings.PersonalBestColor; AheadGainingTimeColor = settings.AheadGainingTimeColor; AheadLosingTimeColor = settings.AheadLosingTimeColor; BehindGainingTimeColor = settings.BehindGainingTimeColor; BehindLosingTimeColor = settings.BehindLosingTimeColor; BestSegmentColor = settings.BestSegmentColor; UseRainbowColor = settings.UseRainbowColor; NotRunningColor = settings.NotRunningColor; PausedColor = settings.PausedColor; TextOutlineColor = settings.TextOutlineColor; ShadowsColor = settings.ShadowsColor; TimerFont = settings.TimerFont.Clone() as Font; TimesFont = settings.TimesFont.Clone() as Font; TextFont = settings.TextFont.Clone() as Font; ShowBestSegments = settings.ShowBestSegments; AlwaysOnTop = settings.AlwaysOnTop; AntiAliasing = settings.AntiAliasing; DropShadows = settings.DropShadows; Opacity = settings.Opacity; MousePassThroughWhileRunning = settings.MousePassThroughWhileRunning; BackgroundType = settings.BackgroundType; BackgroundImage = settings.BackgroundImage; ImageOpacity = settings.ImageOpacity; ImageBlur = settings.ImageBlur; }
private static int ToElement(XmlDocument document, XmlElement element, LayoutSettings settings) { return SettingsHelper.CreateSetting(document, element, "TextColor", settings.TextColor) ^ SettingsHelper.CreateSetting(document, element, "BackgroundColor", settings.BackgroundColor) ^ SettingsHelper.CreateSetting(document, element, "BackgroundColor2", settings.BackgroundColor2) ^ SettingsHelper.CreateSetting(document, element, "ThinSeparatorsColor", settings.ThinSeparatorsColor) ^ SettingsHelper.CreateSetting(document, element, "SeparatorsColor", settings.SeparatorsColor) ^ SettingsHelper.CreateSetting(document, element, "PersonalBestColor", settings.PersonalBestColor) ^ SettingsHelper.CreateSetting(document, element, "AheadGainingTimeColor", settings.AheadGainingTimeColor) ^ SettingsHelper.CreateSetting(document, element, "AheadLosingTimeColor", settings.AheadLosingTimeColor) ^ SettingsHelper.CreateSetting(document, element, "BehindGainingTimeColor", settings.BehindGainingTimeColor) ^ SettingsHelper.CreateSetting(document, element, "BehindLosingTimeColor", settings.BehindLosingTimeColor) ^ SettingsHelper.CreateSetting(document, element, "BestSegmentColor", settings.BestSegmentColor) ^ SettingsHelper.CreateSetting(document, element, "UseRainbowColor", settings.UseRainbowColor) ^ SettingsHelper.CreateSetting(document, element, "NotRunningColor", settings.NotRunningColor) ^ SettingsHelper.CreateSetting(document, element, "PausedColor", settings.PausedColor) ^ SettingsHelper.CreateSetting(document, element, "ShadowsColor", settings.ShadowsColor) ^ SettingsHelper.CreateSetting(document, element, "TimesFont", settings.TimesFont) ^ SettingsHelper.CreateSetting(document, element, "TimerFont", settings.TimerFont) ^ SettingsHelper.CreateSetting(document, element, "TextFont", settings.TextFont) ^ SettingsHelper.CreateSetting(document, element, "AlwaysOnTop", settings.AlwaysOnTop) ^ SettingsHelper.CreateSetting(document, element, "ShowBestSegments", settings.ShowBestSegments) ^ SettingsHelper.CreateSetting(document, element, "AntiAliasing", settings.AntiAliasing) ^ SettingsHelper.CreateSetting(document, element, "DropShadows", settings.DropShadows) ^ SettingsHelper.CreateSetting(document, element, "BackgroundType", settings.BackgroundType) ^ SettingsHelper.CreateSetting(document, element, "BackgroundImage", settings.BackgroundImage) ^ SettingsHelper.CreateSetting(document, element, "ImageOpacity", settings.ImageOpacity) ^ SettingsHelper.CreateSetting(document, element, "ImageBlur", settings.ImageBlur) ^ SettingsHelper.CreateSetting(document, element, "Opacity", settings.Opacity); }
private static XmlElement ToElement(XmlDocument document, LayoutSettings settings) { var element = document.CreateElement("Settings"); element.AppendChild(SettingsHelper.ToElement(document, settings.TextColor, "TextColor")); element.AppendChild(SettingsHelper.ToElement(document, settings.BackgroundColor, "BackgroundColor")); element.AppendChild(SettingsHelper.ToElement(document, settings.BackgroundColor2, "BackgroundColor2")); element.AppendChild(SettingsHelper.ToElement(document, settings.ThinSeparatorsColor, "ThinSeparatorsColor")); element.AppendChild(SettingsHelper.ToElement(document, settings.SeparatorsColor, "SeparatorsColor")); element.AppendChild(SettingsHelper.ToElement(document, settings.PersonalBestColor, "PersonalBestColor")); element.AppendChild(SettingsHelper.ToElement(document, settings.AheadGainingTimeColor, "AheadGainingTimeColor")); element.AppendChild(SettingsHelper.ToElement(document, settings.AheadLosingTimeColor, "AheadLosingTimeColor")); element.AppendChild(SettingsHelper.ToElement(document, settings.BehindGainingTimeColor, "BehindGainingTimeColor")); element.AppendChild(SettingsHelper.ToElement(document, settings.BehindLosingTimeColor, "BehindLosingTimeColor")); element.AppendChild(SettingsHelper.ToElement(document, settings.BestSegmentColor, "BestSegmentColor")); element.AppendChild(SettingsHelper.ToElement(document, settings.NotRunningColor, "NotRunningColor")); element.AppendChild(SettingsHelper.ToElement(document, settings.PausedColor, "PausedColor")); element.AppendChild(SettingsHelper.ToElement(document, settings.ShadowsColor, "ShadowsColor")); element.AppendChild(SettingsHelper.CreateFontElement(document, "TimesFont", settings.TimesFont)); element.AppendChild(SettingsHelper.CreateFontElement(document, "TimerFont", settings.TimerFont)); element.AppendChild(SettingsHelper.CreateFontElement(document, "TextFont", settings.TextFont)); element.AppendChild(SettingsHelper.ToElement(document, "AlwaysOnTop", settings.AlwaysOnTop)); element.AppendChild(SettingsHelper.ToElement(document, "ShowBestSegments", settings.ShowBestSegments)); element.AppendChild(SettingsHelper.ToElement(document, "AntiAliasing", settings.AntiAliasing)); element.AppendChild(SettingsHelper.ToElement(document, "DropShadows", settings.DropShadows)); element.AppendChild(SettingsHelper.ToElement(document, "BackgroundGradient", settings.BackgroundGradient)); element.AppendChild(SettingsHelper.ToElement(document, "Opacity", settings.Opacity)); element.AppendChild(SettingsHelper.ToElement(document, "UseRainbowColor", settings.UseRainbowColor)); return element; }
public void Assign(LayoutSettings settings) { TextColor = settings.TextColor; BackgroundColor = settings.BackgroundColor; BackgroundColor2 = settings.BackgroundColor2; ThinSeparatorsColor = settings.ThinSeparatorsColor; SeparatorsColor = settings.SeparatorsColor; PersonalBestColor = settings.PersonalBestColor; AheadGainingTimeColor = settings.AheadGainingTimeColor; AheadLosingTimeColor = settings.AheadLosingTimeColor; BehindGainingTimeColor = settings.BehindGainingTimeColor; BehindLosingTimeColor = settings.BehindLosingTimeColor; BestSegmentColor = settings.BestSegmentColor; NotRunningColor = settings.NotRunningColor; PausedColor = settings.PausedColor; ShadowsColor = settings.ShadowsColor; TimerFont = settings.TimerFont.Clone() as Font; TimesFont = settings.TimesFont.Clone() as Font; TextFont = settings.TextFont.Clone() as Font; ShowBestSegments = settings.ShowBestSegments; AlwaysOnTop = settings.AlwaysOnTop; AntiAliasing = settings.AntiAliasing; DropShadows = settings.DropShadows; Opacity = settings.Opacity; BackgroundGradient = settings.BackgroundGradient; }
public LayoutSettingsControl(LiveSplit.Options.LayoutSettings settings, LiveSplit.UI.ILayout layout) { InitializeComponent(); Settings = settings; Layout = layout; chkBestSegments.DataBindings.Add("Checked", this, "ShowBestSegments", false, DataSourceUpdateMode.OnPropertyChanged); chkAlwaysOnTop.DataBindings.Add("Checked", this, "AlwaysOnTop", false, DataSourceUpdateMode.OnPropertyChanged); chkAntiAliasing.DataBindings.Add("Checked", this, "AntiAliasing", false, DataSourceUpdateMode.OnPropertyChanged); chkDropShadows.DataBindings.Add("Checked", this, "DropShadows", false, DataSourceUpdateMode.OnPropertyChanged); btnTextColor.DataBindings.Add("BackColor", this, "TextColor", false, DataSourceUpdateMode.OnPropertyChanged); btnBackground.DataBindings.Add("BackColor", this, "BackgroundColor", false, DataSourceUpdateMode.OnPropertyChanged); btnBackground2.DataBindings.Add("BackColor", this, "BackgroundColor2", false, DataSourceUpdateMode.OnPropertyChanged); btnThinSep.DataBindings.Add("BackColor", this, "ThinSeparatorsColor", false, DataSourceUpdateMode.OnPropertyChanged); btnSeparators.DataBindings.Add("BackColor", this, "SeparatorsColor", false, DataSourceUpdateMode.OnPropertyChanged); btnPB.DataBindings.Add("BackColor", this, "PersonalBestColor", false, DataSourceUpdateMode.OnPropertyChanged); btnAheadGaining.DataBindings.Add("BackColor", this, "AheadGainingTimeColor", false, DataSourceUpdateMode.OnPropertyChanged); btnAheadLosing.DataBindings.Add("BackColor", this, "AheadLosingTimeColor", false, DataSourceUpdateMode.OnPropertyChanged); btnBehindGaining.DataBindings.Add("BackColor", this, "BehindGainingTimeColor", false, DataSourceUpdateMode.OnPropertyChanged); btnBehindLosing.DataBindings.Add("BackColor", this, "BehindLosingTimeColor", false, DataSourceUpdateMode.OnPropertyChanged); btnGlod.DataBindings.Add("BackColor", this, "BestSegmentColor", false, DataSourceUpdateMode.OnPropertyChanged); btnNotRunning.DataBindings.Add("BackColor", this, "NotRunningColor", false, DataSourceUpdateMode.OnPropertyChanged); btnPausedColor.DataBindings.Add("BackColor", this, "PausedColor", false, DataSourceUpdateMode.OnPropertyChanged); btnShadowsColor.DataBindings.Add("BackColor", this, "ShadowsColor", false, DataSourceUpdateMode.OnPropertyChanged); lblTimer.DataBindings.Add("Text", this, "TimerFont", false, DataSourceUpdateMode.OnPropertyChanged); lblText.DataBindings.Add("Text", this, "SplitNamesFont", false, DataSourceUpdateMode.OnPropertyChanged); lblTimes.DataBindings.Add("Text", this, "MainFont", false, DataSourceUpdateMode.OnPropertyChanged); trkOpacity.DataBindings.Add("Value", this, "Opacity", false, DataSourceUpdateMode.OnPropertyChanged); cmbGradientType.DataBindings.Add("SelectedItem", this, "GradientString", false, DataSourceUpdateMode.OnPropertyChanged); cmbGradientType.SelectedIndexChanged += cmbGradientType_SelectedIndexChanged; }
public LayoutSettingsDialog(LiveSplit.Options.LayoutSettings settings, LiveSplit.UI.ILayout layout, IComponent tabComponent = null) { InitializeComponent(); Settings = settings; Layout = layout; ComponentSettings = new List <XmlNode>(); Components = new List <IComponent>(); AddNewTab("Layout", new LayoutSettingsControl(settings, layout)); AddComponents(tabComponent); }
private static LayoutSettings ParseSettings(XmlElement element, Version version) { var settings = new LayoutSettings(); settings.TextColor = SettingsHelper.ParseColor(element["TextColor"]); settings.BackgroundColor = SettingsHelper.ParseColor(element["BackgroundColor"]); settings.ThinSeparatorsColor = SettingsHelper.ParseColor(element["ThinSeparatorsColor"]); settings.SeparatorsColor = SettingsHelper.ParseColor(element["SeparatorsColor"]); settings.PersonalBestColor = SettingsHelper.ParseColor(element["PersonalBestColor"]); settings.AheadGainingTimeColor = SettingsHelper.ParseColor(element["AheadGainingTimeColor"]); settings.AheadLosingTimeColor = SettingsHelper.ParseColor(element["AheadLosingTimeColor"]); settings.BehindGainingTimeColor = SettingsHelper.ParseColor(element["BehindGainingTimeColor"]); settings.BehindLosingTimeColor = SettingsHelper.ParseColor(element["BehindLosingTimeColor"]); settings.BestSegmentColor = SettingsHelper.ParseColor(element["BestSegmentColor"]); settings.NotRunningColor = SettingsHelper.ParseColor(element["NotRunningColor"]); settings.PausedColor = SettingsHelper.ParseColor(element["PausedColor"], Color.FromArgb(122, 122, 122)); settings.AntiAliasing = SettingsHelper.ParseBool(element["AntiAliasing"], true); settings.DropShadows = SettingsHelper.ParseBool(element["DropShadows"], true); settings.Opacity = SettingsHelper.ParseFloat(element["Opacity"], 1); settings.BackgroundGradient = SettingsHelper.ParseEnum<GradientType>(element["BackgroundGradient"], GradientType.Plain); settings.ShadowsColor = SettingsHelper.ParseColor(element["ShadowsColor"], Color.FromArgb(128, 0, 0, 0)); settings.ShowBestSegments = SettingsHelper.ParseBool(element["ShowBestSegments"]); settings.UseRainbowColor = SettingsHelper.ParseBool(element["UseRainbowColor"], false); settings.AlwaysOnTop = SettingsHelper.ParseBool(element["AlwaysOnTop"]); settings.TimerFont = SettingsHelper.GetFontFromElement(element["TimerFont"]); using (var timerFont = new Font(settings.TimerFont.FontFamily.Name, (settings.TimerFont.Size / 50f) * 18f, settings.TimerFont.Style, GraphicsUnit.Point)) { settings.TimerFont = new Font(timerFont.FontFamily.Name, (timerFont.Size / 18f) * 50f, timerFont.Style, GraphicsUnit.Pixel); } if (version >= new Version(1, 3)) { settings.BackgroundColor2 = SettingsHelper.ParseColor(element["BackgroundColor2"]); settings.TimesFont = SettingsHelper.GetFontFromElement(element["TimesFont"]); settings.TextFont = SettingsHelper.GetFontFromElement(element["TextFont"]); } else { if (settings.BackgroundColor == Color.Black) settings.BackgroundColor = settings.BackgroundColor2 = Color.Transparent; else settings.BackgroundColor2 = settings.BackgroundColor; settings.TimesFont = SettingsHelper.GetFontFromElement(element["MainFont"]); settings.TextFont = SettingsHelper.GetFontFromElement(element["SplitNamesFont"]); } return settings; }
public object Clone() { var settings = new LayoutSettings(); settings.Assign(this); return settings; }
private static LayoutSettings ParseSettings(XmlElement element, Version version) { var settings = new LayoutSettings(); settings.TextColor = SettingsHelper.ParseColor(element["TextColor"]); settings.BackgroundColor = SettingsHelper.ParseColor(element["BackgroundColor"]); settings.ThinSeparatorsColor = SettingsHelper.ParseColor(element["ThinSeparatorsColor"]); settings.SeparatorsColor = SettingsHelper.ParseColor(element["SeparatorsColor"]); settings.PersonalBestColor = SettingsHelper.ParseColor(element["PersonalBestColor"]); settings.AheadGainingTimeColor = SettingsHelper.ParseColor(element["AheadGainingTimeColor"]); settings.AheadLosingTimeColor = SettingsHelper.ParseColor(element["AheadLosingTimeColor"]); settings.BehindGainingTimeColor = SettingsHelper.ParseColor(element["BehindGainingTimeColor"]); settings.BehindLosingTimeColor = SettingsHelper.ParseColor(element["BehindLosingTimeColor"]); settings.BestSegmentColor = SettingsHelper.ParseColor(element["BestSegmentColor"]); settings.UseRainbowColor = SettingsHelper.ParseBool(element["UseRainbowColor"], false); settings.NotRunningColor = SettingsHelper.ParseColor(element["NotRunningColor"]); settings.PausedColor = SettingsHelper.ParseColor(element["PausedColor"], Color.FromArgb(122, 122, 122)); settings.AntiAliasing = SettingsHelper.ParseBool(element["AntiAliasing"], true); settings.DropShadows = SettingsHelper.ParseBool(element["DropShadows"], true); settings.Opacity = SettingsHelper.ParseFloat(element["Opacity"], 1); settings.ShadowsColor = SettingsHelper.ParseColor(element["ShadowsColor"], Color.FromArgb(128, 0, 0, 0)); settings.ShowBestSegments = SettingsHelper.ParseBool(element["ShowBestSegments"]); settings.AlwaysOnTop = SettingsHelper.ParseBool(element["AlwaysOnTop"]); settings.TimerFont = SettingsHelper.GetFontFromElement(element["TimerFont"]); using (var timerFont = new Font(settings.TimerFont.FontFamily.Name, (settings.TimerFont.Size / 50f) * 18f, settings.TimerFont.Style, GraphicsUnit.Point)) { settings.TimerFont = new Font(timerFont.FontFamily.Name, (timerFont.Size / 18f) * 50f, timerFont.Style, GraphicsUnit.Pixel); } settings.ImageOpacity = SettingsHelper.ParseFloat(element["ImageOpacity"], 1f); settings.ImageBlur = SettingsHelper.ParseFloat(element["ImageBlur"], 0f); if (version >= new Version(1, 3)) { settings.BackgroundColor2 = SettingsHelper.ParseColor(element["BackgroundColor2"]); settings.TimesFont = SettingsHelper.GetFontFromElement(element["TimesFont"]); settings.TextFont = SettingsHelper.GetFontFromElement(element["TextFont"]); } else { if (settings.BackgroundColor == Color.Black) settings.BackgroundColor = settings.BackgroundColor2 = Color.Transparent; else settings.BackgroundColor2 = settings.BackgroundColor; settings.TimesFont = SettingsHelper.GetFontFromElement(element["MainFont"]); settings.TextFont = SettingsHelper.GetFontFromElement(element["SplitNamesFont"]); } if (version >= new Version(1, 6, 1)) { settings.BackgroundType = SettingsHelper.ParseEnum<BackgroundType>(element["BackgroundType"], BackgroundType.SolidColor); } else { var gradientType = element["BackgroundGradient"]; if (gradientType == null || gradientType.InnerText == "Plain") settings.BackgroundType = BackgroundType.SolidColor; else if (gradientType.InnerText == "Vertical") settings.BackgroundType = BackgroundType.VerticalGradient; else settings.BackgroundType = BackgroundType.HorizontalGradient; } settings.BackgroundImagePath = SettingsHelper.ParseString(element["BackgroundImagePath"]); if (!string.IsNullOrEmpty(settings.BackgroundImagePath)) { try { settings.BackgroundImage = Image.FromFile(settings.BackgroundImagePath); } catch (Exception ex) { Log.Error(ex); } } return settings; }