Rewrote hotkeys handling

sort-delete
Aaron 3 years ago
parent a684a680c6
commit 802d2ea2e3

1
Form1.Designer.cs generated

@ -662,6 +662,7 @@ namespace photo_sorter
this.Controls.Add(this.menuStrip1); this.Controls.Add(this.menuStrip1);
this.Controls.Add(this.split_container_main); this.Controls.Add(this.split_container_main);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.KeyPreview = true;
this.MainMenuStrip = this.menuStrip1; this.MainMenuStrip = this.menuStrip1;
this.MinimumSize = new System.Drawing.Size(1024, 480); this.MinimumSize = new System.Drawing.Size(1024, 480);
this.Name = "form_main"; this.Name = "form_main";

@ -273,29 +273,21 @@ namespace photo_sorter
} }
} }
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) protected override bool ProcessCmdKey(ref Message msg, Keys key_data)
{ {
if (tsi_enableGlobalHotkeys.Checked) if (tsi_enableGlobalHotkeys.Checked)
{ {
if (keyData == Keys.Enter) switch (key_data)
{
sort_image();
return true;
}
if (keyData == Keys.PageUp)
{ {
case Keys.PageUp:
if (global.filecount > 1) if (global.filecount > 1)
prev_image(); prev_image();
return true; return true;
} case Keys.PageDown:
if (keyData == Keys.PageDown)
{
if (global.filecount > 1) if (global.filecount > 1)
next_image(); next_image();
return true; return true;
} case Keys.Shift | Keys.Home:
if (keyData == Keys.Home)
{
if (global.filecount > 1) if (global.filecount > 1)
{ {
status_msg("Loading first image..."); status_msg("Loading first image...");
@ -303,9 +295,7 @@ namespace photo_sorter
update_image(); update_image();
} }
return true; return true;
} case Keys.Shift | Keys.End:
if (keyData == Keys.End)
{
if (global.filecount > 1) if (global.filecount > 1)
{ {
status_msg("Loading final image..."); status_msg("Loading final image...");
@ -313,9 +303,18 @@ namespace photo_sorter
update_image(); update_image();
} }
return true; return true;
case Keys.Enter:
sort_image();
return true;
case Keys.Delete:
delete_image();
return true;
case Keys.Shift | Keys.Enter:
delete_image();
return true;
} }
} }
return base.ProcessCmdKey(ref msg, keyData); return base.ProcessCmdKey(ref msg, key_data);
} }
public void next_image() public void next_image()

Loading…
Cancel
Save