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.split_container_main);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.KeyPreview = true;
this.MainMenuStrip = this.menuStrip1;
this.MinimumSize = new System.Drawing.Size(1024, 480);
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 (keyData == Keys.Enter)
switch (key_data)
{
sort_image();
return true;
}
if (keyData == Keys.PageUp)
{
if (global.filecount > 1)
prev_image();
return true;
}
if (keyData == Keys.PageDown)
{
if (global.filecount > 1)
next_image();
return true;
}
if (keyData == Keys.Home)
{
if (global.filecount > 1)
{
status_msg("Loading first image...");
global.position = 0;
update_image();
}
return true;
}
if (keyData == Keys.End)
{
if (global.filecount > 1)
{
status_msg("Loading final image...");
global.position = global.filecount - 1;
update_image();
}
return true;
case Keys.PageUp:
if (global.filecount > 1)
prev_image();
return true;
case Keys.PageDown:
if (global.filecount > 1)
next_image();
return true;
case Keys.Shift | Keys.Home:
if (global.filecount > 1)
{
status_msg("Loading first image...");
global.position = 0;
update_image();
}
return true;
case Keys.Shift | Keys.End:
if (global.filecount > 1)
{
status_msg("Loading final image...");
global.position = global.filecount - 1;
update_image();
}
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()
{
status_msg("Loading next image...");
if (global.position < global.filecount - 1)

Loading…
Cancel
Save