private void DoTabs() { HotkeyTabControl.SuspendLayout(); HotkeyTabControl.TabPages.Clear(); foreach (var tab in HotkeyInfo.Groupings) { var tb = new TabPage { Name = tab, Text = tab }; var bindings = HotkeyInfo.AllHotkeys.Where(kvp => kvp.Value.TabGroup == tab) .OrderBy(static kvp => kvp.Value.Ordinal).ThenBy(static kvp => kvp.Value.DisplayName);
private void SearchBox_KeyDown(object sender, KeyEventArgs e) { if (e.IsPressed(Keys.Enter) || e.IsPressed(Keys.Tab)) { var b = _config.HotkeyBindings.FirstOrDefault(x => string.Compare(x.DisplayName, SearchBox.Text, true) == 0); // Found if (b != null) { var w = InputWidgets.FirstOrDefault(x => x.WidgetName == b.DisplayName); if (w != null) { HotkeyTabControl.SelectTab((TabPage)w.Parent); w.Focus(); } } e.Handled = true; } }
private void SearchBox_KeyDown(object sender, KeyEventArgs e) { // Tab or Enter if (!e.Control && !e.Alt && !e.Shift && (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Tab)) { var b = Global.Config.HotkeyBindings.FirstOrDefault(x => string.Compare(x.DisplayName, SearchBox.Text, true) == 0); // Found if (b != null) { var w = InputWidgets.FirstOrDefault(x => x.WidgetName == b.DisplayName); if (w != null) { HotkeyTabControl.SelectTab((TabPage)w.Parent); w.Focus(); } } e.Handled = true; } }
private void DoTabs() { HotkeyTabControl.SuspendLayout(); HotkeyTabControl.TabPages.Clear(); // Buckets var tabs = _config.HotkeyBindings.Select(x => x.TabGroup).Distinct(); foreach (var tab in tabs) { var tb = new TabPage { Name = tab, Text = tab }; var bindings = _config.HotkeyBindings.Where(n => n.TabGroup == tab).OrderBy(n => n.Ordinal).ThenBy(n => n.DisplayName); int x = UIHelper.ScaleX(6); int y = UIHelper.ScaleY(14); int iwOffsetX = UIHelper.ScaleX(110); int iwOffsetY = UIHelper.ScaleY(-4); int iwWidth = UIHelper.ScaleX(120); tb.SuspendLayout(); foreach (var b in bindings) { var l = new Label { Text = b.DisplayName, Location = new Point(x, y), Size = new Size(iwOffsetX - UIHelper.ScaleX(2), UIHelper.ScaleY(15)) }; var w = new InputCompositeWidget { Location = new Point(x + iwOffsetX, y + iwOffsetY), AutoTab = AutoTabCheckBox.Checked, Width = iwWidth, WidgetName = b.DisplayName }; w.SetupTooltip(toolTip1, b.ToolTip); toolTip1.SetToolTip(l, b.ToolTip); w.Bindings = b.Bindings; tb.Controls.Add(l); tb.Controls.Add(w); y += UIHelper.ScaleY(24); if (y > HotkeyTabControl.Height - UIHelper.ScaleY(35)) { x += iwOffsetX + iwWidth + UIHelper.ScaleX(10); y = UIHelper.ScaleY(14); } } if (tab == "TAStudio") { tb.Controls.Add(new Label { Text = "Save States hotkeys operate with branches when TAStudio is engaged.", Location = new Point(x, y), Size = new Size(iwWidth + iwOffsetX, HotkeyTabControl.Height - y) }); } HotkeyTabControl.TabPages.Add(tb); tb.ResumeLayout(); } HotkeyTabControl.ResumeLayout(); }