diff --git a/AutoTypeSearch/AutoTypeSearch.csproj b/AutoTypeSearch/AutoTypeSearch.csproj index c55c5b8..6145b08 100755 --- a/AutoTypeSearch/AutoTypeSearch.csproj +++ b/AutoTypeSearch/AutoTypeSearch.csproj @@ -82,6 +82,9 @@ SearchWindow.cs + + Component + diff --git a/AutoTypeSearch/AutoTypeSearch.csproj b/AutoTypeSearch/AutoTypeSearch.csproj index c55c5b8..6145b08 100755 --- a/AutoTypeSearch/AutoTypeSearch.csproj +++ b/AutoTypeSearch/AutoTypeSearch.csproj @@ -82,6 +82,9 @@ SearchWindow.cs + + Component + diff --git a/AutoTypeSearch/SearchWindow.Designer.cs b/AutoTypeSearch/SearchWindow.Designer.cs index 18b37d1..8b28309 100755 --- a/AutoTypeSearch/SearchWindow.Designer.cs +++ b/AutoTypeSearch/SearchWindow.Designer.cs @@ -28,6 +28,7 @@ this.mThrobber = new System.Windows.Forms.PictureBox(); this.mResultsUpdater = new System.Windows.Forms.Timer(this.components); this.mNoResultsLabel = new System.Windows.Forms.Label(); + this.mSeq = new AutoTypeSearch.WatermarkTextBox(); this.mLayout.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.mBanner)).BeginInit(); this.mInfoBanner.SuspendLayout(); @@ -38,11 +39,11 @@ // mSearch // this.mSearch.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.mSearch.Location = new System.Drawing.Point(1, 78); - this.mSearch.Margin = new System.Windows.Forms.Padding(1, 0, 1, 0); + | System.Windows.Forms.AnchorStyles.Right))); + this.mSearch.Location = new System.Drawing.Point(2, 121); + this.mSearch.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.mSearch.Name = "mSearch"; - this.mSearch.Size = new System.Drawing.Size(521, 20); + this.mSearch.Size = new System.Drawing.Size(780, 26); this.mSearch.TabIndex = 0; this.mSearch.LocationChanged += new System.EventHandler(this.mSearch_LocationChanged); this.mSearch.TextChanged += new System.EventHandler(this.mSearch_TextChanged); @@ -54,10 +55,10 @@ this.mResults.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; this.mResults.FormattingEnabled = true; this.mResults.IntegralHeight = false; - this.mResults.Location = new System.Drawing.Point(0, 98); + this.mResults.Location = new System.Drawing.Point(0, 173); this.mResults.Margin = new System.Windows.Forms.Padding(0); this.mResults.Name = "mResults"; - this.mResults.Size = new System.Drawing.Size(523, 176); + this.mResults.Size = new System.Drawing.Size(784, 249); this.mResults.TabIndex = 1; this.mResults.TabStop = false; this.mResults.MouseClick += new System.Windows.Forms.MouseEventHandler(this.mResults_MouseClick); @@ -70,20 +71,22 @@ // this.mLayout.ColumnCount = 1; this.mLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.mLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.mLayout.Controls.Add(this.mSearch, 0, 2); - this.mLayout.Controls.Add(this.mResults, 0, 3); this.mLayout.Controls.Add(this.mBanner, 0, 0); this.mLayout.Controls.Add(this.mInfoBanner, 0, 1); + this.mLayout.Controls.Add(this.mResults, 0, 4); + this.mLayout.Controls.Add(this.mSeq, 0, 3); this.mLayout.Dock = System.Windows.Forms.DockStyle.Fill; this.mLayout.Location = new System.Drawing.Point(0, 0); + this.mLayout.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.mLayout.Name = "mLayout"; - this.mLayout.RowCount = 4; + this.mLayout.RowCount = 5; + this.mLayout.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.mLayout.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.mLayout.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.mLayout.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.mLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.mLayout.Size = new System.Drawing.Size(523, 274); + this.mLayout.Size = new System.Drawing.Size(784, 422); this.mLayout.TabIndex = 2; // // mBanner @@ -92,7 +95,7 @@ this.mBanner.Location = new System.Drawing.Point(0, 0); this.mBanner.Margin = new System.Windows.Forms.Padding(0); this.mBanner.Name = "mBanner"; - this.mBanner.Size = new System.Drawing.Size(523, 60); + this.mBanner.Size = new System.Drawing.Size(784, 92); this.mBanner.TabIndex = 3; this.mBanner.TabStop = false; this.mBanner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.mBannerImage_MouseDown); @@ -104,10 +107,10 @@ this.mInfoBanner.Controls.Add(this.mInfoLabel); this.mInfoBanner.Controls.Add(this.mInfoBannerImage); this.mInfoBanner.Dock = System.Windows.Forms.DockStyle.Fill; - this.mInfoBanner.Location = new System.Drawing.Point(2, 61); - this.mInfoBanner.Margin = new System.Windows.Forms.Padding(2, 1, 1, 1); + this.mInfoBanner.Location = new System.Drawing.Point(3, 94); + this.mInfoBanner.Margin = new System.Windows.Forms.Padding(3, 2, 2, 2); this.mInfoBanner.Name = "mInfoBanner"; - this.mInfoBanner.Size = new System.Drawing.Size(520, 16); + this.mInfoBanner.Size = new System.Drawing.Size(779, 25); this.mInfoBanner.TabIndex = 8; // // mInfoLabel @@ -115,9 +118,10 @@ this.mInfoLabel.AutoEllipsis = true; this.mInfoLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.mInfoLabel.ForeColor = System.Drawing.SystemColors.InfoText; - this.mInfoLabel.Location = new System.Drawing.Point(16, 0); + this.mInfoLabel.Location = new System.Drawing.Point(24, 0); + this.mInfoLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.mInfoLabel.Name = "mInfoLabel"; - this.mInfoLabel.Size = new System.Drawing.Size(504, 16); + this.mInfoLabel.Size = new System.Drawing.Size(755, 25); this.mInfoLabel.TabIndex = 6; this.mInfoLabel.Text = "AutoType failed to find"; // @@ -128,7 +132,7 @@ this.mInfoBannerImage.Location = new System.Drawing.Point(0, 0); this.mInfoBannerImage.Margin = new System.Windows.Forms.Padding(0); this.mInfoBannerImage.Name = "mInfoBannerImage"; - this.mInfoBannerImage.Size = new System.Drawing.Size(16, 16); + this.mInfoBannerImage.Size = new System.Drawing.Size(24, 25); this.mInfoBannerImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.mInfoBannerImage.TabIndex = 7; this.mInfoBannerImage.TabStop = false; @@ -137,9 +141,10 @@ // this.mThrobber.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.mThrobber.BackColor = System.Drawing.SystemColors.Window; - this.mThrobber.Location = new System.Drawing.Point(503, 81); + this.mThrobber.Location = new System.Drawing.Point(754, 125); + this.mThrobber.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.mThrobber.Name = "mThrobber"; - this.mThrobber.Size = new System.Drawing.Size(16, 16); + this.mThrobber.Size = new System.Drawing.Size(24, 25); this.mThrobber.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.mThrobber.TabIndex = 4; this.mThrobber.TabStop = false; @@ -153,23 +158,38 @@ // mNoResultsLabel // this.mNoResultsLabel.AutoSize = true; - this.mNoResultsLabel.Location = new System.Drawing.Point(5, 103); + this.mNoResultsLabel.Location = new System.Drawing.Point(8, 183); + this.mNoResultsLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.mNoResultsLabel.Name = "mNoResultsLabel"; - this.mNoResultsLabel.Size = new System.Drawing.Size(84, 13); + this.mNoResultsLabel.Size = new System.Drawing.Size(125, 20); this.mNoResultsLabel.TabIndex = 5; this.mNoResultsLabel.Text = "No results found"; // + // mSeqBox + // + this.mSeq.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.mSeq.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F); + this.mSeq.Location = new System.Drawing.Point(2, 147); + this.mSeq.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.mSeq.Name = "mSeqBox"; + this.mSeq.Size = new System.Drawing.Size(780, 26); + this.mSeq.TabIndex = 9; + this.mSeq.WaterMarkColor = System.Drawing.Color.Gray; + this.mSeq.WaterMarkText = "Set Custom Sequence Here"; + // // SearchWindow // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.Window; - this.ClientSize = new System.Drawing.Size(523, 274); + this.ClientSize = new System.Drawing.Size(784, 422); this.ControlBox = false; this.Controls.Add(this.mNoResultsLabel); this.Controls.Add(this.mThrobber); this.Controls.Add(this.mLayout); - this.MinimumSize = new System.Drawing.Size(160, 96); + this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.MinimumSize = new System.Drawing.Size(229, 136); this.Name = "SearchWindow"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; @@ -197,5 +217,6 @@ private Label mInfoLabel; private Panel mInfoBanner; private PictureBox mInfoBannerImage; + private WatermarkTextBox mSeq; } } \ No newline at end of file diff --git a/AutoTypeSearch/AutoTypeSearch.csproj b/AutoTypeSearch/AutoTypeSearch.csproj index c55c5b8..6145b08 100755 --- a/AutoTypeSearch/AutoTypeSearch.csproj +++ b/AutoTypeSearch/AutoTypeSearch.csproj @@ -82,6 +82,9 @@ SearchWindow.cs + + Component + diff --git a/AutoTypeSearch/SearchWindow.Designer.cs b/AutoTypeSearch/SearchWindow.Designer.cs index 18b37d1..8b28309 100755 --- a/AutoTypeSearch/SearchWindow.Designer.cs +++ b/AutoTypeSearch/SearchWindow.Designer.cs @@ -28,6 +28,7 @@ this.mThrobber = new System.Windows.Forms.PictureBox(); this.mResultsUpdater = new System.Windows.Forms.Timer(this.components); this.mNoResultsLabel = new System.Windows.Forms.Label(); + this.mSeq = new AutoTypeSearch.WatermarkTextBox(); this.mLayout.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.mBanner)).BeginInit(); this.mInfoBanner.SuspendLayout(); @@ -38,11 +39,11 @@ // mSearch // this.mSearch.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.mSearch.Location = new System.Drawing.Point(1, 78); - this.mSearch.Margin = new System.Windows.Forms.Padding(1, 0, 1, 0); + | System.Windows.Forms.AnchorStyles.Right))); + this.mSearch.Location = new System.Drawing.Point(2, 121); + this.mSearch.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.mSearch.Name = "mSearch"; - this.mSearch.Size = new System.Drawing.Size(521, 20); + this.mSearch.Size = new System.Drawing.Size(780, 26); this.mSearch.TabIndex = 0; this.mSearch.LocationChanged += new System.EventHandler(this.mSearch_LocationChanged); this.mSearch.TextChanged += new System.EventHandler(this.mSearch_TextChanged); @@ -54,10 +55,10 @@ this.mResults.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; this.mResults.FormattingEnabled = true; this.mResults.IntegralHeight = false; - this.mResults.Location = new System.Drawing.Point(0, 98); + this.mResults.Location = new System.Drawing.Point(0, 173); this.mResults.Margin = new System.Windows.Forms.Padding(0); this.mResults.Name = "mResults"; - this.mResults.Size = new System.Drawing.Size(523, 176); + this.mResults.Size = new System.Drawing.Size(784, 249); this.mResults.TabIndex = 1; this.mResults.TabStop = false; this.mResults.MouseClick += new System.Windows.Forms.MouseEventHandler(this.mResults_MouseClick); @@ -70,20 +71,22 @@ // this.mLayout.ColumnCount = 1; this.mLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.mLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.mLayout.Controls.Add(this.mSearch, 0, 2); - this.mLayout.Controls.Add(this.mResults, 0, 3); this.mLayout.Controls.Add(this.mBanner, 0, 0); this.mLayout.Controls.Add(this.mInfoBanner, 0, 1); + this.mLayout.Controls.Add(this.mResults, 0, 4); + this.mLayout.Controls.Add(this.mSeq, 0, 3); this.mLayout.Dock = System.Windows.Forms.DockStyle.Fill; this.mLayout.Location = new System.Drawing.Point(0, 0); + this.mLayout.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.mLayout.Name = "mLayout"; - this.mLayout.RowCount = 4; + this.mLayout.RowCount = 5; + this.mLayout.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.mLayout.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.mLayout.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.mLayout.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.mLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.mLayout.Size = new System.Drawing.Size(523, 274); + this.mLayout.Size = new System.Drawing.Size(784, 422); this.mLayout.TabIndex = 2; // // mBanner @@ -92,7 +95,7 @@ this.mBanner.Location = new System.Drawing.Point(0, 0); this.mBanner.Margin = new System.Windows.Forms.Padding(0); this.mBanner.Name = "mBanner"; - this.mBanner.Size = new System.Drawing.Size(523, 60); + this.mBanner.Size = new System.Drawing.Size(784, 92); this.mBanner.TabIndex = 3; this.mBanner.TabStop = false; this.mBanner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.mBannerImage_MouseDown); @@ -104,10 +107,10 @@ this.mInfoBanner.Controls.Add(this.mInfoLabel); this.mInfoBanner.Controls.Add(this.mInfoBannerImage); this.mInfoBanner.Dock = System.Windows.Forms.DockStyle.Fill; - this.mInfoBanner.Location = new System.Drawing.Point(2, 61); - this.mInfoBanner.Margin = new System.Windows.Forms.Padding(2, 1, 1, 1); + this.mInfoBanner.Location = new System.Drawing.Point(3, 94); + this.mInfoBanner.Margin = new System.Windows.Forms.Padding(3, 2, 2, 2); this.mInfoBanner.Name = "mInfoBanner"; - this.mInfoBanner.Size = new System.Drawing.Size(520, 16); + this.mInfoBanner.Size = new System.Drawing.Size(779, 25); this.mInfoBanner.TabIndex = 8; // // mInfoLabel @@ -115,9 +118,10 @@ this.mInfoLabel.AutoEllipsis = true; this.mInfoLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.mInfoLabel.ForeColor = System.Drawing.SystemColors.InfoText; - this.mInfoLabel.Location = new System.Drawing.Point(16, 0); + this.mInfoLabel.Location = new System.Drawing.Point(24, 0); + this.mInfoLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.mInfoLabel.Name = "mInfoLabel"; - this.mInfoLabel.Size = new System.Drawing.Size(504, 16); + this.mInfoLabel.Size = new System.Drawing.Size(755, 25); this.mInfoLabel.TabIndex = 6; this.mInfoLabel.Text = "AutoType failed to find"; // @@ -128,7 +132,7 @@ this.mInfoBannerImage.Location = new System.Drawing.Point(0, 0); this.mInfoBannerImage.Margin = new System.Windows.Forms.Padding(0); this.mInfoBannerImage.Name = "mInfoBannerImage"; - this.mInfoBannerImage.Size = new System.Drawing.Size(16, 16); + this.mInfoBannerImage.Size = new System.Drawing.Size(24, 25); this.mInfoBannerImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.mInfoBannerImage.TabIndex = 7; this.mInfoBannerImage.TabStop = false; @@ -137,9 +141,10 @@ // this.mThrobber.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.mThrobber.BackColor = System.Drawing.SystemColors.Window; - this.mThrobber.Location = new System.Drawing.Point(503, 81); + this.mThrobber.Location = new System.Drawing.Point(754, 125); + this.mThrobber.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.mThrobber.Name = "mThrobber"; - this.mThrobber.Size = new System.Drawing.Size(16, 16); + this.mThrobber.Size = new System.Drawing.Size(24, 25); this.mThrobber.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.mThrobber.TabIndex = 4; this.mThrobber.TabStop = false; @@ -153,23 +158,38 @@ // mNoResultsLabel // this.mNoResultsLabel.AutoSize = true; - this.mNoResultsLabel.Location = new System.Drawing.Point(5, 103); + this.mNoResultsLabel.Location = new System.Drawing.Point(8, 183); + this.mNoResultsLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.mNoResultsLabel.Name = "mNoResultsLabel"; - this.mNoResultsLabel.Size = new System.Drawing.Size(84, 13); + this.mNoResultsLabel.Size = new System.Drawing.Size(125, 20); this.mNoResultsLabel.TabIndex = 5; this.mNoResultsLabel.Text = "No results found"; // + // mSeqBox + // + this.mSeq.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.mSeq.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F); + this.mSeq.Location = new System.Drawing.Point(2, 147); + this.mSeq.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.mSeq.Name = "mSeqBox"; + this.mSeq.Size = new System.Drawing.Size(780, 26); + this.mSeq.TabIndex = 9; + this.mSeq.WaterMarkColor = System.Drawing.Color.Gray; + this.mSeq.WaterMarkText = "Set Custom Sequence Here"; + // // SearchWindow // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.Window; - this.ClientSize = new System.Drawing.Size(523, 274); + this.ClientSize = new System.Drawing.Size(784, 422); this.ControlBox = false; this.Controls.Add(this.mNoResultsLabel); this.Controls.Add(this.mThrobber); this.Controls.Add(this.mLayout); - this.MinimumSize = new System.Drawing.Size(160, 96); + this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.MinimumSize = new System.Drawing.Size(229, 136); this.Name = "SearchWindow"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; @@ -197,5 +217,6 @@ private Label mInfoLabel; private Panel mInfoBanner; private PictureBox mInfoBannerImage; + private WatermarkTextBox mSeq; } } \ No newline at end of file diff --git a/AutoTypeSearch/SearchWindow.cs b/AutoTypeSearch/SearchWindow.cs index 363b898..d7f53bd 100755 --- a/AutoTypeSearch/SearchWindow.cs +++ b/AutoTypeSearch/SearchWindow.cs @@ -107,7 +107,7 @@ var windowRect = Settings.Default.WindowPosition; var collapsedWindowRect = windowRect; - collapsedWindowRect.Height = mSearch.Bottom + (Height - ClientSize.Height); + collapsedWindowRect.Height = mSeq.Bottom + (Height - ClientSize.Height); MinimumSize = new Size(MinimumSize.Width, collapsedWindowRect.Height); @@ -811,6 +811,8 @@ private void PerformAction(Actions action, SearchResult searchResult) { + string seq = mSeq.Text.Length == 0 ? null : mSeq.Text; + Close(); if (searchResult != null) @@ -818,7 +820,7 @@ switch (action) { case Actions.PerformAutoType: - AutoTypeEntry(searchResult); + AutoTypeEntry(searchResult, seq); break; case Actions.EditEntry: EditEntry(searchResult); @@ -838,16 +840,17 @@ } } - private void AutoTypeEntry(SearchResult searchResult) + + private void AutoTypeEntry(SearchResult searchResult, string seq) { bool result; if (ActiveForm != null) { - result = AutoType.PerformIntoPreviousWindow(mMainForm, searchResult.Entry, searchResult.Database); + result = AutoType.PerformIntoPreviousWindow(mMainForm, searchResult.Entry, searchResult.Database, seq); } else { - result = AutoType.PerformIntoCurrentWindow(searchResult.Entry, searchResult.Database); + result = AutoType.PerformIntoCurrentWindow(searchResult.Entry, searchResult.Database, seq); } if (!result) { diff --git a/AutoTypeSearch/AutoTypeSearch.csproj b/AutoTypeSearch/AutoTypeSearch.csproj index c55c5b8..6145b08 100755 --- a/AutoTypeSearch/AutoTypeSearch.csproj +++ b/AutoTypeSearch/AutoTypeSearch.csproj @@ -82,6 +82,9 @@ SearchWindow.cs + + Component + diff --git a/AutoTypeSearch/SearchWindow.Designer.cs b/AutoTypeSearch/SearchWindow.Designer.cs index 18b37d1..8b28309 100755 --- a/AutoTypeSearch/SearchWindow.Designer.cs +++ b/AutoTypeSearch/SearchWindow.Designer.cs @@ -28,6 +28,7 @@ this.mThrobber = new System.Windows.Forms.PictureBox(); this.mResultsUpdater = new System.Windows.Forms.Timer(this.components); this.mNoResultsLabel = new System.Windows.Forms.Label(); + this.mSeq = new AutoTypeSearch.WatermarkTextBox(); this.mLayout.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.mBanner)).BeginInit(); this.mInfoBanner.SuspendLayout(); @@ -38,11 +39,11 @@ // mSearch // this.mSearch.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.mSearch.Location = new System.Drawing.Point(1, 78); - this.mSearch.Margin = new System.Windows.Forms.Padding(1, 0, 1, 0); + | System.Windows.Forms.AnchorStyles.Right))); + this.mSearch.Location = new System.Drawing.Point(2, 121); + this.mSearch.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.mSearch.Name = "mSearch"; - this.mSearch.Size = new System.Drawing.Size(521, 20); + this.mSearch.Size = new System.Drawing.Size(780, 26); this.mSearch.TabIndex = 0; this.mSearch.LocationChanged += new System.EventHandler(this.mSearch_LocationChanged); this.mSearch.TextChanged += new System.EventHandler(this.mSearch_TextChanged); @@ -54,10 +55,10 @@ this.mResults.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; this.mResults.FormattingEnabled = true; this.mResults.IntegralHeight = false; - this.mResults.Location = new System.Drawing.Point(0, 98); + this.mResults.Location = new System.Drawing.Point(0, 173); this.mResults.Margin = new System.Windows.Forms.Padding(0); this.mResults.Name = "mResults"; - this.mResults.Size = new System.Drawing.Size(523, 176); + this.mResults.Size = new System.Drawing.Size(784, 249); this.mResults.TabIndex = 1; this.mResults.TabStop = false; this.mResults.MouseClick += new System.Windows.Forms.MouseEventHandler(this.mResults_MouseClick); @@ -70,20 +71,22 @@ // this.mLayout.ColumnCount = 1; this.mLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.mLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.mLayout.Controls.Add(this.mSearch, 0, 2); - this.mLayout.Controls.Add(this.mResults, 0, 3); this.mLayout.Controls.Add(this.mBanner, 0, 0); this.mLayout.Controls.Add(this.mInfoBanner, 0, 1); + this.mLayout.Controls.Add(this.mResults, 0, 4); + this.mLayout.Controls.Add(this.mSeq, 0, 3); this.mLayout.Dock = System.Windows.Forms.DockStyle.Fill; this.mLayout.Location = new System.Drawing.Point(0, 0); + this.mLayout.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.mLayout.Name = "mLayout"; - this.mLayout.RowCount = 4; + this.mLayout.RowCount = 5; + this.mLayout.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.mLayout.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.mLayout.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.mLayout.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.mLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.mLayout.Size = new System.Drawing.Size(523, 274); + this.mLayout.Size = new System.Drawing.Size(784, 422); this.mLayout.TabIndex = 2; // // mBanner @@ -92,7 +95,7 @@ this.mBanner.Location = new System.Drawing.Point(0, 0); this.mBanner.Margin = new System.Windows.Forms.Padding(0); this.mBanner.Name = "mBanner"; - this.mBanner.Size = new System.Drawing.Size(523, 60); + this.mBanner.Size = new System.Drawing.Size(784, 92); this.mBanner.TabIndex = 3; this.mBanner.TabStop = false; this.mBanner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.mBannerImage_MouseDown); @@ -104,10 +107,10 @@ this.mInfoBanner.Controls.Add(this.mInfoLabel); this.mInfoBanner.Controls.Add(this.mInfoBannerImage); this.mInfoBanner.Dock = System.Windows.Forms.DockStyle.Fill; - this.mInfoBanner.Location = new System.Drawing.Point(2, 61); - this.mInfoBanner.Margin = new System.Windows.Forms.Padding(2, 1, 1, 1); + this.mInfoBanner.Location = new System.Drawing.Point(3, 94); + this.mInfoBanner.Margin = new System.Windows.Forms.Padding(3, 2, 2, 2); this.mInfoBanner.Name = "mInfoBanner"; - this.mInfoBanner.Size = new System.Drawing.Size(520, 16); + this.mInfoBanner.Size = new System.Drawing.Size(779, 25); this.mInfoBanner.TabIndex = 8; // // mInfoLabel @@ -115,9 +118,10 @@ this.mInfoLabel.AutoEllipsis = true; this.mInfoLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.mInfoLabel.ForeColor = System.Drawing.SystemColors.InfoText; - this.mInfoLabel.Location = new System.Drawing.Point(16, 0); + this.mInfoLabel.Location = new System.Drawing.Point(24, 0); + this.mInfoLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.mInfoLabel.Name = "mInfoLabel"; - this.mInfoLabel.Size = new System.Drawing.Size(504, 16); + this.mInfoLabel.Size = new System.Drawing.Size(755, 25); this.mInfoLabel.TabIndex = 6; this.mInfoLabel.Text = "AutoType failed to find"; // @@ -128,7 +132,7 @@ this.mInfoBannerImage.Location = new System.Drawing.Point(0, 0); this.mInfoBannerImage.Margin = new System.Windows.Forms.Padding(0); this.mInfoBannerImage.Name = "mInfoBannerImage"; - this.mInfoBannerImage.Size = new System.Drawing.Size(16, 16); + this.mInfoBannerImage.Size = new System.Drawing.Size(24, 25); this.mInfoBannerImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.mInfoBannerImage.TabIndex = 7; this.mInfoBannerImage.TabStop = false; @@ -137,9 +141,10 @@ // this.mThrobber.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.mThrobber.BackColor = System.Drawing.SystemColors.Window; - this.mThrobber.Location = new System.Drawing.Point(503, 81); + this.mThrobber.Location = new System.Drawing.Point(754, 125); + this.mThrobber.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.mThrobber.Name = "mThrobber"; - this.mThrobber.Size = new System.Drawing.Size(16, 16); + this.mThrobber.Size = new System.Drawing.Size(24, 25); this.mThrobber.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.mThrobber.TabIndex = 4; this.mThrobber.TabStop = false; @@ -153,23 +158,38 @@ // mNoResultsLabel // this.mNoResultsLabel.AutoSize = true; - this.mNoResultsLabel.Location = new System.Drawing.Point(5, 103); + this.mNoResultsLabel.Location = new System.Drawing.Point(8, 183); + this.mNoResultsLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.mNoResultsLabel.Name = "mNoResultsLabel"; - this.mNoResultsLabel.Size = new System.Drawing.Size(84, 13); + this.mNoResultsLabel.Size = new System.Drawing.Size(125, 20); this.mNoResultsLabel.TabIndex = 5; this.mNoResultsLabel.Text = "No results found"; // + // mSeqBox + // + this.mSeq.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.mSeq.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F); + this.mSeq.Location = new System.Drawing.Point(2, 147); + this.mSeq.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.mSeq.Name = "mSeqBox"; + this.mSeq.Size = new System.Drawing.Size(780, 26); + this.mSeq.TabIndex = 9; + this.mSeq.WaterMarkColor = System.Drawing.Color.Gray; + this.mSeq.WaterMarkText = "Set Custom Sequence Here"; + // // SearchWindow // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.Window; - this.ClientSize = new System.Drawing.Size(523, 274); + this.ClientSize = new System.Drawing.Size(784, 422); this.ControlBox = false; this.Controls.Add(this.mNoResultsLabel); this.Controls.Add(this.mThrobber); this.Controls.Add(this.mLayout); - this.MinimumSize = new System.Drawing.Size(160, 96); + this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.MinimumSize = new System.Drawing.Size(229, 136); this.Name = "SearchWindow"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; @@ -197,5 +217,6 @@ private Label mInfoLabel; private Panel mInfoBanner; private PictureBox mInfoBannerImage; + private WatermarkTextBox mSeq; } } \ No newline at end of file diff --git a/AutoTypeSearch/SearchWindow.cs b/AutoTypeSearch/SearchWindow.cs index 363b898..d7f53bd 100755 --- a/AutoTypeSearch/SearchWindow.cs +++ b/AutoTypeSearch/SearchWindow.cs @@ -107,7 +107,7 @@ var windowRect = Settings.Default.WindowPosition; var collapsedWindowRect = windowRect; - collapsedWindowRect.Height = mSearch.Bottom + (Height - ClientSize.Height); + collapsedWindowRect.Height = mSeq.Bottom + (Height - ClientSize.Height); MinimumSize = new Size(MinimumSize.Width, collapsedWindowRect.Height); @@ -811,6 +811,8 @@ private void PerformAction(Actions action, SearchResult searchResult) { + string seq = mSeq.Text.Length == 0 ? null : mSeq.Text; + Close(); if (searchResult != null) @@ -818,7 +820,7 @@ switch (action) { case Actions.PerformAutoType: - AutoTypeEntry(searchResult); + AutoTypeEntry(searchResult, seq); break; case Actions.EditEntry: EditEntry(searchResult); @@ -838,16 +840,17 @@ } } - private void AutoTypeEntry(SearchResult searchResult) + + private void AutoTypeEntry(SearchResult searchResult, string seq) { bool result; if (ActiveForm != null) { - result = AutoType.PerformIntoPreviousWindow(mMainForm, searchResult.Entry, searchResult.Database); + result = AutoType.PerformIntoPreviousWindow(mMainForm, searchResult.Entry, searchResult.Database, seq); } else { - result = AutoType.PerformIntoCurrentWindow(searchResult.Entry, searchResult.Database); + result = AutoType.PerformIntoCurrentWindow(searchResult.Entry, searchResult.Database, seq); } if (!result) { diff --git a/AutoTypeSearch/WatermarkTextBox.cs b/AutoTypeSearch/WatermarkTextBox.cs new file mode 100755 index 0000000..d768633 --- /dev/null +++ b/AutoTypeSearch/WatermarkTextBox.cs @@ -0,0 +1,126 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace AutoTypeSearch +{ + // https://www.codeproject.com/Articles/27849/WaterMark-TextBox-For-Desktop-Applications-Using-C + + class WatermarkTextBox : TextBox + { + private Font oldFont = null; + private Boolean waterMarkTextEnabled = false; + + #region Attributes + private Color _waterMarkColor = Color.Gray; + public Color WaterMarkColor + { + get { return _waterMarkColor; } + set + { + _waterMarkColor = value; Invalidate();/*thanks to Bernhard Elbl + for Invalidate()*/ + } + } + + private string _waterMarkText = "Water Mark"; + public string WaterMarkText + { + get { return _waterMarkText; } + set { _waterMarkText = value; Invalidate(); } + } + #endregion + + //Default constructor + public WatermarkTextBox() + { + JoinEvents(true); + } + + //Override OnCreateControl ... thanks to "lpgray .. codeproject guy" + protected override void OnCreateControl() + { + base.OnCreateControl(); + WaterMark_Toggel(null, null); + } + + //Override OnPaint + protected override void OnPaint(PaintEventArgs args) + { + // Use the same font that was defined in base class + System.Drawing.Font drawFont = new System.Drawing.Font(Font.FontFamily, + Font.Size, Font.Style, Font.Unit); + //Create new brush with gray color or + SolidBrush drawBrush = new SolidBrush(WaterMarkColor);//use Water mark color + //Draw Text or WaterMark + args.Graphics.DrawString((waterMarkTextEnabled ? WaterMarkText : Text), + drawFont, drawBrush, new PointF(0.0F, 0.0F)); + base.OnPaint(args); + } + + private void JoinEvents(Boolean join) + { + if (join) + { + this.TextChanged += new System.EventHandler(this.WaterMark_Toggel); + this.LostFocus += new System.EventHandler(this.WaterMark_Toggel); + this.FontChanged += new System.EventHandler(this.WaterMark_FontChanged); + //No one of the above events will start immeddiatlly + //TextBox control still in constructing, so, + //Font object (for example) couldn't be catched from within + //WaterMark_Toggle + //So, call WaterMark_Toggel through OnCreateControl after TextBox + //is totally created + //No doupt, it will be only one time call + + //Old solution uses Timer.Tick event to check Create property + } + } + + private void WaterMark_Toggel(object sender, EventArgs args) + { + if (this.Text.Length <= 0) + EnableWaterMark(); + else + DisbaleWaterMark(); + } + + private void EnableWaterMark() + { + //Save current font until returning the UserPaint style to false (NOTE: + //It is a try and error advice) + oldFont = new System.Drawing.Font(Font.FontFamily, Font.Size, Font.Style, + Font.Unit); + //Enable OnPaint event handler + this.SetStyle(ControlStyles.UserPaint, true); + this.waterMarkTextEnabled = true; + //Triger OnPaint immediatly + Refresh(); + } + + private void DisbaleWaterMark() + { + //Disbale OnPaint event handler + this.waterMarkTextEnabled = false; + this.SetStyle(ControlStyles.UserPaint, false); + //Return back oldFont if existed + if (oldFont != null) + this.Font = new System.Drawing.Font(oldFont.FontFamily, oldFont.Size, + oldFont.Style, oldFont.Unit); + } + + private void WaterMark_FontChanged(object sender, EventArgs args) + { + if (waterMarkTextEnabled) + { + oldFont = new System.Drawing.Font(Font.FontFamily, Font.Size, Font.Style, + Font.Unit); + Refresh(); + } + } + } +}