From 95be5454f971ee432b718bbd91afe85012e319af Mon Sep 17 00:00:00 2001 From: baldurk Date: Sat, 29 Aug 2015 19:26:50 +0200 Subject: [PATCH] Add a "Find in all files" dialog on ctrl-shift-f to shader viewer --- .../Windows/Dialogs/FindAllDialog.Designer.cs | 343 ++++++++++++++++++ renderdocui/Windows/Dialogs/FindAllDialog.cs | 113 ++++++ .../Windows/Dialogs/FindAllDialog.resx | 126 +++++++ renderdocui/Windows/ShaderViewer.Designer.cs | 331 +++++++++-------- renderdocui/Windows/ShaderViewer.cs | 161 +++++++- renderdocui/Windows/ShaderViewer.resx | 3 + renderdocui/renderdocui.csproj | 9 + 7 files changed, 931 insertions(+), 155 deletions(-) create mode 100644 renderdocui/Windows/Dialogs/FindAllDialog.Designer.cs create mode 100644 renderdocui/Windows/Dialogs/FindAllDialog.cs create mode 100644 renderdocui/Windows/Dialogs/FindAllDialog.resx diff --git a/renderdocui/Windows/Dialogs/FindAllDialog.Designer.cs b/renderdocui/Windows/Dialogs/FindAllDialog.Designer.cs new file mode 100644 index 000000000..6e428e113 --- /dev/null +++ b/renderdocui/Windows/Dialogs/FindAllDialog.Designer.cs @@ -0,0 +1,343 @@ +namespace renderdocui.Windows.Dialogs +{ + partial class FindAllDialog + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.Windows.Forms.Label label1; + System.Windows.Forms.Label label2; + this.options = new System.Windows.Forms.GroupBox(); + this.wordstart = new System.Windows.Forms.CheckBox(); + this.wholeword = new System.Windows.Forms.CheckBox(); + this.matchcase = new System.Windows.Forms.CheckBox(); + this.panel1 = new System.Windows.Forms.Panel(); + this.regexsearch = new System.Windows.Forms.RadioButton(); + this.normalsearch = new System.Windows.Forms.RadioButton(); + this.dofind = new System.Windows.Forms.Button(); + this.regexoptions = new System.Windows.Forms.GroupBox(); + this.singleline = new System.Windows.Forms.CheckBox(); + this.rtl = new System.Windows.Forms.CheckBox(); + this.multi = new System.Windows.Forms.CheckBox(); + this.ignorewspace = new System.Windows.Forms.CheckBox(); + this.ignorecase = new System.Windows.Forms.CheckBox(); + this.explicitcap = new System.Windows.Forms.CheckBox(); + this.ecma = new System.Windows.Forms.CheckBox(); + this.invariant = new System.Windows.Forms.CheckBox(); + this.compiled = new System.Windows.Forms.CheckBox(); + this.findtext = new System.Windows.Forms.ComboBox(); + label1 = new System.Windows.Forms.Label(); + label2 = new System.Windows.Forms.Label(); + this.options.SuspendLayout(); + this.panel1.SuspendLayout(); + this.regexoptions.SuspendLayout(); + this.SuspendLayout(); + // + // label1 + // + label1.AutoSize = true; + label1.Location = new System.Drawing.Point(12, 16); + label1.Name = "label1"; + label1.Size = new System.Drawing.Size(27, 13); + label1.TabIndex = 0; + label1.Text = "Find"; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new System.Drawing.Point(13, 48); + label2.Name = "label2"; + label2.Size = new System.Drawing.Size(68, 13); + label2.TabIndex = 3; + label2.Text = "Search Type"; + // + // options + // + this.options.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.options.Controls.Add(this.wordstart); + this.options.Controls.Add(this.wholeword); + this.options.Controls.Add(this.matchcase); + this.options.Location = new System.Drawing.Point(16, 98); + this.options.Name = "options"; + this.options.Size = new System.Drawing.Size(384, 94); + this.options.TabIndex = 4; + this.options.TabStop = false; + this.options.Text = "Options"; + // + // wordstart + // + this.wordstart.AutoSize = true; + this.wordstart.Location = new System.Drawing.Point(7, 68); + this.wordstart.Name = "wordstart"; + this.wordstart.Size = new System.Drawing.Size(77, 17); + this.wordstart.TabIndex = 2; + this.wordstart.Text = "Word Start"; + this.wordstart.UseVisualStyleBackColor = true; + // + // wholeword + // + this.wholeword.AutoSize = true; + this.wholeword.Location = new System.Drawing.Point(7, 44); + this.wholeword.Name = "wholeword"; + this.wholeword.Size = new System.Drawing.Size(86, 17); + this.wholeword.TabIndex = 1; + this.wholeword.Text = "Whole Word"; + this.wholeword.UseVisualStyleBackColor = true; + // + // matchcase + // + this.matchcase.AutoSize = true; + this.matchcase.Location = new System.Drawing.Point(7, 20); + this.matchcase.Name = "matchcase"; + this.matchcase.Size = new System.Drawing.Size(83, 17); + this.matchcase.TabIndex = 0; + this.matchcase.Text = "Match Case"; + this.matchcase.UseVisualStyleBackColor = true; + // + // panel1 + // + this.panel1.Controls.Add(this.regexsearch); + this.panel1.Controls.Add(this.normalsearch); + this.panel1.Location = new System.Drawing.Point(16, 67); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(197, 25); + this.panel1.TabIndex = 2; + // + // regexsearch + // + this.regexsearch.AutoSize = true; + this.regexsearch.Location = new System.Drawing.Point(77, 3); + this.regexsearch.Name = "regexsearch"; + this.regexsearch.Size = new System.Drawing.Size(116, 17); + this.regexsearch.TabIndex = 1; + this.regexsearch.Text = "Regular Expression"; + this.regexsearch.UseVisualStyleBackColor = true; + this.regexsearch.CheckedChanged += new System.EventHandler(this.regexsearch_CheckedChanged); + // + // normalsearch + // + this.normalsearch.AutoSize = true; + this.normalsearch.Checked = true; + this.normalsearch.Location = new System.Drawing.Point(3, 3); + this.normalsearch.Name = "normalsearch"; + this.normalsearch.Size = new System.Drawing.Size(68, 17); + this.normalsearch.TabIndex = 0; + this.normalsearch.TabStop = true; + this.normalsearch.Text = "Standard"; + this.normalsearch.UseVisualStyleBackColor = true; + this.normalsearch.CheckedChanged += new System.EventHandler(this.normalsearch_CheckedChanged); + // + // dofind + // + this.dofind.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.dofind.Location = new System.Drawing.Point(308, 199); + this.dofind.Name = "dofind"; + this.dofind.Size = new System.Drawing.Size(91, 23); + this.dofind.TabIndex = 5; + this.dofind.Text = "Find In All Files"; + this.dofind.UseVisualStyleBackColor = true; + this.dofind.Click += new System.EventHandler(this.dofind_Click); + // + // regexoptions + // + this.regexoptions.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.regexoptions.Controls.Add(this.singleline); + this.regexoptions.Controls.Add(this.rtl); + this.regexoptions.Controls.Add(this.multi); + this.regexoptions.Controls.Add(this.ignorewspace); + this.regexoptions.Controls.Add(this.ignorecase); + this.regexoptions.Controls.Add(this.explicitcap); + this.regexoptions.Controls.Add(this.ecma); + this.regexoptions.Controls.Add(this.invariant); + this.regexoptions.Controls.Add(this.compiled); + this.regexoptions.Location = new System.Drawing.Point(15, 241); + this.regexoptions.Name = "regexoptions"; + this.regexoptions.Size = new System.Drawing.Size(385, 93); + this.regexoptions.TabIndex = 6; + this.regexoptions.TabStop = false; + this.regexoptions.Text = "Options"; + // + // singleline + // + this.singleline.AutoSize = true; + this.singleline.Location = new System.Drawing.Point(274, 68); + this.singleline.Name = "singleline"; + this.singleline.Size = new System.Drawing.Size(71, 17); + this.singleline.TabIndex = 8; + this.singleline.Text = "Singleline"; + this.singleline.UseVisualStyleBackColor = true; + // + // rtl + // + this.rtl.AutoSize = true; + this.rtl.Location = new System.Drawing.Point(274, 44); + this.rtl.Name = "rtl"; + this.rtl.Size = new System.Drawing.Size(84, 17); + this.rtl.TabIndex = 7; + this.rtl.Text = "Right to Left"; + this.rtl.UseVisualStyleBackColor = true; + // + // multi + // + this.multi.AutoSize = true; + this.multi.Location = new System.Drawing.Point(274, 20); + this.multi.Name = "multi"; + this.multi.Size = new System.Drawing.Size(64, 17); + this.multi.TabIndex = 6; + this.multi.Text = "Multiline"; + this.multi.UseVisualStyleBackColor = true; + // + // ignorewspace + // + this.ignorewspace.AutoSize = true; + this.ignorewspace.Location = new System.Drawing.Point(119, 68); + this.ignorewspace.Name = "ignorewspace"; + this.ignorewspace.Size = new System.Drawing.Size(153, 17); + this.ignorewspace.TabIndex = 5; + this.ignorewspace.Text = "Ignore Pattern Whitespace"; + this.ignorewspace.UseVisualStyleBackColor = true; + // + // ignorecase + // + this.ignorecase.AutoSize = true; + this.ignorecase.Location = new System.Drawing.Point(119, 44); + this.ignorecase.Name = "ignorecase"; + this.ignorecase.Size = new System.Drawing.Size(83, 17); + this.ignorecase.TabIndex = 4; + this.ignorecase.Text = "Ignore Case"; + this.ignorecase.UseVisualStyleBackColor = true; + // + // explicitcap + // + this.explicitcap.AutoSize = true; + this.explicitcap.Location = new System.Drawing.Point(119, 20); + this.explicitcap.Name = "explicitcap"; + this.explicitcap.Size = new System.Drawing.Size(99, 17); + this.explicitcap.TabIndex = 3; + this.explicitcap.Text = "Explicit Capture"; + this.explicitcap.UseVisualStyleBackColor = true; + // + // ecma + // + this.ecma.AutoSize = true; + this.ecma.Location = new System.Drawing.Point(8, 68); + this.ecma.Name = "ecma"; + this.ecma.Size = new System.Drawing.Size(86, 17); + this.ecma.TabIndex = 2; + this.ecma.Text = "ECMA Script"; + this.ecma.UseVisualStyleBackColor = true; + // + // invariant + // + this.invariant.AutoSize = true; + this.invariant.Location = new System.Drawing.Point(8, 44); + this.invariant.Name = "invariant"; + this.invariant.Size = new System.Drawing.Size(103, 17); + this.invariant.TabIndex = 1; + this.invariant.Text = "Culture Invariant"; + this.invariant.UseVisualStyleBackColor = true; + // + // compiled + // + this.compiled.AutoSize = true; + this.compiled.Location = new System.Drawing.Point(8, 20); + this.compiled.Name = "compiled"; + this.compiled.Size = new System.Drawing.Size(69, 17); + this.compiled.TabIndex = 0; + this.compiled.Text = "Compiled"; + this.compiled.UseVisualStyleBackColor = true; + // + // findtext + // + this.findtext.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.findtext.FormattingEnabled = true; + this.findtext.Location = new System.Drawing.Point(45, 13); + this.findtext.Name = "findtext"; + this.findtext.Size = new System.Drawing.Size(355, 21); + this.findtext.TabIndex = 7; + this.findtext.KeyDown += new System.Windows.Forms.KeyEventHandler(this.findtext_KeyDown); + // + // FindAllDialog + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(412, 360); + this.Controls.Add(this.findtext); + this.Controls.Add(this.regexoptions); + this.Controls.Add(this.dofind); + this.Controls.Add(this.options); + this.Controls.Add(label2); + this.Controls.Add(this.panel1); + this.Controls.Add(label1); + this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(420, 256); + this.Name = "FindAllDialog"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.Text = "Find In All Files"; + this.TopMost = true; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FindAllDialog_FormClosing); + this.Shown += new System.EventHandler(this.FindAllDialog_Shown); + this.options.ResumeLayout(false); + this.options.PerformLayout(); + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + this.regexoptions.ResumeLayout(false); + this.regexoptions.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.RadioButton regexsearch; + private System.Windows.Forms.RadioButton normalsearch; + private System.Windows.Forms.CheckBox wordstart; + private System.Windows.Forms.CheckBox wholeword; + private System.Windows.Forms.CheckBox matchcase; + private System.Windows.Forms.Button dofind; + private System.Windows.Forms.GroupBox regexoptions; + private System.Windows.Forms.CheckBox ecma; + private System.Windows.Forms.CheckBox invariant; + private System.Windows.Forms.CheckBox compiled; + private System.Windows.Forms.GroupBox options; + private System.Windows.Forms.CheckBox singleline; + private System.Windows.Forms.CheckBox rtl; + private System.Windows.Forms.CheckBox multi; + private System.Windows.Forms.CheckBox ignorewspace; + private System.Windows.Forms.CheckBox ignorecase; + private System.Windows.Forms.CheckBox explicitcap; + private System.Windows.Forms.ComboBox findtext; + + } +} \ No newline at end of file diff --git a/renderdocui/Windows/Dialogs/FindAllDialog.cs b/renderdocui/Windows/Dialogs/FindAllDialog.cs new file mode 100644 index 000000000..fd2377d71 --- /dev/null +++ b/renderdocui/Windows/Dialogs/FindAllDialog.cs @@ -0,0 +1,113 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using System.Text.RegularExpressions; + +namespace renderdocui.Windows.Dialogs +{ + public partial class FindAllDialog : Form + { + public delegate void OnFindMethod(); + + private OnFindMethod m_FindCallback = null; + + public bool Regexs { get { return regexsearch.Checked; } } + + public string Search { get { return findtext.Text; } set { findtext.Text = value; findtext.Focus(); } } + public ScintillaNET.SearchFlags FindAllOptions + { + get + { + return + (matchcase.Checked ? ScintillaNET.SearchFlags.MatchCase : 0) | + (wholeword.Checked ? ScintillaNET.SearchFlags.WholeWord : 0) | + (wordstart.Checked ? ScintillaNET.SearchFlags.WordStart : 0); + } + } + + public Regex SearchRegex + { + get + { + return new Regex(findtext.Text, regexOptions); + } + } + private RegexOptions regexOptions + { + get + { + return + (ignorecase.Checked ? RegexOptions.IgnoreCase : 0) | + (multi.Checked ? RegexOptions.Multiline : 0) | + (explicitcap.Checked ? RegexOptions.ExplicitCapture : 0) | + (compiled.Checked ? RegexOptions.Compiled : 0) | + (singleline.Checked ? RegexOptions.Singleline : 0) | + (ignorewspace.Checked ? RegexOptions.IgnorePatternWhitespace : 0) | + (rtl.Checked ? RegexOptions.RightToLeft : 0) | + (ecma.Checked ? RegexOptions.ECMAScript : 0) | + (invariant.Checked ? RegexOptions.CultureInvariant : 0); + } + } + + public FindAllDialog(OnFindMethod cb) + { + InitializeComponent(); + + m_FindCallback = cb; + + regexoptions.Location = options.Location; + regexoptions.Visible = false; + normalsearch.Checked = true; + regexsearch.Checked = false; + + Icon = global::renderdocui.Properties.Resources.icon; + } + + private void regexsearch_CheckedChanged(object sender, EventArgs e) + { + if (regexsearch.Checked) + { + options.Visible = false; + regexoptions.Visible = true; + } + } + + private void normalsearch_CheckedChanged(object sender, EventArgs e) + { + if (normalsearch.Checked) + { + options.Visible = true; + regexoptions.Visible = false; + } + } + + private void dofind_Click(object sender, EventArgs e) + { + if(!findtext.Items.Contains(findtext.Text)) + findtext.Items.Add(findtext.Text); + m_FindCallback(); + } + + private void FindAllDialog_Shown(object sender, EventArgs e) + { + findtext.Focus(); + } + + private void FindAllDialog_FormClosing(object sender, FormClosingEventArgs e) + { + Hide(); + e.Cancel = true; + } + + private void findtext_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + dofind_Click(null, null); + } + } +} diff --git a/renderdocui/Windows/Dialogs/FindAllDialog.resx b/renderdocui/Windows/Dialogs/FindAllDialog.resx new file mode 100644 index 000000000..3cffcf7ed --- /dev/null +++ b/renderdocui/Windows/Dialogs/FindAllDialog.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + False + + \ No newline at end of file diff --git a/renderdocui/Windows/ShaderViewer.Designer.cs b/renderdocui/Windows/ShaderViewer.Designer.cs index 6d869ad3e..9c8c39669 100644 --- a/renderdocui/Windows/ShaderViewer.Designer.cs +++ b/renderdocui/Windows/ShaderViewer.Designer.cs @@ -29,12 +29,6 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - TreelistView.TreeListColumn treeListColumn1 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Name", "Name"))); - TreelistView.TreeListColumn treeListColumn2 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Type", "Type"))); - TreelistView.TreeListColumn treeListColumn3 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Value", "Value"))); - TreelistView.TreeListColumn treeListColumn4 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Name", "Name"))); - TreelistView.TreeListColumn treeListColumn5 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Type", "Type"))); - TreelistView.TreeListColumn treeListColumn6 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Value", "Value"))); WeifenLuo.WinFormsUI.Docking.DockPanelSkin dockPanelSkin1 = new WeifenLuo.WinFormsUI.Docking.DockPanelSkin(); WeifenLuo.WinFormsUI.Docking.AutoHideStripSkin autoHideStripSkin1 = new WeifenLuo.WinFormsUI.Docking.AutoHideStripSkin(); WeifenLuo.WinFormsUI.Docking.DockPanelGradient dockPanelGradient1 = new WeifenLuo.WinFormsUI.Docking.DockPanelGradient(); @@ -51,13 +45,6 @@ WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient6 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient7 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ShaderViewer)); - TreelistView.TreeListColumn treeListColumn7 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Name", "Name"))); - TreelistView.TreeListColumn treeListColumn8 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Index", "Index"))); - TreelistView.TreeListColumn treeListColumn9 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Reg", "Reg"))); - TreelistView.TreeListColumn treeListColumn10 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Type", "Type"))); - TreelistView.TreeListColumn treeListColumn11 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("SysValue", "SysValue"))); - TreelistView.TreeListColumn treeListColumn12 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Mask", "Mask"))); - TreelistView.TreeListColumn treeListColumn13 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Used", "Used"))); TreelistView.TreeListColumn treeListColumn14 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Name", "Name"))); TreelistView.TreeListColumn treeListColumn15 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Index", "Index"))); TreelistView.TreeListColumn treeListColumn16 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Reg", "Reg"))); @@ -65,10 +52,21 @@ TreelistView.TreeListColumn treeListColumn18 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("SysValue", "SysValue"))); TreelistView.TreeListColumn treeListColumn19 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Mask", "Mask"))); TreelistView.TreeListColumn treeListColumn20 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Unused", "Unused"))); + TreelistView.TreeListColumn treeListColumn7 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Name", "Name"))); + TreelistView.TreeListColumn treeListColumn8 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Index", "Index"))); + TreelistView.TreeListColumn treeListColumn9 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Reg", "Reg"))); + TreelistView.TreeListColumn treeListColumn10 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Type", "Type"))); + TreelistView.TreeListColumn treeListColumn11 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("SysValue", "SysValue"))); + TreelistView.TreeListColumn treeListColumn12 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Mask", "Mask"))); + TreelistView.TreeListColumn treeListColumn13 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Used", "Used"))); + TreelistView.TreeListColumn treeListColumn1 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Name", "Name"))); + TreelistView.TreeListColumn treeListColumn2 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Type", "Type"))); + TreelistView.TreeListColumn treeListColumn3 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Value", "Value"))); + TreelistView.TreeListColumn treeListColumn4 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Name", "Name"))); + TreelistView.TreeListColumn treeListColumn5 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Type", "Type"))); + TreelistView.TreeListColumn treeListColumn6 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Value", "Value"))); this.variableBox = new System.Windows.Forms.GroupBox(); - this.variableRegs = new TreelistView.TreeListView(); this.constantBox = new System.Windows.Forms.GroupBox(); - this.constantRegs = new TreelistView.TreeListView(); this.dockPanel = new WeifenLuo.WinFormsUI.Docking.DockPanel(); this.showWindows = new System.Windows.Forms.ToolStripDropDownButton(); this.autosToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -95,9 +93,7 @@ this.errorsBox = new System.Windows.Forms.GroupBox(); this.errors = new System.Windows.Forms.TextBox(); this.inSigBox = new System.Windows.Forms.GroupBox(); - this.inSig = new TreelistView.TreeListView(); this.outSigBox = new System.Windows.Forms.GroupBox(); - this.outSig = new TreelistView.TreeListView(); this.watchBox = new System.Windows.Forms.GroupBox(); this.watchRegs = new System.Windows.Forms.ListView(); this.VarName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); @@ -105,20 +101,27 @@ this.Value = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.variableHover = new System.Windows.Forms.ToolTip(this.components); this.hoverTimer = new System.Windows.Forms.Timer(this.components); + this.outSig = new TreelistView.TreeListView(); + this.inSig = new TreelistView.TreeListView(); + this.variableRegs = new TreelistView.TreeListView(); + this.constantRegs = new TreelistView.TreeListView(); + this.toolStrip1 = new System.Windows.Forms.ToolStrip(); + this.findinall = new System.Windows.Forms.ToolStripButton(); this.variableBox.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.variableRegs)).BeginInit(); this.constantBox.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.constantRegs)).BeginInit(); this.debuggingStrip.SuspendLayout(); this.mainLayout.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout(); this.editStrip.SuspendLayout(); this.errorsBox.SuspendLayout(); this.inSigBox.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.inSig)).BeginInit(); this.outSigBox.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.outSig)).BeginInit(); this.watchBox.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.outSig)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.inSig)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.variableRegs)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.constantRegs)).BeginInit(); + this.toolStrip1.SuspendLayout(); this.SuspendLayout(); // // variableBox @@ -131,32 +134,6 @@ this.variableBox.TabStop = false; this.variableBox.Text = "Variable Registers"; // - // variableRegs - // - treeListColumn1.AutoSizeMinSize = 0; - treeListColumn1.Width = 105; - treeListColumn2.AutoSizeMinSize = 0; - treeListColumn2.Width = 57; - treeListColumn3.AutoSize = true; - treeListColumn3.AutoSizeMinSize = 0; - treeListColumn3.Width = 183; - this.variableRegs.Columns.AddRange(new TreelistView.TreeListColumn[] { - treeListColumn1, - treeListColumn2, - treeListColumn3}); - this.variableRegs.Cursor = System.Windows.Forms.Cursors.Arrow; - this.variableRegs.Dock = System.Windows.Forms.DockStyle.Fill; - this.variableRegs.Location = new System.Drawing.Point(3, 16); - this.variableRegs.MultiSelect = false; - this.variableRegs.Name = "variableRegs"; - this.variableRegs.RowOptions.ShowHeader = false; - this.variableRegs.Size = new System.Drawing.Size(183, 169); - this.variableRegs.TabIndex = 1; - this.variableRegs.Text = "treeListView1"; - this.variableRegs.KeyDown += new System.Windows.Forms.KeyEventHandler(this.DebugKeys_KeyDown); - this.variableRegs.Leave += new System.EventHandler(this.regsList_Leave); - this.variableRegs.MouseMove += new System.Windows.Forms.MouseEventHandler(this.regsList_MouseMove); - // // constantBox // this.constantBox.Controls.Add(this.constantRegs); @@ -167,32 +144,6 @@ this.constantBox.TabStop = false; this.constantBox.Text = "Constants && Resources"; // - // constantRegs - // - treeListColumn4.AutoSizeMinSize = 0; - treeListColumn4.Width = 109; - treeListColumn5.AutoSizeMinSize = 0; - treeListColumn5.Width = 57; - treeListColumn6.AutoSize = true; - treeListColumn6.AutoSizeMinSize = 0; - treeListColumn6.Width = 180; - this.constantRegs.Columns.AddRange(new TreelistView.TreeListColumn[] { - treeListColumn4, - treeListColumn5, - treeListColumn6}); - this.constantRegs.Cursor = System.Windows.Forms.Cursors.Arrow; - this.constantRegs.Dock = System.Windows.Forms.DockStyle.Fill; - this.constantRegs.Location = new System.Drawing.Point(3, 16); - this.constantRegs.MultiSelect = false; - this.constantRegs.Name = "constantRegs"; - this.constantRegs.RowOptions.ShowHeader = false; - this.constantRegs.Size = new System.Drawing.Size(226, 171); - this.constantRegs.TabIndex = 0; - this.constantRegs.Text = "treeListView1"; - this.constantRegs.KeyDown += new System.Windows.Forms.KeyEventHandler(this.DebugKeys_KeyDown); - this.constantRegs.Leave += new System.EventHandler(this.regsList_Leave); - this.constantRegs.MouseMove += new System.Windows.Forms.MouseEventHandler(this.regsList_MouseMove); - // // dockPanel // this.dockPanel.DefaultFloatWindowSize = new System.Drawing.Size(800, 500); @@ -403,6 +354,7 @@ this.flowLayoutPanel1.AutoSize = true; this.flowLayoutPanel1.Controls.Add(this.debuggingStrip); this.flowLayoutPanel1.Controls.Add(this.editStrip); + this.flowLayoutPanel1.Controls.Add(this.toolStrip1); this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 3); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; this.flowLayoutPanel1.Size = new System.Drawing.Size(424, 25); @@ -415,6 +367,7 @@ this.saveButton, this.snippetDropDown}); this.editStrip.Location = new System.Drawing.Point(215, 0); + this.editStrip.Margin = new System.Windows.Forms.Padding(0, 0, 12, 0); this.editStrip.Name = "editStrip"; this.editStrip.Size = new System.Drawing.Size(55, 25); this.editStrip.TabIndex = 2; @@ -513,43 +466,6 @@ this.inSigBox.TabStop = false; this.inSigBox.Text = "Input Signature"; // - // inSig - // - treeListColumn7.AutoSize = true; - treeListColumn7.AutoSizeMinSize = 20; - treeListColumn7.Width = 100; - treeListColumn8.AutoSizeMinSize = 10; - treeListColumn8.Width = 50; - treeListColumn9.AutoSizeMinSize = 10; - treeListColumn9.Width = 50; - treeListColumn10.AutoSizeMinSize = 20; - treeListColumn10.Width = 60; - treeListColumn11.AutoSizeMinSize = 15; - treeListColumn11.Width = 75; - treeListColumn12.AutoSizeMinSize = 15; - treeListColumn12.Width = 50; - treeListColumn13.AutoSizeMinSize = 15; - treeListColumn13.Width = 50; - this.inSig.Columns.AddRange(new TreelistView.TreeListColumn[] { - treeListColumn7, - treeListColumn8, - treeListColumn9, - treeListColumn10, - treeListColumn11, - treeListColumn12, - treeListColumn13}); - this.inSig.Cursor = System.Windows.Forms.Cursors.Arrow; - this.inSig.Dock = System.Windows.Forms.DockStyle.Fill; - this.inSig.Location = new System.Drawing.Point(3, 16); - this.inSig.MultiSelect = false; - this.inSig.Name = "inSig"; - this.inSig.RowOptions.ShowHeader = false; - this.inSig.Size = new System.Drawing.Size(452, 169); - this.inSig.TabIndex = 1; - this.inSig.Text = "Input Signature"; - this.inSig.ViewOptions.ShowLine = false; - this.inSig.ViewOptions.ShowPlusMinus = false; - // // outSigBox // this.outSigBox.Controls.Add(this.outSig); @@ -560,43 +476,6 @@ this.outSigBox.TabStop = false; this.outSigBox.Text = "Output Signature"; // - // outSig - // - treeListColumn14.AutoSize = true; - treeListColumn14.AutoSizeMinSize = 20; - treeListColumn14.Width = 100; - treeListColumn15.AutoSizeMinSize = 10; - treeListColumn15.Width = 50; - treeListColumn16.AutoSizeMinSize = 10; - treeListColumn16.Width = 50; - treeListColumn17.AutoSizeMinSize = 20; - treeListColumn17.Width = 60; - treeListColumn18.AutoSizeMinSize = 15; - treeListColumn18.Width = 75; - treeListColumn19.AutoSizeMinSize = 15; - treeListColumn19.Width = 50; - treeListColumn20.AutoSizeMinSize = 15; - treeListColumn20.Width = 50; - this.outSig.Columns.AddRange(new TreelistView.TreeListColumn[] { - treeListColumn14, - treeListColumn15, - treeListColumn16, - treeListColumn17, - treeListColumn18, - treeListColumn19, - treeListColumn20}); - this.outSig.Cursor = System.Windows.Forms.Cursors.Arrow; - this.outSig.Dock = System.Windows.Forms.DockStyle.Fill; - this.outSig.Location = new System.Drawing.Point(3, 16); - this.outSig.MultiSelect = false; - this.outSig.Name = "outSig"; - this.outSig.RowOptions.ShowHeader = false; - this.outSig.Size = new System.Drawing.Size(452, 153); - this.outSig.TabIndex = 1; - this.outSig.Text = "Output Signature"; - this.outSig.ViewOptions.ShowLine = false; - this.outSig.ViewOptions.ShowPlusMinus = false; - // // watchBox // this.watchBox.Controls.Add(this.watchRegs); @@ -663,6 +542,152 @@ this.hoverTimer.Interval = 500; this.hoverTimer.Tick += new System.EventHandler(this.hoverTimer_Tick); // + // outSig + // + treeListColumn14.AutoSize = true; + treeListColumn14.AutoSizeMinSize = 20; + treeListColumn14.Width = 100; + treeListColumn15.AutoSizeMinSize = 10; + treeListColumn15.Width = 50; + treeListColumn16.AutoSizeMinSize = 10; + treeListColumn16.Width = 50; + treeListColumn17.AutoSizeMinSize = 20; + treeListColumn17.Width = 60; + treeListColumn18.AutoSizeMinSize = 15; + treeListColumn18.Width = 75; + treeListColumn19.AutoSizeMinSize = 15; + treeListColumn19.Width = 50; + treeListColumn20.AutoSizeMinSize = 15; + treeListColumn20.Width = 50; + this.outSig.Columns.AddRange(new TreelistView.TreeListColumn[] { + treeListColumn14, + treeListColumn15, + treeListColumn16, + treeListColumn17, + treeListColumn18, + treeListColumn19, + treeListColumn20}); + this.outSig.Cursor = System.Windows.Forms.Cursors.Arrow; + this.outSig.Dock = System.Windows.Forms.DockStyle.Fill; + this.outSig.Location = new System.Drawing.Point(3, 16); + this.outSig.MultiSelect = false; + this.outSig.Name = "outSig"; + this.outSig.RowOptions.ShowHeader = false; + this.outSig.Size = new System.Drawing.Size(452, 153); + this.outSig.TabIndex = 1; + this.outSig.Text = "Output Signature"; + this.outSig.ViewOptions.ShowLine = false; + this.outSig.ViewOptions.ShowPlusMinus = false; + // + // inSig + // + treeListColumn7.AutoSize = true; + treeListColumn7.AutoSizeMinSize = 20; + treeListColumn7.Width = 100; + treeListColumn8.AutoSizeMinSize = 10; + treeListColumn8.Width = 50; + treeListColumn9.AutoSizeMinSize = 10; + treeListColumn9.Width = 50; + treeListColumn10.AutoSizeMinSize = 20; + treeListColumn10.Width = 60; + treeListColumn11.AutoSizeMinSize = 15; + treeListColumn11.Width = 75; + treeListColumn12.AutoSizeMinSize = 15; + treeListColumn12.Width = 50; + treeListColumn13.AutoSizeMinSize = 15; + treeListColumn13.Width = 50; + this.inSig.Columns.AddRange(new TreelistView.TreeListColumn[] { + treeListColumn7, + treeListColumn8, + treeListColumn9, + treeListColumn10, + treeListColumn11, + treeListColumn12, + treeListColumn13}); + this.inSig.Cursor = System.Windows.Forms.Cursors.VSplit; + this.inSig.Dock = System.Windows.Forms.DockStyle.Fill; + this.inSig.Location = new System.Drawing.Point(3, 16); + this.inSig.MultiSelect = false; + this.inSig.Name = "inSig"; + this.inSig.RowOptions.ShowHeader = false; + this.inSig.Size = new System.Drawing.Size(452, 169); + this.inSig.TabIndex = 1; + this.inSig.Text = "Input Signature"; + this.inSig.ViewOptions.ShowLine = false; + this.inSig.ViewOptions.ShowPlusMinus = false; + // + // variableRegs + // + treeListColumn1.AutoSizeMinSize = 0; + treeListColumn1.Width = 105; + treeListColumn2.AutoSizeMinSize = 0; + treeListColumn2.Width = 57; + treeListColumn3.AutoSize = true; + treeListColumn3.AutoSizeMinSize = 0; + treeListColumn3.Width = 183; + this.variableRegs.Columns.AddRange(new TreelistView.TreeListColumn[] { + treeListColumn1, + treeListColumn2, + treeListColumn3}); + this.variableRegs.Cursor = System.Windows.Forms.Cursors.Arrow; + this.variableRegs.Dock = System.Windows.Forms.DockStyle.Fill; + this.variableRegs.Location = new System.Drawing.Point(3, 16); + this.variableRegs.MultiSelect = false; + this.variableRegs.Name = "variableRegs"; + this.variableRegs.RowOptions.ShowHeader = false; + this.variableRegs.Size = new System.Drawing.Size(183, 169); + this.variableRegs.TabIndex = 1; + this.variableRegs.Text = "treeListView1"; + this.variableRegs.KeyDown += new System.Windows.Forms.KeyEventHandler(this.DebugKeys_KeyDown); + this.variableRegs.Leave += new System.EventHandler(this.regsList_Leave); + this.variableRegs.MouseMove += new System.Windows.Forms.MouseEventHandler(this.regsList_MouseMove); + // + // constantRegs + // + treeListColumn4.AutoSizeMinSize = 0; + treeListColumn4.Width = 109; + treeListColumn5.AutoSizeMinSize = 0; + treeListColumn5.Width = 57; + treeListColumn6.AutoSize = true; + treeListColumn6.AutoSizeMinSize = 0; + treeListColumn6.Width = 180; + this.constantRegs.Columns.AddRange(new TreelistView.TreeListColumn[] { + treeListColumn4, + treeListColumn5, + treeListColumn6}); + this.constantRegs.Cursor = System.Windows.Forms.Cursors.Arrow; + this.constantRegs.Dock = System.Windows.Forms.DockStyle.Fill; + this.constantRegs.Location = new System.Drawing.Point(3, 16); + this.constantRegs.MultiSelect = false; + this.constantRegs.Name = "constantRegs"; + this.constantRegs.RowOptions.ShowHeader = false; + this.constantRegs.Size = new System.Drawing.Size(226, 171); + this.constantRegs.TabIndex = 0; + this.constantRegs.Text = "treeListView1"; + this.constantRegs.KeyDown += new System.Windows.Forms.KeyEventHandler(this.DebugKeys_KeyDown); + this.constantRegs.Leave += new System.EventHandler(this.regsList_Leave); + this.constantRegs.MouseMove += new System.Windows.Forms.MouseEventHandler(this.regsList_MouseMove); + // + // toolStrip1 + // + this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.findinall}); + this.toolStrip1.Location = new System.Drawing.Point(282, 0); + this.toolStrip1.Name = "toolStrip1"; + this.toolStrip1.Size = new System.Drawing.Size(33, 25); + this.toolStrip1.TabIndex = 3; + this.toolStrip1.Text = "toolStrip1"; + // + // findinall + // + this.findinall.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.findinall.Image = global::renderdocui.Properties.Resources.find; + this.findinall.ImageTransparentColor = System.Drawing.Color.Magenta; + this.findinall.Name = "findinall"; + this.findinall.Size = new System.Drawing.Size(23, 22); + this.findinall.Text = "Find In All Files"; + this.findinall.Click += new System.EventHandler(this.findinall_Click); + // // ShaderViewer // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -681,9 +706,7 @@ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ShaderViewer_FormClosing); this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ShaderViewer_FormClosed); this.variableBox.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.variableRegs)).EndInit(); this.constantBox.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.constantRegs)).EndInit(); this.debuggingStrip.ResumeLayout(false); this.debuggingStrip.PerformLayout(); this.mainLayout.ResumeLayout(false); @@ -695,10 +718,14 @@ this.errorsBox.ResumeLayout(false); this.errorsBox.PerformLayout(); this.inSigBox.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.inSig)).EndInit(); this.outSigBox.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.outSig)).EndInit(); this.watchBox.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.outSig)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.inSig)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.variableRegs)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.constantRegs)).EndInit(); + this.toolStrip1.ResumeLayout(false); + this.toolStrip1.PerformLayout(); this.ResumeLayout(false); } @@ -745,5 +772,7 @@ private System.Windows.Forms.ColumnHeader Value; private System.Windows.Forms.ToolTip variableHover; private System.Windows.Forms.Timer hoverTimer; + private System.Windows.Forms.ToolStrip toolStrip1; + private System.Windows.Forms.ToolStripButton findinall; } } diff --git a/renderdocui/Windows/ShaderViewer.cs b/renderdocui/Windows/ShaderViewer.cs index b55930c9a..acc241f3b 100644 --- a/renderdocui/Windows/ShaderViewer.cs +++ b/renderdocui/Windows/ShaderViewer.cs @@ -36,6 +36,7 @@ using System.Windows.Forms; using WeifenLuo.WinFormsUI.Docking; using renderdocui.Code; using renderdoc; +using renderdocui.Windows.Dialogs; using System.Text.RegularExpressions; namespace renderdocui.Windows @@ -64,6 +65,8 @@ namespace renderdocui.Windows private DockContent m_VariablesDock = null; private DockContent m_WatchDock = null; + private FindAllDialog m_FindAll = null; + private MenuItem m_IntContext = null; private MenuItem m_FloatContext = null; private int m_RightclickPoint = 0; @@ -267,10 +270,13 @@ namespace renderdocui.Windows Text = string.Format("{0} - Edit ({1})", entry, f.Key); } + m_FindAll = new FindAllDialog(FindAllFiles); + m_FindAll.Hide(); + if (files.Count > 3) AddFileList(); - if(sel != null) + if (sel != null) sel.Show(); ShowConstants(); @@ -324,6 +330,22 @@ namespace renderdocui.Windows sc.Selection.Range = range; } } + else if (e.KeyCode == Keys.F && e.Control && e.Shift) + { + ScintillaNET.Scintilla sc = sender as ScintillaNET.Scintilla; + + if (sc != null) + { + string search = sc.GetWordFromPosition(sc.CurrentPos); + if (sc.Selection.Length > 0) + search = sc.Selection.Text; + + if (search.Length > 0) + m_FindAll.Search = search; + + m_FindAll.Show(); + } + } } private HashSet m_Breakpoints = new HashSet(); @@ -571,6 +593,9 @@ namespace renderdocui.Windows sel.Show(); } + m_FindAll = new FindAllDialog(FindAllFiles); + m_FindAll.Hide(); + ShowConstants(); ShowVariables(); ShowWatch(); @@ -660,10 +685,7 @@ namespace renderdocui.Windows 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() @@ -759,6 +781,132 @@ namespace renderdocui.Windows return scintilla1; } + List< KeyValuePair > m_FindResults = new List< KeyValuePair >(); + ScintillaNET.Scintilla m_FindResultsDisplay = null; + + void FindAllFiles() + { + if (m_Scintillas.Count == 0) + return; + + if (m_FindResultsDisplay == null) + { + m_FindResultsDisplay = new ScintillaNET.Scintilla(); + ((System.ComponentModel.ISupportInitialize)(m_FindResultsDisplay)).BeginInit(); + + m_FindResultsDisplay.Dock = System.Windows.Forms.DockStyle.Fill; + m_FindResultsDisplay.Margins.Left = 0; + m_FindResultsDisplay.Name = "findResults"; + m_FindResultsDisplay.ConfigurationManager.Language = "errorlist"; + + m_FindResultsDisplay.DoubleClick += new EventHandler(findResults_DoubleClick); + + ((System.ComponentModel.ISupportInitialize)(m_FindResultsDisplay)).EndInit(); + + var w = Helpers.WrapDockContent(dockPanel, m_FindResultsDisplay, "Find Results"); + w.DockAreas |= DockAreas.Float; + w.DockState = DockState.DockBottom; + w.HideOnClose = true; + w.Show((m_Scintillas[0].Parent as DockContent).Pane, DockAlignment.Bottom, 0.5); + } + else + { + m_FindResultsDisplay.Text = ""; + m_FindResultsDisplay.Parent.Show(); + } + + var findResultsByEd = new Dictionary>(); + + if (m_FindAll.Regexs) + { + m_FindResultsDisplay.Text = String.Format("Find all \"{0}\", Regular Expressions", m_FindAll.Search); + + foreach (var s in m_Scintillas) + { + if (s == m_DisassemblyView) + continue; + findResultsByEd.Add(s, s.FindReplace.FindAll(m_FindAll.SearchRegex)); + } + } + else + { + m_FindResultsDisplay.Text = String.Format("Find all \"{0}\"", m_FindAll.Search); + + if((m_FindAll.FindAllOptions & ScintillaNET.SearchFlags.MatchCase) != 0) + m_FindResultsDisplay.Text += ", Match case"; + if ((m_FindAll.FindAllOptions & ScintillaNET.SearchFlags.WholeWord) != 0) + m_FindResultsDisplay.Text += ", Whole word"; + if ((m_FindAll.FindAllOptions & ScintillaNET.SearchFlags.WordStart) != 0) + m_FindResultsDisplay.Text += ", Word start"; + + foreach (var s in m_Scintillas) + { + if (s == m_DisassemblyView) + continue; + findResultsByEd.Add(s, s.FindReplace.FindAll(m_FindAll.Search, m_FindAll.FindAllOptions)); + } + } + + int fileCount = 0; + + foreach (var kv in findResultsByEd) + { + string filename = (kv.Key.Parent as DockContent).Text; + + if (kv.Value.Count > 0) + fileCount++; + + foreach(var result in kv.Value) + { + string text = kv.Key.Lines[result.StartingLine.Number].Text; + + int nl = text.IndexOf('\n'); + if (nl != -1) + text = text.Substring(0, nl); + + m_FindResultsDisplay.Text += String.Format("{0} {1}({2}): {3}", Environment.NewLine, filename, result.StartingLine.Number + 1, text); + + m_FindResults.Add(new KeyValuePair(kv.Key, result)); + } + } + + m_FindResultsDisplay.Text += String.Format("{0}Matching lines: {1} Matching files: {2} Total files searched: {3}", + Environment.NewLine, m_FindResults.Count, fileCount, m_Scintillas.Count - (m_DisassemblyView != null ? 1 : 0)); + } + + void findResults_DoubleClick(object sender, EventArgs e) + { + int line = m_FindResultsDisplay.Lines.Current.Number; + + if (line > 0 && line < m_FindResultsDisplay.Lines.Count) + { + // clear selection from double click, but don't scroll or move cursor + int linevis = m_FindResultsDisplay.Lines.FirstVisibleIndex; + int pos = m_FindResultsDisplay.CurrentPos; + + m_FindResultsDisplay.Selection.SelectNone(); + + m_FindResultsDisplay.CurrentPos = pos; + m_FindResultsDisplay.Lines.FirstVisibleIndex = linevis; + + m_FindResultsDisplay.FindReplace.ClearAllHighlights(); + m_FindResultsDisplay.FindReplace.HighlightAll(new ScintillaNET.Range[] { m_FindResultsDisplay.Lines[line].Range }); + + int idx = line - 1; + + DockContent dc = (m_FindResults[idx].Key.Parent as DockContent); + + dc.Activate(); + dc.Show(); + + m_FindResults[idx].Key.GoTo.Line(m_FindResults[idx].Value.StartingLine.Number); + + foreach(var res in m_FindResults) + res.Key.FindReplace.ClearAllHighlights(); + m_FindResults[idx].Key.FindReplace.HighlightAll(new ScintillaNET.Range[] { m_FindResults[idx].Value }); + } + } + List m_PrevRanges = new List(); void scintilla1_Click(object sender, EventArgs e) @@ -1978,5 +2126,10 @@ namespace renderdocui.Windows { m_Core.RemoveLogViewer(this); } + + private void findinall_Click(object sender, EventArgs e) + { + m_FindAll.Show(); + } } } \ No newline at end of file diff --git a/renderdocui/Windows/ShaderViewer.resx b/renderdocui/Windows/ShaderViewer.resx index 32eeb878f..5f9696a66 100644 --- a/renderdocui/Windows/ShaderViewer.resx +++ b/renderdocui/Windows/ShaderViewer.resx @@ -154,6 +154,9 @@ 261, 17 + + 582, 17 + 354, 17 diff --git a/renderdocui/renderdocui.csproj b/renderdocui/renderdocui.csproj index b70cfc1b4..78afefe2c 100644 --- a/renderdocui/renderdocui.csproj +++ b/renderdocui/renderdocui.csproj @@ -222,6 +222,12 @@ ColumnSelector.cs + + Form + + + FindAllDialog.cs + Form @@ -363,6 +369,9 @@ ColumnSelector.cs + + FindAllDialog.cs + PythonShell.cs