Skip to content

Commit 7859e73

Browse files
committed
Update
1 parent 8ad8c6f commit 7859e73

File tree

5 files changed

+96
-26
lines changed

5 files changed

+96
-26
lines changed

HovText/History.cs

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,10 +1039,13 @@ private void SelectEntry ()
10391039
// ###########################################################################################
10401040
// Search filter.
10411041
// Filter keywords:
1042-
// :f[avorite]
1043-
// :u[rl]
10441042
// :e[mail]
1043+
// :f[avorite]
10451044
// :i[mage]
1045+
// :m[ail]
1046+
// :p[icture]
1047+
// :u[rl]
1048+
// :w[eb]
10461049
// ###########################################################################################
10471050

10481051
private void Search_TextChanged(object sender, System.EventArgs e)
@@ -1052,14 +1055,17 @@ private void Search_TextChanged(object sender, System.EventArgs e)
10521055

10531056
// Check if the input contains a word starting with ":u" or ":e"
10541057
string favoriteKeyword = searchTexts.FirstOrDefault(text => text.StartsWith(":f"));
1055-
string urlKeyword = searchTexts.FirstOrDefault(text => text.StartsWith(":u"));
1056-
string emailKeyword = searchTexts.FirstOrDefault(text => text.StartsWith(":e"));
1057-
string imageKeyword = searchTexts.FirstOrDefault(text => text.StartsWith(":i"));
1058+
string urlKeyword1 = searchTexts.FirstOrDefault(text => text.StartsWith(":u"));
1059+
string urlKeyword2 = searchTexts.FirstOrDefault(text => text.StartsWith(":w"));
1060+
string emailKeyword1 = searchTexts.FirstOrDefault(text => text.StartsWith(":e"));
1061+
string emailKeyword2 = searchTexts.FirstOrDefault(text => text.StartsWith(":m"));
1062+
string imageKeyword1 = searchTexts.FirstOrDefault(text => text.StartsWith(":i"));
1063+
string imageKeyword2 = searchTexts.FirstOrDefault(text => text.StartsWith(":p"));
10581064

10591065
bool searchForFavorite = favoriteKeyword != null;
1060-
bool searchForUrl = urlKeyword != null;
1061-
bool searchForEmail = emailKeyword != null;
1062-
bool searchForImage = imageKeyword != null;
1066+
bool searchForUrl = urlKeyword1 != null || urlKeyword2 != null;
1067+
bool searchForEmail = emailKeyword1 != null || emailKeyword2 != null;
1068+
bool searchForImage = imageKeyword1 != null || imageKeyword2 != null;
10631069

10641070
// If ":f" or ":u" or ":e" or ":i" is found, remove it from the searchTexts array
10651071
if (searchForFavorite)
@@ -1068,19 +1074,19 @@ private void Search_TextChanged(object sender, System.EventArgs e)
10681074
}
10691075
if (searchForUrl)
10701076
{
1071-
searchTexts = searchTexts.Where(text => text != urlKeyword).ToArray();
1077+
searchTexts = searchTexts.Where(text => text != urlKeyword1 && text != urlKeyword2).ToArray();
10721078
}
10731079
if (searchForEmail)
10741080
{
1075-
searchTexts = searchTexts.Where(text => text != emailKeyword).ToArray();
1081+
searchTexts = searchTexts.Where(text => text != emailKeyword1 && text != emailKeyword2).ToArray();
10761082
}
10771083
if (searchForImage)
10781084
{
1079-
searchTexts = searchTexts.Where(text => text != imageKeyword).ToArray();
1085+
searchTexts = searchTexts.Where(text => text != imageKeyword1 && text != imageKeyword2).ToArray();
10801086
}
10811087

1082-
// Remove terms that start with ":" (except for ":u*" and ":e*")
1083-
searchTexts = searchTexts.Where(text => !text.StartsWith(":") || text == favoriteKeyword || text == urlKeyword || text == emailKeyword || text == imageKeyword).ToArray();
1088+
// Remove terms that start with ":" (except for the special ones)
1089+
searchTexts = searchTexts.Where(text => !text.StartsWith(":") || text == favoriteKeyword || text == urlKeyword1 || text == urlKeyword2 || text == emailKeyword1 || text == emailKeyword2 || text == imageKeyword1 || text == imageKeyword2).ToArray();
10841090

10851091
// Perform a case-insensitive wildcard search using LINQ
10861092
var searchResults = Settings.entriesText

HovText/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
// The following GUID is for the ID of the typelib if this project is exposed to COM
1818
[assembly: Guid("03fbad69-cd44-4a0c-b4bf-90406561f14f")]
1919
//[assembly: AssemblyVersion("2021.01.23.1")]
20-
[assembly: AssemblyFileVersion("2023.08.02.1")]
20+
[assembly: AssemblyFileVersion("2023.09.20.1")]
2121

2222
// Setting ComVisible to false makes the types in this assembly not visible
2323
// to COM components. If you need to access a type in this assembly from
2424
// COM, set the ComVisible attribute to true on that type.
2525
[assembly: ComVisible(false)]
2626
[assembly: NeutralResourcesLanguage("en")]
27-
[assembly: AssemblyVersion("2023.08.02.1")]
27+
[assembly: AssemblyVersion("2023.09.20.1")]

HovText/Settings.Designer.cs

Lines changed: 41 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

HovText/Settings.cs

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,9 @@ public Settings()
495495

496496
// Set the initial text on the tray icon
497497
UpdateNotifyIconText();
498+
499+
// Update the location of the dynamic labels
500+
UpdateLocationDynamicLabels();
498501
}
499502

500503

@@ -3015,6 +3018,32 @@ private void HotkeyPasteOnHotkey(object sender, NHotkey.HotkeyEventArgs e)
30153018
}
30163019

30173020

3021+
// ###########################################################################################
3022+
// Rearrange the dynamic labels for the "interface" hotkeys
3023+
// ###########################################################################################
3024+
3025+
private void UpdateLocationDynamicLabels()
3026+
{
3027+
Graphics g = GuiSearch.CreateGraphics();
3028+
SizeF size = g.MeasureString(GuiSearch.Text, GuiSearch.Font);
3029+
label3.Text = "(" + GuiHotkeySearch.Text + ")";
3030+
int centeredY = GuiSearch.Location.Y + (GuiSearch.Height - label3.Height) / 2;
3031+
label3.Location = new Point(GuiSearch.Location.X + (int)size.Width + 10 + 10, centeredY);
3032+
3033+
g = GuiInstantSelect.CreateGraphics();
3034+
size = g.MeasureString(GuiInstantSelect.Text, GuiInstantSelect.Font);
3035+
label5.Text = "(" + GuiHotkeyOlder.Text + ")";
3036+
centeredY = GuiInstantSelect.Location.Y + (GuiInstantSelect.Height - label5.Height) / 2;
3037+
label5.Location = new Point(GuiInstantSelect.Location.X + (int)size.Width + 10 + 10, centeredY);
3038+
3039+
g = label3.CreateGraphics();
3040+
size = g.MeasureString(label3.Text, label3.Font);
3041+
label9.Text = "(" + GuiHotkeyNewer.Text + ")";
3042+
centeredY = label5.Location.Y + (label5.Height - label9.Height) / 2;
3043+
label9.Location = new Point(label5.Location.X + (int)size.Width + 12, centeredY);
3044+
}
3045+
3046+
30183047
// ###########################################################################################
30193048
// On "key down" in one of the hotkey fields then convert that in to a string
30203049
// ###########################################################################################
@@ -3075,6 +3104,7 @@ private void GuiHotkeySearch_KeyDown(object sender, KeyEventArgs e)
30753104
{
30763105
string hotkey = ConvertKeyboardInputToString(e);
30773106
GuiHotkeySearch.Text = hotkey;
3107+
30783108
if (e.Alt)
30793109
{
30803110
// https://stackoverflow.com/a/3068797/2028935
@@ -3149,16 +3179,11 @@ private void HotkeyEnable_Enter(object sender, EventArgs e)
31493179
}
31503180

31513181
private void GuiHotkeySearch_Enter(object sender, EventArgs e)
3152-
{
3153-
}
3154-
3155-
private void GuiHotkeySearch_Click(object sender, EventArgs e)
31563182
{
31573183
hotkey = "hotkeySearch";
31583184
ModifyHotkey();
31593185
}
31603186

3161-
31623187
private void HotkeyOlder_Enter(object sender, EventArgs e)
31633188
{
31643189
hotkey = "hotkeyOlder";
@@ -3256,6 +3281,7 @@ public static void RemoveAllHotkeys()
32563281
private void ApplyHotkeys_Click(object sender, EventArgs e)
32573282
{
32583283
SetHotkeys("Apply hotkeys button press");
3284+
UpdateLocationDynamicLabels();
32593285
}
32603286

32613287

HovText/Update.Designer.cs

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)