diff --git a/ShareX.ScreenCaptureLib/Forms/TextDrawingInputBox.Designer.cs b/ShareX.ScreenCaptureLib/Forms/TextDrawingInputBox.Designer.cs index e4fc36fa2..e1519c827 100644 --- a/ShareX.ScreenCaptureLib/Forms/TextDrawingInputBox.Designer.cs +++ b/ShareX.ScreenCaptureLib/Forms/TextDrawingInputBox.Designer.cs @@ -233,6 +233,7 @@ private void InitializeComponent() // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.SystemColors.Window; this.Controls.Add(this.btnOK); this.Controls.Add(this.flpProperties); this.Controls.Add(this.txtInput); diff --git a/ShareX/Forms/SimpleActionsEditForm.Designer.cs b/ShareX/Forms/SimpleActionsEditForm.Designer.cs new file mode 100644 index 000000000..79eed6f74 --- /dev/null +++ b/ShareX/Forms/SimpleActionsEditForm.Designer.cs @@ -0,0 +1,114 @@ +namespace ShareX +{ + partial class SimpleActionsEditForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.btnRemove = new System.Windows.Forms.Button(); + this.btnAdd = new ShareX.HelpersLib.MenuButton(); + this.cmsAction = new System.Windows.Forms.ContextMenuStrip(this.components); + this.lvActions = new ShareX.HelpersLib.MyListView(); + this.chAction = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.ilMain = new System.Windows.Forms.ImageList(this.components); + this.SuspendLayout(); + // + // btnRemove + // + this.btnRemove.Location = new System.Drawing.Point(128, 8); + this.btnRemove.Name = "btnRemove"; + this.btnRemove.Size = new System.Drawing.Size(112, 23); + this.btnRemove.TabIndex = 1; + this.btnRemove.Text = "Remove"; + this.btnRemove.UseVisualStyleBackColor = true; + this.btnRemove.Click += new System.EventHandler(this.btnRemove_Click); + // + // btnAdd + // + this.btnAdd.Location = new System.Drawing.Point(8, 8); + this.btnAdd.Menu = this.cmsAction; + this.btnAdd.Name = "btnAdd"; + this.btnAdd.Size = new System.Drawing.Size(115, 23); + this.btnAdd.TabIndex = 2; + this.btnAdd.Text = "Add"; + this.btnAdd.UseVisualStyleBackColor = true; + // + // cmsAction + // + this.cmsAction.Name = "cmsAction"; + this.cmsAction.Size = new System.Drawing.Size(61, 4); + // + // lvActions + // + this.lvActions.AutoFillColumn = true; + this.lvActions.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.chAction}); + this.lvActions.FullRowSelect = true; + this.lvActions.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; + this.lvActions.Location = new System.Drawing.Point(8, 40); + this.lvActions.Name = "lvActions"; + this.lvActions.Size = new System.Drawing.Size(448, 368); + this.lvActions.SmallImageList = this.ilMain; + this.lvActions.TabIndex = 3; + this.lvActions.UseCompatibleStateImageBehavior = false; + this.lvActions.View = System.Windows.Forms.View.Details; + // + // chAction + // + this.chAction.Width = 435; + // + // ilMain + // + this.ilMain.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit; + this.ilMain.ImageSize = new System.Drawing.Size(16, 16); + this.ilMain.TransparentColor = System.Drawing.Color.Transparent; + // + // SimpleActionsEditForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.SystemColors.Window; + this.ClientSize = new System.Drawing.Size(466, 417); + this.Controls.Add(this.lvActions); + this.Controls.Add(this.btnAdd); + this.Controls.Add(this.btnRemove); + this.Name = "SimpleActionsEditForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "ShareX - Simple actions edit"; + this.ResumeLayout(false); + + } + + #endregion + private System.Windows.Forms.Button btnRemove; + private HelpersLib.MenuButton btnAdd; + private System.Windows.Forms.ContextMenuStrip cmsAction; + private HelpersLib.MyListView lvActions; + private System.Windows.Forms.ColumnHeader chAction; + private System.Windows.Forms.ImageList ilMain; + } +} \ No newline at end of file diff --git a/ShareX/Forms/SimpleActionsEditForm.cs b/ShareX/Forms/SimpleActionsEditForm.cs new file mode 100644 index 000000000..c9faa8c82 --- /dev/null +++ b/ShareX/Forms/SimpleActionsEditForm.cs @@ -0,0 +1,146 @@ +#region License Information (GPL v3) + +/* + ShareX - A program that allows you to take screenshots and share any file type + Copyright (c) 2007-2016 ShareX Team + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Optionally you can also view the license at . +*/ + +#endregion License Information (GPL v3) + +using ShareX.HelpersLib; +using ShareX.Properties; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace ShareX +{ + public partial class SimpleActionsEditForm : Form + { + public List Actions { get; private set; } + + public SimpleActionsEditForm(List actions) + { + InitializeComponent(); + Icon = ShareXResources.Icon; + + Actions = actions; + + foreach (HotkeyType hotkeyType in Helpers.GetEnums()) + { + Image img; + + if (hotkeyType == HotkeyType.None) + { + img = Resources.ui_splitter; + } + else + { + img = TaskHelpers.GetHotkeyTypeIcon(hotkeyType); + } + + ilMain.Images.Add(hotkeyType.ToString(), img); + } + + AddEnumItemsContextMenu(x => + { + AddActionToList(x); + }, cmsAction); + + foreach (HotkeyType action in Actions) + { + AddActionToList(action); + } + } + + private void AddEnumItemsContextMenu(Action selectedEnum, params ToolStripDropDown[] parents) + { + EnumInfo[] enums = Helpers.GetEnums().OfType().Select(x => new EnumInfo(x)).ToArray(); + + foreach (ToolStripDropDown parent in parents) + { + foreach (EnumInfo enumInfo in enums) + { + HotkeyType hotkeyType = (HotkeyType)Enum.ToObject(typeof(HotkeyType), enumInfo.Value); + + Image img; + + if (hotkeyType == HotkeyType.None) + { + img = Resources.ui_splitter; + } + else + { + img = TaskHelpers.GetHotkeyTypeIcon(hotkeyType); + } + + ToolStripMenuItem tsmi = new ToolStripMenuItem(enumInfo.Description.Replace("&", "&&")); + tsmi.Image = img; + tsmi.Tag = enumInfo; + + tsmi.Click += (sender, e) => + { + selectedEnum(hotkeyType); + }; + + if (!string.IsNullOrEmpty(enumInfo.Category)) + { + ToolStripMenuItem tsmiParent = parent.Items.OfType().FirstOrDefault(x => x.Text == enumInfo.Category); + + if (tsmiParent == null) + { + tsmiParent = new ToolStripMenuItem(enumInfo.Category); + parent.Items.Add(tsmiParent); + } + + tsmiParent.DropDownItems.Add(tsmi); + } + else + { + parent.Items.Add(tsmi); + } + } + } + } + + private void AddActionToList(HotkeyType hotkeyType) + { + ListViewItem lvi = new ListViewItem() + { + Text = hotkeyType.GetLocalizedDescription(), + ImageKey = hotkeyType.ToString() + }; + + lvActions.Items.Add(lvi); + } + + private void btnRemove_Click(object sender, EventArgs e) + { + if (lvActions.SelectedItems.Count > 0) + { + lvActions.Items.Remove(lvActions.SelectedItems[0]); + } + } + } +} \ No newline at end of file diff --git a/ShareX/Forms/SimpleActionsEditForm.resx b/ShareX/Forms/SimpleActionsEditForm.resx new file mode 100644 index 000000000..92efb8ae5 --- /dev/null +++ b/ShareX/Forms/SimpleActionsEditForm.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 125, 17 + + \ No newline at end of file diff --git a/ShareX/Forms/SimpleActionsForm.cs b/ShareX/Forms/SimpleActionsForm.cs index 4791a961f..d28c1934d 100644 --- a/ShareX/Forms/SimpleActionsForm.cs +++ b/ShareX/Forms/SimpleActionsForm.cs @@ -224,6 +224,10 @@ private void tslTitle_MouseUp(object sender, MouseEventArgs e) { Close(); } + else if (e.Button == MouseButtons.Middle) + { + new SimpleActionsEditForm(Actions).Show(); + } } } } \ No newline at end of file diff --git a/ShareX/Properties/Resources.Designer.cs b/ShareX/Properties/Resources.Designer.cs index 007912ad1..150a3c7bd 100644 --- a/ShareX/Properties/Resources.Designer.cs +++ b/ShareX/Properties/Resources.Designer.cs @@ -2100,6 +2100,16 @@ public class Resources { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap ui_splitter { + get { + object obj = ResourceManager.GetObject("ui_splitter", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/ShareX/Properties/Resources.resx b/ShareX/Properties/Resources.resx index 28df1a32a..51c917625 100644 --- a/ShareX/Properties/Resources.resx +++ b/ShareX/Properties/Resources.resx @@ -870,4 +870,7 @@ Tray icon tasks: ..\Resources\drive-upload.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\ui-splitter.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/ShareX/Resources/ui-splitter.png b/ShareX/Resources/ui-splitter.png new file mode 100644 index 000000000..f05169198 Binary files /dev/null and b/ShareX/Resources/ui-splitter.png differ diff --git a/ShareX/ShareX.csproj b/ShareX/ShareX.csproj index aacd90222..787d752b9 100644 --- a/ShareX/ShareX.csproj +++ b/ShareX/ShareX.csproj @@ -204,6 +204,12 @@ FirstTimeConfigForm.cs + + Form + + + SimpleActionsEditForm.cs + Form @@ -989,6 +995,9 @@ FirstTimeConfigForm.cs + + SimpleActionsEditForm.cs + TaskSettingsForm.cs @@ -1322,6 +1331,7 @@ +