Support enter key in filename and url textboxes

This commit is contained in:
Jaex 2021-05-26 05:05:11 +03:00
parent eb87cc06ec
commit e67c7fce1d
7 changed files with 62 additions and 38 deletions

View file

@ -38,8 +38,10 @@ private void InitializeComponent()
this.chDateTime = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chFilename = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chURL = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.btnShowStats = new System.Windows.Forms.Button();
this.nudMaxItemCount = new System.Windows.Forms.NumericUpDown();
this.pbThumbnail = new ShareX.HelpersLib.MyPictureBox();
this.btnShowStats = new System.Windows.Forms.Button();
this.lblMaxItemCount = new System.Windows.Forms.Label();
this.gbFilters = new System.Windows.Forms.GroupBox();
this.lblURLFilter = new System.Windows.Forms.Label();
this.txtURLFilter = new System.Windows.Forms.TextBox();
@ -56,15 +58,13 @@ private void InitializeComponent()
this.cbDateFilter = new System.Windows.Forms.CheckBox();
this.dtpFilterTo = new System.Windows.Forms.DateTimePicker();
this.txtFilenameFilter = new System.Windows.Forms.TextBox();
this.lblMaxItemCount = new System.Windows.Forms.Label();
this.nudMaxItemCount = new System.Windows.Forms.NumericUpDown();
((System.ComponentModel.ISupportInitialize)(this.scMain)).BeginInit();
this.scMain.Panel1.SuspendLayout();
this.scMain.Panel2.SuspendLayout();
this.scMain.SuspendLayout();
this.pStats.SuspendLayout();
this.gbFilters.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudMaxItemCount)).BeginInit();
this.gbFilters.SuspendLayout();
this.SuspendLayout();
//
// scMain
@ -138,12 +138,16 @@ private void InitializeComponent()
//
resources.ApplyResources(this.chURL, "chURL");
//
// btnShowStats
// nudMaxItemCount
//
resources.ApplyResources(this.btnShowStats, "btnShowStats");
this.btnShowStats.Name = "btnShowStats";
this.btnShowStats.UseVisualStyleBackColor = true;
this.btnShowStats.Click += new System.EventHandler(this.BtnShowStats_Click);
resources.ApplyResources(this.nudMaxItemCount, "nudMaxItemCount");
this.nudMaxItemCount.Maximum = new decimal(new int[] {
10000,
0,
0,
0});
this.nudMaxItemCount.Name = "nudMaxItemCount";
this.nudMaxItemCount.ValueChanged += new System.EventHandler(this.nudMaxItemCount_ValueChanged);
//
// pbThumbnail
//
@ -156,6 +160,18 @@ private void InitializeComponent()
this.pbThumbnail.PictureBoxBackColor = System.Drawing.SystemColors.Control;
this.pbThumbnail.ShowImageSizeLabel = true;
//
// btnShowStats
//
resources.ApplyResources(this.btnShowStats, "btnShowStats");
this.btnShowStats.Name = "btnShowStats";
this.btnShowStats.UseVisualStyleBackColor = true;
this.btnShowStats.Click += new System.EventHandler(this.BtnShowStats_Click);
//
// lblMaxItemCount
//
resources.ApplyResources(this.lblMaxItemCount, "lblMaxItemCount");
this.lblMaxItemCount.Name = "lblMaxItemCount";
//
// gbFilters
//
resources.ApplyResources(this.gbFilters, "gbFilters");
@ -186,6 +202,7 @@ private void InitializeComponent()
//
resources.ApplyResources(this.txtURLFilter, "txtURLFilter");
this.txtURLFilter.Name = "txtURLFilter";
this.txtURLFilter.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtURLFilter_KeyDown);
//
// lblFilenameFilter
//
@ -261,22 +278,7 @@ private void InitializeComponent()
//
resources.ApplyResources(this.txtFilenameFilter, "txtFilenameFilter");
this.txtFilenameFilter.Name = "txtFilenameFilter";
//
// lblMaxItemCount
//
resources.ApplyResources(this.lblMaxItemCount, "lblMaxItemCount");
this.lblMaxItemCount.Name = "lblMaxItemCount";
//
// nudMaxItemCount
//
resources.ApplyResources(this.nudMaxItemCount, "nudMaxItemCount");
this.nudMaxItemCount.Maximum = new decimal(new int[] {
10000,
0,
0,
0});
this.nudMaxItemCount.Name = "nudMaxItemCount";
this.nudMaxItemCount.ValueChanged += new System.EventHandler(this.nudMaxItemCount_ValueChanged);
this.txtFilenameFilter.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtFilenameFilter_KeyDown);
//
// HistoryForm
//
@ -295,9 +297,9 @@ private void InitializeComponent()
((System.ComponentModel.ISupportInitialize)(this.scMain)).EndInit();
this.scMain.ResumeLayout(false);
this.pStats.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.nudMaxItemCount)).EndInit();
this.gbFilters.ResumeLayout(false);
this.gbFilters.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nudMaxItemCount)).EndInit();
this.ResumeLayout(false);
}

View file

@ -395,6 +395,28 @@ private void scMain_SplitterMoved(object sender, SplitterEventArgs e)
Settings.SplitterDistance = scMain.SplitterDistance;
}
private void txtFilenameFilter_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
e.Handled = true;
e.SuppressKeyPress = true;
ApplyFiltersAndAdd();
txtFilenameFilter.Focus();
}
}
private void txtURLFilter_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
e.Handled = true;
e.SuppressKeyPress = true;
ApplyFiltersAndAdd();
txtURLFilter.Focus();
}
}
private void btnApplyFilters_Click(object sender, EventArgs e)
{
ApplyFiltersAndAdd();

View file

@ -226,7 +226,7 @@
<value>lvHistory</value>
</data>
<data name="&gt;&gt;lvHistory.Type" xml:space="preserve">
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=13.2.2.0, Culture=neutral, PublicKeyToken=null</value>
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=13.5.1.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;lvHistory.Parent" xml:space="preserve">
<value>scMain.Panel1</value>
@ -283,7 +283,7 @@
<value>8, 8</value>
</data>
<data name="pbThumbnail.Size" type="System.Drawing.Size, System.Drawing">
<value>404, 352</value>
<value>402, 352</value>
</data>
<data name="pbThumbnail.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
@ -292,7 +292,7 @@
<value>pbThumbnail</value>
</data>
<data name="&gt;&gt;pbThumbnail.Type" xml:space="preserve">
<value>ShareX.HelpersLib.MyPictureBox, ShareX.HelpersLib, Version=13.2.2.0, Culture=neutral, PublicKeyToken=null</value>
<value>ShareX.HelpersLib.MyPictureBox, ShareX.HelpersLib, Version=13.5.1.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;pbThumbnail.Parent" xml:space="preserve">
<value>scMain.Panel2</value>
@ -808,7 +808,7 @@
<value>scMain</value>
</data>
<data name="&gt;&gt;scMain.Type" xml:space="preserve">
<value>ShareX.HelpersLib.SplitContainerCustomSplitter, ShareX.HelpersLib, Version=13.2.2.0, Culture=neutral, PublicKeyToken=null</value>
<value>ShareX.HelpersLib.SplitContainerCustomSplitter, ShareX.HelpersLib, Version=13.5.1.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;scMain.Parent" xml:space="preserve">
<value>$this</value>

View file

@ -45,6 +45,7 @@ private void InitializeComponent()
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.Controls.Add(this.pgHistoryItem);
this.Name = "HistoryItemInfoForm";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.ResumeLayout(false);
}

View file

@ -34,7 +34,6 @@ public HistoryItemInfoForm(HistoryItem hi)
{
InitializeComponent();
ShareXResources.ApplyTheme(this);
pgHistoryItem.SelectedObject = hi;
}
}

View file

@ -130,7 +130,7 @@
<value>3, 3</value>
</data>
<data name="pgHistoryItem.Size" type="System.Drawing.Size, System.Drawing">
<value>448, 405</value>
<value>578, 405</value>
</data>
<data name="pgHistoryItem.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
@ -154,7 +154,7 @@
<value>96, 96</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>454, 411</value>
<value>584, 411</value>
</data>
<data name="$this.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 3, 3, 3</value>

View file

@ -506,11 +506,6 @@ public void ShowImagePreview()
if (HistoryItem != null && IsImageFile) ImageViewer.ShowImage(HistoryItem.FilePath);
}
public void ShowMoreInfo()
{
new HistoryItemInfoForm(HistoryItem).Show();
}
public void UploadFile()
{
if (uploadFile != null && HistoryItem != null && IsFileExist) uploadFile(HistoryItem.FilePath);
@ -520,5 +515,10 @@ public void EditImage()
{
if (editImage != null && HistoryItem != null && IsImageFile) editImage(HistoryItem.FilePath);
}
public void ShowMoreInfo()
{
new HistoryItemInfoForm(HistoryItem).Show();
}
}
}