From 9f43f1213541a294afe6975903fbdd52ba59e643 Mon Sep 17 00:00:00 2001 From: baldurk Date: Sat, 29 Aug 2015 17:18:28 +0200 Subject: [PATCH] Add a list of all files in shader viewer when there are more than 3 --- renderdocui/Windows/ShaderViewer.cs | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/renderdocui/Windows/ShaderViewer.cs b/renderdocui/Windows/ShaderViewer.cs index 7e2b52cd7..b55930c9a 100644 --- a/renderdocui/Windows/ShaderViewer.cs +++ b/renderdocui/Windows/ShaderViewer.cs @@ -267,6 +267,9 @@ namespace renderdocui.Windows Text = string.Format("{0} - Edit ({1})", entry, f.Key); } + if (files.Count > 3) + AddFileList(); + if(sel != null) sel.Show(); @@ -559,6 +562,9 @@ namespace renderdocui.Windows fileIdx++; } + if (shader.DebugInfo.files.Length > 2) + AddFileList(); + if (trace != null || sel == null) sel = (DockContent)m_DisassemblyView.Parent; @@ -650,6 +656,37 @@ namespace renderdocui.Windows this.ResumeLayout(false); } + private ListBox m_FileList = null; + + void list_SelectedIndexChanged(object sender, EventArgs e) + { + int idx = m_FileList.SelectedIndex; + + if (idx >= 0 && idx < m_Scintillas.Count) + (m_Scintillas[idx].Parent as DockContent).Show(); + } + + private void AddFileList() + { + m_FileList = new ListBox(); + m_FileList.Dock = System.Windows.Forms.DockStyle.Fill; + m_FileList.FormattingEnabled = true; + m_FileList.HorizontalScrollbar = false; + m_FileList.Location = new System.Drawing.Point(0, 0); + m_FileList.Name = "fileList"; + m_FileList.SelectionMode = System.Windows.Forms.SelectionMode.One; + m_FileList.SelectedIndexChanged += new EventHandler(list_SelectedIndexChanged); + + foreach (ScintillaNET.Scintilla s in m_Scintillas) + m_FileList.Items.Add((s.Parent as DockContent).Text); + + var w = Helpers.WrapDockContent(dockPanel, m_FileList, "File List"); + w.DockState = DockState.DockLeft; + w.CloseButton = false; + w.CloseButtonVisible = false; + w.Show(dockPanel); + } + private ScintillaNET.Scintilla MakeEditor(string name, string text, bool src) { ScintillaNET.Scintilla scintilla1 = new ScintillaNET.Scintilla();