From 996ff74e6e6598a44b12d2769004e63f76f9bb01 Mon Sep 17 00:00:00 2001 From: ooterness Date: Mon, 17 Feb 2020 15:48:48 -0800 Subject: [PATCH 1/2] Added a new column type: "Completed Splits" --- UI/ColumnType.cs | 2 +- UI/Components/ColumnSettings.Designer.cs | 13 +++++-------- UI/Components/ColumnSettings.cs | 2 ++ UI/Components/SplitComponent.cs | 8 +++++--- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/UI/ColumnType.cs b/UI/ColumnType.cs index 3d32ce6..0ad51c0 100644 --- a/UI/ColumnType.cs +++ b/UI/ColumnType.cs @@ -2,6 +2,6 @@ { public enum ColumnType { - Delta, SplitTime, DeltaorSplitTime, SegmentDelta, SegmentTime, SegmentDeltaorSegmentTime + Delta, SplitTime, CompletedSplits, DeltaorSplitTime, SegmentDelta, SegmentTime, SegmentDeltaorSegmentTime } } diff --git a/UI/Components/ColumnSettings.Designer.cs b/UI/Components/ColumnSettings.Designer.cs index 5c3a4d7..39c9214 100644 --- a/UI/Components/ColumnSettings.Designer.cs +++ b/UI/Components/ColumnSettings.Designer.cs @@ -1,4 +1,6 @@ -namespace LiveSplit.UI.Components +using System.Linq; + +namespace LiveSplit.UI.Components { partial class ColumnSettings { @@ -127,17 +129,12 @@ private void InitializeComponent() // // cmbColumnType // + System.Collections.IEnumerable colNames = from ColumnType type in System.Enum.GetValues(typeof(ColumnType)) select ColumnSettings.GetColumnType(type); this.cmbColumnType.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.tableLayoutPanel1.SetColumnSpan(this.cmbColumnType, 3); this.cmbColumnType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbColumnType.FormattingEnabled = true; - this.cmbColumnType.Items.AddRange(new object[] { - "Delta", - "Split Time", - "Delta or Split Time", - "Segment Delta", - "Segment Time", - "Segment Delta or Segment Time"}); + this.cmbColumnType.Items.AddRange(colNames.Cast().ToArray()); this.cmbColumnType.Location = new System.Drawing.Point(93, 33); this.cmbColumnType.Name = "cmbColumnType"; this.cmbColumnType.Size = new System.Drawing.Size(325, 21); diff --git a/UI/Components/ColumnSettings.cs b/UI/Components/ColumnSettings.cs index c70a8c1..bdacc04 100644 --- a/UI/Components/ColumnSettings.cs +++ b/UI/Components/ColumnSettings.cs @@ -106,6 +106,8 @@ private static string GetColumnType(ColumnType type) { if (type == ColumnType.SplitTime) return "Split Time"; + else if (type == ColumnType.CompletedSplits) + return "Completed Splits"; else if (type == ColumnType.Delta) return "Delta"; else if (type == ColumnType.DeltaorSplitTime) diff --git a/UI/Components/SplitComponent.cs b/UI/Components/SplitComponent.cs index 66a8e94..3e31a49 100644 --- a/UI/Components/SplitComponent.cs +++ b/UI/Components/SplitComponent.cs @@ -758,11 +758,12 @@ protected void UpdateColumn(LiveSplitState state, SimpleLabel label, ColumnData var splitIndex = state.Run.IndexOf(Split); if (splitIndex < state.CurrentSplitIndex) { - if (type == ColumnType.SplitTime || type == ColumnType.SegmentTime) + // Formatting for each completed segment. + if (type == ColumnType.SplitTime || type == ColumnType.CompletedSplits || type == ColumnType.SegmentTime) { label.ForeColor = Settings.OverrideTimesColor ? Settings.BeforeTimesColor : state.LayoutSettings.TextColor; - if (type == ColumnType.SplitTime) + if (type == ColumnType.SplitTime || type == ColumnType.CompletedSplits) { label.Text = TimeFormatter.Format(Split.SplitTime[timingMethod]); } @@ -816,6 +817,7 @@ protected void UpdateColumn(LiveSplitState state, SimpleLabel label, ColumnData } else { + // Formatting for each active or upcoming segment. if (type == ColumnType.SplitTime || type == ColumnType.SegmentTime || type == ColumnType.DeltaorSplitTime || type == ColumnType.SegmentDeltaorSegmentTime) { if (IsActive) @@ -852,7 +854,7 @@ protected void UpdateColumn(LiveSplitState state, SimpleLabel label, ColumnData label.Text = DeltaTimeFormatter.Format(bestDelta); label.ForeColor = Settings.OverrideDeltasColor ? Settings.DeltasColor : state.LayoutSettings.TextColor; } - else if (type == ColumnType.Delta || type == ColumnType.SegmentDelta) + else if (type == ColumnType.Delta || type == ColumnType.SegmentDelta || type == ColumnType.CompletedSplits) { label.Text = ""; } From 8ef8ec99084615a5825b4788670cbccb11e5d588 Mon Sep 17 00:00:00 2001 From: ooterness Date: Mon, 17 Feb 2020 16:36:16 -0800 Subject: [PATCH 2/2] Added a new column type: "Reference Splits" Moved column-type enumeration to avoid breaking auto-generated code. --- UI/ColumnType.cs | 2 +- UI/Components/ColumnSettings.Designer.cs | 6 +----- UI/Components/ColumnSettings.cs | 6 ++++++ UI/Components/SplitComponent.cs | 7 +++++++ 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/UI/ColumnType.cs b/UI/ColumnType.cs index 0ad51c0..80f830d 100644 --- a/UI/ColumnType.cs +++ b/UI/ColumnType.cs @@ -2,6 +2,6 @@ { public enum ColumnType { - Delta, SplitTime, CompletedSplits, DeltaorSplitTime, SegmentDelta, SegmentTime, SegmentDeltaorSegmentTime + Delta, SplitTime, CompletedSplits, ReferenceSplits, DeltaorSplitTime, SegmentDelta, SegmentTime, SegmentDeltaorSegmentTime } } diff --git a/UI/Components/ColumnSettings.Designer.cs b/UI/Components/ColumnSettings.Designer.cs index 39c9214..18a0ebc 100644 --- a/UI/Components/ColumnSettings.Designer.cs +++ b/UI/Components/ColumnSettings.Designer.cs @@ -1,6 +1,4 @@ -using System.Linq; - -namespace LiveSplit.UI.Components +namespace LiveSplit.UI.Components { partial class ColumnSettings { @@ -129,12 +127,10 @@ private void InitializeComponent() // // cmbColumnType // - System.Collections.IEnumerable colNames = from ColumnType type in System.Enum.GetValues(typeof(ColumnType)) select ColumnSettings.GetColumnType(type); this.cmbColumnType.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.tableLayoutPanel1.SetColumnSpan(this.cmbColumnType, 3); this.cmbColumnType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbColumnType.FormattingEnabled = true; - this.cmbColumnType.Items.AddRange(colNames.Cast().ToArray()); this.cmbColumnType.Location = new System.Drawing.Point(93, 33); this.cmbColumnType.Name = "cmbColumnType"; this.cmbColumnType.Size = new System.Drawing.Size(325, 21); diff --git a/UI/Components/ColumnSettings.cs b/UI/Components/ColumnSettings.cs index bdacc04..aa7bcf5 100644 --- a/UI/Components/ColumnSettings.cs +++ b/UI/Components/ColumnSettings.cs @@ -37,6 +37,10 @@ public ColumnSettings(LiveSplitState state, string columnName, IList().ToArray()); + Data = new ColumnData(columnName, ColumnType.Delta, "Current Comparison", "Current Timing Method"); CurrentState = state; @@ -108,6 +112,8 @@ private static string GetColumnType(ColumnType type) return "Split Time"; else if (type == ColumnType.CompletedSplits) return "Completed Splits"; + else if (type == ColumnType.ReferenceSplits) + return "Reference Splits"; else if (type == ColumnType.Delta) return "Delta"; else if (type == ColumnType.DeltaorSplitTime) diff --git a/UI/Components/SplitComponent.cs b/UI/Components/SplitComponent.cs index 3e31a49..bf3485d 100644 --- a/UI/Components/SplitComponent.cs +++ b/UI/Components/SplitComponent.cs @@ -755,6 +755,13 @@ protected void UpdateColumn(LiveSplitState state, SimpleLabel label, ColumnData var type = data.Type; + if (type == ColumnType.ReferenceSplits) + { + label.ForeColor = state.LayoutSettings.TextColor; + label.Text = TimeFormatter.Format(Split.Comparisons[comparison][timingMethod]); + return; + } + var splitIndex = state.Run.IndexOf(Split); if (splitIndex < state.CurrentSplitIndex) {