diff --git a/mRemoteV1/Resources/Language/Language.Designer.cs b/mRemoteV1/Resources/Language/Language.Designer.cs index cea2e48d4..af6dbb1be 100644 --- a/mRemoteV1/Resources/Language/Language.Designer.cs +++ b/mRemoteV1/Resources/Language/Language.Designer.cs @@ -78,6 +78,15 @@ namespace mRemoteNG { } } + /// + /// Looks up a localized string similar to Clear search string. + /// + internal static string ClearSearchString { + get { + return ResourceManager.GetString("ClearSearchString", resourceCulture); + } + } + /// /// Looks up a localized string similar to Create a New Connection File. /// diff --git a/mRemoteV1/Resources/Language/Language.de.resx b/mRemoteV1/Resources/Language/Language.de.resx index 4373d8d3e..c834cc5d5 100644 --- a/mRemoteV1/Resources/Language/Language.de.resx +++ b/mRemoteV1/Resources/Language/Language.de.resx @@ -2660,6 +2660,9 @@ Development umfasst Alphas, Betas und Release Candidates. Favoriten + + Suchbegriff löschen + Im View-Only-Modus verbinden diff --git a/mRemoteV1/Resources/Language/Language.resx b/mRemoteV1/Resources/Language/Language.resx index c492084a8..dbf400715 100644 --- a/mRemoteV1/Resources/Language/Language.resx +++ b/mRemoteV1/Resources/Language/Language.resx @@ -2775,6 +2775,9 @@ Development Channel includes Alphas, Betas & Release Candidates. Favorites + + Clear search string + Connect in View Only mode diff --git a/mRemoteV1/UI/Controls/Base/NGSearchBox.cs b/mRemoteV1/UI/Controls/Base/NGSearchBox.cs new file mode 100644 index 000000000..2f891023e --- /dev/null +++ b/mRemoteV1/UI/Controls/Base/NGSearchBox.cs @@ -0,0 +1,65 @@ +using System; +using System.Drawing; +using System.Windows.Forms; + +namespace mRemoteNG.UI.Controls.Base +{ + public class NGSearchBox : NGTextBox + { + private PictureBox pbClear = new PictureBox(); + private ToolTip btClearToolTip = new ToolTip(); + + public NGSearchBox() + { + InitializeComponent(); + LostFocus += FocusLost; + GotFocus += FocusGot; + AddClearButton(); + ApplyLanguage(); + } + + private void ApplyLanguage() + { + btClearToolTip.SetToolTip(pbClear, Language.ClearSearchString); + } + + private void AddClearButton() + { + pbClear.Image = Resources.Delete; + pbClear.Width = 20; + pbClear.Dock = DockStyle.Right; + pbClear.Cursor = Cursors.Default; + pbClear.Click += PbClear_Click; + pbClear.LostFocus += FocusLost; + Controls.Add(pbClear); + } + + private void FocusLost(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(Text)) + { + Text = Language.strSearchPrompt; + pbClear.Visible = false; + } + } + + private void FocusGot(object sender, EventArgs e) => Text = ""; + + private void InitializeComponent() + { + this.SuspendLayout(); + // + // NGSearchBox + // + this.TextChanged += new System.EventHandler(this.NGSearchBox_TextChanged); + this.ResumeLayout(false); + } + + private void PbClear_Click(object sender, EventArgs e) => Text = string.Empty; + + private void NGSearchBox_TextChanged(object sender, EventArgs e) + { + pbClear.Visible = Text == Language.strSearchPrompt ? false : TextLength > 0; + } + } +} \ No newline at end of file diff --git a/mRemoteV1/UI/Controls/Base/NGSearchBox.resx b/mRemoteV1/UI/Controls/Base/NGSearchBox.resx new file mode 100644 index 000000000..e5858cc29 --- /dev/null +++ b/mRemoteV1/UI/Controls/Base/NGSearchBox.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/mRemoteV1/UI/Window/ConnectionTreeWindow.Designer.cs b/mRemoteV1/UI/Window/ConnectionTreeWindow.Designer.cs index 821c74960..b1f182998 100644 --- a/mRemoteV1/UI/Window/ConnectionTreeWindow.Designer.cs +++ b/mRemoteV1/UI/Window/ConnectionTreeWindow.Designer.cs @@ -1,4 +1,4 @@ - + using mRemoteNG.Connection; using mRemoteNG.Tree; @@ -29,14 +29,14 @@ namespace mRemoteNG.UI.Window this.mMenViewExpandAllFolders = new System.Windows.Forms.ToolStripMenuItem(); this.mMenViewCollapseAllFolders = new System.Windows.Forms.ToolStripMenuItem(); this.mMenSortAscending = new System.Windows.Forms.ToolStripMenuItem(); - this.vsToolStripExtender = new WeifenLuo.WinFormsUI.Docking.VisualStudioToolStripExtender(this.components); - this.PictureBoxSearch = new mRemoteNG.UI.Controls.Base.NGPictureBox(this.components); - this.txtSearch = new mRemoteNG.UI.Controls.Base.NGTextBox(); - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.mMenFavorites = new System.Windows.Forms.ToolStripMenuItem(); + this.vsToolStripExtender = new WeifenLuo.WinFormsUI.Docking.VisualStudioToolStripExtender(this.components); + this.pbSearch = new mRemoteNG.UI.Controls.Base.NGPictureBox(this.components); + this.txtSearch = new mRemoteNG.UI.Controls.Base.NGSearchBox(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); ((System.ComponentModel.ISupportInitialize)(this.olvConnections)).BeginInit(); this.msMain.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.PictureBoxSearch)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pbSearch)).BeginInit(); this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // @@ -133,21 +133,29 @@ namespace mRemoteNG.UI.Window this.mMenSortAscending.Name = "mMenSortAscending"; this.mMenSortAscending.Size = new System.Drawing.Size(28, 20); // + // mMenFavorites + // + this.mMenFavorites.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.mMenFavorites.Image = global::mRemoteNG.Resources.star; + this.mMenFavorites.Name = "mMenFavorites"; + this.mMenFavorites.Size = new System.Drawing.Size(28, 20); + this.mMenFavorites.Text = "Favorites"; + // // vsToolStripExtender // this.vsToolStripExtender.DefaultRenderer = null; // - // PictureBoxSearch + // pbSearch // - this.PictureBoxSearch.Dock = System.Windows.Forms.DockStyle.Fill; - this.PictureBoxSearch.Image = global::mRemoteNG.Resources.Search; - this.PictureBoxSearch.Location = new System.Drawing.Point(0, 0); - this.PictureBoxSearch.Margin = new System.Windows.Forms.Padding(0); - this.PictureBoxSearch.Name = "PictureBoxSearch"; - this.PictureBoxSearch.Size = new System.Drawing.Size(26, 21); - this.PictureBoxSearch.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; - this.PictureBoxSearch.TabIndex = 1; - this.PictureBoxSearch.TabStop = false; + this.pbSearch.Dock = System.Windows.Forms.DockStyle.Fill; + this.pbSearch.Image = global::mRemoteNG.Resources.Search; + this.pbSearch.Location = new System.Drawing.Point(0, 0); + this.pbSearch.Margin = new System.Windows.Forms.Padding(0); + this.pbSearch.Name = "pbSearch"; + this.pbSearch.Size = new System.Drawing.Size(26, 21); + this.pbSearch.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.pbSearch.TabIndex = 1; + this.pbSearch.TabStop = false; // // txtSearch // @@ -163,9 +171,7 @@ namespace mRemoteNG.UI.Window this.txtSearch.TabStop = false; this.txtSearch.Text = "Search"; this.txtSearch.TextChanged += new System.EventHandler(this.txtSearch_TextChanged); - this.txtSearch.GotFocus += new System.EventHandler(this.txtSearch_GotFocus); this.txtSearch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtSearch_KeyDown); - this.txtSearch.LostFocus += new System.EventHandler(this.txtSearch_LostFocus); // // tableLayoutPanel1 // @@ -173,7 +179,7 @@ namespace mRemoteNG.UI.Window this.tableLayoutPanel1.ColumnCount = 2; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 26F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.Controls.Add(this.PictureBoxSearch, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.pbSearch, 0, 0); this.tableLayoutPanel1.Controls.Add(this.txtSearch); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 390); @@ -183,14 +189,6 @@ namespace mRemoteNG.UI.Window this.tableLayoutPanel1.Size = new System.Drawing.Size(204, 21); this.tableLayoutPanel1.TabIndex = 32; // - // mMenFavorites - // - this.mMenFavorites.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.mMenFavorites.Image = global::mRemoteNG.Resources.star; - this.mMenFavorites.Name = "mMenFavorites"; - this.mMenFavorites.Size = new System.Drawing.Size(28, 20); - this.mMenFavorites.Text = "Favorites"; - // // ConnectionTreeWindow // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); @@ -209,7 +207,7 @@ namespace mRemoteNG.UI.Window ((System.ComponentModel.ISupportInitialize)(this.olvConnections)).EndInit(); this.msMain.ResumeLayout(false); this.msMain.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.PictureBoxSearch)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pbSearch)).EndInit(); this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.PerformLayout(); this.ResumeLayout(false); @@ -221,8 +219,8 @@ namespace mRemoteNG.UI.Window private System.ComponentModel.IContainer components; private Controls.ConnectionTree olvConnections; private WeifenLuo.WinFormsUI.Docking.VisualStudioToolStripExtender vsToolStripExtender; - internal Controls.Base.NGPictureBox PictureBoxSearch; - internal Controls.Base.NGTextBox txtSearch; + internal Controls.Base.NGPictureBox pbSearch; + internal Controls.Base.NGSearchBox txtSearch; public System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; internal System.Windows.Forms.ToolStripMenuItem mMenFavorites; } diff --git a/mRemoteV1/UI/Window/ConnectionTreeWindow.cs b/mRemoteV1/UI/Window/ConnectionTreeWindow.cs index b3723d319..3f2cd103b 100644 --- a/mRemoteV1/UI/Window/ConnectionTreeWindow.cs +++ b/mRemoteV1/UI/Window/ConnectionTreeWindow.cs @@ -103,7 +103,7 @@ namespace mRemoteNG.UI.Window _themeManager.ActiveTheme.Theme); if (!_themeManager.ActiveAndExtended) return; - //Treelistview need to be manually themed + //Treelistview needs to be manually themed olvConnections.BackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TreeView_Background"); olvConnections.ForeColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TreeView_Foreground"); olvConnections.SelectedBackColor = @@ -117,6 +117,8 @@ namespace mRemoteNG.UI.Window //There is a border around txtSearch that dont theme well txtSearch.BackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TextBox_Background"); txtSearch.ForeColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TextBox_Foreground"); + //Picturebox needs to be manually themed + pbSearch.BackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TreeView_Background"); } #endregion @@ -252,18 +254,6 @@ namespace mRemoteNG.UI.Window #region Search - private void txtSearch_GotFocus(object sender, EventArgs e) - { - if (txtSearch.Text == Language.strSearchPrompt) - txtSearch.Text = ""; - } - - private void txtSearch_LostFocus(object sender, EventArgs e) - { - if (txtSearch.Text != "") return; - txtSearch.Text = Language.strSearchPrompt; - } - private void txtSearch_KeyDown(object sender, KeyEventArgs e) { try @@ -295,9 +285,7 @@ namespace mRemoteNG.UI.Window } catch (Exception ex) { - Runtime.MessageCollector.AddExceptionStackTrace( - "txtSearch_KeyDown (UI.Window.ConnectionTreeWindow) failed", - ex); + Runtime.MessageCollector.AddExceptionStackTrace("txtSearch_KeyDown (UI.Window.ConnectionTreeWindow) failed", ex); } } @@ -360,9 +348,7 @@ namespace mRemoteNG.UI.Window } catch (Exception ex) { - Runtime.MessageCollector.AddExceptionStackTrace( - "tvConnections_KeyPress (UI.Window.ConnectionTreeWindow) failed", - ex); + Runtime.MessageCollector.AddExceptionStackTrace("tvConnections_KeyPress (UI.Window.ConnectionTreeWindow) failed", ex); } } @@ -384,9 +370,7 @@ namespace mRemoteNG.UI.Window } catch (Exception ex) { - Runtime.MessageCollector.AddExceptionStackTrace( - "tvConnections_KeyDown (UI.Window.ConnectionTreeWindow) failed", - ex); + Runtime.MessageCollector.AddExceptionStackTrace("tvConnections_KeyDown (UI.Window.ConnectionTreeWindow) failed", ex); } } diff --git a/mRemoteV1/mRemoteV1.csproj b/mRemoteV1/mRemoteV1.csproj index d3fb115cf..90515366b 100644 --- a/mRemoteV1/mRemoteV1.csproj +++ b/mRemoteV1/mRemoteV1.csproj @@ -406,6 +406,9 @@ Component + + Component + Component @@ -846,6 +849,9 @@ NGRadioButton.cs + + NGSearchBox.cs + NGTextBox.cs