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,52 +273,51 @@ 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(); case Keys.PageUp:
return true; if (global.filecount > 1)
} prev_image();
if (keyData == Keys.PageUp) return true;
{ case Keys.PageDown:
if (global.filecount > 1) if (global.filecount > 1)
prev_image(); next_image();
return true; return true;
} case Keys.Shift | Keys.Home:
if (keyData == Keys.PageDown) if (global.filecount > 1)
{ {
if (global.filecount > 1) status_msg("Loading first image...");
next_image(); global.position = 0;
return true; update_image();
} }
if (keyData == Keys.Home) return true;
{ case Keys.Shift | Keys.End:
if (global.filecount > 1) if (global.filecount > 1)
{ {
status_msg("Loading first image..."); status_msg("Loading final image...");
global.position = 0; global.position = global.filecount - 1;
update_image(); update_image();
} }
return true; return true;
} case Keys.Enter:
if (keyData == Keys.End) sort_image();
{ return true;
if (global.filecount > 1) case Keys.Delete:
{ delete_image();
status_msg("Loading final image..."); return true;
global.position = global.filecount - 1; case Keys.Shift | Keys.Enter:
update_image(); delete_image();
} return true;
return true;
} }
} }
return base.ProcessCmdKey(ref msg, keyData); return base.ProcessCmdKey(ref msg, key_data);
} }
public void next_image() public void next_image()
{ {
status_msg("Loading next image..."); status_msg("Loading next image...");
if (global.position < global.filecount - 1) if (global.position < global.filecount - 1)

Loading…
Cancel
Save