mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-02 18:26:27 +13:00
GreenshotImageEditor SaveAs button
This commit is contained in:
parent
45ec42eba4
commit
96d1636f6a
10 changed files with 749 additions and 517 deletions
|
@ -107,7 +107,9 @@ private void InitializeComponent() {
|
|||
this.btnSaveClose = new System.Windows.Forms.ToolStripButton();
|
||||
this.btnClose = new System.Windows.Forms.ToolStripButton();
|
||||
this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.btnSaveAs = new System.Windows.Forms.ToolStripButton();
|
||||
this.btnClipboardCopy = new System.Windows.Forms.ToolStripButton();
|
||||
this.btnUploadImage = new System.Windows.Forms.ToolStripButton();
|
||||
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.btnUndo = new System.Windows.Forms.ToolStripButton();
|
||||
this.btnRedo = new System.Windows.Forms.ToolStripButton();
|
||||
|
@ -166,7 +168,6 @@ private void InitializeComponent() {
|
|||
this.fileSavedStatusContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.copyPathMenuItem = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
|
||||
this.openDirectoryMenuItem = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
|
||||
this.btnUploadImage = new System.Windows.Forms.ToolStripButton();
|
||||
this.toolStripContainer1.ContentPanel.SuspendLayout();
|
||||
this.toolStripContainer1.LeftToolStripPanel.SuspendLayout();
|
||||
this.toolStripContainer1.TopToolStripPanel.SuspendLayout();
|
||||
|
@ -771,6 +772,7 @@ private void InitializeComponent() {
|
|||
this.btnSaveClose,
|
||||
this.btnClose,
|
||||
this.toolStripSeparator6,
|
||||
this.btnSaveAs,
|
||||
this.btnClipboardCopy,
|
||||
this.btnUploadImage,
|
||||
this.toolStripSeparator2,
|
||||
|
@ -841,6 +843,16 @@ private void InitializeComponent() {
|
|||
this.toolStripSeparator6.Name = "toolStripSeparator6";
|
||||
this.toolStripSeparator6.Size = new System.Drawing.Size(6, 27);
|
||||
//
|
||||
// btnSaveAs
|
||||
//
|
||||
this.btnSaveAs.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.btnSaveAs.Image = ((System.Drawing.Image)(resources.GetObject("btnSaveAs.Image")));
|
||||
this.btnSaveAs.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.btnSaveAs.Name = "btnSaveAs";
|
||||
this.btnSaveAs.Size = new System.Drawing.Size(23, 24);
|
||||
this.btnSaveAs.Text = "toolStripButton1";
|
||||
this.btnSaveAs.Click += new System.EventHandler(this.btnSaveAs_Click);
|
||||
//
|
||||
// btnClipboardCopy
|
||||
//
|
||||
this.btnClipboardCopy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
|
@ -850,6 +862,16 @@ private void InitializeComponent() {
|
|||
this.btnClipboardCopy.Text = "Copy to clipboard";
|
||||
this.btnClipboardCopy.Click += new System.EventHandler(this.btnClipboardCopy_Click);
|
||||
//
|
||||
// btnUploadImage
|
||||
//
|
||||
this.btnUploadImage.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.btnUploadImage.Image = ((System.Drawing.Image)(resources.GetObject("btnUploadImage.Image")));
|
||||
this.btnUploadImage.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.btnUploadImage.Name = "btnUploadImage";
|
||||
this.btnUploadImage.Size = new System.Drawing.Size(23, 24);
|
||||
this.btnUploadImage.Text = "Upload image";
|
||||
this.btnUploadImage.Click += new System.EventHandler(this.btnUploadImage_Click);
|
||||
//
|
||||
// toolStripSeparator2
|
||||
//
|
||||
this.toolStripSeparator2.Name = "toolStripSeparator2";
|
||||
|
@ -1089,7 +1111,7 @@ private void InitializeComponent() {
|
|||
this.fontFamilyComboBox.MaxDropDownItems = 20;
|
||||
this.fontFamilyComboBox.Name = "fontFamilyComboBox";
|
||||
this.fontFamilyComboBox.Size = new System.Drawing.Size(200, 23);
|
||||
this.fontFamilyComboBox.Text = "ABeeZee";
|
||||
this.fontFamilyComboBox.Text = "Agency FB";
|
||||
this.fontFamilyComboBox.GotFocus += new System.EventHandler(this.ToolBarFocusableElementGotFocus);
|
||||
this.fontFamilyComboBox.LostFocus += new System.EventHandler(this.ToolBarFocusableElementLostFocus);
|
||||
//
|
||||
|
@ -1119,7 +1141,7 @@ private void InitializeComponent() {
|
|||
0,
|
||||
0});
|
||||
this.fontSizeUpDown.Name = "fontSizeUpDown";
|
||||
this.fontSizeUpDown.Size = new System.Drawing.Size(41, 24);
|
||||
this.fontSizeUpDown.Size = new System.Drawing.Size(41, 23);
|
||||
this.fontSizeUpDown.Text = "12";
|
||||
this.fontSizeUpDown.Value = new decimal(new int[] {
|
||||
12,
|
||||
|
@ -1549,16 +1571,6 @@ private void InitializeComponent() {
|
|||
this.openDirectoryMenuItem.Text = "Open directory in Windows Explorer";
|
||||
this.openDirectoryMenuItem.Click += new System.EventHandler(this.OpenDirectoryMenuItemClick);
|
||||
//
|
||||
// btnUploadImage
|
||||
//
|
||||
this.btnUploadImage.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.btnUploadImage.Image = ((System.Drawing.Image)(resources.GetObject("btnUploadImage.Image")));
|
||||
this.btnUploadImage.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.btnUploadImage.Name = "btnUploadImage";
|
||||
this.btnUploadImage.Size = new System.Drawing.Size(23, 24);
|
||||
this.btnUploadImage.Text = "Upload image";
|
||||
this.btnUploadImage.Click += new System.EventHandler(this.btnUploadImage_Click);
|
||||
//
|
||||
// ImageEditorForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
|
@ -1710,5 +1722,6 @@ private void InitializeComponent() {
|
|||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator6;
|
||||
private System.Windows.Forms.ToolStripButton btnClipboardCopy;
|
||||
private System.Windows.Forms.ToolStripButton btnUploadImage;
|
||||
private System.Windows.Forms.ToolStripButton btnSaveAs;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ public partial class ImageEditorForm : BaseForm, IImageEditor
|
|||
{
|
||||
public event Action<Image> ClipboardCopyRequested;
|
||||
public event Action<Image> ImageUploadRequested;
|
||||
public event Action<Image> ImageSaveAsRequested;
|
||||
|
||||
private static EditorConfiguration editorConfiguration = IniConfig.GetIniSection<EditorConfiguration>();
|
||||
private static List<string> ignoreDestinations = new List<string> { };
|
||||
|
@ -1359,5 +1360,19 @@ public void OnImageUploadRequested()
|
|||
ImageUploadRequested(img);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnImageSaveAsRequesed()
|
||||
{
|
||||
if (ImageSaveAsRequested != null)
|
||||
{
|
||||
Image img = surface.GetImageForExport();
|
||||
ImageSaveAsRequested(img);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnSaveAs_Click(object sender, EventArgs e)
|
||||
{
|
||||
OnImageSaveAsRequesed();
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -227,6 +227,11 @@
|
|||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Helpers\LOG.cs" />
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UnmanagedHelpers\DWM.cs" />
|
||||
<Compile Include="UnmanagedHelpers\Enumerations.cs" />
|
||||
<Compile Include="UnmanagedHelpers\GDI32.cs" />
|
||||
|
@ -238,6 +243,10 @@
|
|||
<Compile Include="UnmanagedHelpers\User32.cs" />
|
||||
<Compile Include="UnmanagedHelpers\Win32Errors.cs" />
|
||||
<Compile Include="UnmanagedHelpers\WinMM.cs" />
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="Forms\DropShadowSettingsForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</None>
|
||||
|
|
63
GreenshotImageEditor/Properties/Resources.Designer.cs
generated
Normal file
63
GreenshotImageEditor/Properties/Resources.Designer.cs
generated
Normal file
|
@ -0,0 +1,63 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34014
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Greenshot.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Greenshot.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
GreenshotImageEditor/Properties/Resources.resx
Normal file
120
GreenshotImageEditor/Properties/Resources.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>
|
BIN
GreenshotImageEditor/icons/disk-black.png
Normal file
BIN
GreenshotImageEditor/icons/disk-black.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 433 B |
|
@ -662,10 +662,13 @@ public static Bitmap RotateImage(Image inputImage, float angleDegrees, bool upsi
|
|||
|
||||
public static Image AnnotateImage(Image img)
|
||||
{
|
||||
return AnnotateImage(img, false, null, null, null);
|
||||
return AnnotateImage(img, false, null, null, null, null);
|
||||
}
|
||||
|
||||
public static Image AnnotateImage(Image img, bool allowSave, string configPath, Action<Image> clipboardCopyRequested, Action<Image> imageUploadRequested)
|
||||
public static Image AnnotateImage(Image img, bool allowSave, string configPath,
|
||||
Action<Image> clipboardCopyRequested,
|
||||
Action<Image> imageUploadRequested,
|
||||
Action<Image> imageSaveAsRequested)
|
||||
{
|
||||
if (!IniConfig.isInitialized)
|
||||
{
|
||||
|
@ -680,6 +683,7 @@ public static Image AnnotateImage(Image img, bool allowSave, string configPath,
|
|||
{
|
||||
editor.ClipboardCopyRequested += clipboardCopyRequested;
|
||||
editor.ImageUploadRequested += imageUploadRequested;
|
||||
editor.ImageSaveAsRequested += imageSaveAsRequested;
|
||||
|
||||
if (editor.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@ CreateAppDir=true
|
|||
DefaultDirName={pf}\{#MyAppName}
|
||||
DefaultGroupName={#MyAppName}
|
||||
DirExistsWarning=no
|
||||
;InfoBeforeFile=Docs\VersionHistory.txt
|
||||
InfoBeforeFile=Docs\VersionHistory.txt
|
||||
InternalCompressLevel=ultra64
|
||||
LanguageDetectionMethod=uilanguage
|
||||
LicenseFile=LICENSE.txt
|
||||
|
|
|
@ -229,7 +229,8 @@ public static Image AnnotateImage(Image img)
|
|||
{
|
||||
return ImageHelpers.AnnotateImage(img, !Program.IsSandbox, Program.PersonalPath,
|
||||
x => Program.MainForm.InvokeSafe(() => ClipboardHelpers.CopyImage(x)),
|
||||
x => Program.MainForm.InvokeSafe(() => UploadManager.RunImageTask(x)));
|
||||
x => Program.MainForm.InvokeSafe(() => UploadManager.RunImageTask(x)),
|
||||
x => Program.MainForm.InvokeSafe(() => ImageHelpers.SaveImageFileDialog(x)));
|
||||
}
|
||||
|
||||
public static Image AddImageEffects(Image img, TaskSettings taskSettings)
|
||||
|
|
Loading…
Reference in a new issue