Skip to content
This repository has been archived by the owner on Feb 3, 2019. It is now read-only.

Commit

Permalink
Hotkeys
Browse files Browse the repository at this point in the history
Hotkeys no longer unregistered when hiding
  • Loading branch information
Mike Tarkus committed May 23, 2014
1 parent b20848b commit 271c953
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 23 deletions.
2 changes: 2 additions & 0 deletions frm_Main.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 37 additions & 23 deletions frm_Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ void hook_KeyPressed(object sender, KeyPressedEventArgs e)
{
switch(e.Key) {
case Keys.D3:
btn_capture.PerformClick();
screen_capture("screen");
break;

case Keys.D4:
btn_capture_selected_area.PerformClick();
screen_capture("region");
break;

case Keys.D5:
Btn_windowClick();
screen_capture("window");
break;
}
}
Expand All @@ -100,6 +100,12 @@ void Frm_MainLoad(object sender, EventArgs e)

Snipper.initialize();
}

void Frm_MainFormClosing(object sender, FormClosingEventArgs e)
{
inverse_tray_options(sender, e);
e.Cancel = true;
}
#endregion

#region Upload Images
Expand Down Expand Up @@ -145,8 +151,29 @@ void save_screenshot(Bitmap bmp, String name = null)
}
}

void work_image(Bitmap bmp) {

void screen_capture(String type)
{
Bitmap bmp = null;

switch(type) {
case "screen":
bmp = Screen_Capture.screen(Settings.show_cursor);
break;

case "window":
bmp = Screen_Capture.window(Settings.show_cursor);
break;

default:
bmp = Screen_Capture.region(Snipper.get_region());
break;
}

work_image(bmp);
}

void work_image(Bitmap bmp)
{
Global_Func.play_sound("capture.wav");

bmp = edit_screenshot(bmp);
Expand All @@ -160,23 +187,9 @@ void work_image(Bitmap bmp) {
save_screenshot(bmp);
}

void Btn_windowClick()
{
Bitmap bmp = Screen_Capture.window();
work_image(bmp);
}

void Btn_captureClick(object sender, EventArgs e)
{
Bitmap bmp = Screen_Capture.screen(Settings.show_cursor);
work_image(bmp);
}

void Btn_capture_regionClick(object sender, EventArgs e)
{
Bitmap bmp = Screen_Capture.region(Snipper.get_region());
work_image(bmp);
}
void Btn_captureClick(object sender, EventArgs e) { screen_capture("screen"); }
void Btn_windowClick() { screen_capture("window"); }
void Btn_capture_regionClick(object sender, EventArgs e) { screen_capture("region"); }
#endregion

#region Main Menu
Expand All @@ -198,7 +211,8 @@ void AboutToolStripMenuItemClick(object sender, EventArgs e)
void inverse_tray_options(object sender, EventArgs e) {
minimizeToTrayToolStripMenuItem.Text = (minimizeToTrayToolStripMenuItem.Text == "Open Window") ? "Minimize to Tray" : "Open Window";

this.Visible = !this.Visible;
ShowInTaskbar = !ShowInTaskbar;
Opacity = Opacity < 1 ? 100 : 0;
}
#endregion

Expand Down

0 comments on commit 271c953

Please sign in to comment.