mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-02 18:26:27 +13:00
Adding sticker pack form
This commit is contained in:
parent
ee96cd98fb
commit
025d0ccbe7
6 changed files with 405 additions and 3 deletions
|
@ -63,7 +63,10 @@ public StickerForm(List<StickerPackInfo> stickerPacks, int stickerSize = 64)
|
|||
{
|
||||
tscbStickers.Items.Add(stickerPackInfo);
|
||||
}
|
||||
if (tscbStickers.Items.Count > 0)
|
||||
{
|
||||
tscbStickers.SelectedIndex = 0;
|
||||
}
|
||||
tstbSearch.Focus();
|
||||
}
|
||||
|
||||
|
@ -149,7 +152,10 @@ private void tscbStickers_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
||||
private void tsbEditStickers_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
using (StickerPackForm stickerPackForm = new StickerPackForm(StickerPacks))
|
||||
{
|
||||
stickerPackForm.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void tsnudSize_ValueChanged(object sender, EventArgs e)
|
||||
|
|
149
ShareX.ScreenCaptureLib/Forms/StickerPackForm.Designer.cs
generated
Normal file
149
ShareX.ScreenCaptureLib/Forms/StickerPackForm.Designer.cs
generated
Normal file
|
@ -0,0 +1,149 @@
|
|||
namespace ShareX.ScreenCaptureLib
|
||||
{
|
||||
partial class StickerPackForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.lblFolder = new System.Windows.Forms.Label();
|
||||
this.txtFolder = new System.Windows.Forms.TextBox();
|
||||
this.lblName = new System.Windows.Forms.Label();
|
||||
this.txtName = new System.Windows.Forms.TextBox();
|
||||
this.cbStickers = new System.Windows.Forms.ComboBox();
|
||||
this.btnAdd = new System.Windows.Forms.Button();
|
||||
this.btnRemove = new System.Windows.Forms.Button();
|
||||
this.btnFolderBrowse = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lblFolder
|
||||
//
|
||||
this.lblFolder.AutoSize = true;
|
||||
this.lblFolder.Location = new System.Drawing.Point(8, 64);
|
||||
this.lblFolder.Name = "lblFolder";
|
||||
this.lblFolder.Size = new System.Drawing.Size(39, 13);
|
||||
this.lblFolder.TabIndex = 0;
|
||||
this.lblFolder.Text = "Folder:";
|
||||
//
|
||||
// txtFolder
|
||||
//
|
||||
this.txtFolder.Location = new System.Drawing.Point(56, 60);
|
||||
this.txtFolder.Name = "txtFolder";
|
||||
this.txtFolder.Size = new System.Drawing.Size(160, 20);
|
||||
this.txtFolder.TabIndex = 1;
|
||||
this.txtFolder.TextChanged += new System.EventHandler(this.txtFolder_TextChanged);
|
||||
//
|
||||
// lblName
|
||||
//
|
||||
this.lblName.AutoSize = true;
|
||||
this.lblName.Location = new System.Drawing.Point(8, 88);
|
||||
this.lblName.Name = "lblName";
|
||||
this.lblName.Size = new System.Drawing.Size(38, 13);
|
||||
this.lblName.TabIndex = 2;
|
||||
this.lblName.Text = "Name:";
|
||||
//
|
||||
// txtName
|
||||
//
|
||||
this.txtName.Location = new System.Drawing.Point(56, 84);
|
||||
this.txtName.Name = "txtName";
|
||||
this.txtName.Size = new System.Drawing.Size(160, 20);
|
||||
this.txtName.TabIndex = 3;
|
||||
this.txtName.TextChanged += new System.EventHandler(this.txtName_TextChanged);
|
||||
//
|
||||
// cbStickers
|
||||
//
|
||||
this.cbStickers.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cbStickers.FormattingEnabled = true;
|
||||
this.cbStickers.Location = new System.Drawing.Point(8, 8);
|
||||
this.cbStickers.Name = "cbStickers";
|
||||
this.cbStickers.Size = new System.Drawing.Size(208, 21);
|
||||
this.cbStickers.TabIndex = 4;
|
||||
this.cbStickers.SelectedIndexChanged += new System.EventHandler(this.cbStickers_SelectedIndexChanged);
|
||||
//
|
||||
// btnAdd
|
||||
//
|
||||
this.btnAdd.Location = new System.Drawing.Point(8, 32);
|
||||
this.btnAdd.Name = "btnAdd";
|
||||
this.btnAdd.Size = new System.Drawing.Size(104, 23);
|
||||
this.btnAdd.TabIndex = 5;
|
||||
this.btnAdd.Text = "Add";
|
||||
this.btnAdd.UseVisualStyleBackColor = true;
|
||||
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
|
||||
//
|
||||
// btnRemove
|
||||
//
|
||||
this.btnRemove.Location = new System.Drawing.Point(112, 32);
|
||||
this.btnRemove.Name = "btnRemove";
|
||||
this.btnRemove.Size = new System.Drawing.Size(104, 23);
|
||||
this.btnRemove.TabIndex = 6;
|
||||
this.btnRemove.Text = "Remove";
|
||||
this.btnRemove.UseVisualStyleBackColor = true;
|
||||
this.btnRemove.Click += new System.EventHandler(this.btnRemove_Click);
|
||||
//
|
||||
// btnFolderBrowse
|
||||
//
|
||||
this.btnFolderBrowse.Location = new System.Drawing.Point(218, 59);
|
||||
this.btnFolderBrowse.Name = "btnFolderBrowse";
|
||||
this.btnFolderBrowse.Size = new System.Drawing.Size(24, 23);
|
||||
this.btnFolderBrowse.TabIndex = 7;
|
||||
this.btnFolderBrowse.Text = "...";
|
||||
this.btnFolderBrowse.UseVisualStyleBackColor = true;
|
||||
this.btnFolderBrowse.Click += new System.EventHandler(this.btnFolderBrowse_Click);
|
||||
//
|
||||
// StickerPackForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(248, 113);
|
||||
this.Controls.Add(this.btnFolderBrowse);
|
||||
this.Controls.Add(this.btnRemove);
|
||||
this.Controls.Add(this.btnAdd);
|
||||
this.Controls.Add(this.cbStickers);
|
||||
this.Controls.Add(this.txtName);
|
||||
this.Controls.Add(this.lblName);
|
||||
this.Controls.Add(this.txtFolder);
|
||||
this.Controls.Add(this.lblFolder);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "StickerPackForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "ShareX - Sticker packs";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label lblFolder;
|
||||
private System.Windows.Forms.TextBox txtFolder;
|
||||
private System.Windows.Forms.Label lblName;
|
||||
private System.Windows.Forms.TextBox txtName;
|
||||
private System.Windows.Forms.ComboBox cbStickers;
|
||||
private System.Windows.Forms.Button btnAdd;
|
||||
private System.Windows.Forms.Button btnRemove;
|
||||
private System.Windows.Forms.Button btnFolderBrowse;
|
||||
}
|
||||
}
|
118
ShareX.ScreenCaptureLib/Forms/StickerPackForm.cs
Normal file
118
ShareX.ScreenCaptureLib/Forms/StickerPackForm.cs
Normal file
|
@ -0,0 +1,118 @@
|
|||
#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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#endregion License Information (GPL v3)
|
||||
|
||||
using ShareX.HelpersLib;
|
||||
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.ScreenCaptureLib
|
||||
{
|
||||
public partial class StickerPackForm : Form
|
||||
{
|
||||
public List<StickerPackInfo> Stickers { get; private set; }
|
||||
|
||||
public StickerPackForm(List<StickerPackInfo> stickers)
|
||||
{
|
||||
Stickers = stickers;
|
||||
|
||||
InitializeComponent();
|
||||
Icon = ShareXResources.Icon;
|
||||
|
||||
foreach (StickerPackInfo stickerPackInfo in Stickers)
|
||||
{
|
||||
cbStickers.Items.Add(stickerPackInfo);
|
||||
}
|
||||
|
||||
if (cbStickers.Items.Count > 0)
|
||||
{
|
||||
cbStickers.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private StickerPackInfo GetCurrentStickerPack()
|
||||
{
|
||||
if (cbStickers.SelectedIndex > -1)
|
||||
{
|
||||
return cbStickers.SelectedItem as StickerPackInfo;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void cbStickers_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
StickerPackInfo stickerPackInfo = GetCurrentStickerPack();
|
||||
|
||||
if (stickerPackInfo != null)
|
||||
{
|
||||
txtFolder.Text = stickerPackInfo.FolderPath;
|
||||
txtName.Text = stickerPackInfo.Name;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
Stickers.Add(new StickerPackInfo());
|
||||
cbStickers.Items.Add(Stickers[Stickers.Count - 1]);
|
||||
cbStickers.SelectedIndex = cbStickers.Items.Count - 1;
|
||||
}
|
||||
|
||||
private void btnRemove_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void txtFolder_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
StickerPackInfo stickerPackInfo = GetCurrentStickerPack();
|
||||
|
||||
if (stickerPackInfo != null)
|
||||
{
|
||||
stickerPackInfo.FolderPath = txtFolder.Text;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnFolderBrowse_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void txtName_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
StickerPackInfo stickerPackInfo = GetCurrentStickerPack();
|
||||
|
||||
if (stickerPackInfo != null)
|
||||
{
|
||||
stickerPackInfo.Name = txtName.Text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
ShareX.ScreenCaptureLib/Forms/StickerPackForm.resx
Normal file
120
ShareX.ScreenCaptureLib/Forms/StickerPackForm.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
|
@ -35,7 +35,7 @@ public class StickerPackInfo
|
|||
public string FolderPath { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
public StickerPackInfo(string folderPath, string name)
|
||||
public StickerPackInfo(string folderPath = "", string name = "")
|
||||
{
|
||||
FolderPath = folderPath;
|
||||
Name = name;
|
||||
|
|
|
@ -116,6 +116,12 @@
|
|||
<DependentUpon>StickerForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\StickerImageListViewRenderer.cs" />
|
||||
<Compile Include="Forms\StickerPackForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\StickerPackForm.Designer.cs">
|
||||
<DependentUpon>StickerPackForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="RegionHelpers\ButtonObject.cs" />
|
||||
<Compile Include="RegionHelpers\ScrollbarManager.cs" />
|
||||
<Compile Include="Shapes\AnnotationOptions.cs" />
|
||||
|
@ -384,6 +390,9 @@
|
|||
<EmbeddedResource Include="Forms\StickerForm.resx">
|
||||
<DependentUpon>StickerForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\StickerPackForm.resx">
|
||||
<DependentUpon>StickerPackForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\TextDrawingInputBox.fr.resx">
|
||||
<DependentUpon>TextDrawingInputBox.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
|
Loading…
Reference in a new issue