protected void UpdateAll(LiveSplitState state) { if (Split != null) { RecreateLabels(); NameLabel.Text = Split.Name; var splitIndex = state.Run.IndexOf(Split); if (splitIndex < state.CurrentSplitIndex) { NameLabel.ForeColor = Settings.OverrideTextColor ? Settings.BeforeNamesColor : state.LayoutSettings.TextColor; } else { if (Split == state.CurrentSplit) { NameLabel.ForeColor = Settings.OverrideTextColor ? Settings.CurrentNamesColor : state.LayoutSettings.TextColor; } else { NameLabel.ForeColor = Settings.OverrideTextColor ? Settings.AfterNamesColor : state.LayoutSettings.TextColor; } } foreach (var label in LabelsList) { var column = ColumnsList.ElementAt(LabelsList.IndexOf(label)); UpdateColumn(state, label, column); } } }
public override void WriteToStream(IndentStream stream) { stream.Write("INSERT INTO "); Table.WriteToStream(stream); if (ColumnsList != null && ColumnsList.Count > 0) { stream.Write("("); ColumnsList.WriteToStreamWithComma(stream); stream.Write(")"); } if (WithExpr != null) { stream.Write(" "); WithExpr.WriteToStream(stream); } if (OutputList != null && OutputList.Count > 0) { stream.WriteLine(); stream.Write("OUTPUT "); OutputList.WriteToStreamWithComma(stream); } if (OutputIntoExpr != null) { stream.WriteLine(); OutputIntoExpr.WriteToStream(stream); } stream.WriteLine(); SelectFromExpr.WriteToStream(stream); }
} // SelectedColumns private void SettingsEditorModeMultiColumn_Load(object sender, EventArgs e) { ManualUpdateLock++; comboColumns.DataSource = ColumnsList.AsReadOnly(); comboColumns.SelectedValue = Columns[0]; ManualUpdateLock--; } // SettingsEditorModeMultiColumn_Load
public Profile() { modifierList = new ModifierList(); collectionsList = new CollectionsList(); columnsList = new ColumnsList(); selectedColumnsList = new SelectedColumnsList(); }
} // private void SettingsEditorModeTripleColumn_Load(object sender, EventArgs e) { ManualUpdateLock++; comboFirstColumn.DataSource = ColumnsList.AsReadOnly(); comboSecondColumn.DataSource = ColumnsNoneList.AsReadOnly(); comboThirdColumn.DataSource = ColumnsNoneList.AsReadOnly(); switch (Columns.Count) { case 0: comboFirstColumn.SelectedValue = UiBroadcastListColumn.NumberAndName; comboSecondColumn.SelectedValue = UiBroadcastListColumn.None; comboThirdColumn.SelectedValue = UiBroadcastListColumn.None; break; case 1: comboFirstColumn.SelectedValue = Columns[0]; comboSecondColumn.SelectedValue = UiBroadcastListColumn.None; comboThirdColumn.SelectedValue = UiBroadcastListColumn.None; break; case 2: comboFirstColumn.SelectedValue = Columns[0]; comboSecondColumn.SelectedValue = Columns[1]; comboThirdColumn.SelectedValue = UiBroadcastListColumn.None; break; default: comboFirstColumn.SelectedValue = Columns[0]; comboSecondColumn.SelectedValue = Columns[1]; comboThirdColumn.SelectedValue = Columns[2]; break; } // switch ManualUpdateLock--; } // SettingsEditorModeTripleColumn_Load
public JsonResult Columns_Destroy(ColumnModel model) { var target = ColumnOne(m => m.ID == model.ID); ColumnsList.Remove(target); return(Json(target)); }
void column_MovedUp(object sender, EventArgs e) { var column = (ColumnSettings)sender; var index = ColumnsList.IndexOf(column); ColumnsList.Remove(column); ColumnsList.Insert(index - 1, column); ResetColumns(); column.SelectControl(); }
} // SelectedColumns private void SettingsEditorModeMultiColumn_Load(object sender, EventArgs e) { ItemsManager = new ListItemsManager <UiBroadcastListColumn>(listSelectedColumns, buttonRemove, buttonMoveUp, buttonMoveDown); comboColumns.DataSource = ColumnsList.AsReadOnly(); buttonAddColumn.Enabled = (comboColumns.Items.Count > 0); ItemsManager.SetValueDictionary(ColumnsList, null); ItemsManager.Add(Columns); } // SettingsEditorModeMultiColumn_Load
protected void UpdateAll(LiveSplitState state) { RecreateLabels(); foreach (var label in LabelsList) { var column = ColumnsList.ElementAt(LabelsList.IndexOf(label)); label.Text = column.Name; label.ForeColor = Settings.LabelsColor; } }
public JsonResult Columns_Create(ColumnModel model) { int lastID = ColumnsList.Select(m => m.ID).Max(); int order = ColumnsList.Select(m => m.Order).Max(); model.ID = lastID + 1; model.Order = order + 1; model.Status = model.Text.ToLowerInvariant(); ColumnsList.Add(model); return(Json(model)); }
private void btnADelete_Click(object sender, RoutedEventArgs e) { var selectedItem = (KeyValuePair <string, string>)lstDisplayColumns.SelectedItem; DisplayColumnsList.Remove(selectedItem.Key.ToString()); ColumnsList.Add(selectedItem.Key, selectedItem.Value); lstAllColumns.Items.Refresh(); lstDisplayColumns.Items.Refresh(); }
protected float CalculateLabelsWidth() { if (ColumnsList != null) { var mixedCount = ColumnsList.Count(x => x.Type == ColumnType.DeltaorSplitTime || x.Type == ColumnType.SegmentDeltaorSegmentTime); var deltaCount = ColumnsList.Count(x => x.Type == ColumnType.Delta || x.Type == ColumnType.SegmentDelta); var timeCount = ColumnsList.Count(x => x.Type == ColumnType.SplitTime || x.Type == ColumnType.SegmentTime); return((mixedCount * (Math.Max(MeasureDeltaLabel.ActualWidth, MeasureTimeLabel.ActualWidth) + 5)) + (deltaCount * (MeasureDeltaLabel.ActualWidth + 5)) + (timeCount * (MeasureTimeLabel.ActualWidth + 5))); } return(0f); }
public XmlNode GetSettings(XmlDocument document) { var parent = document.CreateElement("Settings"); parent.AppendChild(ToElement(document, "Version", "1.5")); parent.AppendChild(ToElement(document, CurrentSplitTopColor, "CurrentSplitTopColor")); parent.AppendChild(ToElement(document, CurrentSplitBottomColor, "CurrentSplitBottomColor")); parent.AppendChild(ToElement(document, "VisualSplitCount", VisualSplitCount)); parent.AppendChild(ToElement(document, "SplitPreviewCount", SplitPreviewCount)); parent.AppendChild(ToElement(document, "DisplayIcons", DisplayIcons)); parent.AppendChild(ToElement(document, "ShowThinSeparators", ShowThinSeparators)); parent.AppendChild(ToElement(document, "AlwaysShowLastSplit", AlwaysShowLastSplit)); parent.AppendChild(ToElement(document, "SplitWidth", SplitWidth)); parent.AppendChild(ToElement(document, "SplitTimesAccuracy", SplitTimesAccuracy)); parent.AppendChild(ToElement(document, BeforeNamesColor, "BeforeNamesColor")); parent.AppendChild(ToElement(document, CurrentNamesColor, "CurrentNamesColor")); parent.AppendChild(ToElement(document, AfterNamesColor, "AfterNamesColor")); parent.AppendChild(ToElement(document, "OverrideTextColor", OverrideTextColor)); parent.AppendChild(ToElement(document, BeforeTimesColor, "BeforeTimesColor")); parent.AppendChild(ToElement(document, CurrentTimesColor, "CurrentTimesColor")); parent.AppendChild(ToElement(document, AfterTimesColor, "AfterTimesColor")); parent.AppendChild(ToElement(document, "OverrideTimesColor", OverrideTimesColor)); parent.AppendChild(ToElement(document, "ShowBlankSplits", ShowBlankSplits)); parent.AppendChild(ToElement(document, "LockLastSplit", LockLastSplit)); parent.AppendChild(ToElement(document, "IconSize", IconSize)); parent.AppendChild(ToElement(document, "IconShadows", IconShadows)); parent.AppendChild(ToElement(document, "SplitHeight", SplitHeight)); parent.AppendChild(ToElement(document, "CurrentSplitGradient", CurrentSplitGradient)); parent.AppendChild(ToElement(document, BackgroundColor, "BackgroundColor")); parent.AppendChild(ToElement(document, BackgroundColor2, "BackgroundColor2")); parent.AppendChild(ToElement(document, "BackgroundGradient", BackgroundGradient)); parent.AppendChild(ToElement(document, "SeparatorLastSplit", SeparatorLastSplit)); parent.AppendChild(ToElement(document, "DeltasAccuracy", DeltasAccuracy)); parent.AppendChild(ToElement(document, "DropDecimals", DropDecimals)); parent.AppendChild(ToElement(document, "OverrideDeltasColor", OverrideDeltasColor)); parent.AppendChild(ToElement(document, DeltasColor, "DeltasColor")); parent.AppendChild(ToElement(document, "Display2Rows", Display2Rows)); parent.AppendChild(ToElement(document, "HideIconsIfAllBlank", HideIconsIfAllBlank)); parent.AppendChild(ToElement(document, "ShowColumnLabels", ShowColumnLabels)); parent.AppendChild(ToElement(document, LabelsColor, "LabelsColor")); var columnsElement = document.CreateElement("Columns"); foreach (var columnData in ColumnsList.Select(x => x.Data)) { columnsElement.AppendChild(columnData.ToXml(document)); } parent.AppendChild(columnsElement); return(parent); }
private void btnAddColumn_Click(object sender, EventArgs e) { UpdateLayoutForColumn(); var columnControl = new ColumnSettings(CurrentState, "#" + (ColumnsList.Count + 1), ColumnsList); ColumnsList.Add(columnControl); AddColumnToLayout(columnControl, ColumnsList.Count); foreach (var column in ColumnsList) { column.UpdateEnabledButtons(); } }
protected void RecreateLabels() { if (ColumnsList != null && LabelsList.Count != ColumnsList.Count()) { LabelsList.Clear(); foreach (var column in ColumnsList) { LabelsList.Add(new SimpleLabel { HorizontalAlignment = StringAlignment.Far }); } } }
/// <summary> /// Generating the data grid columns. /// </summary> private void GenerateGridColumns() { DataGridExpander.ItemsSource = ItemSourceCollection; foreach (var item in ColumnsList.Where(x => x.Visibility.Equals(true))) { var column = new DataGridTextColumn { Header = item.Header, Binding = new Binding(item.ColumnName), Width = item.Width, Visibility = item.Visibility ? Visibility.Visible : Visibility.Collapsed }; } }
public void RegisterColumn(IMGridColumn pColumn) { if (ColumnsList.Any(c => c.Identifier == pColumn.Identifier)) { return; } ColumnsList.Add(pColumn); if (pColumn is MGridActionColumn <T> ) { mHasActionColumn = true; } if (pColumn is IMGridPropertyColumn propc) { var iprop = ReflectionHelper.GetIMPropertyInfo(typeof(T), propc.Property, propc.PropertyType); propc.PropertyType = iprop.PropertyType; if (propc.Attributes != null) { iprop.SetAttributes(propc.Attributes); } mPropertyInfoCache.Add(propc, iprop); if (pColumn is IMGridSortableColumn sc && sc.SortDirection != MSortDirection.None) { object comparer = null; if (pColumn is IMGridCustomComparer) { comparer = ((dynamic)pColumn).Comparer; } SortInstructions.Add(new SortInstruction() { Direction = sc.SortDirection, PropertyInfo = iprop, Index = sc.SortIndex, Comparer = comparer }); } } mFilterModel = null; ClearDataCache(); StateHasChanged(); }
void column_ColumnRemoved(object sender, EventArgs e) { var column = (ColumnSettings)sender; var index = ColumnsList.IndexOf(column); ColumnsList.Remove(column); ResetColumns(); if (ColumnsList.Count > 0) { ColumnsList.Last().SelectControl(); } else { chkColumnLabels.Select(); } }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { UpdateAll(state); Cache.Restart(); Cache["ColumnsCount"] = ColumnsList.Count(); foreach (var label in LabelsList) { Cache["Columns" + LabelsList.IndexOf(label) + "Text"] = label.Text; } if (invalidator != null && Cache.HasChanged || FrameCount > 1) { invalidator.Invalidate(0, 0, width, height); } }
protected void UpdateAll(LiveSplitState state) { if (Split != null) { RecreateLabels(); if (Settings.AutomaticAbbreviations) { if (NameLabel.Text != Split.Name || NameLabel.AlternateText == null || !NameLabel.AlternateText.Any()) { NameLabel.AlternateText = Split.Name.GetAbbreviations().ToList(); } } else if (NameLabel.AlternateText?.Any() == true) { NameLabel.AlternateText.Clear(); } NameLabel.Text = Split.Name; var splitIndex = state.Run.IndexOf(Split); if (splitIndex < state.CurrentSplitIndex) { NameLabel.ForeColor = Settings.OverrideTextColor ? Settings.BeforeNamesColor : state.LayoutSettings.TextColor; } else { if (Split == state.CurrentSplit) { NameLabel.ForeColor = Settings.OverrideTextColor ? Settings.CurrentNamesColor : state.LayoutSettings.TextColor; } else { NameLabel.ForeColor = Settings.OverrideTextColor ? Settings.AfterNamesColor : state.LayoutSettings.TextColor; } } foreach (var label in LabelsList) { var column = ColumnsList.ElementAt(LabelsList.IndexOf(label)); UpdateColumn(state, label, column); } } }
public List <ColumnsList> vratiSveKolone(ComboBox comboTabela) { OtvoriKonekciju(); List <ColumnsList> lista = new List <ColumnsList>(); string upit = "SELECT column_name FROM dbo.col_list"; SqlCommand komanda = new SqlCommand(upit, konekcija, transakcija); DataTable tabela = new DataTable(); SqlDataReader citac = komanda.ExecuteReader(); tabela.Load(citac); foreach (DataRow red in tabela.Rows) { ColumnsList cl = new ColumnsList(); cl.ColumnName = red[0].ToString(); lista.Add(cl); } ZatvoriKonekciju(); return(lista); }
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { if (Split != null) { UpdateAll(state); NeedUpdateAll = false; IsActive = (state.CurrentPhase == TimerPhase.Running || state.CurrentPhase == TimerPhase.Paused) && state.CurrentSplit == Split; Cache.Restart(); Cache["Icon"] = Split.Icon; if (Cache.HasChanged) { if (Split.Icon == null) { FrameCount = 0; } else { FrameCount = Split.Icon.GetFrameCount(new FrameDimension(Split.Icon.FrameDimensionsList[0])); } } Cache["DisplayIcon"] = DisplayIcon; Cache["SplitName"] = NameLabel.Text; Cache["IsActive"] = IsActive; Cache["NameColor"] = NameLabel.ForeColor.ToArgb(); Cache["ColumnsCount"] = ColumnsList.Count(); foreach (var label in LabelsList) { Cache["Columns" + LabelsList.IndexOf(label) + "Text"] = label.Text; Cache["Columns" + LabelsList.IndexOf(label) + "Color"] = label.ForeColor.ToArgb(); } if (invalidator != null && Cache.HasChanged || FrameCount > 1) { invalidator.Invalidate(0, 0, width, height); } } }
private void DataGrid_SizeChanged(object sender, SizeChangedEventArgs e) { if (ColumnsList != null && ColumnsList.Count > 0) { totalWidth = ColumnsList.Sum(x => x.Width); currentWidth = ColumnsList.Where(i => i.Visibility.Equals(true)).Sum(x => x.Width); } if (nextInlineColumn != null && nextInlineColumn.Width > 0) if ((currentWidth + nextInlineColumn.Width) <= DataGridExpander.ActualWidth) { ColumnsList[ColumnsList.LastIndexOf(nextInlineColumn)].Visibility = true; FindCurrentAndNextColumn(); } else if (currentWidth > ActualWidth) { ColumnsList[ColumnsList.LastIndexOf(currentVisibleColumn)].Visibility = false; FindCurrentAndNextColumn(); } currentWidth = DataGridExpander.ActualWidth; GenerateGridColumns(); }
private void DrawGeneral(Graphics g, LiveSplitState state, float width, float height, LayoutMode mode) { if (Settings.BackgroundGradient == ExtendedGradientType.Alternating) { g.FillRectangle(new SolidBrush( Settings.BackgroundColor ), 0, 0, width, height); } MeasureTimeLabel.Text = TimeFormatter.Format(new TimeSpan(24, 0, 0)); MeasureDeltaLabel.Text = DeltaTimeFormatter.Format(new TimeSpan(0, 9, 0, 0)); MeasureTimeLabel.Font = state.LayoutSettings.TimesFont; MeasureTimeLabel.IsMonospaced = true; MeasureDeltaLabel.Font = state.LayoutSettings.TimesFont; MeasureDeltaLabel.IsMonospaced = true; MeasureTimeLabel.SetActualWidth(g); MeasureDeltaLabel.SetActualWidth(g); if (Settings.SplitTimesAccuracy != CurrentAccuracy) { TimeFormatter = new RegularSplitTimeFormatter(Settings.SplitTimesAccuracy); CurrentAccuracy = Settings.SplitTimesAccuracy; } if (Settings.DeltasAccuracy != CurrentDeltaAccuracy || Settings.DropDecimals != CurrentDropDecimals) { DeltaTimeFormatter = new DeltaSplitTimeFormatter(Settings.DeltasAccuracy, Settings.DropDecimals); CurrentDeltaAccuracy = Settings.DeltasAccuracy; CurrentDropDecimals = Settings.DropDecimals; } foreach (var label in LabelsList) { label.ShadowColor = state.LayoutSettings.ShadowsColor; label.Y = 0; label.Height = height; } MinimumWidth = 10f; if (ColumnsList.Count() == LabelsList.Count) { var curX = width - 7; foreach (var label in LabelsList.Reverse()) { var column = ColumnsList.ElementAt(LabelsList.IndexOf(label)); var labelWidth = 0f; if (column.Type == ColumnType.DeltaorSplitTime || column.Type == ColumnType.SegmentDeltaorSegmentTime) { labelWidth = Math.Max(MeasureDeltaLabel.ActualWidth, MeasureTimeLabel.ActualWidth); } else if (column.Type == ColumnType.Delta || column.Type == ColumnType.SegmentDelta) { labelWidth = MeasureDeltaLabel.ActualWidth; } else { labelWidth = MeasureTimeLabel.ActualWidth; } curX -= labelWidth + 5; label.Width = labelWidth; label.X = curX + 5; label.Font = state.LayoutSettings.TextFont; label.HasShadow = state.LayoutSettings.DropShadows; label.Draw(g); } } }
/// <summary> /// Fetching the last visible column and next column in line to show. /// </summary> private void FindCurrentAndNextColumn() { nextInlineColumn = ColumnsList.OrderBy(x => x.Order).ToList().FirstOrDefault(i => i.Visibility.Equals(false)); currentVisibleColumn = ColumnsList.OrderBy(x => x.Order).ToList().LastOrDefault(i => i.Visibility.Equals(true)); }
private void DrawGeneral(Graphics g, LiveSplitState state, float width, float height, LayoutMode mode) { if (NeedUpdateAll) { UpdateAll(state); } if (Settings.BackgroundGradient == ExtendedGradientType.Alternating) { g.FillRectangle(new SolidBrush( state.Run.IndexOf(Split) % 2 + (Settings.ShowColumnLabels ? 1 : 0) == 1 ? Settings.BackgroundColor2 : Settings.BackgroundColor ), 0, 0, width, height); } MeasureTimeLabel.Text = TimeFormatter.Format(new TimeSpan(24, 0, 0)); MeasureDeltaLabel.Text = DeltaTimeFormatter.Format(new TimeSpan(0, 9, 0, 0)); MeasureTimeLabel.Font = state.LayoutSettings.TimesFont; MeasureTimeLabel.IsMonospaced = true; MeasureDeltaLabel.Font = state.LayoutSettings.TimesFont; MeasureDeltaLabel.IsMonospaced = true; MeasureTimeLabel.SetActualWidth(g); MeasureDeltaLabel.SetActualWidth(g); NameLabel.ShadowColor = state.LayoutSettings.ShadowsColor; foreach (var label in LabelsList) { label.SetActualWidth(g); label.ShadowColor = state.LayoutSettings.ShadowsColor; } MinimumWidth = CalculateLabelsWidth() + IconWidth + 10; MinimumHeight = 0.85f * (g.MeasureString("A", state.LayoutSettings.TimesFont).Height + g.MeasureString("A", state.LayoutSettings.TextFont).Height); if (Settings.SplitTimesAccuracy != CurrentAccuracy) { TimeFormatter = new RegularSplitTimeFormatter(Settings.SplitTimesAccuracy); CurrentAccuracy = Settings.SplitTimesAccuracy; } if (Settings.DeltasAccuracy != CurrentDeltaAccuracy || Settings.DropDecimals != CurrentDropDecimals) { DeltaTimeFormatter = new DeltaSplitTimeFormatter(Settings.DeltasAccuracy, Settings.DropDecimals); CurrentDeltaAccuracy = Settings.DeltasAccuracy; CurrentDropDecimals = Settings.DropDecimals; } if (Split != null) { if (mode == LayoutMode.Vertical) { NameLabel.VerticalAlignment = StringAlignment.Center; NameLabel.Y = 0; NameLabel.Height = height; foreach (var label in LabelsList) { label.VerticalAlignment = StringAlignment.Center; label.Y = 0; label.Height = height; } } else { NameLabel.VerticalAlignment = StringAlignment.Near; NameLabel.Y = 0; NameLabel.Height = 50; foreach (var label in LabelsList) { label.VerticalAlignment = StringAlignment.Far; label.Y = height - 50; label.Height = 50; } } if (IsActive) { var currentSplitBrush = new LinearGradientBrush( new PointF(0, 0), Settings.CurrentSplitGradient == GradientType.Horizontal ? new PointF(width, 0) : new PointF(0, height), Settings.CurrentSplitTopColor, Settings.CurrentSplitGradient == GradientType.Plain ? Settings.CurrentSplitTopColor : Settings.CurrentSplitBottomColor); g.FillRectangle(currentSplitBrush, 0, 0, width, height); } if (DisplayIcon) { var icon = Split.Icon ?? NoIconImage; var shadow = (Split.Icon != null) ? ShadowImage : NoIconShadow; /*if (DateTime.Now.Date.Month == 4 && DateTime.Now.Date.Day == 1) * { * icon = LiveSplit.Web.Share.TwitchEmoteResolver.Resolve("Kappa", true, false, false); * shadow = null; * }*/ if (OldImage != icon) { ImageAnimator.Animate(icon, (s, o) => { }); ImageAnimator.Animate(shadow, (s, o) => { }); OldImage = icon; } var drawWidth = Settings.IconSize; var drawHeight = Settings.IconSize; var shadowWidth = Settings.IconSize * (5 / 4f); var shadowHeight = Settings.IconSize * (5 / 4f); if (icon.Width > icon.Height) { var ratio = icon.Height / (float)icon.Width; drawHeight *= ratio; shadowHeight *= ratio; } else { var ratio = icon.Width / (float)icon.Height; drawWidth *= ratio; shadowWidth *= ratio; } ImageAnimator.UpdateFrames(shadow); if (Settings.IconShadows && shadow != null) { g.DrawImage( shadow, 7 + (Settings.IconSize * (5 / 4f) - shadowWidth) / 2 - 0.7f, (height - Settings.IconSize) / 2.0f + (Settings.IconSize * (5 / 4f) - shadowHeight) / 2 - 0.7f, shadowWidth, shadowHeight); } ImageAnimator.UpdateFrames(icon); g.DrawImage( icon, 7 + (Settings.IconSize - drawWidth) / 2, (height - Settings.IconSize) / 2.0f + (Settings.IconSize - drawHeight) / 2, drawWidth, drawHeight); } NameLabel.Font = state.LayoutSettings.TextFont; NameLabel.X = 5 + IconWidth; NameLabel.HasShadow = state.LayoutSettings.DropShadows; if (ColumnsList.Count() == LabelsList.Count) { var curX = width - 7; var nameX = width - 7; foreach (var label in LabelsList.Reverse()) { var column = ColumnsList.ElementAt(LabelsList.IndexOf(label)); var labelWidth = 0f; if (column.Type == ColumnType.DeltaorSplitTime || column.Type == ColumnType.SegmentDeltaorSegmentTime) { labelWidth = Math.Max(MeasureDeltaLabel.ActualWidth, MeasureTimeLabel.ActualWidth); } else if (column.Type == ColumnType.Delta || column.Type == ColumnType.SegmentDelta) { labelWidth = MeasureDeltaLabel.ActualWidth; } else { labelWidth = MeasureTimeLabel.ActualWidth; } label.Width = labelWidth + 20; curX -= labelWidth + 5; label.X = curX - 15; label.Font = state.LayoutSettings.TimesFont; label.HasShadow = state.LayoutSettings.DropShadows; label.IsMonospaced = true; label.Draw(g); if (!String.IsNullOrEmpty(label.Text)) { nameX = curX + labelWidth + 5 - label.ActualWidth; } } NameLabel.Width = (mode == LayoutMode.Horizontal ? width - 10 : nameX) - IconWidth; NameLabel.Draw(g); } } else { DisplayIcon = Settings.DisplayIcons; } }
public static ColumnModel ColumnOne(Func <ColumnModel, bool> predicate) { return(ColumnsList.FirstOrDefault(predicate)); }
public Table(string tname) { Columns = new ColumnsList(this); Name = ""; a = new ArrayList(); Name = tname; }
public void SetSettings(XmlNode node) { var element = (XmlElement)node; Version version = SettingsHelper.ParseVersion(element["Version"]); CurrentSplitTopColor = SettingsHelper.ParseColor(element["CurrentSplitTopColor"]); CurrentSplitBottomColor = SettingsHelper.ParseColor(element["CurrentSplitBottomColor"]); VisualSplitCount = SettingsHelper.ParseInt(element["VisualSplitCount"]); SplitPreviewCount = SettingsHelper.ParseInt(element["SplitPreviewCount"]); DisplayIcons = SettingsHelper.ParseBool(element["DisplayIcons"]); ShowThinSeparators = SettingsHelper.ParseBool(element["ShowThinSeparators"]); AlwaysShowLastSplit = SettingsHelper.ParseBool(element["AlwaysShowLastSplit"]); SplitWidth = SettingsHelper.ParseFloat(element["SplitWidth"]); AutomaticAbbreviations = SettingsHelper.ParseBool(element["AutomaticAbbreviations"], false); ShowColumnLabels = SettingsHelper.ParseBool(element["ShowColumnLabels"], false); LabelsColor = SettingsHelper.ParseColor(element["LabelsColor"], Color.FromArgb(255, 255, 255)); OverrideTimesColor = SettingsHelper.ParseBool(element["OverrideTimesColor"], false); BeforeTimesColor = SettingsHelper.ParseColor(element["BeforeTimesColor"], Color.FromArgb(255, 255, 255)); CurrentTimesColor = SettingsHelper.ParseColor(element["CurrentTimesColor"], Color.FromArgb(255, 255, 255)); AfterTimesColor = SettingsHelper.ParseColor(element["AfterTimesColor"], Color.FromArgb(255, 255, 255)); SplitHeight = SettingsHelper.ParseFloat(element["SplitHeight"], 6); SplitGradientString = SettingsHelper.ParseString(element["CurrentSplitGradient"], GradientType.Vertical.ToString()); BackgroundColor = SettingsHelper.ParseColor(element["BackgroundColor"], Color.Transparent); BackgroundColor2 = SettingsHelper.ParseColor(element["BackgroundColor2"], Color.Transparent); GradientString = SettingsHelper.ParseString(element["BackgroundGradient"], ExtendedGradientType.Plain.ToString()); SeparatorLastSplit = SettingsHelper.ParseBool(element["SeparatorLastSplit"], true); DropDecimals = SettingsHelper.ParseBool(element["DropDecimals"], true); DeltasAccuracy = SettingsHelper.ParseEnum(element["DeltasAccuracy"], TimeAccuracy.Tenths); OverrideDeltasColor = SettingsHelper.ParseBool(element["OverrideDeltasColor"], false); DeltasColor = SettingsHelper.ParseColor(element["DeltasColor"], Color.FromArgb(255, 255, 255)); Display2Rows = SettingsHelper.ParseBool(element["Display2Rows"], false); SplitTimesAccuracy = SettingsHelper.ParseEnum(element["SplitTimesAccuracy"], TimeAccuracy.Seconds); ShowBlankSplits = SettingsHelper.ParseBool(element["ShowBlankSplits"], true); LockLastSplit = SettingsHelper.ParseBool(element["LockLastSplit"], false); IconSize = SettingsHelper.ParseFloat(element["IconSize"], 24f); IconShadows = SettingsHelper.ParseBool(element["IconShadows"], true); if (version >= new Version(1, 5)) { var columnsElement = element["Columns"]; ColumnsList.Clear(); foreach (var child in columnsElement.ChildNodes) { var columnData = ColumnData.FromXml((XmlNode)child); ColumnsList.Add(new ColumnSettings(CurrentState, columnData.Name, ColumnsList) { Data = columnData }); } } else { ColumnsList.Clear(); var comparison = SettingsHelper.ParseString(element["Comparison"]); if (SettingsHelper.ParseBool(element["ShowSplitTimes"])) { ColumnsList.Add(new ColumnSettings(CurrentState, "+/-", ColumnsList) { Data = new ColumnData("+/-", ColumnType.Delta, comparison, "Current Timing Method") }); ColumnsList.Add(new ColumnSettings(CurrentState, "Time", ColumnsList) { Data = new ColumnData("Time", ColumnType.SplitTime, comparison, "Current Timing Method") }); } else { ColumnsList.Add(new ColumnSettings(CurrentState, "+/-", ColumnsList) { Data = new ColumnData("+/-", ColumnType.DeltaorSplitTime, comparison, "Current Timing Method") }); } } if (version >= new Version(1, 3)) { BeforeNamesColor = SettingsHelper.ParseColor(element["BeforeNamesColor"]); CurrentNamesColor = SettingsHelper.ParseColor(element["CurrentNamesColor"]); AfterNamesColor = SettingsHelper.ParseColor(element["AfterNamesColor"]); OverrideTextColor = SettingsHelper.ParseBool(element["OverrideTextColor"]); } else { if (version >= new Version(1, 2)) { BeforeNamesColor = CurrentNamesColor = AfterNamesColor = SettingsHelper.ParseColor(element["SplitNamesColor"]); } else { BeforeNamesColor = Color.FromArgb(255, 255, 255); CurrentNamesColor = Color.FromArgb(255, 255, 255); AfterNamesColor = Color.FromArgb(255, 255, 255); } OverrideTextColor = !SettingsHelper.ParseBool(element["UseTextColor"], true); } }
private int CreateSettingsNode(XmlDocument document, XmlElement parent) { var hashCode = SettingsHelper.CreateSetting(document, parent, "Version", "1.6") ^ SettingsHelper.CreateSetting(document, parent, "CurrentSplitTopColor", CurrentSplitTopColor) ^ SettingsHelper.CreateSetting(document, parent, "CurrentSplitBottomColor", CurrentSplitBottomColor) ^ SettingsHelper.CreateSetting(document, parent, "VisualSplitCount", VisualSplitCount) ^ SettingsHelper.CreateSetting(document, parent, "SplitPreviewCount", SplitPreviewCount) ^ SettingsHelper.CreateSetting(document, parent, "DisplayIcons", DisplayIcons) ^ SettingsHelper.CreateSetting(document, parent, "ShowThinSeparators", ShowThinSeparators) ^ SettingsHelper.CreateSetting(document, parent, "AlwaysShowLastSplit", AlwaysShowLastSplit) ^ SettingsHelper.CreateSetting(document, parent, "SplitWidth", SplitWidth) ^ SettingsHelper.CreateSetting(document, parent, "SplitTimesAccuracy", SplitTimesAccuracy) ^ SettingsHelper.CreateSetting(document, parent, "AutomaticAbbreviations", AutomaticAbbreviations) ^ SettingsHelper.CreateSetting(document, parent, "BeforeNamesColor", BeforeNamesColor) ^ SettingsHelper.CreateSetting(document, parent, "CurrentNamesColor", CurrentNamesColor) ^ SettingsHelper.CreateSetting(document, parent, "AfterNamesColor", AfterNamesColor) ^ SettingsHelper.CreateSetting(document, parent, "OverrideTextColor", OverrideTextColor) ^ SettingsHelper.CreateSetting(document, parent, "BeforeTimesColor", BeforeTimesColor) ^ SettingsHelper.CreateSetting(document, parent, "CurrentTimesColor", CurrentTimesColor) ^ SettingsHelper.CreateSetting(document, parent, "AfterTimesColor", AfterTimesColor) ^ SettingsHelper.CreateSetting(document, parent, "OverrideTimesColor", OverrideTimesColor) ^ SettingsHelper.CreateSetting(document, parent, "ShowBlankSplits", ShowBlankSplits) ^ SettingsHelper.CreateSetting(document, parent, "LockLastSplit", LockLastSplit) ^ SettingsHelper.CreateSetting(document, parent, "IconSize", IconSize) ^ SettingsHelper.CreateSetting(document, parent, "IconShadows", IconShadows) ^ SettingsHelper.CreateSetting(document, parent, "SplitHeight", SplitHeight) ^ SettingsHelper.CreateSetting(document, parent, "CurrentSplitGradient", CurrentSplitGradient) ^ SettingsHelper.CreateSetting(document, parent, "BackgroundColor", BackgroundColor) ^ SettingsHelper.CreateSetting(document, parent, "BackgroundColor2", BackgroundColor2) ^ SettingsHelper.CreateSetting(document, parent, "BackgroundGradient", BackgroundGradient) ^ SettingsHelper.CreateSetting(document, parent, "SeparatorLastSplit", SeparatorLastSplit) ^ SettingsHelper.CreateSetting(document, parent, "DeltasAccuracy", DeltasAccuracy) ^ SettingsHelper.CreateSetting(document, parent, "DropDecimals", DropDecimals) ^ SettingsHelper.CreateSetting(document, parent, "OverrideDeltasColor", OverrideDeltasColor) ^ SettingsHelper.CreateSetting(document, parent, "DeltasColor", DeltasColor) ^ SettingsHelper.CreateSetting(document, parent, "Display2Rows", Display2Rows) ^ SettingsHelper.CreateSetting(document, parent, "ShowColumnLabels", ShowColumnLabels) ^ SettingsHelper.CreateSetting(document, parent, "LabelsColor", LabelsColor); XmlElement columnsElement = null; if (document != null) { columnsElement = document.CreateElement("Columns"); parent.AppendChild(columnsElement); } var count = 1; foreach (var columnData in ColumnsList.Select(x => x.Data)) { XmlElement settings = null; if (document != null) { settings = document.CreateElement("Settings"); columnsElement.AppendChild(settings); } hashCode ^= columnData.CreateElement(document, settings) * count; count++; } return(hashCode); }
private void DrawGeneral(Graphics g, LiveSplitState state, float width, float height, LayoutMode mode) { if (NeedUpdateAll) { UpdateAll(state); } int splitIndex = state.Run.IndexOf(Split) % 7; if (IsActive) { switch (splitIndex) { case 0: img = Properties.Resources.row_0_s; break; case 1: img = Properties.Resources.row_1_s; break; case 2: img = Properties.Resources.row_2_s; break; case 3: img = Properties.Resources.row_3_s; break; case 4: img = Properties.Resources.row_4_s; break; case 5: img = Properties.Resources.row_5_s; break; case 6: img = Properties.Resources.row_6_s; break; default: img = Properties.Resources.row_0_s; break; } } else { switch (splitIndex) { case 0: img = Properties.Resources.row_0; break; case 1: img = Properties.Resources.row_1; break; case 2: img = Properties.Resources.row_2; break; case 3: img = Properties.Resources.row_3; break; case 4: img = Properties.Resources.row_4; break; case 5: img = Properties.Resources.row_5; break; case 6: img = Properties.Resources.row_6; break; default: img = Properties.Resources.row_0; break; } } g.DrawImage(img, 0, 0, width, height); MeasureTimeLabel.Text = TimeFormatter.Format(new TimeSpan(24, 0, 0)); MeasureDeltaLabel.Text = DeltaTimeFormatter.Format(new TimeSpan(0, 9, 0, 0)); MeasureTimeLabel.Font = state.LayoutSettings.TimesFont; MeasureTimeLabel.IsMonospaced = true; MeasureDeltaLabel.Font = state.LayoutSettings.TimesFont; MeasureDeltaLabel.IsMonospaced = true; MeasureTimeLabel.SetActualWidth(g); MeasureDeltaLabel.SetActualWidth(g); NameLabel.ShadowColor = state.LayoutSettings.ShadowsColor; NameLabel.OutlineColor = state.LayoutSettings.TextOutlineColor; foreach (var label in LabelsList) { label.ShadowColor = state.LayoutSettings.ShadowsColor; label.OutlineColor = state.LayoutSettings.TextOutlineColor; } if (Settings.SplitTimesAccuracy != CurrentAccuracy) { TimeFormatter = new RegularSplitTimeFormatter(Settings.SplitTimesAccuracy); CurrentAccuracy = Settings.SplitTimesAccuracy; } if (Settings.DeltasAccuracy != CurrentDeltaAccuracy || Settings.DropDecimals != CurrentDropDecimals) { DeltaTimeFormatter = new DeltaSplitTimeFormatter(Settings.DeltasAccuracy, Settings.DropDecimals); CurrentDeltaAccuracy = Settings.DeltasAccuracy; CurrentDropDecimals = Settings.DropDecimals; } if (Split != null) { if (mode == LayoutMode.Vertical) { NameLabel.VerticalAlignment = StringAlignment.Center; NameLabel.Y = 0; NameLabel.Height = height; foreach (var label in LabelsList) { label.VerticalAlignment = StringAlignment.Center; label.Y = 0; label.Height = height; } } else { NameLabel.VerticalAlignment = StringAlignment.Near; NameLabel.Y = 0; NameLabel.Height = 50; foreach (var label in LabelsList) { label.VerticalAlignment = StringAlignment.Far; label.Y = height - 50; label.Height = 50; } } if (IsActive) { g.DrawImage(SplitCursor, 2, ((height - 24f) / 2.0f), 30f, 24f); } NameLabel.Font = state.LayoutSettings.TextFont; NameLabel.X = IsActive ? 35 : 5; NameLabel.HasShadow = state.LayoutSettings.DropShadows; if (ColumnsList.Count() == LabelsList.Count) { var curX = width - 12; var nameX = width - 7; foreach (var label in LabelsList.Reverse()) { var column = ColumnsList.ElementAt(LabelsList.IndexOf(label)); var labelWidth = 0f; if (column.Type == ColumnType.DeltaorSplitTime || column.Type == ColumnType.SegmentDeltaorSegmentTime) { labelWidth = Math.Max(MeasureDeltaLabel.ActualWidth, MeasureTimeLabel.ActualWidth); } else if (column.Type == ColumnType.Delta || column.Type == ColumnType.SegmentDelta) { labelWidth = MeasureDeltaLabel.ActualWidth; } else { labelWidth = MeasureTimeLabel.ActualWidth; } label.Width = labelWidth + 20; curX -= labelWidth + 5; label.X = curX - 15; label.Font = state.LayoutSettings.TimesFont; label.HasShadow = state.LayoutSettings.DropShadows; label.OutlineColor = state.LayoutSettings.TextOutlineColor; label.IsMonospaced = true; label.Draw(g); if (!string.IsNullOrEmpty(label.Text)) { nameX = curX + labelWidth + 5 - label.ActualWidth; } } NameLabel.Width = (mode == LayoutMode.Horizontal ? width - 10 : width * 0.4f); NameLabel.Draw(g); } } }