mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
Interim work for sticker form
This commit is contained in:
parent
0f28989d9d
commit
4cdf93b755
10 changed files with 531 additions and 4 deletions
|
@ -2645,7 +2645,7 @@ internal static string ReplCodeMenuEntry_ra_Random_alphanumeric_char {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Random line from a file. Use {path} to determine the file.
|
/// Looks up a localized string similar to Random line from a file. Use {filepath} to determine the file.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string ReplCodeMenuEntry_rf_Random_line_from_file {
|
internal static string ReplCodeMenuEntry_rf_Random_line_from_file {
|
||||||
get {
|
get {
|
||||||
|
|
|
@ -1146,6 +1146,6 @@ Would you like to download it?</value>
|
||||||
<value>..\Resources\animals.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
<value>..\Resources\animals.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ReplCodeMenuEntry_rf_Random_line_from_file" xml:space="preserve">
|
<data name="ReplCodeMenuEntry_rf_Random_line_from_file" xml:space="preserve">
|
||||||
<value>Random line from a file. Use {path} to determine the file</value>
|
<value>Random line from a file. Use {filepath} to determine the file</value>
|
||||||
</data>
|
</data>
|
||||||
</root>
|
</root>
|
170
ShareX.ScreenCaptureLib/Forms/StickerForm.Designer.cs
generated
Normal file
170
ShareX.ScreenCaptureLib/Forms/StickerForm.Designer.cs
generated
Normal file
|
@ -0,0 +1,170 @@
|
||||||
|
namespace ShareX.ScreenCaptureLib
|
||||||
|
{
|
||||||
|
partial class StickerForm
|
||||||
|
{
|
||||||
|
/// <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.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.toolStripContainer1.ContentPanel.SuspendLayout();
|
||||||
|
this.toolStripContainer1.TopToolStripPanel.SuspendLayout();
|
||||||
|
this.toolStripContainer1.SuspendLayout();
|
||||||
|
this.toolStrip2.SuspendLayout();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// ilvStickers
|
||||||
|
//
|
||||||
|
this.ilvStickers.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||||
|
this.ilvStickers.ColumnHeaderFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
|
||||||
|
this.ilvStickers.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.ilvStickers.GroupHeaderFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold);
|
||||||
|
this.ilvStickers.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.ilvStickers.Name = "ilvStickers";
|
||||||
|
this.ilvStickers.PersistentCacheDirectory = "";
|
||||||
|
this.ilvStickers.PersistentCacheSize = ((long)(100));
|
||||||
|
this.ilvStickers.Size = new System.Drawing.Size(784, 484);
|
||||||
|
this.ilvStickers.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// toolStripContainer1
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// toolStripContainer1.ContentPanel
|
||||||
|
//
|
||||||
|
this.toolStripContainer1.ContentPanel.Controls.Add(this.ilvStickers);
|
||||||
|
this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(784, 484);
|
||||||
|
this.toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.toolStripContainer1.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.toolStripContainer1.Name = "toolStripContainer1";
|
||||||
|
this.toolStripContainer1.Size = new System.Drawing.Size(784, 511);
|
||||||
|
this.toolStripContainer1.TabIndex = 2;
|
||||||
|
this.toolStripContainer1.Text = "toolStripContainer1";
|
||||||
|
//
|
||||||
|
// toolStripContainer1.TopToolStripPanel
|
||||||
|
//
|
||||||
|
this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.toolStrip2);
|
||||||
|
//
|
||||||
|
// toolStrip2
|
||||||
|
//
|
||||||
|
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;
|
||||||
|
//
|
||||||
|
// toolStripLabel1
|
||||||
|
//
|
||||||
|
this.toolStripLabel1.Name = "toolStripLabel1";
|
||||||
|
this.toolStripLabel1.Size = new System.Drawing.Size(45, 20);
|
||||||
|
this.toolStripLabel1.Text = "Search:";
|
||||||
|
//
|
||||||
|
// toolStripTextBox1
|
||||||
|
//
|
||||||
|
this.toolStripTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.toolStripTextBox1.Name = "toolStripTextBox1";
|
||||||
|
this.toolStripTextBox1.Size = new System.Drawing.Size(100, 23);
|
||||||
|
//
|
||||||
|
// toolStripLabel2
|
||||||
|
//
|
||||||
|
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:";
|
||||||
|
//
|
||||||
|
// toolStripComboBox1
|
||||||
|
//
|
||||||
|
this.toolStripComboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
this.toolStripComboBox1.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
||||||
|
this.toolStripComboBox1.Items.AddRange(new object[] {
|
||||||
|
"Blob Emoji"});
|
||||||
|
this.toolStripComboBox1.Name = "toolStripComboBox1";
|
||||||
|
this.toolStripComboBox1.Size = new System.Drawing.Size(121, 23);
|
||||||
|
//
|
||||||
|
// toolStripLabel3
|
||||||
|
//
|
||||||
|
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:";
|
||||||
|
//
|
||||||
|
// toolStripTextBox3
|
||||||
|
//
|
||||||
|
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;
|
||||||
|
//
|
||||||
|
// StickerForm
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(784, 511);
|
||||||
|
this.Controls.Add(this.toolStripContainer1);
|
||||||
|
this.Name = "StickerForm";
|
||||||
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
|
this.Text = "ShareX - Sticker picker";
|
||||||
|
this.toolStripContainer1.ContentPanel.ResumeLayout(false);
|
||||||
|
this.toolStripContainer1.TopToolStripPanel.ResumeLayout(false);
|
||||||
|
this.toolStripContainer1.TopToolStripPanel.PerformLayout();
|
||||||
|
this.toolStripContainer1.ResumeLayout(false);
|
||||||
|
this.toolStripContainer1.PerformLayout();
|
||||||
|
this.toolStrip2.ResumeLayout(false);
|
||||||
|
this.toolStrip2.PerformLayout();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
56
ShareX.ScreenCaptureLib/Forms/StickerForm.cs
Normal file
56
ShareX.ScreenCaptureLib/Forms/StickerForm.cs
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
#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.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace ShareX.ScreenCaptureLib
|
||||||
|
{
|
||||||
|
public partial class StickerForm : Form
|
||||||
|
{
|
||||||
|
public StickerForm()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
Icon = ShareXResources.Icon;
|
||||||
|
toolStrip2.Renderer = new CustomToolStripProfessionalRenderer();
|
||||||
|
ilvStickers.SetRenderer(new StickerImageListViewRenderer());
|
||||||
|
ilvStickers.ThumbnailSize = new Size(64, 64);
|
||||||
|
ilvStickers.Colors.SelectedColor1 = Color.Transparent;
|
||||||
|
ilvStickers.Colors.SelectedColor2 = Color.FromArgb(252, 221, 132);
|
||||||
|
ilvStickers.Colors.HoverColor1 = Color.Transparent;
|
||||||
|
ilvStickers.Colors.HoverColor2 = Color.FromArgb(252, 221, 132);
|
||||||
|
ilvStickers.Items.AddRange(Directory.GetFiles("blobs", "*.png"));
|
||||||
|
toolStripComboBox1.SelectedIndex = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
126
ShareX.ScreenCaptureLib/Forms/StickerForm.resx
Normal file
126
ShareX.ScreenCaptureLib/Forms/StickerForm.resx
Normal file
|
@ -0,0 +1,126 @@
|
||||||
|
<?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>
|
||||||
|
<metadata name="toolStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>59</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
150
ShareX.ScreenCaptureLib/Forms/StickerImageListViewRenderer.cs
Normal file
150
ShareX.ScreenCaptureLib/Forms/StickerImageListViewRenderer.cs
Normal file
|
@ -0,0 +1,150 @@
|
||||||
|
#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 Manina.Windows.Forms;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Drawing2D;
|
||||||
|
using System.IO;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using ShareX.HelpersLib;
|
||||||
|
using static Manina.Windows.Forms.ImageListView;
|
||||||
|
|
||||||
|
namespace ShareX.ScreenCaptureLib
|
||||||
|
{
|
||||||
|
public class StickerImageListViewRenderer : ImageListViewRenderer
|
||||||
|
{
|
||||||
|
public override void InitializeGraphics(Graphics g)
|
||||||
|
{
|
||||||
|
base.InitializeGraphics(g);
|
||||||
|
|
||||||
|
ItemDrawOrder = ItemDrawOrder.NormalSelectedHovered;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DrawItem(Graphics g, ImageListViewItem item, ItemState state, Rectangle bounds)
|
||||||
|
{
|
||||||
|
Clip = false;
|
||||||
|
|
||||||
|
Size itemPadding = new Size(4, 4);
|
||||||
|
Rectangle imageBounds = bounds;
|
||||||
|
|
||||||
|
string text = Path.GetFileNameWithoutExtension(item.Text);
|
||||||
|
Size szt = TextRenderer.MeasureText(text, ImageListView.Font);
|
||||||
|
int textWidth = szt.Width + itemPadding.Width * 2;
|
||||||
|
|
||||||
|
if ((state & ItemState.Hovered) != ItemState.None && textWidth > bounds.Width)
|
||||||
|
{
|
||||||
|
bounds = new Rectangle(bounds.X + bounds.Width / 2 - textWidth / 2, bounds.Y, textWidth, bounds.Height);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Paint background
|
||||||
|
if (ImageListView.Enabled)
|
||||||
|
{
|
||||||
|
using (Brush bItemBack = new SolidBrush(ImageListView.Colors.BackColor))
|
||||||
|
{
|
||||||
|
g.FillRectangle(bItemBack, bounds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
using (Brush bItemBack = new SolidBrush(ImageListView.Colors.DisabledBackColor))
|
||||||
|
{
|
||||||
|
g.FillRectangle(bItemBack, bounds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((state & ItemState.Disabled) != ItemState.None) // Paint background Disabled
|
||||||
|
{
|
||||||
|
using (Brush bDisabled = new LinearGradientBrush(bounds.Offset(1), ImageListView.Colors.DisabledColor1, ImageListView.Colors.DisabledColor2, LinearGradientMode.Vertical))
|
||||||
|
{
|
||||||
|
Utility.FillRoundedRectangle(g, bDisabled, bounds, 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ((ImageListView.Focused && ((state & ItemState.Selected) != ItemState.None)) ||
|
||||||
|
(!ImageListView.Focused && ((state & ItemState.Selected) != ItemState.None) && ((state & ItemState.Hovered) != ItemState.None))) // Paint background Selected
|
||||||
|
{
|
||||||
|
using (Brush bSelected = new LinearGradientBrush(bounds.Offset(1), ImageListView.Colors.SelectedColor1, ImageListView.Colors.SelectedColor2, LinearGradientMode.Vertical))
|
||||||
|
{
|
||||||
|
Utility.FillRoundedRectangle(g, bSelected, bounds, 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!ImageListView.Focused && ((state & ItemState.Selected) != ItemState.None)) // Paint background unfocused
|
||||||
|
{
|
||||||
|
using (Brush bGray64 = new LinearGradientBrush(bounds.Offset(1), ImageListView.Colors.UnFocusedColor1, ImageListView.Colors.UnFocusedColor2, LinearGradientMode.Vertical))
|
||||||
|
{
|
||||||
|
Utility.FillRoundedRectangle(g, bGray64, bounds, 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Paint background Hovered
|
||||||
|
if ((state & ItemState.Hovered) != ItemState.None)
|
||||||
|
{
|
||||||
|
using (Brush bHovered = new LinearGradientBrush(bounds.Offset(1), ImageListView.Colors.HoverColor1, ImageListView.Colors.HoverColor2, LinearGradientMode.Vertical))
|
||||||
|
{
|
||||||
|
Utility.FillRoundedRectangle(g, bHovered, bounds, 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw the image
|
||||||
|
Image img = item.GetCachedImage(CachedImageType.Thumbnail);
|
||||||
|
if (img != null)
|
||||||
|
{
|
||||||
|
Rectangle pos = Utility.GetSizedImageBounds(img, new Rectangle(imageBounds.Location + itemPadding, ImageListView.ThumbnailSize));
|
||||||
|
g.DrawImage(img, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw item text
|
||||||
|
Color foreColor = ImageListView.Colors.ForeColor;
|
||||||
|
if ((state & ItemState.Disabled) != ItemState.None)
|
||||||
|
{
|
||||||
|
foreColor = ImageListView.Colors.DisabledForeColor;
|
||||||
|
}
|
||||||
|
else if ((state & ItemState.Selected) != ItemState.None)
|
||||||
|
{
|
||||||
|
if (ImageListView.Focused)
|
||||||
|
{
|
||||||
|
foreColor = ImageListView.Colors.SelectedForeColor;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreColor = ImageListView.Colors.UnFocusedForeColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle rt = new Rectangle(bounds.Left, bounds.Top + 2 * itemPadding.Height + ImageListView.ThumbnailSize.Height, bounds.Width, szt.Height);
|
||||||
|
TextFormatFlags flags;
|
||||||
|
|
||||||
|
if ((state & ItemState.Hovered) != ItemState.None)
|
||||||
|
{
|
||||||
|
flags = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.SingleLine | TextFormatFlags.NoClipping;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flags = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.SingleLine | TextFormatFlags.WordEllipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
TextRenderer.DrawText(g, text, ImageListView.Font, rt, foreColor, flags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -565,7 +565,7 @@ internal void CreateToolbar()
|
||||||
};
|
};
|
||||||
tsddbShapeOptions.DropDownItems.Add(tsmiShadow);
|
tsddbShapeOptions.DropDownItems.Add(tsmiShadow);
|
||||||
|
|
||||||
tsmiShadowColor = new ToolStripMenuItem("Shadow color...");
|
tsmiShadowColor = new ToolStripMenuItem("Drop shadow color...");
|
||||||
tsmiShadowColor.Click += (sender, e) =>
|
tsmiShadowColor.Click += (sender, e) =>
|
||||||
{
|
{
|
||||||
Form.Pause();
|
Form.Pause();
|
||||||
|
@ -1006,6 +1006,13 @@ private void MenuForm_Shown(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Form.ToolbarHeight = menuForm.Height;
|
Form.ToolbarHeight = menuForm.Height;
|
||||||
Form.CenterCanvas();
|
Form.CenterCanvas();
|
||||||
|
|
||||||
|
if (Form.IsEditorMode)
|
||||||
|
{
|
||||||
|
Form.Pause();
|
||||||
|
StickerForm stickerForm = new StickerForm();
|
||||||
|
stickerForm.Show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MenuForm_KeyDown(object sender, KeyEventArgs e)
|
private void MenuForm_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
|
|
@ -68,6 +68,9 @@
|
||||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="ImageListView, Version=11.0.4.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\ImageListView.11.0.4.0\lib\net35\ImageListView.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Design" />
|
<Reference Include="System.Design" />
|
||||||
|
@ -106,6 +109,13 @@
|
||||||
<Compile Include="Forms\ImageSizeForm.Designer.cs">
|
<Compile Include="Forms\ImageSizeForm.Designer.cs">
|
||||||
<DependentUpon>ImageSizeForm.cs</DependentUpon>
|
<DependentUpon>ImageSizeForm.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Forms\StickerForm.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Forms\StickerForm.Designer.cs">
|
||||||
|
<DependentUpon>StickerForm.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Forms\StickerImageListViewRenderer.cs" />
|
||||||
<Compile Include="RegionHelpers\ButtonObject.cs" />
|
<Compile Include="RegionHelpers\ButtonObject.cs" />
|
||||||
<Compile Include="RegionHelpers\ScrollbarManager.cs" />
|
<Compile Include="RegionHelpers\ScrollbarManager.cs" />
|
||||||
<Compile Include="Shapes\AnnotationOptions.cs" />
|
<Compile Include="Shapes\AnnotationOptions.cs" />
|
||||||
|
@ -223,6 +233,7 @@
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
<None Include="Resources\image-saturation.png" />
|
<None Include="Resources\image-saturation.png" />
|
||||||
<None Include="Resources\image-select.png" />
|
<None Include="Resources\image-select.png" />
|
||||||
<None Include="Resources\image-empty.png" />
|
<None Include="Resources\image-empty.png" />
|
||||||
|
@ -367,6 +378,9 @@
|
||||||
<EmbeddedResource Include="Forms\ScrollingCaptureForm.zh-TW.resx">
|
<EmbeddedResource Include="Forms\ScrollingCaptureForm.zh-TW.resx">
|
||||||
<DependentUpon>ScrollingCaptureForm.cs</DependentUpon>
|
<DependentUpon>ScrollingCaptureForm.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Forms\StickerForm.resx">
|
||||||
|
<DependentUpon>StickerForm.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Forms\TextDrawingInputBox.fr.resx">
|
<EmbeddedResource Include="Forms\TextDrawingInputBox.fr.resx">
|
||||||
<DependentUpon>TextDrawingInputBox.cs</DependentUpon>
|
<DependentUpon>TextDrawingInputBox.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
|
4
ShareX.ScreenCaptureLib/packages.config
Normal file
4
ShareX.ScreenCaptureLib/packages.config
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="ImageListView" version="11.0.4.0" targetFramework="net40" />
|
||||||
|
</packages>
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio 15
|
||||||
VisualStudioVersion = 15.0.27130.2010
|
VisualStudioVersion = 15.0.27130.2027
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShareX", "ShareX\ShareX.csproj", "{C5AE4585-E9EC-4FA3-B75A-E1210635ACB6}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShareX", "ShareX\ShareX.csproj", "{C5AE4585-E9EC-4FA3-B75A-E1210635ACB6}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
|
Loading…
Reference in a new issue