/// <summary> /// </summary> private void AddSvTable() { ImGui.BeginChild("TP Area"); ImGui.Columns(2); ImGui.SetColumnWidth(0, 105); if (NeedsToScroll && SelectedTimingPoints.Count != 0 && WorkingMap.TimingPoints.Count == 0) { ImGui.SetScrollHereY(-0.05f); NeedsToScroll = false; } foreach (var tp in WorkingMap.TimingPoints) { var isSelected = SelectedTimingPoints.Contains(tp); if (!isSelected) { ImGui.PushStyleColor(ImGuiCol.Button, new Vector4(100, 100, 100, 0)); } if (NeedsToScroll && SelectedTimingPoints.Count != 0 && SelectedTimingPoints.First() == tp) { ImGui.SetScrollHereY(-0.05f); NeedsToScroll = false; } OnTpButtonClicked(tp, isSelected); if (!isSelected) { ImGui.PopStyleColor(); } ImGui.NextColumn(); ImGui.Text($"{tp.Bpm:0.00}"); ImGui.NextColumn(); } ImGui.EndChild(); }
/// <summary> /// </summary> private void SetInputTextToFirstSelected() { TextTime = SelectedTimingPoints.First().StartTime.ToString(CultureInfo.InvariantCulture); TextBpm = $"{SelectedTimingPoints.First().Bpm:0.00}"; }
/// <summary> /// </summary> private void HandleTextboxes() { ImGui.Dummy(new Vector2(0, 10)); ImGui.Text("Time"); if (ImGui.InputText("", ref TextTime, 100, SelectedTimingPoints.Count == 0 ? ImGuiInputTextFlags.ReadOnly : ImGuiInputTextFlags.CharsDecimal)) { if (string.IsNullOrEmpty(TextTime) || string.IsNullOrWhiteSpace(TextTime)) { TextTime = "0"; } TextTime = OnlyDigits(TextTime); } // User stopped typing in the time field, so it needs to be updated if (!ImGui.IsItemActive() && TextTimeFocusedInLastFrame) { UpdateSelectedTimingPoints(); } TextTimeFocusedInLastFrame = ImGui.IsItemActive(); ImGui.SameLine(); if (SelectedTimingPoints.Count == 1) { var game = GameBase.Game as QuaverGame; var screen = game?.CurrentScreen as EditorScreen; if (ImGui.ArrowButton("1", ImGuiDir.Left)) { var tp = SelectedTimingPoints.First(); screen?.Ruleset.ActionManager.Perform(new EditorActionChangeTimingPoint(WorkingMap, new List <EditorTimingPointChangeInfo> { new EditorTimingPointChangeInfo(tp, tp.StartTime - 1, tp.Bpm) })); TextTime = $"{tp.StartTime:0.00}"; } ImGui.SameLine(); if (ImGui.ArrowButton("2", ImGuiDir.Right)) { var tp = SelectedTimingPoints.First(); screen?.Ruleset.ActionManager.Perform(new EditorActionChangeTimingPoint(WorkingMap, new List <EditorTimingPointChangeInfo> { new EditorTimingPointChangeInfo(tp, tp.StartTime + 1, tp.Bpm) })); TextTime = $"{tp.StartTime:0.00}"; } } ImGui.Dummy(new Vector2(0, 10)); ImGui.Text("BPM"); if (ImGui.InputText(" ", ref TextBpm, 100, SelectedTimingPoints.Count == 0 ? ImGuiInputTextFlags.ReadOnly : ImGuiInputTextFlags.CharsDecimal)) { if (string.IsNullOrEmpty(TextBpm) || string.IsNullOrWhiteSpace(TextBpm)) { TextBpm = "0"; } TextBpm = Decimal(TextBpm); } // User stopped typing in multiplier frame if (!ImGui.IsItemActive() && TextBpmFocusedInLastFrame) { UpdateSelectedTimingPoints(); } TextBpmFocusedInLastFrame = ImGui.IsItemActive(); }