From ea149c788bfda3050b4efc0279bf2c3a80e10a90 Mon Sep 17 00:00:00 2001 From: Jaex Date: Fri, 20 Jan 2017 14:56:44 +0300 Subject: [PATCH] Added toggle actions toolbar --- ShareX/Forms/ActionsToolbarForm.cs | 4 +- ShareX/Forms/MainForm.cs | 2 +- ShareX/Forms/MainForm.resx | 721 ++++++++++++++--------------- ShareX/TaskHelpers.cs | 12 + 4 files changed, 357 insertions(+), 382 deletions(-) diff --git a/ShareX/Forms/ActionsToolbarForm.cs b/ShareX/Forms/ActionsToolbarForm.cs index 8aac946c2..f1b61513d 100644 --- a/ShareX/Forms/ActionsToolbarForm.cs +++ b/ShareX/Forms/ActionsToolbarForm.cs @@ -40,7 +40,7 @@ public static ActionsToolbarForm Instance { get { - if (instance == null || instance.IsDisposed) + if (!IsInstanceActive) { instance = new ActionsToolbarForm(); } @@ -49,6 +49,8 @@ public static ActionsToolbarForm Instance } } + public static bool IsInstanceActive => instance != null && !instance.IsDisposed; + private IContainer components; private ToolStripEx tsMain; private ToolTip ttMain; diff --git a/ShareX/Forms/MainForm.cs b/ShareX/Forms/MainForm.cs index 78798d379..c2c4fb8e4 100644 --- a/ShareX/Forms/MainForm.cs +++ b/ShareX/Forms/MainForm.cs @@ -1676,7 +1676,7 @@ private void tsmiTrayToggleHotkeys_Click(object sender, EventArgs e) private void tsmiOpenActionsToolbar_Click(object sender, EventArgs e) { - TaskHelpers.OpenActionsToolbar(); + TaskHelpers.ToggleActionsToolbar(); } private void tsmiTrayShow_Click(object sender, EventArgs e) diff --git a/ShareX/Forms/MainForm.resx b/ShareX/Forms/MainForm.resx index 2ab8708a7..2fdb088e4 100644 --- a/ShareX/Forms/MainForm.resx +++ b/ShareX/Forms/MainForm.resx @@ -125,9 +125,6 @@ 160, 0 - - 567, 17 - Top, Right @@ -144,6 +141,9 @@ 3 + + 567, 17 + Show tips and hotkeys @@ -216,6 +216,45 @@ 2 + + Filename + + + 150 + + + Status + + + Progress + + + 125 + + + Speed + + + 75 + + + Elapsed + + + 45 + + + Remaining + + + 45 + + + URL + + + 145 + Fill @@ -312,102 +351,12 @@ 3 - - Filename - - - 150 - - - Status - - - Progress - - - 125 - - - Speed - - - 75 - - - Elapsed - - - 45 - - - Remaining - - - 45 - - - URL - - - 145 - Bottom, Right True - - pbPatreonOpen - - - System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - flpPatreon - - - 0 - - - pbPatreonHide - - - System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - flpPatreon - - - 1 - - - 613, 356 - - - 215, 45 - - - 3 - - - False - - - False - - - flpPatreon - - - System.Windows.Forms.FlowLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 2 - 0, 0 @@ -468,6 +417,33 @@ 1 + + 613, 356 + + + 215, 45 + + + 3 + + + False + + + False + + + flpPatreon + + + System.Windows.Forms.FlowLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 + 17, 17 @@ -477,42 +453,6 @@ Left - - 0, 0 - - - 6, 6, 6, 6 - - - 160, 407 - - - 1 - - - tsMain - - - System.Windows.Forms.ToolStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 4 - - - MiddleLeft - - - Magenta - - - 147, 20 - - - Capture - 191, 22 @@ -591,17 +531,17 @@ Auto capture... - + MiddleLeft - + Magenta - + 147, 20 - - Upload + + Capture 203, 22 @@ -633,6 +573,18 @@ Drag and drop upload... + + MiddleLeft + + + Magenta + + + 147, 20 + + + Upload + BottomLeft @@ -645,18 +597,6 @@ Workflows - - MiddleLeft - - - Magenta - - - 147, 20 - - - Tools - 183, 22 @@ -741,6 +681,18 @@ Monitor test... + + MiddleLeft + + + Magenta + + + 147, 20 + + + Tools + 147, 6 @@ -768,18 +720,6 @@ After upload tasks - - MiddleLeft - - - Magenta - - - 147, 20 - - - Destinations - 187, 22 @@ -819,6 +759,18 @@ Destination settings... + + MiddleLeft + + + Magenta + + + 147, 20 + + + Destinations + MiddleLeft @@ -894,18 +846,6 @@ Image history... - - MiddleLeft - - - Magenta - - - 147, 20 - - - Debug - 172, 22 @@ -942,6 +882,18 @@ Test URL sharing + + MiddleLeft + + + Magenta + + + 147, 20 + + + Debug + MiddleLeft @@ -966,18 +918,33 @@ About... + + 0, 0 + + + 6, 6, 6, 6 + + + 160, 407 + + + 1 + + + tsMain + + + System.Windows.Forms.ToolStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 4 + 286, 17 - - 174, 406 - - - cmsTaskInfo - - - System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 173, 22 @@ -990,12 +957,6 @@ Stop upload - - 173, 22 - - - Open - 156, 22 @@ -1041,11 +1002,11 @@ Thumbnail file - + 173, 22 - - Copy + + Open 233, 22 @@ -1179,6 +1140,12 @@ False + + 173, 22 + + + Copy + 173, 22 @@ -1260,12 +1227,6 @@ Hide columns - - 173, 22 - - - Image preview - 130, 22 @@ -1284,162 +1245,27 @@ Automatic + + 173, 22 + + + Image preview + + + 174, 406 + + + cmsTaskInfo + + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + 105, 17 190, 17 - - 188, 22 - - - Capture - - - 188, 22 - - - Upload - - - 188, 22 - - - Workflows - - - 188, 22 - - - Tools - - - 185, 6 - - - 188, 22 - - - After capture tasks - - - 188, 22 - - - After upload tasks - - - 188, 22 - - - Destinations - - - 188, 22 - - - Task settings... - - - 188, 22 - - - Application settings... - - - 188, 22 - - - Hotkey settings... - - - 188, 22 - - - Disable hotkeys - - - 185, 6 - - - 188, 22 - - - Screenshots folder... - - - 188, 22 - - - History... - - - 188, 22 - - - Image history... - - - 188, 22 - - - Debug - - - 188, 22 - - - Donate... - - - 188, 22 - - - About... - - - 185, 6 - - - 188, 22 - - - Recent links - - - False - - - 188, 22 - - - Open actions toolbar - - - 188, 22 - - - Open main window - - - 188, 22 - - - Exit - - - 189, 506 - - - cmsTray - - - System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ShareX - 191, 22 @@ -1518,6 +1344,12 @@ Auto capture... + + 192, 22 + + + Capture + 203, 22 @@ -1548,6 +1380,18 @@ Drag and drop upload... + + 192, 22 + + + Upload + + + 192, 22 + + + Workflows + 183, 22 @@ -1632,6 +1476,27 @@ Monitor test... + + 192, 22 + + + Tools + + + 189, 6 + + + 192, 22 + + + After capture tasks + + + 192, 22 + + + After upload tasks + 187, 22 @@ -1671,6 +1536,57 @@ Destination settings... + + 192, 22 + + + Destinations + + + 192, 22 + + + Task settings... + + + 192, 22 + + + Application settings... + + + 192, 22 + + + Hotkey settings... + + + 192, 22 + + + Disable hotkeys + + + 189, 6 + + + 192, 22 + + + Screenshots folder... + + + 192, 22 + + + History... + + + 192, 22 + + + Image history... + 172, 22 @@ -1707,6 +1623,66 @@ Test URL sharing + + 192, 22 + + + Debug + + + 192, 22 + + + Donate... + + + 192, 22 + + + About... + + + 189, 6 + + + 192, 22 + + + Recent links + + + False + + + 192, 22 + + + Toggle actions toolbar + + + 192, 22 + + + Open main window + + + 192, 22 + + + Exit + + + 193, 484 + + + cmsTray + + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ShareX + 405, 17 @@ -1716,6 +1692,27 @@ True + + True + + + Microsoft Sans Serif, 9.75pt + + + NoControl + + + 0, 0 + + + 10, 10, 10, 10 + + + 20, 36 + + + 0 + lblTips @@ -1752,42 +1749,6 @@ 5 - - True - - - Microsoft Sans Serif, 9.75pt - - - NoControl - - - 0, 0 - - - 10, 10, 10, 10 - - - 20, 36 - - - 0 - - - lblTips - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - pTips - - - 0 - - - 567, 17 - True diff --git a/ShareX/TaskHelpers.cs b/ShareX/TaskHelpers.cs index bbb5b9581..2a329fe42 100644 --- a/ShareX/TaskHelpers.cs +++ b/ShareX/TaskHelpers.cs @@ -1433,5 +1433,17 @@ public static void OpenActionsToolbar() { ActionsToolbarForm.Instance.ForceActivate(); } + + public static void ToggleActionsToolbar() + { + if (ActionsToolbarForm.IsInstanceActive) + { + ActionsToolbarForm.Instance.Close(); + } + else + { + ActionsToolbarForm.Instance.ForceActivate(); + } + } } } \ No newline at end of file