From 7859e734492a7609c47bcb64540935e7f3d6ef80 Mon Sep 17 00:00:00 2001 From: Dennis <74433222+HovKlan-DH@users.noreply.github.com> Date: Wed, 20 Sep 2023 08:44:21 +0200 Subject: [PATCH] Update --- HovText/History.cs | 32 +++++++++++++--------- HovText/Properties/AssemblyInfo.cs | 4 +-- HovText/Settings.Designer.cs | 44 ++++++++++++++++++++++++++++-- HovText/Settings.cs | 36 ++++++++++++++++++++---- HovText/Update.Designer.cs | 6 ++-- 5 files changed, 96 insertions(+), 26 deletions(-) diff --git a/HovText/History.cs b/HovText/History.cs index 9292450..aaf0e46 100644 --- a/HovText/History.cs +++ b/HovText/History.cs @@ -1039,10 +1039,13 @@ private void SelectEntry () // ########################################################################################### // Search filter. // Filter keywords: - // :f[avorite] - // :u[rl] // :e[mail] + // :f[avorite] // :i[mage] + // :m[ail] + // :p[icture] + // :u[rl] + // :w[eb] // ########################################################################################### private void Search_TextChanged(object sender, System.EventArgs e) @@ -1052,14 +1055,17 @@ private void Search_TextChanged(object sender, System.EventArgs e) // Check if the input contains a word starting with ":u" or ":e" string favoriteKeyword = searchTexts.FirstOrDefault(text => text.StartsWith(":f")); - string urlKeyword = searchTexts.FirstOrDefault(text => text.StartsWith(":u")); - string emailKeyword = searchTexts.FirstOrDefault(text => text.StartsWith(":e")); - string imageKeyword = searchTexts.FirstOrDefault(text => text.StartsWith(":i")); + string urlKeyword1 = searchTexts.FirstOrDefault(text => text.StartsWith(":u")); + string urlKeyword2 = searchTexts.FirstOrDefault(text => text.StartsWith(":w")); + string emailKeyword1 = searchTexts.FirstOrDefault(text => text.StartsWith(":e")); + string emailKeyword2 = searchTexts.FirstOrDefault(text => text.StartsWith(":m")); + string imageKeyword1 = searchTexts.FirstOrDefault(text => text.StartsWith(":i")); + string imageKeyword2 = searchTexts.FirstOrDefault(text => text.StartsWith(":p")); bool searchForFavorite = favoriteKeyword != null; - bool searchForUrl = urlKeyword != null; - bool searchForEmail = emailKeyword != null; - bool searchForImage = imageKeyword != null; + bool searchForUrl = urlKeyword1 != null || urlKeyword2 != null; + bool searchForEmail = emailKeyword1 != null || emailKeyword2 != null; + bool searchForImage = imageKeyword1 != null || imageKeyword2 != null; // If ":f" or ":u" or ":e" or ":i" is found, remove it from the searchTexts array if (searchForFavorite) @@ -1068,19 +1074,19 @@ private void Search_TextChanged(object sender, System.EventArgs e) } if (searchForUrl) { - searchTexts = searchTexts.Where(text => text != urlKeyword).ToArray(); + searchTexts = searchTexts.Where(text => text != urlKeyword1 && text != urlKeyword2).ToArray(); } if (searchForEmail) { - searchTexts = searchTexts.Where(text => text != emailKeyword).ToArray(); + searchTexts = searchTexts.Where(text => text != emailKeyword1 && text != emailKeyword2).ToArray(); } if (searchForImage) { - searchTexts = searchTexts.Where(text => text != imageKeyword).ToArray(); + searchTexts = searchTexts.Where(text => text != imageKeyword1 && text != imageKeyword2).ToArray(); } - // Remove terms that start with ":" (except for ":u*" and ":e*") - searchTexts = searchTexts.Where(text => !text.StartsWith(":") || text == favoriteKeyword || text == urlKeyword || text == emailKeyword || text == imageKeyword).ToArray(); + // Remove terms that start with ":" (except for the special ones) + searchTexts = searchTexts.Where(text => !text.StartsWith(":") || text == favoriteKeyword || text == urlKeyword1 || text == urlKeyword2 || text == emailKeyword1 || text == emailKeyword2 || text == imageKeyword1 || text == imageKeyword2).ToArray(); // Perform a case-insensitive wildcard search using LINQ var searchResults = Settings.entriesText diff --git a/HovText/Properties/AssemblyInfo.cs b/HovText/Properties/AssemblyInfo.cs index 2243619..fd83b74 100644 --- a/HovText/Properties/AssemblyInfo.cs +++ b/HovText/Properties/AssemblyInfo.cs @@ -17,11 +17,11 @@ // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("03fbad69-cd44-4a0c-b4bf-90406561f14f")] //[assembly: AssemblyVersion("2021.01.23.1")] -[assembly: AssemblyFileVersion("2023.08.02.1")] +[assembly: AssemblyFileVersion("2023.09.20.1")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] [assembly: NeutralResourcesLanguage("en")] -[assembly: AssemblyVersion("2023.08.02.1")] +[assembly: AssemblyVersion("2023.09.20.1")] diff --git a/HovText/Settings.Designer.cs b/HovText/Settings.Designer.cs index 32f7b14..966b900 100644 --- a/HovText/Settings.Designer.cs +++ b/HovText/Settings.Designer.cs @@ -186,6 +186,9 @@ private void InitializeComponent() this.terminateTimer = new System.Windows.Forms.Timer(this.components); this.colorDialogSearch = new System.Windows.Forms.ColorDialog(); this.colorDialogSearchText = new System.Windows.Forms.ColorDialog(); + this.label3 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); this.notifyIconMenuStrip.SuspendLayout(); this.tabAbout.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.GuiPictureBox1)).BeginInit(); @@ -721,7 +724,6 @@ private void InitializeComponent() this.GuiHotkeySearch.TabIndex = 212; this.GuiHotkeySearch.Text = "Default text"; this.GuiHotkeySearch.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this.GuiHotkeySearch.Click += new System.EventHandler(this.GuiHotkeySearch_Click); this.GuiHotkeySearch.Enter += new System.EventHandler(this.GuiHotkeySearch_Enter); this.GuiHotkeySearch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.GuiHotkeySearch_KeyDown); // @@ -922,6 +924,9 @@ private void InitializeComponent() // // groupBox2 // + this.groupBox2.Controls.Add(this.label9); + this.groupBox2.Controls.Add(this.label5); + this.groupBox2.Controls.Add(this.label3); this.groupBox2.Controls.Add(this.GuiAlwaysPasteOriginal); this.groupBox2.Controls.Add(this.GuiSearch); this.groupBox2.Controls.Add(this.GuiPasteOnSelection); @@ -940,9 +945,9 @@ private void InitializeComponent() this.GuiAlwaysPasteOriginal.AutoSize = true; this.GuiAlwaysPasteOriginal.Location = new System.Drawing.Point(28, 213); this.GuiAlwaysPasteOriginal.Name = "GuiAlwaysPasteOriginal"; - this.GuiAlwaysPasteOriginal.Size = new System.Drawing.Size(345, 29); + this.GuiAlwaysPasteOriginal.Size = new System.Drawing.Size(435, 29); this.GuiAlwaysPasteOriginal.TabIndex = 126; - this.GuiAlwaysPasteOriginal.Text = "Always paste original clipboard entry"; + this.GuiAlwaysPasteOriginal.Text = "Always paste original/formatted clipboard entry"; this.GuiAlwaysPasteOriginal.UseVisualStyleBackColor = true; this.GuiAlwaysPasteOriginal.CheckedChanged += new System.EventHandler(this.GuiAlwaysPasteOriginal_CheckedChanged); // @@ -1904,6 +1909,36 @@ private void InitializeComponent() this.terminateTimer.Interval = 5000; this.terminateTimer.Tick += new System.EventHandler(this.TerminateTimer_Tick); // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("Segoe UI", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label3.Location = new System.Drawing.Point(258, 44); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(60, 17); + this.label3.TabIndex = 127; + this.label3.Text = "(Alt + S)"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("Segoe UI", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label5.Location = new System.Drawing.Point(314, 80); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(63, 17); + this.label5.TabIndex = 128; + this.label5.Text = "(Alt + H)"; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Font = new System.Drawing.Font("Segoe UI", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label9.Location = new System.Drawing.Point(383, 80); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(109, 17); + this.label9.TabIndex = 129; + this.label9.Text = "(Shift + Alt + H)"; + // // Settings // this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 25F); @@ -2136,6 +2171,9 @@ private void InitializeComponent() private System.Windows.Forms.ColorDialog colorDialogSearchText; private System.Windows.Forms.CheckBox GuiAlwaysPasteOriginal; private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label9; } } \ No newline at end of file diff --git a/HovText/Settings.cs b/HovText/Settings.cs index 050f444..ff61ca1 100644 --- a/HovText/Settings.cs +++ b/HovText/Settings.cs @@ -495,6 +495,9 @@ public Settings() // Set the initial text on the tray icon UpdateNotifyIconText(); + + // Update the location of the dynamic labels + UpdateLocationDynamicLabels(); } @@ -3015,6 +3018,32 @@ private void HotkeyPasteOnHotkey(object sender, NHotkey.HotkeyEventArgs e) } + // ########################################################################################### + // Rearrange the dynamic labels for the "interface" hotkeys + // ########################################################################################### + + private void UpdateLocationDynamicLabels() + { + Graphics g = GuiSearch.CreateGraphics(); + SizeF size = g.MeasureString(GuiSearch.Text, GuiSearch.Font); + label3.Text = "(" + GuiHotkeySearch.Text + ")"; + int centeredY = GuiSearch.Location.Y + (GuiSearch.Height - label3.Height) / 2; + label3.Location = new Point(GuiSearch.Location.X + (int)size.Width + 10 + 10, centeredY); + + g = GuiInstantSelect.CreateGraphics(); + size = g.MeasureString(GuiInstantSelect.Text, GuiInstantSelect.Font); + label5.Text = "(" + GuiHotkeyOlder.Text + ")"; + centeredY = GuiInstantSelect.Location.Y + (GuiInstantSelect.Height - label5.Height) / 2; + label5.Location = new Point(GuiInstantSelect.Location.X + (int)size.Width + 10 + 10, centeredY); + + g = label3.CreateGraphics(); + size = g.MeasureString(label3.Text, label3.Font); + label9.Text = "(" + GuiHotkeyNewer.Text + ")"; + centeredY = label5.Location.Y + (label5.Height - label9.Height) / 2; + label9.Location = new Point(label5.Location.X + (int)size.Width + 12, centeredY); + } + + // ########################################################################################### // On "key down" in one of the hotkey fields then convert that in to a string // ########################################################################################### @@ -3075,6 +3104,7 @@ private void GuiHotkeySearch_KeyDown(object sender, KeyEventArgs e) { string hotkey = ConvertKeyboardInputToString(e); GuiHotkeySearch.Text = hotkey; + if (e.Alt) { // https://stackoverflow.com/a/3068797/2028935 @@ -3149,16 +3179,11 @@ private void HotkeyEnable_Enter(object sender, EventArgs e) } private void GuiHotkeySearch_Enter(object sender, EventArgs e) - { - } - - private void GuiHotkeySearch_Click(object sender, EventArgs e) { hotkey = "hotkeySearch"; ModifyHotkey(); } - private void HotkeyOlder_Enter(object sender, EventArgs e) { hotkey = "hotkeyOlder"; @@ -3256,6 +3281,7 @@ public static void RemoveAllHotkeys() private void ApplyHotkeys_Click(object sender, EventArgs e) { SetHotkeys("Apply hotkeys button press"); + UpdateLocationDynamicLabels(); } diff --git a/HovText/Update.Designer.cs b/HovText/Update.Designer.cs index 1d0e6c7..3505082 100644 --- a/HovText/Update.Designer.cs +++ b/HovText/Update.Designer.cs @@ -43,7 +43,7 @@ private void InitializeComponent() // // GuiUpdateButton1 // - this.GuiUpdateButton1.Location = new System.Drawing.Point(400, 228); + this.GuiUpdateButton1.Location = new System.Drawing.Point(420, 228); this.GuiUpdateButton1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.GuiUpdateButton1.Name = "GuiUpdateButton1"; this.GuiUpdateButton1.Size = new System.Drawing.Size(182, 37); @@ -54,7 +54,7 @@ private void InitializeComponent() // // GuiUpdateButton2 // - this.GuiUpdateButton2.Location = new System.Drawing.Point(210, 228); + this.GuiUpdateButton2.Location = new System.Drawing.Point(220, 228); this.GuiUpdateButton2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.GuiUpdateButton2.Name = "GuiUpdateButton2"; this.GuiUpdateButton2.Size = new System.Drawing.Size(182, 37); @@ -160,7 +160,7 @@ private void InitializeComponent() // this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(601, 288); + this.ClientSize = new System.Drawing.Size(621, 288); this.Controls.Add(this.GuiUpdateButton3); this.Controls.Add(this.GuiUpdateButton2); this.Controls.Add(this.GuiUpdateButton1);