diff --git a/renderdocui/Code/PersistantConfig.cs b/renderdocui/Code/PersistantConfig.cs index c48fb0994..48f191341 100644 --- a/renderdocui/Code/PersistantConfig.cs +++ b/renderdocui/Code/PersistantConfig.cs @@ -41,6 +41,30 @@ namespace renderdocui.Code { public string Hostname = ""; public string RunCommand = ""; + + [XmlIgnore] + public bool ServerRunning = false; + + public void Launch() + { + try + { + System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo("cmd.exe"); + startInfo.CreateNoWindow = true; + startInfo.UseShellExecute = false; + startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; + startInfo.Arguments = "/C " + RunCommand; + System.Diagnostics.Process cmd = System.Diagnostics.Process.Start(startInfo); + + // wait up to 2s for the command to exit + cmd.WaitForExit(2000); + } + catch (Exception) + { + MessageBox.Show(String.Format("Error running command to launch remote server:\n{0}", RunCommand), + "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } } [Serializable] @@ -209,6 +233,25 @@ namespace renderdocui.Code } } + // localhost should always be available + bool foundLocalhost = false; + + for (int i = 0; i < c.RemoteHosts.Count; i++) + { + if (c.RemoteHosts[i].Hostname == "localhost") + { + foundLocalhost = true; + break; + } + } + + if (!foundLocalhost) + { + RemoteHost host = new RemoteHost(); + host.Hostname = "localhost"; + c.RemoteHosts.Add(host); + } + return c; } } diff --git a/renderdocui/Properties/Resources.Designer.cs b/renderdocui/Properties/Resources.Designer.cs index 4c5b7249a..7859af013 100644 --- a/renderdocui/Properties/Resources.Designer.cs +++ b/renderdocui/Properties/Resources.Designer.cs @@ -290,6 +290,16 @@ namespace renderdocui.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap house { + get { + object obj = ResourceManager.GetObject("house", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). /// diff --git a/renderdocui/Properties/Resources.resx b/renderdocui/Properties/Resources.resx index dd9138ebd..fcfdb9e1d 100644 --- a/renderdocui/Properties/Resources.resx +++ b/renderdocui/Properties/Resources.resx @@ -292,4 +292,7 @@ ..\Resources\up_arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\house.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/renderdocui/Resources/house.png b/renderdocui/Resources/house.png new file mode 100644 index 000000000..fed62219f Binary files /dev/null and b/renderdocui/Resources/house.png differ diff --git a/renderdocui/Windows/Dialogs/RemoteManager.cs b/renderdocui/Windows/Dialogs/RemoteManager.cs index fb4fc05cb..fad568c4e 100644 --- a/renderdocui/Windows/Dialogs/RemoteManager.cs +++ b/renderdocui/Windows/Dialogs/RemoteManager.cs @@ -29,7 +29,6 @@ using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; -using System.Diagnostics; using System.Linq; using System.Threading; using System.Text; @@ -65,15 +64,28 @@ namespace renderdocui.Windows.Dialogs private static void SetRemoteServerLive(TreelistView.Node node, bool live) { - node["running"] = live ? RemoteServerLiveText : RemoteServerDeadText; - node.Image = live - ? global::renderdocui.Properties.Resources.connect - : global::renderdocui.Properties.Resources.disconnect; + RemoteHost host = node.Tag as RemoteHost; + + host.ServerRunning = live; + + if (host.Hostname == "localhost") + { + node.Image = null; + node["running"] = ""; + } + else + { + node["running"] = live ? RemoteServerLiveText : RemoteServerDeadText; + + node.Image = live + ? global::renderdocui.Properties.Resources.connect + : global::renderdocui.Properties.Resources.disconnect; + } } private static bool IsRemoteServerLive(TreelistView.Node node) { - return node["running"].ToString() == RemoteServerLiveText; + return (node.Tag as RemoteHost).ServerRunning; } public RemoteManager(Core core, MainWindow main) @@ -91,25 +103,6 @@ namespace renderdocui.Windows.Dialogs hosts.BeginInit(); - // localhost should always be available - bool foundLocalhost = false; - - for (int i = 0; i < m_Core.Config.RemoteHosts.Count; i++) - { - if (m_Core.Config.RemoteHosts[i].Hostname == "localhost") - { - foundLocalhost = true; - break; - } - } - - if (!foundLocalhost) - { - RemoteHost host = new RemoteHost(); - host.Hostname = "localhost"; - m_Core.Config.RemoteHosts.Add(host); - } - foreach (var h in m_Core.Config.RemoteHosts) AddHost(h); @@ -142,27 +135,11 @@ namespace renderdocui.Windows.Dialogs TreelistView.Node node = o as TreelistView.Node; RemoteHost host = node.Tag as RemoteHost; - try - { - ProcessStartInfo startInfo = new ProcessStartInfo("cmd.exe"); - startInfo.CreateNoWindow = true; - startInfo.UseShellExecute = false; - startInfo.WindowStyle = ProcessWindowStyle.Hidden; - startInfo.Arguments = "/C " + host.RunCommand; - Process cmd = Process.Start(startInfo); + host.Launch(); - // wait up to 2s for the command to exit - cmd.WaitForExit(2000); - - // now refresh this host - Thread th = Helpers.NewThread(new ParameterizedThreadStart(LookupHostConnections)); - th.Start(node); - } - catch (Exception) - { - MessageBox.Show(String.Format("Error running command to launch remote server:\n{0}", host.RunCommand), - "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } + // now refresh this host + Thread th = Helpers.NewThread(new ParameterizedThreadStart(LookupHostConnections)); + th.Start(node); } // this function looks up the remote connections and for each one open @@ -256,8 +233,7 @@ namespace renderdocui.Windows.Dialogs // (to stop flooding) private void LookupComplete() { - if(hosts.SelectedNode != null) - hosts_AfterSelect(hosts, new TreeViewEventArgs(null)); + updateConnectButton(); if (lookupsInProgress == 0) { @@ -270,6 +246,31 @@ namespace renderdocui.Windows.Dialogs configHostname.Enabled = configRunCommand.Enabled = false; configHostname.Text = configRunCommand.Text = ""; + if (hosts.SelectedNode != null && + hosts.SelectedNode.Tag != null) + { + RemoteHost host = hosts.SelectedNode.Tag as RemoteHost; + + if (host != null) + { + if (host.Hostname == "localhost") + { + configHostname.Text = "localhost"; + } + else + { + configHostname.Enabled = configRunCommand.Enabled = true; + configHostname.Text = host.Hostname; + configRunCommand.Text = host.RunCommand; + } + } + } + + updateConnectButton(); + } + + private void updateConnectButton() + { if (hosts.SelectedNode != null && hosts.SelectedNode.Tag != null) { @@ -280,10 +281,6 @@ namespace renderdocui.Windows.Dialogs if (host != null) { - configHostname.Enabled = configRunCommand.Enabled = true; - configHostname.Text = host.Hostname; - configRunCommand.Text = host.RunCommand; - if(IsRemoteServerLive(hosts.SelectedNode)) { connect.Text = "Shutdown"; @@ -382,7 +379,7 @@ namespace renderdocui.Windows.Dialogs MessageBox.Show("Error shutting down remote server", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } - hosts_AfterSelect(hosts, new TreeViewEventArgs(null)); + updateConnectButton(); } else { @@ -487,7 +484,6 @@ namespace renderdocui.Windows.Dialogs m_Core.Config.Serialize(Core.ConfigFilename); hosts.BeginUpdate(); hosts.SelectedNode["hostname"] = m_Core.Config.RemoteHosts[idx].Hostname; - hosts.SelectedNode.Tag = m_Core.Config.RemoteHosts[idx]; hosts.EndUpdate(); } } diff --git a/renderdocui/Windows/MainWindow.Designer.cs b/renderdocui/Windows/MainWindow.Designer.cs index 10907a02c..856e4b27e 100644 --- a/renderdocui/Windows/MainWindow.Designer.cs +++ b/renderdocui/Windows/MainWindow.Designer.cs @@ -28,21 +28,21 @@ /// private void InitializeComponent() { - 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(); - WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient1 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); - WeifenLuo.WinFormsUI.Docking.DockPaneStripSkin dockPaneStripSkin1 = new WeifenLuo.WinFormsUI.Docking.DockPaneStripSkin(); - WeifenLuo.WinFormsUI.Docking.DockPaneStripGradient dockPaneStripGradient1 = new WeifenLuo.WinFormsUI.Docking.DockPaneStripGradient(); - WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient2 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); - WeifenLuo.WinFormsUI.Docking.DockPanelGradient dockPanelGradient2 = new WeifenLuo.WinFormsUI.Docking.DockPanelGradient(); - WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient3 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); - WeifenLuo.WinFormsUI.Docking.DockPaneStripToolWindowGradient dockPaneStripToolWindowGradient1 = new WeifenLuo.WinFormsUI.Docking.DockPaneStripToolWindowGradient(); - WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient4 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); - WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient5 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); - WeifenLuo.WinFormsUI.Docking.DockPanelGradient dockPanelGradient3 = new WeifenLuo.WinFormsUI.Docking.DockPanelGradient(); - WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient6 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); - WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient7 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); + WeifenLuo.WinFormsUI.Docking.DockPanelSkin dockPanelSkin6 = new WeifenLuo.WinFormsUI.Docking.DockPanelSkin(); + WeifenLuo.WinFormsUI.Docking.AutoHideStripSkin autoHideStripSkin6 = new WeifenLuo.WinFormsUI.Docking.AutoHideStripSkin(); + WeifenLuo.WinFormsUI.Docking.DockPanelGradient dockPanelGradient16 = new WeifenLuo.WinFormsUI.Docking.DockPanelGradient(); + WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient36 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); + WeifenLuo.WinFormsUI.Docking.DockPaneStripSkin dockPaneStripSkin6 = new WeifenLuo.WinFormsUI.Docking.DockPaneStripSkin(); + WeifenLuo.WinFormsUI.Docking.DockPaneStripGradient dockPaneStripGradient6 = new WeifenLuo.WinFormsUI.Docking.DockPaneStripGradient(); + WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient37 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); + WeifenLuo.WinFormsUI.Docking.DockPanelGradient dockPanelGradient17 = new WeifenLuo.WinFormsUI.Docking.DockPanelGradient(); + WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient38 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); + WeifenLuo.WinFormsUI.Docking.DockPaneStripToolWindowGradient dockPaneStripToolWindowGradient6 = new WeifenLuo.WinFormsUI.Docking.DockPaneStripToolWindowGradient(); + WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient39 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); + WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient40 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); + WeifenLuo.WinFormsUI.Docking.DockPanelGradient dockPanelGradient18 = new WeifenLuo.WinFormsUI.Docking.DockPanelGradient(); + WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient41 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); + WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient42 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.captureLogToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -111,14 +111,13 @@ this.openDialog = new System.Windows.Forms.OpenFileDialog(); this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer(); this.statusStrip = new System.Windows.Forms.StatusStrip(); + this.contextChooser = new System.Windows.Forms.ToolStripDropDownButton(); + this.localContext = new System.Windows.Forms.ToolStripMenuItem(); this.statusIcon = new System.Windows.Forms.ToolStripStatusLabel(); this.statusText = new System.Windows.Forms.ToolStripStatusLabel(); this.statusProgress = new System.Windows.Forms.ToolStripProgressBar(); this.dockPanel = new WeifenLuo.WinFormsUI.Docking.DockPanel(); this.saveDialog = new System.Windows.Forms.SaveFileDialog(); - this.contextChooser = new System.Windows.Forms.ToolStripDropDownButton(); - this.foohostToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.barhostToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.toolStripContainer1.BottomToolStripPanel.SuspendLayout(); this.toolStripContainer1.ContentPanel.SuspendLayout(); @@ -137,7 +136,7 @@ this.helpToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(1272, 24); + this.menuStrip1.Size = new System.Drawing.Size(920, 24); this.menuStrip1.TabIndex = 3; this.menuStrip1.Text = "menuStrip1"; // @@ -525,26 +524,26 @@ // resolveSymbolsToolStripMenuItem // this.resolveSymbolsToolStripMenuItem.Name = "resolveSymbolsToolStripMenuItem"; - this.resolveSymbolsToolStripMenuItem.Size = new System.Drawing.Size(188, 22); + this.resolveSymbolsToolStripMenuItem.Size = new System.Drawing.Size(192, 22); this.resolveSymbolsToolStripMenuItem.Text = "&Resolve Symbols"; this.resolveSymbolsToolStripMenuItem.Click += new System.EventHandler(this.resolveSymbolsToolStripMenuItem_Click); // // toolStripSeparator11 // this.toolStripSeparator11.Name = "toolStripSeparator11"; - this.toolStripSeparator11.Size = new System.Drawing.Size(185, 6); + this.toolStripSeparator11.Size = new System.Drawing.Size(189, 6); // // optionsToolStripMenuItem // this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; - this.optionsToolStripMenuItem.Size = new System.Drawing.Size(188, 22); + this.optionsToolStripMenuItem.Size = new System.Drawing.Size(192, 22); this.optionsToolStripMenuItem.Text = "&Options"; this.optionsToolStripMenuItem.Click += new System.EventHandler(this.optionsToolStripMenuItem_Click); // - // manageReplayDevicesToolStripMenuItem + // manageRemote // this.manageRemote.Name = "manageRemote"; - this.manageRemote.Size = new System.Drawing.Size(188, 22); + this.manageRemote.Size = new System.Drawing.Size(192, 22); this.manageRemote.Text = "&Manage Remote Servers"; this.manageRemote.Click += new System.EventHandler(this.manageRemote_Click); // @@ -669,13 +668,13 @@ // toolStripContainer1.ContentPanel // this.toolStripContainer1.ContentPanel.Controls.Add(this.dockPanel); - this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(1272, 727); + this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(920, 394); this.toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill; this.toolStripContainer1.LeftToolStripPanelVisible = false; this.toolStripContainer1.Location = new System.Drawing.Point(0, 0); this.toolStripContainer1.Name = "toolStripContainer1"; this.toolStripContainer1.RightToolStripPanelVisible = false; - this.toolStripContainer1.Size = new System.Drawing.Size(1272, 773); + this.toolStripContainer1.Size = new System.Drawing.Size(920, 440); this.toolStripContainer1.TabIndex = 5; this.toolStripContainer1.Text = "toolStripContainer1"; // @@ -687,15 +686,34 @@ // this.statusStrip.Dock = System.Windows.Forms.DockStyle.None; this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.contextChooser, this.statusIcon, this.statusText, - this.statusProgress, - this.contextChooser}); + this.statusProgress}); this.statusStrip.Location = new System.Drawing.Point(0, 0); this.statusStrip.Name = "statusStrip"; - this.statusStrip.Size = new System.Drawing.Size(1272, 22); + this.statusStrip.Size = new System.Drawing.Size(920, 22); this.statusStrip.TabIndex = 0; // + // contextChooser + // + this.contextChooser.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.localContext}); + this.contextChooser.Image = global::renderdocui.Properties.Resources.house; + this.contextChooser.ImageTransparentColor = System.Drawing.Color.Magenta; + this.contextChooser.Name = "contextChooser"; + this.contextChooser.Size = new System.Drawing.Size(142, 20); + this.contextChooser.Text = "Replay Context: Local"; + this.contextChooser.DropDownOpening += new System.EventHandler(this.contextChooser_DropDownOpening); + // + // localContext + // + this.localContext.Image = global::renderdocui.Properties.Resources.house; + this.localContext.Name = "localContext"; + this.localContext.Size = new System.Drawing.Size(152, 22); + this.localContext.Text = "Local"; + this.localContext.Click += new System.EventHandler(this.switchContext); + // // statusIcon // this.statusIcon.AutoSize = false; @@ -731,53 +749,53 @@ this.dockPanel.DocumentStyle = WeifenLuo.WinFormsUI.Docking.DocumentStyle.DockingWindow; this.dockPanel.Location = new System.Drawing.Point(0, 0); this.dockPanel.Name = "dockPanel"; - this.dockPanel.Size = new System.Drawing.Size(1272, 727); - dockPanelGradient1.EndColor = System.Drawing.SystemColors.ControlLight; - dockPanelGradient1.StartColor = System.Drawing.SystemColors.ControlLight; - autoHideStripSkin1.DockStripGradient = dockPanelGradient1; - tabGradient1.EndColor = System.Drawing.SystemColors.Control; - tabGradient1.StartColor = System.Drawing.SystemColors.Control; - tabGradient1.TextColor = System.Drawing.SystemColors.ControlDarkDark; - autoHideStripSkin1.TabGradient = tabGradient1; - autoHideStripSkin1.TextFont = new System.Drawing.Font("Tahoma", 8.25F); - dockPanelSkin1.AutoHideStripSkin = autoHideStripSkin1; - tabGradient2.EndColor = System.Drawing.SystemColors.ControlLightLight; - tabGradient2.StartColor = System.Drawing.SystemColors.ControlLightLight; - tabGradient2.TextColor = System.Drawing.SystemColors.ControlText; - dockPaneStripGradient1.ActiveTabGradient = tabGradient2; - dockPanelGradient2.EndColor = System.Drawing.SystemColors.Control; - dockPanelGradient2.StartColor = System.Drawing.SystemColors.Control; - dockPaneStripGradient1.DockStripGradient = dockPanelGradient2; - tabGradient3.EndColor = System.Drawing.SystemColors.ControlLight; - tabGradient3.StartColor = System.Drawing.SystemColors.ControlLight; - tabGradient3.TextColor = System.Drawing.SystemColors.ControlText; - dockPaneStripGradient1.InactiveTabGradient = tabGradient3; - dockPaneStripSkin1.DocumentGradient = dockPaneStripGradient1; - dockPaneStripSkin1.TextFont = new System.Drawing.Font("Tahoma", 8.25F); - tabGradient4.EndColor = System.Drawing.SystemColors.ActiveCaption; - tabGradient4.LinearGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical; - tabGradient4.StartColor = System.Drawing.SystemColors.GradientActiveCaption; - tabGradient4.TextColor = System.Drawing.SystemColors.ActiveCaptionText; - dockPaneStripToolWindowGradient1.ActiveCaptionGradient = tabGradient4; - tabGradient5.EndColor = System.Drawing.SystemColors.Control; - tabGradient5.StartColor = System.Drawing.SystemColors.Control; - tabGradient5.TextColor = System.Drawing.SystemColors.ControlText; - dockPaneStripToolWindowGradient1.ActiveTabGradient = tabGradient5; - dockPanelGradient3.EndColor = System.Drawing.SystemColors.ControlLight; - dockPanelGradient3.StartColor = System.Drawing.SystemColors.ControlLight; - dockPaneStripToolWindowGradient1.DockStripGradient = dockPanelGradient3; - tabGradient6.EndColor = System.Drawing.SystemColors.InactiveCaption; - tabGradient6.LinearGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical; - tabGradient6.StartColor = System.Drawing.SystemColors.GradientInactiveCaption; - tabGradient6.TextColor = System.Drawing.SystemColors.InactiveCaptionText; - dockPaneStripToolWindowGradient1.InactiveCaptionGradient = tabGradient6; - tabGradient7.EndColor = System.Drawing.Color.Transparent; - tabGradient7.StartColor = System.Drawing.Color.Transparent; - tabGradient7.TextColor = System.Drawing.SystemColors.ControlDarkDark; - dockPaneStripToolWindowGradient1.InactiveTabGradient = tabGradient7; - dockPaneStripSkin1.ToolWindowGradient = dockPaneStripToolWindowGradient1; - dockPanelSkin1.DockPaneStripSkin = dockPaneStripSkin1; - this.dockPanel.Skin = dockPanelSkin1; + this.dockPanel.Size = new System.Drawing.Size(920, 394); + dockPanelGradient16.EndColor = System.Drawing.SystemColors.ControlLight; + dockPanelGradient16.StartColor = System.Drawing.SystemColors.ControlLight; + autoHideStripSkin6.DockStripGradient = dockPanelGradient16; + tabGradient36.EndColor = System.Drawing.SystemColors.Control; + tabGradient36.StartColor = System.Drawing.SystemColors.Control; + tabGradient36.TextColor = System.Drawing.SystemColors.ControlDarkDark; + autoHideStripSkin6.TabGradient = tabGradient36; + autoHideStripSkin6.TextFont = new System.Drawing.Font("Tahoma", 8.25F); + dockPanelSkin6.AutoHideStripSkin = autoHideStripSkin6; + tabGradient37.EndColor = System.Drawing.SystemColors.ControlLightLight; + tabGradient37.StartColor = System.Drawing.SystemColors.ControlLightLight; + tabGradient37.TextColor = System.Drawing.SystemColors.ControlText; + dockPaneStripGradient6.ActiveTabGradient = tabGradient37; + dockPanelGradient17.EndColor = System.Drawing.SystemColors.Control; + dockPanelGradient17.StartColor = System.Drawing.SystemColors.Control; + dockPaneStripGradient6.DockStripGradient = dockPanelGradient17; + tabGradient38.EndColor = System.Drawing.SystemColors.ControlLight; + tabGradient38.StartColor = System.Drawing.SystemColors.ControlLight; + tabGradient38.TextColor = System.Drawing.SystemColors.ControlText; + dockPaneStripGradient6.InactiveTabGradient = tabGradient38; + dockPaneStripSkin6.DocumentGradient = dockPaneStripGradient6; + dockPaneStripSkin6.TextFont = new System.Drawing.Font("Tahoma", 8.25F); + tabGradient39.EndColor = System.Drawing.SystemColors.ActiveCaption; + tabGradient39.LinearGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical; + tabGradient39.StartColor = System.Drawing.SystemColors.GradientActiveCaption; + tabGradient39.TextColor = System.Drawing.SystemColors.ActiveCaptionText; + dockPaneStripToolWindowGradient6.ActiveCaptionGradient = tabGradient39; + tabGradient40.EndColor = System.Drawing.SystemColors.Control; + tabGradient40.StartColor = System.Drawing.SystemColors.Control; + tabGradient40.TextColor = System.Drawing.SystemColors.ControlText; + dockPaneStripToolWindowGradient6.ActiveTabGradient = tabGradient40; + dockPanelGradient18.EndColor = System.Drawing.SystemColors.ControlLight; + dockPanelGradient18.StartColor = System.Drawing.SystemColors.ControlLight; + dockPaneStripToolWindowGradient6.DockStripGradient = dockPanelGradient18; + tabGradient41.EndColor = System.Drawing.SystemColors.InactiveCaption; + tabGradient41.LinearGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical; + tabGradient41.StartColor = System.Drawing.SystemColors.GradientInactiveCaption; + tabGradient41.TextColor = System.Drawing.SystemColors.InactiveCaptionText; + dockPaneStripToolWindowGradient6.InactiveCaptionGradient = tabGradient41; + tabGradient42.EndColor = System.Drawing.Color.Transparent; + tabGradient42.StartColor = System.Drawing.Color.Transparent; + tabGradient42.TextColor = System.Drawing.SystemColors.ControlDarkDark; + dockPaneStripToolWindowGradient6.InactiveTabGradient = tabGradient42; + dockPaneStripSkin6.ToolWindowGradient = dockPaneStripToolWindowGradient6; + dockPanelSkin6.DockPaneStripSkin = dockPaneStripSkin6; + this.dockPanel.Skin = dockPanelSkin6; this.dockPanel.TabIndex = 0; // // saveDialog @@ -786,38 +804,13 @@ this.saveDialog.Filter = "Log Files (*.rdc)|*.rdc"; this.saveDialog.Title = "Save Log As"; // - // contextChooser - // - this.contextChooser.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.barhostToolStripMenuItem, - this.foohostToolStripMenuItem}); - this.contextChooser.Image = global::renderdocui.Properties.Resources.disconnect; - this.contextChooser.ImageTransparentColor = System.Drawing.Color.Magenta; - this.contextChooser.Name = "contextChooser"; - this.contextChooser.Size = new System.Drawing.Size(142, 20); - this.contextChooser.Text = "Replay Context: Local"; - // - // foohostToolStripMenuItem - // - this.foohostToolStripMenuItem.Image = global::renderdocui.Properties.Resources.cross; - this.foohostToolStripMenuItem.Name = "foohostToolStripMenuItem"; - this.foohostToolStripMenuItem.Size = new System.Drawing.Size(154, 22); - this.foohostToolStripMenuItem.Text = "foohost (Offline)"; - // - // barhostToolStripMenuItem - // - this.barhostToolStripMenuItem.Image = global::renderdocui.Properties.Resources.tick; - this.barhostToolStripMenuItem.Name = "barhostToolStripMenuItem"; - this.barhostToolStripMenuItem.Size = new System.Drawing.Size(154, 22); - this.barhostToolStripMenuItem.Text = "barhost (Online)"; - // // MainWindow // this.AllowDrop = true; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.Control; - this.ClientSize = new System.Drawing.Size(1272, 773); + this.ClientSize = new System.Drawing.Size(920, 440); this.Controls.Add(this.toolStripContainer1); this.DoubleBuffered = true; this.ForeColor = System.Drawing.SystemColors.ControlText; @@ -919,7 +912,6 @@ private System.Windows.Forms.ToolStripSeparator toolStripSeparator12; private System.Windows.Forms.ToolStripMenuItem statisticsViewerToolStripMenuItem; private System.Windows.Forms.ToolStripDropDownButton contextChooser; - private System.Windows.Forms.ToolStripMenuItem barhostToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem foohostToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem localContext; } } \ No newline at end of file diff --git a/renderdocui/Windows/MainWindow.cs b/renderdocui/Windows/MainWindow.cs index 02d02efd1..967aa7808 100644 --- a/renderdocui/Windows/MainWindow.cs +++ b/renderdocui/Windows/MainWindow.cs @@ -72,6 +72,8 @@ namespace renderdocui.Windows private string m_InitRemoteHost; private uint m_InitRemoteIdent; + private RemoteHost m_RemoteHost = null; + private List m_LiveCaptures = new List(); private string InformationalVersion @@ -239,7 +241,7 @@ namespace renderdocui.Windows { statusProgress.Visible = false; statusText.Text = ""; - statusIcon.Image = null; + statusIcon.Image = global::renderdocui.Properties.Resources.hourglass; } else { @@ -867,6 +869,120 @@ namespace renderdocui.Windows } } + private void contextChooser_DropDownOpening(object sender, EventArgs e) + { + ToolStripItem[] items = new ToolStripItem[m_Core.Config.RemoteHosts.Count]; + + int idx = 0; + + for(int i=0; i < m_Core.Config.RemoteHosts.Count; i++) + { + RemoteHost host = m_Core.Config.RemoteHosts[i]; + + // add localhost at the end + if (host.Hostname == "localhost") + continue; + + ToolStripItem item = new ToolStripMenuItem(); + + item.Image = host.ServerRunning + ? global::renderdocui.Properties.Resources.tick + : global::renderdocui.Properties.Resources.cross; + item.Text = host.ServerRunning + ? String.Format("{0} (Online)", host.Hostname) + : String.Format("{0} (Offline)", host.Hostname); + item.Click += new EventHandler(switchContext); + item.Tag = host; + + items[idx++] = item; + } + + items[idx] = localContext; + + contextChooser.DropDownItems.Clear(); + contextChooser.DropDownItems.AddRange(items); + } + + private void switchContext(object sender, EventArgs e) + { + if(sender == localContext) + { + contextChooser.Image = global::renderdocui.Properties.Resources.house; + contextChooser.Text = "Replay Context: Local"; + + m_RemoteHost = null; + + statusText.Text = ""; + } + else + { + RemoteHost host = (sender as ToolStripMenuItem).Tag as RemoteHost; + contextChooser.Text = "Replay Context: " + host.Hostname; + contextChooser.Image = host.ServerRunning + ? global::renderdocui.Properties.Resources.connect + : global::renderdocui.Properties.Resources.disconnect; + + // disable until checking is done + contextChooser.Enabled = false; + + m_RemoteHost = host; + + statusText.Text = "Checking remote server status..."; + + Thread th = Helpers.NewThread(new ThreadStart(() => + { + // see if the server is up + try + { + RemoteServer server = StaticExports.CreateRemoteServer(host.Hostname, 0); + server.ShutdownConnection(); + + // if we got this far without an exception, the server is running + host.ServerRunning = true; + } + catch (ApplicationException) + { + } + + if (!host.ServerRunning && host.RunCommand != "") + { + this.BeginInvoke(new Action(() => { statusText.Text = "Running remote server command..."; })); + + host.Launch(); + + // check if it's running now + try + { + RemoteServer server = StaticExports.CreateRemoteServer(host.Hostname, 0); + server.ShutdownConnection(); + + // if we got this far without an exception, the server is running + host.ServerRunning = true; + } + catch (ApplicationException) + { + } + } + + this.BeginInvoke(new Action(() => + { + contextChooser.Image = host.ServerRunning + ? global::renderdocui.Properties.Resources.connect + : global::renderdocui.Properties.Resources.disconnect; + + if (host.ServerRunning) + statusText.Text = "Remote server ready"; + else + statusText.Text = "Remote server not running or failed"; + + contextChooser.Enabled = true; + })); + })); + + th.Start(); + } + } + #endregion #region Menu Handlers diff --git a/renderdocui/renderdocui.csproj b/renderdocui/renderdocui.csproj index 1d5437654..3a92f1fea 100644 --- a/renderdocui/renderdocui.csproj +++ b/renderdocui/renderdocui.csproj @@ -552,6 +552,7 @@ +