diff --git a/ShareX.HistoryLib/ImageHistoryForm.Designer.cs b/ShareX.HistoryLib/ImageHistoryForm.Designer.cs index 96fd07d2d..5969d47d8 100644 --- a/ShareX.HistoryLib/ImageHistoryForm.Designer.cs +++ b/ShareX.HistoryLib/ImageHistoryForm.Designer.cs @@ -106,6 +106,7 @@ private void InitializeComponent() this.tstbSearch.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.tstbSearch.Name = "tstbSearch"; resources.ApplyResources(this.tstbSearch, "tstbSearch"); + this.tstbSearch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tstbSearch_KeyDown); // // tsbSearch // diff --git a/ShareX.HistoryLib/ImageHistoryForm.cs b/ShareX.HistoryLib/ImageHistoryForm.cs index 62468a46d..e863dd23a 100644 --- a/ShareX.HistoryLib/ImageHistoryForm.cs +++ b/ShareX.HistoryLib/ImageHistoryForm.cs @@ -99,13 +99,15 @@ public ImageHistoryForm(string historyPath, int viewMode, Size thumbnailSize, Ac private void RefreshHistoryItems() { + SearchText = tstbSearch.Text; + if (history == null) { history = new HistoryManager(HistoryPath); } ilvImages.Items.Clear(); - ImageListViewItem[] ilvItems = GetHistoryItems().Select(historyItem => new ImageListViewItem(historyItem.Filepath) { Tag = historyItem }).ToArray(); + ImageListViewItem[] ilvItems = GetHistoryItems().Select(hi => new ImageListViewItem(hi.Filepath) { Tag = hi }).ToArray(); ilvImages.Items.AddRange(ilvItems); } @@ -131,6 +133,7 @@ private HistoryItem[] him_GetHistoryItems() private void ImageHistoryForm_Shown(object sender, EventArgs e) { + tstbSearch.Focus(); Application.DoEvents(); this.ForceActivate(); RefreshHistoryItems(); @@ -138,12 +141,10 @@ private void ImageHistoryForm_Shown(object sender, EventArgs e) private void ImageHistoryForm_KeyDown(object sender, KeyEventArgs e) { - switch (e.KeyData) + if (e.KeyCode == Keys.F5) { - case Keys.F5: - RefreshHistoryItems(); - e.Handled = true; - break; + RefreshHistoryItems(); + e.Handled = true; } } @@ -165,9 +166,18 @@ private void ilvImages_ItemDoubleClick(object sender, ItemClickEventArgs e) him.ShowImagePreview(); } + private void tstbSearch_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + { + RefreshHistoryItems(); + e.Handled = true; + e.SuppressKeyPress = true; + } + } + private void tsbSearch_Click(object sender, EventArgs e) { - SearchText = tstbSearch.Text; RefreshHistoryItems(); } diff --git a/ShareX.HistoryLib/ImageHistoryForm.resx b/ShareX.HistoryLib/ImageHistoryForm.resx index 2dce3fc42..1ce80bb74 100644 --- a/ShareX.HistoryLib/ImageHistoryForm.resx +++ b/ShareX.HistoryLib/ImageHistoryForm.resx @@ -231,12 +231,60 @@ toolStripButton1 + + 137, 22 + + + Thumbnails + + + 137, 22 + + + Gallery + + + 137, 22 + + + Pane + 79, 22 View mode + + 121, 22 + + + 75 x 75 + + + 121, 22 + + + 100 x 100 + + + 121, 22 + + + 150 x 150 + + + 121, 22 + + + 200 x 200 + + + 121, 22 + + + 250 x 250 + 100, 22 @@ -247,7 +295,7 @@ 3, 0 - 489, 25 + 458, 25 0 @@ -288,54 +336,6 @@ 0 - - 137, 22 - - - Thumbnails - - - 137, 22 - - - Gallery - - - 137, 22 - - - Pane - - - 121, 22 - - - 75 x 75 - - - 121, 22 - - - 100 x 100 - - - 121, 22 - - - 150 x 150 - - - 121, 22 - - - 200 x 200 - - - 121, 22 - - - 250 x 250 - True