Added icons and hotkeys to quick task menu
100
ShareX/Properties/Resources.Designer.cs
generated
|
@ -1383,6 +1383,106 @@ public static System.Drawing.Bitmap notebook {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap notification_counter {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("notification_counter", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap notification_counter_00 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("notification_counter_00", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap notification_counter_02 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("notification_counter_02", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap notification_counter_03 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("notification_counter_03", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap notification_counter_04 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("notification_counter_04", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap notification_counter_05 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("notification_counter_05", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap notification_counter_06 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("notification_counter_06", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap notification_counter_07 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("notification_counter_07", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap notification_counter_08 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("notification_counter_08", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap notification_counter_09 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("notification_counter_09", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
|
|
|
@ -814,4 +814,34 @@ Would you like to restart ShareX?</value>
|
|||
<data name="layout_select" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\layout-select.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="notification_counter" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\notification-counter.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="notification_counter_00" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\notification-counter-00.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="notification_counter_02" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\notification-counter-02.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="notification_counter_03" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\notification-counter-03.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="notification_counter_04" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\notification-counter-04.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="notification_counter_05" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\notification-counter-05.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="notification_counter_06" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\notification-counter-06.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="notification_counter_07" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\notification-counter-07.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="notification_counter_08" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\notification-counter-08.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="notification_counter_09" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\notification-counter-09.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
|
@ -24,6 +24,9 @@ You should have received a copy of the GNU General Public License
|
|||
#endregion License Information (GPL v3)
|
||||
|
||||
using ShareX.HelpersLib;
|
||||
using ShareX.Properties;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
@ -34,29 +37,39 @@ public class QuickTaskMenu
|
|||
public delegate void TaskInfoSelectedEventHandler(QuickTaskInfo taskInfo);
|
||||
public TaskInfoSelectedEventHandler TaskInfoSelected;
|
||||
|
||||
private ContextMenuStrip cms;
|
||||
private List<QuickTaskInfo> quickTaskInfoList;
|
||||
|
||||
public void ShowMenu()
|
||||
{
|
||||
ContextMenuStrip cms = new ContextMenuStrip
|
||||
quickTaskInfoList = new List<QuickTaskInfo>();
|
||||
|
||||
cms = new ContextMenuStrip()
|
||||
{
|
||||
Font = new Font("Arial", 10f),
|
||||
AutoClose = false,
|
||||
ShowImageMargin = false
|
||||
Font = new Font("Arial", 10f)
|
||||
};
|
||||
|
||||
cms.KeyUp += Cms_KeyUp;
|
||||
cms.Closed += (sender, e) => cms = null;
|
||||
|
||||
if (Program.Settings != null && Program.Settings.QuickTaskPresets != null && Program.Settings.QuickTaskPresets.Count > 0)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
foreach (QuickTaskInfo taskInfo in Program.Settings.QuickTaskPresets)
|
||||
{
|
||||
if (taskInfo.IsValid)
|
||||
{
|
||||
ToolStripMenuItem tsmi = new ToolStripMenuItem { Text = taskInfo.ToString().Replace("&", "&&"), Tag = taskInfo };
|
||||
tsmi.Image = GetNumberImage(index);
|
||||
tsmi.Click += (sender, e) =>
|
||||
{
|
||||
QuickTaskInfo selectedTaskInfo = ((ToolStripMenuItem)sender).Tag as QuickTaskInfo;
|
||||
cms.Close();
|
||||
OnTaskInfoSelected(selectedTaskInfo);
|
||||
};
|
||||
cms.Items.Add(tsmi);
|
||||
quickTaskInfoList.Add(taskInfo);
|
||||
index++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -71,6 +84,7 @@ public void ShowMenu()
|
|||
|
||||
// Translate
|
||||
ToolStripMenuItem tsmiEdit = new ToolStripMenuItem("Edit this menu...");
|
||||
tsmiEdit.Image = Resources.gear;
|
||||
tsmiEdit.Click += (sender, e) =>
|
||||
{
|
||||
cms.Close();
|
||||
|
@ -81,6 +95,7 @@ public void ShowMenu()
|
|||
cms.Items.Add(new ToolStripSeparator());
|
||||
|
||||
ToolStripMenuItem tsmiCancel = new ToolStripMenuItem("Cancel");
|
||||
tsmiCancel.Image = Resources.cross;
|
||||
tsmiCancel.Click += (sender, e) => cms.Close();
|
||||
cms.Items.Add(tsmiCancel);
|
||||
|
||||
|
@ -89,10 +104,59 @@ public void ShowMenu()
|
|||
cms.Show(cursorPosition);
|
||||
}
|
||||
|
||||
private void Cms_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.D1: case Keys.NumPad1: ExecuteTaskAt(0); break;
|
||||
case Keys.D2: case Keys.NumPad2: ExecuteTaskAt(1); break;
|
||||
case Keys.D3: case Keys.NumPad3: ExecuteTaskAt(2); break;
|
||||
case Keys.D4: case Keys.NumPad4: ExecuteTaskAt(3); break;
|
||||
case Keys.D5: case Keys.NumPad5: ExecuteTaskAt(4); break;
|
||||
case Keys.D6: case Keys.NumPad6: ExecuteTaskAt(5); break;
|
||||
case Keys.D7: case Keys.NumPad7: ExecuteTaskAt(6); break;
|
||||
case Keys.D8: case Keys.NumPad8: ExecuteTaskAt(7); break;
|
||||
case Keys.D9: case Keys.NumPad9: ExecuteTaskAt(8); break;
|
||||
case Keys.D0: case Keys.NumPad0: ExecuteTaskAt(9); break;
|
||||
}
|
||||
}
|
||||
|
||||
private Image GetNumberImage(int index)
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
case 0: return Resources.notification_counter;
|
||||
case 1: return Resources.notification_counter_02;
|
||||
case 2: return Resources.notification_counter_03;
|
||||
case 3: return Resources.notification_counter_04;
|
||||
case 4: return Resources.notification_counter_05;
|
||||
case 5: return Resources.notification_counter_06;
|
||||
case 6: return Resources.notification_counter_07;
|
||||
case 7: return Resources.notification_counter_08;
|
||||
case 8: return Resources.notification_counter_09;
|
||||
case 9: return Resources.notification_counter_00;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void ExecuteTaskAt(int index)
|
||||
{
|
||||
if (quickTaskInfoList != null && quickTaskInfoList.Count > 0 && quickTaskInfoList.Count > index)
|
||||
{
|
||||
OnTaskInfoSelected(quickTaskInfoList[index]);
|
||||
}
|
||||
}
|
||||
|
||||
protected void OnTaskInfoSelected(QuickTaskInfo taskInfo)
|
||||
{
|
||||
if (TaskInfoSelected != null)
|
||||
{
|
||||
if (cms != null && !cms.IsDisposed)
|
||||
{
|
||||
cms.Close();
|
||||
}
|
||||
|
||||
TaskInfoSelected(taskInfo);
|
||||
}
|
||||
}
|
||||
|
|
BIN
ShareX/Resources/notification-counter-00.png
Normal file
After Width: | Height: | Size: 492 B |
BIN
ShareX/Resources/notification-counter-02.png
Normal file
After Width: | Height: | Size: 424 B |
BIN
ShareX/Resources/notification-counter-03.png
Normal file
After Width: | Height: | Size: 429 B |
BIN
ShareX/Resources/notification-counter-04.png
Normal file
After Width: | Height: | Size: 421 B |
BIN
ShareX/Resources/notification-counter-05.png
Normal file
After Width: | Height: | Size: 423 B |
BIN
ShareX/Resources/notification-counter-06.png
Normal file
After Width: | Height: | Size: 428 B |
BIN
ShareX/Resources/notification-counter-07.png
Normal file
After Width: | Height: | Size: 416 B |
BIN
ShareX/Resources/notification-counter-08.png
Normal file
After Width: | Height: | Size: 434 B |
BIN
ShareX/Resources/notification-counter-09.png
Normal file
After Width: | Height: | Size: 423 B |
BIN
ShareX/Resources/notification-counter.png
Normal file
After Width: | Height: | Size: 407 B |
|
@ -1266,6 +1266,16 @@
|
|||
<None Include="Resources\document-break.png" />
|
||||
<None Include="Resources\vn.png" />
|
||||
<None Include="Resources\layout-select.png" />
|
||||
<None Include="Resources\notification-counter.png" />
|
||||
<None Include="Resources\notification-counter-02.png" />
|
||||
<None Include="Resources\notification-counter-03.png" />
|
||||
<None Include="Resources\notification-counter-04.png" />
|
||||
<None Include="Resources\notification-counter-05.png" />
|
||||
<None Include="Resources\notification-counter-06.png" />
|
||||
<None Include="Resources\notification-counter-07.png" />
|
||||
<None Include="Resources\notification-counter-08.png" />
|
||||
<None Include="Resources\notification-counter-09.png" />
|
||||
<None Include="Resources\notification-counter-00.png" />
|
||||
<Content Include="ShareX_Icon.ico" />
|
||||
<None Include="Resources\globe--pencil.png" />
|
||||
<None Include="Resources\camcorder--pencil.png" />
|
||||
|
|