diff --git a/ShareX.HelpersLib/Controls/ToolStripNumericUpDown.cs b/ShareX.HelpersLib/Controls/ToolStripNumericUpDown.cs new file mode 100644 index 000000000..cc3733035 --- /dev/null +++ b/ShareX.HelpersLib/Controls/ToolStripNumericUpDown.cs @@ -0,0 +1,74 @@ +#region License Information (GPL v3) + +/* + ShareX - A program that allows you to take screenshots and share any file type + Copyright (c) 2007-2018 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 System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using System.Windows.Forms.Design; + +namespace ShareX.HelpersLib +{ + [ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.ToolStrip)] + public class ToolStripNumericUpDown : ToolStripControlHost + { + public event EventHandler ValueChanged; + + public NumericUpDown NumericUpDownControl + { + get + { + return Control as NumericUpDown; + } + } + + public ToolStripNumericUpDown() : base(new NumericUpDown()) + { + } + + protected override void OnSubscribeControlEvents(Control control) + { + base.OnSubscribeControlEvents(control); + + ((NumericUpDown)control).ValueChanged += new EventHandler(OnValueChanged); + } + + protected override void OnUnsubscribeControlEvents(Control control) + { + base.OnUnsubscribeControlEvents(control); + + ((NumericUpDown)control).ValueChanged -= new EventHandler(OnValueChanged); + } + + public void OnValueChanged(object sender, EventArgs e) + { + if (ValueChanged != null) + { + ValueChanged(this, e); + } + } + } +} \ No newline at end of file diff --git a/ShareX.HelpersLib/ShareX.HelpersLib.csproj b/ShareX.HelpersLib/ShareX.HelpersLib.csproj index e378118b5..2b095736a 100644 --- a/ShareX.HelpersLib/ShareX.HelpersLib.csproj +++ b/ShareX.HelpersLib/ShareX.HelpersLib.csproj @@ -126,6 +126,9 @@ Component + + Component + diff --git a/ShareX.ScreenCaptureLib/Forms/StickerForm.Designer.cs b/ShareX.ScreenCaptureLib/Forms/StickerForm.Designer.cs index 23e236158..102e17096 100644 --- a/ShareX.ScreenCaptureLib/Forms/StickerForm.Designer.cs +++ b/ShareX.ScreenCaptureLib/Forms/StickerForm.Designer.cs @@ -30,17 +30,17 @@ private void InitializeComponent() { this.ilvStickers = new Manina.Windows.Forms.ImageListView(); this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer(); - this.toolStrip2 = new System.Windows.Forms.ToolStrip(); - this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel(); - this.toolStripTextBox1 = new System.Windows.Forms.ToolStripTextBox(); - this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel(); - this.toolStripComboBox1 = new System.Windows.Forms.ToolStripComboBox(); - this.toolStripLabel3 = new System.Windows.Forms.ToolStripLabel(); - this.toolStripTextBox3 = new System.Windows.Forms.ToolStripTextBox(); + this.tsMain = new System.Windows.Forms.ToolStrip(); + this.tslSearch = new System.Windows.Forms.ToolStripLabel(); + this.tstbSearch = new System.Windows.Forms.ToolStripTextBox(); + this.tslStickers = new System.Windows.Forms.ToolStripLabel(); + this.tscbStickers = new System.Windows.Forms.ToolStripComboBox(); + this.tslSize = new System.Windows.Forms.ToolStripLabel(); + this.tsnudSize = new ShareX.HelpersLib.ToolStripNumericUpDown(); this.toolStripContainer1.ContentPanel.SuspendLayout(); this.toolStripContainer1.TopToolStripPanel.SuspendLayout(); this.toolStripContainer1.SuspendLayout(); - this.toolStrip2.SuspendLayout(); + this.tsMain.SuspendLayout(); this.SuspendLayout(); // // ilvStickers @@ -53,7 +53,7 @@ private void InitializeComponent() this.ilvStickers.Name = "ilvStickers"; this.ilvStickers.PersistentCacheDirectory = ""; this.ilvStickers.PersistentCacheSize = ((long)(100)); - this.ilvStickers.Size = new System.Drawing.Size(784, 484); + this.ilvStickers.Size = new System.Drawing.Size(784, 481); this.ilvStickers.TabIndex = 0; // // toolStripContainer1 @@ -62,7 +62,7 @@ private void InitializeComponent() // toolStripContainer1.ContentPanel // this.toolStripContainer1.ContentPanel.Controls.Add(this.ilvStickers); - this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(784, 484); + this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(784, 481); this.toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill; this.toolStripContainer1.Location = new System.Drawing.Point(0, 0); this.toolStripContainer1.Name = "toolStripContainer1"; @@ -72,68 +72,67 @@ private void InitializeComponent() // // toolStripContainer1.TopToolStripPanel // - this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.toolStrip2); + this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.tsMain); // - // toolStrip2 + // tsMain // - this.toolStrip2.Dock = System.Windows.Forms.DockStyle.None; - this.toolStrip2.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; - this.toolStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripLabel1, - this.toolStripTextBox1, - this.toolStripLabel2, - this.toolStripComboBox1, - this.toolStripLabel3, - this.toolStripTextBox3}); - this.toolStrip2.Location = new System.Drawing.Point(0, 0); - this.toolStrip2.Name = "toolStrip2"; - this.toolStrip2.Padding = new System.Windows.Forms.Padding(2); - this.toolStrip2.Size = new System.Drawing.Size(784, 27); - this.toolStrip2.Stretch = true; - this.toolStrip2.TabIndex = 0; + this.tsMain.Dock = System.Windows.Forms.DockStyle.None; + this.tsMain.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; + this.tsMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.tslSearch, + this.tstbSearch, + this.tslStickers, + this.tscbStickers, + this.tslSize, + this.tsnudSize}); + this.tsMain.Location = new System.Drawing.Point(0, 0); + this.tsMain.Name = "tsMain"; + this.tsMain.Padding = new System.Windows.Forms.Padding(2); + this.tsMain.Size = new System.Drawing.Size(784, 30); + this.tsMain.Stretch = true; + this.tsMain.TabIndex = 0; // - // toolStripLabel1 + // tslSearch // - this.toolStripLabel1.Name = "toolStripLabel1"; - this.toolStripLabel1.Size = new System.Drawing.Size(45, 20); - this.toolStripLabel1.Text = "Search:"; + this.tslSearch.Name = "tslSearch"; + this.tslSearch.Size = new System.Drawing.Size(45, 23); + this.tslSearch.Text = "Search:"; // - // toolStripTextBox1 + // tstbSearch // - this.toolStripTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.toolStripTextBox1.Name = "toolStripTextBox1"; - this.toolStripTextBox1.Size = new System.Drawing.Size(100, 23); + this.tstbSearch.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.tstbSearch.Name = "tstbSearch"; + this.tstbSearch.Size = new System.Drawing.Size(100, 26); // - // toolStripLabel2 + // tslStickers // - this.toolStripLabel2.Margin = new System.Windows.Forms.Padding(2, 1, 0, 2); - this.toolStripLabel2.Name = "toolStripLabel2"; - this.toolStripLabel2.Size = new System.Drawing.Size(50, 20); - this.toolStripLabel2.Text = "Stickers:"; + this.tslStickers.Margin = new System.Windows.Forms.Padding(2, 1, 0, 2); + this.tslStickers.Name = "tslStickers"; + this.tslStickers.Size = new System.Drawing.Size(50, 23); + this.tslStickers.Text = "Stickers:"; // - // toolStripComboBox1 + // tscbStickers // - this.toolStripComboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.toolStripComboBox1.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.toolStripComboBox1.Items.AddRange(new object[] { + this.tscbStickers.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.tscbStickers.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.tscbStickers.Items.AddRange(new object[] { "Blob Emoji"}); - this.toolStripComboBox1.Name = "toolStripComboBox1"; - this.toolStripComboBox1.Size = new System.Drawing.Size(121, 23); + this.tscbStickers.Name = "tscbStickers"; + this.tscbStickers.Size = new System.Drawing.Size(121, 26); // - // toolStripLabel3 + // tslSize // - this.toolStripLabel3.Margin = new System.Windows.Forms.Padding(2, 1, 0, 2); - this.toolStripLabel3.Name = "toolStripLabel3"; - this.toolStripLabel3.Size = new System.Drawing.Size(30, 20); - this.toolStripLabel3.Text = "Size:"; + this.tslSize.Margin = new System.Windows.Forms.Padding(2, 1, 0, 2); + this.tslSize.Name = "tslSize"; + this.tslSize.Size = new System.Drawing.Size(30, 23); + this.tslSize.Text = "Size:"; // - // toolStripTextBox3 + // tsnudSize // - this.toolStripTextBox3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.toolStripTextBox3.Name = "toolStripTextBox3"; - this.toolStripTextBox3.Size = new System.Drawing.Size(30, 23); - this.toolStripTextBox3.Text = "64"; - this.toolStripTextBox3.TextBoxTextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.tsnudSize.Name = "tsnudSize"; + this.tsnudSize.Size = new System.Drawing.Size(41, 23); + this.tsnudSize.Text = "16"; + this.tsnudSize.ValueChanged += new System.EventHandler(this.tsnudSize_ValueChanged); // // StickerForm // @@ -149,8 +148,8 @@ private void InitializeComponent() this.toolStripContainer1.TopToolStripPanel.PerformLayout(); this.toolStripContainer1.ResumeLayout(false); this.toolStripContainer1.PerformLayout(); - this.toolStrip2.ResumeLayout(false); - this.toolStrip2.PerformLayout(); + this.tsMain.ResumeLayout(false); + this.tsMain.PerformLayout(); this.ResumeLayout(false); } @@ -159,12 +158,12 @@ private void InitializeComponent() private Manina.Windows.Forms.ImageListView ilvStickers; private System.Windows.Forms.ToolStripContainer toolStripContainer1; - private System.Windows.Forms.ToolStrip toolStrip2; - private System.Windows.Forms.ToolStripLabel toolStripLabel1; - private System.Windows.Forms.ToolStripTextBox toolStripTextBox1; - private System.Windows.Forms.ToolStripLabel toolStripLabel2; - private System.Windows.Forms.ToolStripLabel toolStripLabel3; - private System.Windows.Forms.ToolStripTextBox toolStripTextBox3; - private System.Windows.Forms.ToolStripComboBox toolStripComboBox1; + private System.Windows.Forms.ToolStrip tsMain; + private System.Windows.Forms.ToolStripLabel tslSearch; + private System.Windows.Forms.ToolStripTextBox tstbSearch; + private System.Windows.Forms.ToolStripLabel tslStickers; + private System.Windows.Forms.ToolStripLabel tslSize; + private System.Windows.Forms.ToolStripComboBox tscbStickers; + private HelpersLib.ToolStripNumericUpDown tsnudSize; } } \ No newline at end of file diff --git a/ShareX.ScreenCaptureLib/Forms/StickerForm.cs b/ShareX.ScreenCaptureLib/Forms/StickerForm.cs index f0efabf79..2fee9a05f 100644 --- a/ShareX.ScreenCaptureLib/Forms/StickerForm.cs +++ b/ShareX.ScreenCaptureLib/Forms/StickerForm.cs @@ -42,7 +42,11 @@ public StickerForm() { InitializeComponent(); Icon = ShareXResources.Icon; - toolStrip2.Renderer = new CustomToolStripProfessionalRenderer(); + tsMain.Renderer = new CustomToolStripProfessionalRenderer(); + tsnudSize.NumericUpDownControl.Minimum = 16; + tsnudSize.NumericUpDownControl.Maximum = 512; + tsnudSize.NumericUpDownControl.Increment = 16; + tsnudSize.NumericUpDownControl.TextAlign = HorizontalAlignment.Center; ilvStickers.SetRenderer(new StickerImageListViewRenderer()); ilvStickers.ThumbnailSize = new Size(64, 64); ilvStickers.Colors.SelectedColor1 = Color.Transparent; @@ -50,7 +54,13 @@ public StickerForm() ilvStickers.Colors.HoverColor1 = Color.Transparent; ilvStickers.Colors.HoverColor2 = Color.FromArgb(252, 221, 132); ilvStickers.Items.AddRange(Directory.GetFiles("blobs", "*.png")); - toolStripComboBox1.SelectedIndex = 0; + tscbStickers.SelectedIndex = 0; + } + + private void tsnudSize_ValueChanged(object sender, EventArgs e) + { + int size = (int)tsnudSize.NumericUpDownControl.Value; + ilvStickers.ThumbnailSize = new Size(size, size); } } } \ No newline at end of file diff --git a/ShareX.ScreenCaptureLib/Forms/StickerForm.resx b/ShareX.ScreenCaptureLib/Forms/StickerForm.resx index c30babd2e..367b4b365 100644 --- a/ShareX.ScreenCaptureLib/Forms/StickerForm.resx +++ b/ShareX.ScreenCaptureLib/Forms/StickerForm.resx @@ -117,7 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + 17, 17