Make Ctrl-# shortcuts for EventBrowser bookmarks work anywhere

This commit is contained in:
baldurk
2015-07-15 19:10:20 +02:00
parent 7539f67d57
commit 26cf1f8541
2 changed files with 28 additions and 2 deletions
+2 -2
View File
@@ -1013,12 +1013,12 @@ namespace renderdocui.Windows
return m_Bookmark.Contains(EID);
}
private bool HasBookmark(int index)
public bool HasBookmark(int index)
{
return index >= 0 && index < m_Bookmark.Count;
}
private UInt32 GetBookmark(int index)
public UInt32 GetBookmark(int index)
{
if (!HasBookmark(index))
return 0;
+26
View File
@@ -1119,6 +1119,32 @@ namespace renderdocui.Windows
return false;
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
// bookmark keys are handled globally
if ((keyData & Keys.Control) == Keys.Control)
{
Keys[] digits = { Keys.D1, Keys.D2, Keys.D3, Keys.D4, Keys.D5,
Keys.D6, Keys.D7, Keys.D8, Keys.D9, Keys.D0 };
for (int i = 0; i < digits.Length; i++)
{
if ((keyData & digits[i]) == digits[i])
{
EventBrowser eb = m_Core.GetEventBrowser();
if (eb.Visible && eb.HasBookmark(i))
{
m_Core.SetEventID(null, m_Core.CurFrame, eb.GetBookmark(i));
return true;
}
}
}
}
return base.ProcessCmdKey(ref msg, keyData);
}
private void MainWindow_FormClosing(object sender, FormClosingEventArgs e)
{
foreach (var live in m_LiveCaptures)