From 39b995fcfafc7f0b5f578ffc79ed6e347003cf5a Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 19 Aug 2016 14:58:35 +0200 Subject: [PATCH] Add a dialog to ask if the user wants to replay remotely --- renderdocui/Code/PersistantConfig.cs | 1 + .../Dialogs/SettingsDialog.Designer.cs | 156 ++++++++------ renderdocui/Windows/Dialogs/SettingsDialog.cs | 9 + .../Windows/Dialogs/SettingsDialog.resx | 96 +++------ .../Dialogs/SuggestRemoteDialog.Designer.cs | 199 ++++++++++++++++++ .../Windows/Dialogs/SuggestRemoteDialog.cs | 140 ++++++++++++ .../Windows/Dialogs/SuggestRemoteDialog.resx | 132 ++++++++++++ renderdocui/Windows/MainWindow.cs | 87 +++++++- renderdocui/renderdocui.csproj | 9 + 9 files changed, 692 insertions(+), 137 deletions(-) create mode 100644 renderdocui/Windows/Dialogs/SuggestRemoteDialog.Designer.cs create mode 100644 renderdocui/Windows/Dialogs/SuggestRemoteDialog.cs create mode 100644 renderdocui/Windows/Dialogs/SuggestRemoteDialog.resx diff --git a/renderdocui/Code/PersistantConfig.cs b/renderdocui/Code/PersistantConfig.cs index 91ff29350..450fda3e5 100644 --- a/renderdocui/Code/PersistantConfig.cs +++ b/renderdocui/Code/PersistantConfig.cs @@ -112,6 +112,7 @@ namespace renderdocui.Code public bool TextureViewer_PerTexSettings = true; public bool ShaderViewer_FriendlyNaming = true; + public bool AlwaysReplayLocally = false; public List RemoteHosts = new List(); public int LocalProxy = 0; diff --git a/renderdocui/Windows/Dialogs/SettingsDialog.Designer.cs b/renderdocui/Windows/Dialogs/SettingsDialog.Designer.cs index 063360c52..93a25af42 100644 --- a/renderdocui/Windows/Dialogs/SettingsDialog.Designer.cs +++ b/renderdocui/Windows/Dialogs/SettingsDialog.Designer.cs @@ -43,6 +43,7 @@ System.Windows.Forms.Label label3; System.Windows.Forms.Label label11; System.Windows.Forms.Label label15; + System.Windows.Forms.Label label18; System.Windows.Forms.TableLayoutPanel tableLayoutPanel6; System.Windows.Forms.Label label19; System.Windows.Forms.GroupBox groupBox2; @@ -52,9 +53,12 @@ System.Windows.Forms.GroupBox groupBox4; System.Windows.Forms.Label label8; System.Windows.Forms.Label label9; - TreelistView.TreeListColumn treeListColumn3 = new TreelistView.TreeListColumn("Section", "Section"); System.Windows.Forms.Label label16; System.Windows.Forms.Label label17; + TreelistView.TreeListColumn treeListColumn1 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Section", "Section"))); + this.ok = new System.Windows.Forms.Button(); + this.toolTip = new System.Windows.Forms.ToolTip(this.components); + this.browserCaptureDialog = new System.Windows.Forms.FolderBrowserDialog(); this.settingsTabs = new renderdocui.Controls.TablessControl(); this.generalTab = new System.Windows.Forms.TabPage(); this.AllowGlobalHook = new System.Windows.Forms.CheckBox(); @@ -67,6 +71,7 @@ this.CheckUpdate_AllowChecks = new System.Windows.Forms.CheckBox(); this.browseCaptureDirectory = new System.Windows.Forms.Button(); this.Font_PreferMonospaced = new System.Windows.Forms.CheckBox(); + this.AlwaysReplayLocally = new System.Windows.Forms.CheckBox(); this.corePage = new System.Windows.Forms.TabPage(); this.groupBox5 = new System.Windows.Forms.GroupBox(); this.chooseSearchPaths = new System.Windows.Forms.Button(); @@ -82,12 +87,9 @@ this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel(); this.EventBrowser_TimeUnit = new System.Windows.Forms.ComboBox(); this.EventBrowser_HideEmpty = new System.Windows.Forms.CheckBox(); - this.pagesTree = new TreelistView.TreeListView(); - this.ok = new System.Windows.Forms.Button(); - this.toolTip = new System.Windows.Forms.ToolTip(this.components); - this.browserCaptureDialog = new System.Windows.Forms.FolderBrowserDialog(); this.EventBrowser_ApplyColours = new System.Windows.Forms.CheckBox(); this.EventBrowser_ColourEventRow = new System.Windows.Forms.CheckBox(); + this.pagesTree = new TreelistView.TreeListView(); tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); groupBox1 = new System.Windows.Forms.GroupBox(); tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); @@ -101,6 +103,7 @@ label3 = new System.Windows.Forms.Label(); label11 = new System.Windows.Forms.Label(); label15 = new System.Windows.Forms.Label(); + label18 = new System.Windows.Forms.Label(); tableLayoutPanel6 = new System.Windows.Forms.TableLayoutPanel(); label19 = new System.Windows.Forms.Label(); groupBox2 = new System.Windows.Forms.GroupBox(); @@ -150,9 +153,24 @@ tableLayoutPanel1.RowCount = 2; tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - tableLayoutPanel1.Size = new System.Drawing.Size(580, 353); + tableLayoutPanel1.Size = new System.Drawing.Size(580, 363); tableLayoutPanel1.TabIndex = 1; // + // ok + // + this.ok.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.ok.Location = new System.Drawing.Point(502, 337); + this.ok.Name = "ok"; + this.ok.Size = new System.Drawing.Size(75, 23); + this.ok.TabIndex = 100; + this.ok.Text = "OK"; + this.ok.UseVisualStyleBackColor = true; + this.ok.Click += new System.EventHandler(this.ok_Click); + // + // browserCaptureDialog + // + this.browserCaptureDialog.RootFolder = System.Environment.SpecialFolder.MyComputer; + // // settingsTabs // this.settingsTabs.Alignment = System.Windows.Forms.TabAlignment.Left; @@ -166,7 +184,7 @@ this.settingsTabs.Multiline = true; this.settingsTabs.Name = "settingsTabs"; this.settingsTabs.SelectedIndex = 0; - this.settingsTabs.Size = new System.Drawing.Size(400, 318); + this.settingsTabs.Size = new System.Drawing.Size(400, 328); this.settingsTabs.TabIndex = 0; // // generalTab @@ -175,7 +193,7 @@ this.generalTab.Location = new System.Drawing.Point(42, 4); this.generalTab.Name = "generalTab"; this.generalTab.Padding = new System.Windows.Forms.Padding(3); - this.generalTab.Size = new System.Drawing.Size(354, 310); + this.generalTab.Size = new System.Drawing.Size(354, 320); this.generalTab.TabIndex = 0; this.generalTab.Text = "General"; this.generalTab.UseVisualStyleBackColor = true; @@ -186,7 +204,7 @@ groupBox1.Dock = System.Windows.Forms.DockStyle.Fill; groupBox1.Location = new System.Drawing.Point(3, 3); groupBox1.Name = "groupBox1"; - groupBox1.Size = new System.Drawing.Size(348, 304); + groupBox1.Size = new System.Drawing.Size(348, 314); groupBox1.TabIndex = 0; groupBox1.TabStop = false; groupBox1.Text = "General"; @@ -216,10 +234,14 @@ tableLayoutPanel2.Controls.Add(this.browseCaptureDirectory, 1, 6); tableLayoutPanel2.Controls.Add(label15, 0, 9); tableLayoutPanel2.Controls.Add(this.Font_PreferMonospaced, 1, 9); + tableLayoutPanel2.Controls.Add(label18, 0, 10); + tableLayoutPanel2.Controls.Add(this.AlwaysReplayLocally, 1, 10); tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; tableLayoutPanel2.Location = new System.Drawing.Point(3, 16); tableLayoutPanel2.Name = "tableLayoutPanel2"; - tableLayoutPanel2.RowCount = 11; + tableLayoutPanel2.RowCount = 12; + tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); + tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); @@ -229,9 +251,8 @@ tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); - tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - tableLayoutPanel2.Size = new System.Drawing.Size(342, 285); + tableLayoutPanel2.Size = new System.Drawing.Size(342, 295); tableLayoutPanel2.TabIndex = 0; // // AllowGlobalHook @@ -545,13 +566,40 @@ this.Font_PreferMonospaced.UseVisualStyleBackColor = true; this.Font_PreferMonospaced.CheckedChanged += new System.EventHandler(this.Font_PreferMonospaced_CheckedChanged); // + // label18 + // + label18.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + label18.AutoSize = true; + label18.Location = new System.Drawing.Point(3, 251); + label18.Name = "label18"; + label18.Size = new System.Drawing.Size(240, 20); + label18.TabIndex = 19; + label18.Text = "Always replay logs locally, never prompt about it"; + label18.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.toolTip.SetToolTip(label18, resources.GetString("label18.ToolTip")); + // + // AlwaysReplayLocally + // + this.AlwaysReplayLocally.AutoSize = true; + this.AlwaysReplayLocally.Checked = true; + this.AlwaysReplayLocally.CheckState = System.Windows.Forms.CheckState.Checked; + this.AlwaysReplayLocally.Location = new System.Drawing.Point(249, 254); + this.AlwaysReplayLocally.Name = "AlwaysReplayLocally"; + this.AlwaysReplayLocally.Size = new System.Drawing.Size(15, 14); + this.AlwaysReplayLocally.TabIndex = 20; + this.toolTip.SetToolTip(this.AlwaysReplayLocally, resources.GetString("AlwaysReplayLocally.ToolTip")); + this.AlwaysReplayLocally.UseVisualStyleBackColor = true; + this.AlwaysReplayLocally.CheckedChanged += new System.EventHandler(this.AlwaysReplayLocally_CheckedChanged); + // // corePage // this.corePage.Controls.Add(this.groupBox5); this.corePage.Location = new System.Drawing.Point(42, 4); this.corePage.Name = "corePage"; this.corePage.Padding = new System.Windows.Forms.Padding(3); - this.corePage.Size = new System.Drawing.Size(354, 310); + this.corePage.Size = new System.Drawing.Size(354, 320); this.corePage.TabIndex = 4; this.corePage.Text = "Core"; this.corePage.UseVisualStyleBackColor = true; @@ -562,7 +610,7 @@ this.groupBox5.Dock = System.Windows.Forms.DockStyle.Fill; this.groupBox5.Location = new System.Drawing.Point(3, 3); this.groupBox5.Name = "groupBox5"; - this.groupBox5.Size = new System.Drawing.Size(348, 304); + this.groupBox5.Size = new System.Drawing.Size(348, 314); this.groupBox5.TabIndex = 0; this.groupBox5.TabStop = false; this.groupBox5.Text = "Core"; @@ -589,7 +637,7 @@ tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - tableLayoutPanel6.Size = new System.Drawing.Size(342, 285); + tableLayoutPanel6.Size = new System.Drawing.Size(342, 295); tableLayoutPanel6.TabIndex = 1; // // chooseSearchPaths @@ -623,7 +671,7 @@ this.texViewTab.Location = new System.Drawing.Point(42, 4); this.texViewTab.Name = "texViewTab"; this.texViewTab.Padding = new System.Windows.Forms.Padding(3); - this.texViewTab.Size = new System.Drawing.Size(354, 310); + this.texViewTab.Size = new System.Drawing.Size(354, 320); this.texViewTab.TabIndex = 1; this.texViewTab.Text = "Texture Viewer"; this.texViewTab.UseVisualStyleBackColor = true; @@ -634,7 +682,7 @@ groupBox2.Dock = System.Windows.Forms.DockStyle.Fill; groupBox2.Location = new System.Drawing.Point(3, 3); groupBox2.Name = "groupBox2"; - groupBox2.Size = new System.Drawing.Size(348, 304); + groupBox2.Size = new System.Drawing.Size(348, 314); groupBox2.TabIndex = 0; groupBox2.TabStop = false; groupBox2.Text = "Texture Viewer"; @@ -655,7 +703,7 @@ this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel3.Size = new System.Drawing.Size(342, 285); + this.tableLayoutPanel3.Size = new System.Drawing.Size(342, 295); this.tableLayoutPanel3.TabIndex = 0; // // TextureViewer_ResetRange @@ -717,7 +765,7 @@ this.shadViewTab.Location = new System.Drawing.Point(42, 4); this.shadViewTab.Name = "shadViewTab"; this.shadViewTab.Padding = new System.Windows.Forms.Padding(3); - this.shadViewTab.Size = new System.Drawing.Size(354, 310); + this.shadViewTab.Size = new System.Drawing.Size(354, 320); this.shadViewTab.TabIndex = 2; this.shadViewTab.Text = "Shader Viewer"; this.shadViewTab.UseVisualStyleBackColor = true; @@ -728,7 +776,7 @@ groupBox3.Dock = System.Windows.Forms.DockStyle.Fill; groupBox3.Location = new System.Drawing.Point(3, 3); groupBox3.Name = "groupBox3"; - groupBox3.Size = new System.Drawing.Size(348, 304); + groupBox3.Size = new System.Drawing.Size(348, 314); groupBox3.TabIndex = 0; groupBox3.TabStop = false; groupBox3.Text = "Shader Viewer"; @@ -746,7 +794,7 @@ this.tableLayoutPanel4.RowCount = 2; this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel4.Size = new System.Drawing.Size(342, 285); + this.tableLayoutPanel4.Size = new System.Drawing.Size(342, 295); this.tableLayoutPanel4.TabIndex = 1; // // ShaderViewer_FriendlyNaming @@ -781,7 +829,7 @@ this.eventTab.Location = new System.Drawing.Point(42, 4); this.eventTab.Name = "eventTab"; this.eventTab.Padding = new System.Windows.Forms.Padding(3); - this.eventTab.Size = new System.Drawing.Size(354, 310); + this.eventTab.Size = new System.Drawing.Size(354, 320); this.eventTab.TabIndex = 3; this.eventTab.Text = "Event Browser"; this.eventTab.UseVisualStyleBackColor = true; @@ -792,7 +840,7 @@ groupBox4.Dock = System.Windows.Forms.DockStyle.Fill; groupBox4.Location = new System.Drawing.Point(3, 3); groupBox4.Name = "groupBox4"; - groupBox4.Size = new System.Drawing.Size(348, 304); + groupBox4.Size = new System.Drawing.Size(348, 314); groupBox4.TabIndex = 1; groupBox4.TabStop = false; groupBox4.Text = "Event Browser"; @@ -819,7 +867,7 @@ this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel5.Size = new System.Drawing.Size(342, 285); + this.tableLayoutPanel5.Size = new System.Drawing.Size(342, 295); this.tableLayoutPanel5.TabIndex = 0; // // label8 @@ -873,42 +921,6 @@ this.EventBrowser_HideEmpty.UseVisualStyleBackColor = true; this.EventBrowser_HideEmpty.CheckedChanged += new System.EventHandler(this.EventBrowser_HideEmpty_CheckedChanged); // - // pagesTree - // - treeListColumn3.AutoSize = true; - treeListColumn3.AutoSizeMinSize = 0; - treeListColumn3.Width = 50; - this.pagesTree.Columns.AddRange(new TreelistView.TreeListColumn[] { - treeListColumn3}); - this.pagesTree.ColumnsOptions.HeaderHeight = 1; - this.pagesTree.Cursor = System.Windows.Forms.Cursors.Arrow; - this.pagesTree.Dock = System.Windows.Forms.DockStyle.Fill; - this.pagesTree.Location = new System.Drawing.Point(3, 3); - this.pagesTree.MultiSelect = false; - this.pagesTree.Name = "pagesTree"; - this.pagesTree.RowOptions.ShowHeader = false; - this.pagesTree.Size = new System.Drawing.Size(168, 318); - this.pagesTree.TabIndex = 0; - this.pagesTree.ViewOptions.ShowGridLines = false; - this.pagesTree.ViewOptions.ShowLine = false; - this.pagesTree.ViewOptions.ShowPlusMinus = false; - this.pagesTree.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.pagesTree_AfterSelect); - // - // ok - // - this.ok.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.ok.Location = new System.Drawing.Point(502, 327); - this.ok.Name = "ok"; - this.ok.Size = new System.Drawing.Size(75, 23); - this.ok.TabIndex = 100; - this.ok.Text = "OK"; - this.ok.UseVisualStyleBackColor = true; - this.ok.Click += new System.EventHandler(this.ok_Click); - // - // browserCaptureDialog - // - this.browserCaptureDialog.RootFolder = System.Environment.SpecialFolder.MyComputer; - // // label16 // label16.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -962,11 +974,32 @@ this.EventBrowser_ColourEventRow.UseVisualStyleBackColor = true; this.EventBrowser_ColourEventRow.CheckedChanged += new System.EventHandler(this.EventBrowser_ColourEventRow_CheckedChanged); // + // pagesTree + // + treeListColumn1.AutoSize = true; + treeListColumn1.AutoSizeMinSize = 0; + treeListColumn1.Width = 50; + this.pagesTree.Columns.AddRange(new TreelistView.TreeListColumn[] { + treeListColumn1}); + this.pagesTree.ColumnsOptions.HeaderHeight = 1; + this.pagesTree.Cursor = System.Windows.Forms.Cursors.Arrow; + this.pagesTree.Dock = System.Windows.Forms.DockStyle.Fill; + this.pagesTree.Location = new System.Drawing.Point(3, 3); + this.pagesTree.MultiSelect = false; + this.pagesTree.Name = "pagesTree"; + this.pagesTree.RowOptions.ShowHeader = false; + this.pagesTree.Size = new System.Drawing.Size(168, 328); + this.pagesTree.TabIndex = 0; + this.pagesTree.ViewOptions.ShowGridLines = false; + this.pagesTree.ViewOptions.ShowLine = false; + this.pagesTree.ViewOptions.ShowPlusMinus = false; + this.pagesTree.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.pagesTree_AfterSelect); + // // SettingsDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(580, 353); + this.ClientSize = new System.Drawing.Size(580, 363); this.Controls.Add(tableLayoutPanel1); this.MinimumSize = new System.Drawing.Size(500, 300); this.Name = "SettingsDialog"; @@ -1038,5 +1071,6 @@ private System.Windows.Forms.Button chooseSearchPaths; private System.Windows.Forms.CheckBox EventBrowser_ApplyColours; private System.Windows.Forms.CheckBox EventBrowser_ColourEventRow; + private System.Windows.Forms.CheckBox AlwaysReplayLocally; } } \ No newline at end of file diff --git a/renderdocui/Windows/Dialogs/SettingsDialog.cs b/renderdocui/Windows/Dialogs/SettingsDialog.cs index 1883e85fd..a7e1bf5d6 100644 --- a/renderdocui/Windows/Dialogs/SettingsDialog.cs +++ b/renderdocui/Windows/Dialogs/SettingsDialog.cs @@ -64,6 +64,8 @@ namespace renderdocui.Windows.Dialogs CheckUpdate_AllowChecks.Checked = m_Core.Config.CheckUpdate_AllowChecks; Font_PreferMonospaced.Checked = m_Core.Config.Font_PreferMonospaced; + AlwaysReplayLocally.Checked = m_Core.Config.AlwaysReplayLocally; + AllowGlobalHook.Checked = m_Core.Config.AllowGlobalHook; { @@ -178,6 +180,13 @@ namespace renderdocui.Windows.Dialogs m_Core.CaptureDialog.UpdateGlobalHook(); } + private void AlwaysReplayLocally_CheckedChanged(object sender, EventArgs e) + { + m_Core.Config.AlwaysReplayLocally = AlwaysReplayLocally.Checked; + + m_Core.Config.Serialize(Core.ConfigFilename); + } + private void EventBrowser_TimeUnit_SelectionChangeCommitted(object sender, EventArgs e) { m_Core.Config.EventBrowser_TimeUnit = (PersistantConfig.TimeUnit)EventBrowser_TimeUnit.SelectedIndex; diff --git a/renderdocui/Windows/Dialogs/SettingsDialog.resx b/renderdocui/Windows/Dialogs/SettingsDialog.resx index 797f367f1..18a272209 100644 --- a/renderdocui/Windows/Dialogs/SettingsDialog.resx +++ b/renderdocui/Windows/Dialogs/SettingsDialog.resx @@ -123,72 +123,12 @@ False - - False - - - False - - - False - - - False - - - False - - - False - - + False 17, 17 - - 17, 17 - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - Enables functionality on the capture application window that will insert RenderDoc automatically into all new processes created - then inject into the target (matching) executable. @@ -236,34 +176,52 @@ Since this is a global system hook it must be used carefully and only when neces False - + False + + If a capture is marked as being created on a significantly different system (different OS or platform) +as is currently running, then by default the UI will prompt to ask if you want to replay on a remote context. + +This option overrides that and will always replay locally if the local context is selected. + + + If a capture is marked as being created on a significantly different system (different OS or platform) +as is currently running, then by default the UI will prompt to ask if you want to replay on a remote context. + +This option overrides that and will always replay locally if the local context is selected. + False False - - False - False False - - False - False False - + + False + + + False + + + False + + + False + + False diff --git a/renderdocui/Windows/Dialogs/SuggestRemoteDialog.Designer.cs b/renderdocui/Windows/Dialogs/SuggestRemoteDialog.Designer.cs new file mode 100644 index 000000000..648a0e6af --- /dev/null +++ b/renderdocui/Windows/Dialogs/SuggestRemoteDialog.Designer.cs @@ -0,0 +1,199 @@ +namespace renderdocui.Windows.Dialogs +{ + partial class SuggestRemoteDialog + { + /// + /// 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() + { + this.components = new System.ComponentModel.Container(); + System.Windows.Forms.TableLayoutPanel tableLayout; + System.Windows.Forms.Panel topPanel; + System.Windows.Forms.Panel bottomPanel; + this.warning = new System.Windows.Forms.Label(); + this.icon = new System.Windows.Forms.PictureBox(); + this.remote = new System.Windows.Forms.CheckBox(); + this.alwaysLocal = new System.Windows.Forms.CheckBox(); + this.local = new System.Windows.Forms.Button(); + this.cancel = new System.Windows.Forms.Button(); + this.remoteDropDown = new System.Windows.Forms.ContextMenuStrip(this.components); + tableLayout = new System.Windows.Forms.TableLayoutPanel(); + topPanel = new System.Windows.Forms.Panel(); + bottomPanel = new System.Windows.Forms.Panel(); + tableLayout.SuspendLayout(); + topPanel.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.icon)).BeginInit(); + bottomPanel.SuspendLayout(); + this.SuspendLayout(); + // + // tableLayout + // + tableLayout.ColumnCount = 1; + tableLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + tableLayout.Controls.Add(topPanel, 0, 0); + tableLayout.Controls.Add(bottomPanel, 0, 1); + tableLayout.Dock = System.Windows.Forms.DockStyle.Fill; + tableLayout.Location = new System.Drawing.Point(0, 0); + tableLayout.Margin = new System.Windows.Forms.Padding(0); + tableLayout.Name = "tableLayout"; + tableLayout.RowCount = 2; + tableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + tableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F)); + tableLayout.Size = new System.Drawing.Size(397, 163); + tableLayout.TabIndex = 0; + // + // topPanel + // + topPanel.BackColor = System.Drawing.SystemColors.Window; + topPanel.Controls.Add(this.warning); + topPanel.Controls.Add(this.icon); + topPanel.Dock = System.Windows.Forms.DockStyle.Fill; + topPanel.Location = new System.Drawing.Point(0, 0); + topPanel.Margin = new System.Windows.Forms.Padding(0); + topPanel.Name = "topPanel"; + topPanel.Size = new System.Drawing.Size(397, 123); + topPanel.TabIndex = 0; + // + // warning + // + this.warning.AutoSize = true; + this.warning.ForeColor = System.Drawing.SystemColors.WindowText; + this.warning.Location = new System.Drawing.Point(61, 22); + this.warning.Name = "warning"; + this.warning.Size = new System.Drawing.Size(47, 13); + this.warning.TabIndex = 1; + this.warning.Text = "Warning"; + // + // icon + // + this.icon.Location = new System.Drawing.Point(22, 22); + this.icon.Name = "icon"; + this.icon.Size = new System.Drawing.Size(32, 32); + this.icon.TabIndex = 0; + this.icon.TabStop = false; + // + // bottomPanel + // + bottomPanel.Controls.Add(this.remote); + bottomPanel.Controls.Add(this.alwaysLocal); + bottomPanel.Controls.Add(this.local); + bottomPanel.Controls.Add(this.cancel); + bottomPanel.Dock = System.Windows.Forms.DockStyle.Fill; + bottomPanel.Location = new System.Drawing.Point(0, 123); + bottomPanel.Margin = new System.Windows.Forms.Padding(0); + bottomPanel.Name = "bottomPanel"; + bottomPanel.Size = new System.Drawing.Size(397, 40); + bottomPanel.TabIndex = 1; + // + // remote + // + this.remote.Appearance = System.Windows.Forms.Appearance.Button; + this.remote.AutoCheck = false; + this.remote.Image = global::renderdocui.Properties.Resources.down_arrow; + this.remote.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; + this.remote.Location = new System.Drawing.Point(152, 8); + this.remote.Name = "remote"; + this.remote.Size = new System.Drawing.Size(75, 23); + this.remote.TabIndex = 2; + this.remote.Text = "Remote "; + this.remote.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.remote.UseVisualStyleBackColor = true; + this.remote.Click += new System.EventHandler(this.remote_Click); + // + // alwaysLocal + // + this.alwaysLocal.AutoSize = true; + this.alwaysLocal.Location = new System.Drawing.Point(12, 5); + this.alwaysLocal.Name = "alwaysLocal"; + this.alwaysLocal.Size = new System.Drawing.Size(124, 30); + this.alwaysLocal.TabIndex = 3; + this.alwaysLocal.Text = "Don\'t prompt again,\r\nalways replay locally.\r\n"; + this.alwaysLocal.UseVisualStyleBackColor = true; + this.alwaysLocal.CheckedChanged += new System.EventHandler(this.alwaysLocal_CheckedChanged); + // + // local + // + this.local.Location = new System.Drawing.Point(233, 8); + this.local.Name = "local"; + this.local.Size = new System.Drawing.Size(75, 23); + this.local.TabIndex = 1; + this.local.Text = "Local"; + this.local.UseVisualStyleBackColor = true; + this.local.Click += new System.EventHandler(this.local_Click); + // + // cancel + // + this.cancel.Location = new System.Drawing.Point(314, 8); + this.cancel.Name = "cancel"; + this.cancel.Size = new System.Drawing.Size(75, 23); + this.cancel.TabIndex = 0; + this.cancel.Text = "Cancel"; + this.cancel.UseVisualStyleBackColor = true; + this.cancel.Click += new System.EventHandler(this.cancel_Click); + // + // remoteDropDown + // + this.remoteDropDown.Name = "remoteDropDown"; + this.remoteDropDown.Size = new System.Drawing.Size(61, 4); + this.remoteDropDown.Closed += new System.Windows.Forms.ToolStripDropDownClosedEventHandler(this.remoteDropDown_Closed); + this.remoteDropDown.ItemAdded += new System.Windows.Forms.ToolStripItemEventHandler(this.remoteDropDown_ItemAdded); + this.remoteDropDown.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.remoteDropDown_ItemClicked); + // + // SuggestRemoteDialog + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(397, 163); + this.Controls.Add(tableLayout); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "SuggestRemoteDialog"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "SuggestRemoteDialog"; + tableLayout.ResumeLayout(false); + topPanel.ResumeLayout(false); + topPanel.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.icon)).EndInit(); + bottomPanel.ResumeLayout(false); + bottomPanel.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.PictureBox icon; + private System.Windows.Forms.Label warning; + private System.Windows.Forms.CheckBox remote; + private System.Windows.Forms.Button local; + private System.Windows.Forms.Button cancel; + private System.Windows.Forms.CheckBox alwaysLocal; + private System.Windows.Forms.ContextMenuStrip remoteDropDown; + } +} \ No newline at end of file diff --git a/renderdocui/Windows/Dialogs/SuggestRemoteDialog.cs b/renderdocui/Windows/Dialogs/SuggestRemoteDialog.cs new file mode 100644 index 000000000..d05589b5e --- /dev/null +++ b/renderdocui/Windows/Dialogs/SuggestRemoteDialog.cs @@ -0,0 +1,140 @@ +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 renderdocui.Code; + +namespace renderdocui.Windows.Dialogs +{ + public partial class SuggestRemoteDialog : Form + { + public enum SuggestRemoteResult + { + Cancel, + Local, + Remote, + } + + string m_WarningStart; + + public SuggestRemoteDialog(string driver, string machineIdent) + { + InitializeComponent(); + + icon.Image = SystemIcons.Exclamation.ToBitmap(); + + m_WarningStart = + "This " + driver + " capture was originally created on a\n" + + "'" + machineIdent.Trim() + "' machine.\n\n"; + + warning.Text = + m_WarningStart + + "Currently you have no remote context selected or configured\n" + + "to replay on. Would you like to load the capture locally or\n" + + "back out to configure one in Tools > Manage Remote Servers?"; + + remote.Enabled = false; + remote.Image = null; + remote.Text = "No Remote"; + } + + private void remoteDropDown_ItemAdded(object sender, ToolStripItemEventArgs e) + { + // update text and buttons to reflect that remote hosts are configured + warning.Text = + m_WarningStart + + "Currently you have no remote context selected, would you like\n" + + "to choose a remote context to replay on, or continue and load\n" + + "the capture locally?"; + + remote.Enabled = true; + remote.Image = global::renderdocui.Properties.Resources.down_arrow; + remote.Text = "Remote "; + } + + private void alwaysLocal_CheckedChanged(object sender, EventArgs e) + { + remote.Enabled = RemoteItems.Count > 0 && !alwaysLocal.Checked; + } + + protected override bool ProcessCmdKey(ref Message msg, Keys keyData) + { + if (keyData == Keys.Escape) + { + this.Close(); + return true; + } + return base.ProcessCmdKey(ref msg, keyData); + } + + private void cancel_Click(object sender, EventArgs e) + { + m_Result = SuggestRemoteResult.Cancel; + Close(); + } + + private void local_Click(object sender, EventArgs e) + { + m_Result = SuggestRemoteResult.Local; + Close(); + } + + private void remoteDropDown_ItemClicked(object sender, ToolStripItemClickedEventArgs e) + { + m_Result = SuggestRemoteResult.Remote; + } + + private void remote_Click(object sender, EventArgs e) + { + if(remote.Checked) + return; + + Point showPos = remote.PointToScreen(remote.ClientRectangle.Location); + + showPos.Y = showPos.Y + remote.ClientRectangle.Height; + + // gives the appearance that the button stays pressed + remote.Checked = true; + + remoteDropDown.Show(showPos); + } + + private void remoteDropDown_Closed(object sender, ToolStripDropDownClosedEventArgs e) + { + remote.Checked = false; + + // if the result is Remote now then one of the items was clicked on + if (m_Result == SuggestRemoteResult.Remote) + Close(); + } + + private SuggestRemoteResult m_Result = SuggestRemoteResult.Cancel; + public SuggestRemoteResult Result + { + get + { + return m_Result; + } + } + + public ToolStripItemCollection RemoteItems + { + get + { + return remoteDropDown.Items; + } + } + + public bool AlwaysReplayLocally + { + get + { + return alwaysLocal.Checked; + } + } + } +} diff --git a/renderdocui/Windows/Dialogs/SuggestRemoteDialog.resx b/renderdocui/Windows/Dialogs/SuggestRemoteDialog.resx new file mode 100644 index 000000000..42e2d2a2a --- /dev/null +++ b/renderdocui/Windows/Dialogs/SuggestRemoteDialog.resx @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + False + + + 14, 16 + + \ No newline at end of file diff --git a/renderdocui/Windows/MainWindow.cs b/renderdocui/Windows/MainWindow.cs index fb8bdb38b..df68fd963 100644 --- a/renderdocui/Windows/MainWindow.cs +++ b/renderdocui/Windows/MainWindow.cs @@ -634,6 +634,66 @@ namespace renderdocui.Windows { support = StaticExports.SupportLocalReplay(filename, out driver, out machineIdent); + // if the return value suggests remote replay, and it's not already selected, AND the user hasn't + // previously chosen to always replay locally without being prompted, ask if they'd prefer to + // switch to a remote context for replaying. + if (support == ReplaySupport.SuggestRemote && !remoteReplay && !m_Core.Config.AlwaysReplayLocally) + { + var dialog = new Dialogs.SuggestRemoteDialog(driver, machineIdent); + + FillRemotesToolStrip(dialog.RemoteItems, false); + + dialog.ShowDialog(); + + if (dialog.Result == Dialogs.SuggestRemoteDialog.SuggestRemoteResult.Cancel) + { + return; + } + else if (dialog.Result == Dialogs.SuggestRemoteDialog.SuggestRemoteResult.Remote) + { + // we only get back here from the dialog once the context switch has begun, + // so contextChooser will have been disabled. + // Check once to see if it's enabled before even popping up the dialog in case + // it has finished already. Otherwise pop up a waiting dialog until it completes + // one way or another, then process the result. + + if (!contextChooser.Enabled) + { + ProgressPopup modal = new ProgressPopup((ModalCloseCallback)delegate + { + return contextChooser.Enabled; + }, false); + modal.SetModalText("Please Wait - Checking remote connection..."); + + modal.ShowDialog(); + } + + remoteReplay = (m_Core.Renderer.Remote != null && m_Core.Renderer.Remote.Connected); + + if (!remoteReplay) + { + string remoteMessage = "Failed to make a connection to the remote server.\n\n"; + + remoteMessage += "More information may be available in the status bar."; + + MessageBox.Show(remoteMessage, "Couldn't connect to remote server", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + return; + } + } + else + { + // nothing to do - we just continue replaying locally + // however we need to check if the user selected 'always replay locally' and + // set that bit as sticky in the config + if (dialog.AlwaysReplayLocally) + { + m_Core.Config.AlwaysReplayLocally = true; + + m_Core.Config.Serialize(Core.ConfigFilename); + } + } + } + if (remoteReplay) { support = ReplaySupport.Unsupported; @@ -933,13 +993,13 @@ namespace renderdocui.Windows } } - private void contextChooser_DropDownOpening(object sender, EventArgs e) + private void FillRemotesToolStrip(ToolStripItemCollection strip, bool includeLocalhost) { ToolStripItem[] items = new ToolStripItem[m_Core.Config.RemoteHosts.Count]; int idx = 0; - for(int i=0; i < m_Core.Config.RemoteHosts.Count; i++) + for (int i = 0; i < m_Core.Config.RemoteHosts.Count; i++) { RemoteHost host = m_Core.Config.RemoteHosts[i]; @@ -961,14 +1021,27 @@ namespace renderdocui.Windows items[idx++] = item; } - items[idx] = localContext; + if(includeLocalhost && idx < items.Length) + items[idx] = localContext; - contextChooser.DropDownItems.Clear(); - contextChooser.DropDownItems.AddRange(items); + strip.Clear(); + foreach(ToolStripItem item in items) + if(item != null) + strip.Add(item); + } + + private void contextChooser_DropDownOpening(object sender, EventArgs e) + { + FillRemotesToolStrip(contextChooser.DropDownItems, true); } private void switchContext(object sender, EventArgs e) { + ToolStripItem item = sender as ToolStripItem; + + if(item == null) + return; + foreach (var live in m_LiveCaptures) if (live.CheckAllowClose() == false) return; @@ -984,7 +1057,7 @@ namespace renderdocui.Windows m_Core.Renderer.DisconnectFromRemoteServer(); - if(sender == localContext) + if (item.Tag == null) { contextChooser.Image = global::renderdocui.Properties.Resources.house; contextChooser.Text = "Replay Context: Local"; @@ -997,7 +1070,7 @@ namespace renderdocui.Windows } else { - RemoteHost host = (sender as ToolStripMenuItem).Tag as RemoteHost; + RemoteHost host = item.Tag as RemoteHost; contextChooser.Text = "Replay Context: " + host.Hostname; contextChooser.Image = host.ServerRunning ? global::renderdocui.Properties.Resources.connect diff --git a/renderdocui/renderdocui.csproj b/renderdocui/renderdocui.csproj index 70a9b7897..833bce7d6 100644 --- a/renderdocui/renderdocui.csproj +++ b/renderdocui/renderdocui.csproj @@ -259,6 +259,12 @@ SettingsDialog.cs + + Form + + + SuggestRemoteDialog.cs + Form @@ -424,6 +430,9 @@ SettingsDialog.cs + + SuggestRemoteDialog.cs + TextureGoto.cs