From 3379cd133b9068e7661b709062a1960faf968759 Mon Sep 17 00:00:00 2001 From: Jaex Date: Sun, 6 Apr 2014 05:10:34 +0300 Subject: [PATCH] fixed #98: Added drag & drop box --- HelpersLib/HelpersLib.csproj | 4 + HelpersLib/Native/LayeredForm.cs | 140 +++++++++++++++++++++++ HelpersLib/Native/NativeConstants.cs | 50 +++++++++ HelpersLib/Native/NativeMethods.cs | 27 ----- ShareX/Forms/DropForm.cs | 142 ++++++++++++++++++++++++ ShareX/Forms/MainForm.Designer.cs | 87 +++++++++------ ShareX/Forms/MainForm.cs | 5 + ShareX/Properties/Resources.Designer.cs | 12 +- ShareX/Properties/Resources.resx | 30 ++--- ShareX/Resources/inbox--plus.png | Bin 0 -> 600 bytes ShareX/ShareX.csproj | 4 + 11 files changed, 427 insertions(+), 74 deletions(-) create mode 100644 HelpersLib/Native/LayeredForm.cs create mode 100644 HelpersLib/Native/NativeConstants.cs create mode 100644 ShareX/Forms/DropForm.cs create mode 100644 ShareX/Resources/inbox--plus.png diff --git a/HelpersLib/HelpersLib.csproj b/HelpersLib/HelpersLib.csproj index 593170cb3..92b2282b1 100644 --- a/HelpersLib/HelpersLib.csproj +++ b/HelpersLib/HelpersLib.csproj @@ -88,6 +88,9 @@ + + Form + Form @@ -95,6 +98,7 @@ MonitorTestForm.cs + diff --git a/HelpersLib/Native/LayeredForm.cs b/HelpersLib/Native/LayeredForm.cs new file mode 100644 index 000000000..59243fa53 --- /dev/null +++ b/HelpersLib/Native/LayeredForm.cs @@ -0,0 +1,140 @@ +#region License Information (GPL v3) + +/* + ShareX - A program that allows you to take screenshots and share any file type + Copyright (C) 2008-2014 ShareX Developers + + 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.ComponentModel; +using System.Data; +using System.Drawing; +using System.Drawing.Imaging; +using System.Runtime.InteropServices; +using System.Text; +using System.Windows.Forms; + +namespace HelpersLib +{ + public partial class LayeredForm : Form + { + public LayeredForm() + { + InitializeComponent(); + } + + #region Windows Form Designer generated code + + /// + /// 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); + } + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.SuspendLayout(); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(292, 273); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Name = "LayeredForm"; + this.ShowInTaskbar = false; + this.Text = "LayeredForm"; + this.TopMost = true; + this.ResumeLayout(false); + } + + #endregion Windows Form Designer generated code + + protected override CreateParams CreateParams + { + get + { + CreateParams createParams = base.CreateParams; + createParams.ExStyle |= (int)WindowStyles.WS_EX_LAYERED; + return createParams; + } + } + + public void SelectBitmap(Bitmap bitmap) + { + SelectBitmap(bitmap, 255); + } + + public void SelectBitmap(Bitmap bitmap, int opacity) + { + if (bitmap.PixelFormat != PixelFormat.Format32bppArgb) + { + throw new ApplicationException("The bitmap must be 32bpp with alpha-channel."); + } + + IntPtr screenDc = NativeMethods.GetDC(IntPtr.Zero); + IntPtr memDc = NativeMethods.CreateCompatibleDC(screenDc); + IntPtr hBitmap = IntPtr.Zero; + IntPtr hOldBitmap = IntPtr.Zero; + + try + { + hBitmap = bitmap.GetHbitmap(Color.FromArgb(0)); + hOldBitmap = NativeMethods.SelectObject(memDc, hBitmap); + + SIZE newSize = new SIZE(bitmap.Width, bitmap.Height); + POINT sourceLocation = new POINT(0, 0); + POINT newLocation = new POINT(this.Left, this.Top); + BLENDFUNCTION blend = new BLENDFUNCTION(); + blend.BlendOp = NativeMethods.AC_SRC_OVER; + blend.BlendFlags = 0; + blend.SourceConstantAlpha = (byte)opacity; + blend.AlphaFormat = NativeMethods.AC_SRC_ALPHA; + + NativeMethods.UpdateLayeredWindow(this.Handle, screenDc, ref newLocation, ref newSize, memDc, ref sourceLocation, 0, ref blend, NativeMethods.ULW_ALPHA); + } + finally + { + NativeMethods.ReleaseDC(IntPtr.Zero, screenDc); + if (hBitmap != IntPtr.Zero) + { + NativeMethods.SelectObject(memDc, hOldBitmap); + NativeMethods.DeleteObject(hBitmap); + } + NativeMethods.DeleteDC(memDc); + } + } + } +} \ No newline at end of file diff --git a/HelpersLib/Native/NativeConstants.cs b/HelpersLib/Native/NativeConstants.cs new file mode 100644 index 000000000..94277e0e7 --- /dev/null +++ b/HelpersLib/Native/NativeConstants.cs @@ -0,0 +1,50 @@ +#region License Information (GPL v3) + +/* + ShareX - A program that allows you to take screenshots and share any file type + Copyright (C) 2008-2014 ShareX Developers + + 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) + +namespace HelpersLib +{ + public static partial class NativeMethods + { + public const int GCL_HICONSM = -34; + public const int GCL_HICON = -14; + public const int ICON_SMALL = 0; + public const int ICON_BIG = 1; + public const int ICON_SMALL2 = 2; + public const int SC_MINIMIZE = 0xF020; + public const int HT_CAPTION = 2; + public const int CURSOR_SHOWING = 1; + public const int GWL_STYLE = -16; + public const int DWM_TNP_RECTDESTINATION = 0x1; + public const int DWM_TNP_RECTSOURCE = 0x2; + public const int DWM_TNP_OPACITY = 0x4; + public const int DWM_TNP_VISIBLE = 0x8; + public const int DWM_TNP_SOURCECLIENTAREAONLY = 0x10; + public const int WH_KEYBOARD_LL = 13; + public const int WH_MOUSE_LL = 14; + public const int ULW_ALPHA = 0x02; + public const byte AC_SRC_OVER = 0x00; + public const byte AC_SRC_ALPHA = 0x01; + } +} \ No newline at end of file diff --git a/HelpersLib/Native/NativeMethods.cs b/HelpersLib/Native/NativeMethods.cs index 3317cca9b..8ff750a47 100644 --- a/HelpersLib/Native/NativeMethods.cs +++ b/HelpersLib/Native/NativeMethods.cs @@ -32,33 +32,6 @@ namespace HelpersLib { public static partial class NativeMethods { - #region Constants - - public const int GCL_HICONSM = -34; - public const int GCL_HICON = -14; - - public const int ICON_SMALL = 0; - public const int ICON_BIG = 1; - public const int ICON_SMALL2 = 2; - - public const int SC_MINIMIZE = 0xF020; - - public const int HT_CAPTION = 2; - public const int CURSOR_SHOWING = 1; - public const int GWL_STYLE = -16; - public const ulong TARGETWINDOW = (uint)WindowStyles.WS_BORDER | (uint)WindowStyles.WS_VISIBLE; - - public const int DWM_TNP_RECTDESTINATION = 0x1; - public const int DWM_TNP_RECTSOURCE = 0x2; - public const int DWM_TNP_OPACITY = 0x4; - public const int DWM_TNP_VISIBLE = 0x8; - public const int DWM_TNP_SOURCECLIENTAREAONLY = 0x10; - - public const int WH_KEYBOARD_LL = 13; - public const int WH_MOUSE_LL = 14; - - #endregion Constants - #region Delegates public delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam); diff --git a/ShareX/Forms/DropForm.cs b/ShareX/Forms/DropForm.cs new file mode 100644 index 000000000..12c922489 --- /dev/null +++ b/ShareX/Forms/DropForm.cs @@ -0,0 +1,142 @@ +#region License Information (GPL v3) + +/* + ShareX - A program that allows you to take screenshots and share any file type + Copyright (C) 2008-2014 ShareX Developers + + 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 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 +{ + public partial class DropForm : LayeredForm + { + public DropForm() + { + InitializeComponent(); + + Image logo = null; + + try + { + logo = ShareXResources.Logo; + logo = ImageHelpers.ResizeImage(logo, 150, 150); + + int windowOffset = 5; + ContentAlignment placement = ContentAlignment.BottomRight; + Point position = Helpers.GetPosition(placement, new Point(windowOffset, windowOffset), Screen.PrimaryScreen.WorkingArea.Size, logo.Size); + Location = position; + + SelectBitmap((Bitmap)logo, 150); + } + finally + { + if (logo != null) + { + logo.Dispose(); + } + } + } + + private void DropForm_MouseDown(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Left) + { + NativeMethods.ReleaseCapture(); + NativeMethods.SendMessage(Handle, (uint)WindowsMessages.NCLBUTTONDOWN, (IntPtr)NativeMethods.HT_CAPTION, IntPtr.Zero); + } + } + + private void DropForm_MouseUp(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Right) + { + this.Close(); + } + } + + private void DropForm_DragEnter(object sender, DragEventArgs e) + { + if (e.Data.GetDataPresent(DataFormats.FileDrop)) + { + e.Effect = DragDropEffects.All; + } + else + { + e.Effect = DragDropEffects.None; + } + } + + private void DropForm_DragDrop(object sender, DragEventArgs e) + { + string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, true); + + UploadManager.UploadFile(files); + } + + #region Windows Form Designer generated code + + /// + /// 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); + } + + /// + /// 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.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Text = "DropForm"; + this.AllowDrop = true; + + MouseDown += DropForm_MouseDown; + MouseUp += DropForm_MouseUp; + DragEnter += DropForm_DragEnter; + DragDrop += DropForm_DragDrop; + } + + #endregion Windows Form Designer generated code + } +} \ No newline at end of file diff --git a/ShareX/Forms/MainForm.Designer.cs b/ShareX/Forms/MainForm.Designer.cs index e9e2753d0..d317561a4 100644 --- a/ShareX/Forms/MainForm.Designer.cs +++ b/ShareX/Forms/MainForm.Designer.cs @@ -58,6 +58,7 @@ private void InitializeComponent() this.tsMain = new System.Windows.Forms.ToolStrip(); this.tsbClipboardUpload = new System.Windows.Forms.ToolStripButton(); this.tsbFileUpload = new System.Windows.Forms.ToolStripButton(); + this.tsbDragDropUpload = new System.Windows.Forms.ToolStripButton(); this.tsddbCapture = new System.Windows.Forms.ToolStripDropDownButton(); this.tsmiFullscreen = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiWindow = new System.Windows.Forms.ToolStripMenuItem(); @@ -122,6 +123,7 @@ private void InitializeComponent() this.chURL = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.pbPreview = new HelpersLib.MyPictureBox(); this.cmsUploadInfo = new System.Windows.Forms.ContextMenuStrip(this.components); + this.tsmiShowErrors = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiStopUpload = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiOpen = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiOpenURL = new System.Windows.Forms.ToolStripMenuItem(); @@ -154,7 +156,6 @@ private void InitializeComponent() this.tsmiCopyFileNameWithExtension = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiCopyFolder = new System.Windows.Forms.ToolStripMenuItem(); this.tssCopy5 = new System.Windows.Forms.ToolStripSeparator(); - this.tsmiShowErrors = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiShowResponse = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiUploadSelectedFile = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiClearList = new System.Windows.Forms.ToolStripMenuItem(); @@ -213,6 +214,7 @@ private void InitializeComponent() this.tsmiTrayShow = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiTrayExit = new System.Windows.Forms.ToolStripMenuItem(); this.ssToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.tsmiTrayDragDropUpload = new System.Windows.Forms.ToolStripMenuItem(); this.tsMain.SuspendLayout(); this.scMain.Panel1.SuspendLayout(); this.scMain.Panel2.SuspendLayout(); @@ -230,6 +232,7 @@ private void InitializeComponent() this.tsMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.tsbClipboardUpload, this.tsbFileUpload, + this.tsbDragDropUpload, this.tsddbCapture, this.tsddbAfterCaptureTasks, this.tsddbAfterUploadTasks, @@ -254,7 +257,6 @@ private void InitializeComponent() this.tsMain.ShowItemToolTips = false; this.tsMain.Size = new System.Drawing.Size(160, 430); this.tsMain.TabIndex = 0; - this.tsMain.Text = "toolStrip1"; // // tsbClipboardUpload // @@ -276,6 +278,16 @@ private void InitializeComponent() this.tsbFileUpload.Text = "File upload..."; this.tsbFileUpload.Click += new System.EventHandler(this.tsbFileUpload_Click); // + // tsbDragDropUpload + // + this.tsbDragDropUpload.Image = global::ShareX.Properties.Resources.inbox_plus; + this.tsbDragDropUpload.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.tsbDragDropUpload.ImageTransparentColor = System.Drawing.Color.Magenta; + this.tsbDragDropUpload.Name = "tsbDragDropUpload"; + this.tsbDragDropUpload.Size = new System.Drawing.Size(147, 20); + this.tsbDragDropUpload.Text = "Drag && drop upload..."; + this.tsbDragDropUpload.Click += new System.EventHandler(this.tsbDragDropUpload_Click); + // // tsddbCapture // this.tsddbCapture.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -872,7 +884,14 @@ private void InitializeComponent() this.tsmiHidePreview}); this.cmsUploadInfo.Name = "cmsHistory"; this.cmsUploadInfo.ShowImageMargin = false; - this.cmsUploadInfo.Size = new System.Drawing.Size(155, 280); + this.cmsUploadInfo.Size = new System.Drawing.Size(155, 258); + // + // tsmiShowErrors + // + this.tsmiShowErrors.Name = "tsmiShowErrors"; + this.tsmiShowErrors.Size = new System.Drawing.Size(154, 22); + this.tsmiShowErrors.Text = "Show errors"; + this.tsmiShowErrors.Click += new System.EventHandler(this.tsmiShowErrors_Click); // // tsmiStopUpload // @@ -1116,13 +1135,6 @@ private void InitializeComponent() this.tssCopy5.Size = new System.Drawing.Size(230, 6); this.tssCopy5.Visible = false; // - // tsmiShowErrors - // - this.tsmiShowErrors.Name = "tsmiShowErrors"; - this.tsmiShowErrors.Size = new System.Drawing.Size(154, 22); - this.tsmiShowErrors.Text = "Show errors"; - this.tsmiShowErrors.Click += new System.EventHandler(this.tsmiShowErrors_Click); - // // tsmiShowResponse // this.tsmiShowResponse.Name = "tsmiShowResponse"; @@ -1195,6 +1207,7 @@ private void InitializeComponent() this.cmsTray.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.tsmiTrayClipboardUpload, this.tsmiTrayFileUpload, + this.tsmiTrayDragDropUpload, this.tsmiTrayCapture, this.tsmiTrayAfterCaptureTasks, this.tsmiTrayAfterUploadTasks, @@ -1215,13 +1228,13 @@ private void InitializeComponent() this.tsmiTrayShow, this.tsmiTrayExit}); this.cmsTray.Name = "cmsTray"; - this.cmsTray.Size = new System.Drawing.Size(189, 418); + this.cmsTray.Size = new System.Drawing.Size(190, 440); // // tsmiTrayClipboardUpload // this.tsmiTrayClipboardUpload.Image = global::ShareX.Properties.Resources.clipboard_plus; this.tsmiTrayClipboardUpload.Name = "tsmiTrayClipboardUpload"; - this.tsmiTrayClipboardUpload.Size = new System.Drawing.Size(188, 22); + this.tsmiTrayClipboardUpload.Size = new System.Drawing.Size(189, 22); this.tsmiTrayClipboardUpload.Text = "Clipboard upload..."; this.tsmiTrayClipboardUpload.Click += new System.EventHandler(this.tsbClipboardUpload_Click); // @@ -1229,7 +1242,7 @@ private void InitializeComponent() // this.tsmiTrayFileUpload.Image = global::ShareX.Properties.Resources.folder_plus; this.tsmiTrayFileUpload.Name = "tsmiTrayFileUpload"; - this.tsmiTrayFileUpload.Size = new System.Drawing.Size(188, 22); + this.tsmiTrayFileUpload.Size = new System.Drawing.Size(189, 22); this.tsmiTrayFileUpload.Text = "File upload..."; this.tsmiTrayFileUpload.Click += new System.EventHandler(this.tsbFileUpload_Click); // @@ -1252,7 +1265,7 @@ private void InitializeComponent() this.tsmiTrayAutoCapture}); this.tsmiTrayCapture.Image = global::ShareX.Properties.Resources.camera; this.tsmiTrayCapture.Name = "tsmiTrayCapture"; - this.tsmiTrayCapture.Size = new System.Drawing.Size(188, 22); + this.tsmiTrayCapture.Size = new System.Drawing.Size(189, 22); this.tsmiTrayCapture.Text = "Capture"; this.tsmiTrayCapture.DropDownOpening += new System.EventHandler(this.tsmiCapture_DropDownOpening); // @@ -1370,14 +1383,14 @@ private void InitializeComponent() // this.tsmiTrayAfterCaptureTasks.Image = global::ShareX.Properties.Resources.image_export; this.tsmiTrayAfterCaptureTasks.Name = "tsmiTrayAfterCaptureTasks"; - this.tsmiTrayAfterCaptureTasks.Size = new System.Drawing.Size(188, 22); + this.tsmiTrayAfterCaptureTasks.Size = new System.Drawing.Size(189, 22); this.tsmiTrayAfterCaptureTasks.Text = "After capture"; // // tsmiTrayAfterUploadTasks // this.tsmiTrayAfterUploadTasks.Image = global::ShareX.Properties.Resources.upload_cloud; this.tsmiTrayAfterUploadTasks.Name = "tsmiTrayAfterUploadTasks"; - this.tsmiTrayAfterUploadTasks.Size = new System.Drawing.Size(188, 22); + this.tsmiTrayAfterUploadTasks.Size = new System.Drawing.Size(189, 22); this.tsmiTrayAfterUploadTasks.Text = "After upload"; // // tsmiTrayDestinations @@ -1390,7 +1403,7 @@ private void InitializeComponent() this.tsmiTraySocialServices}); this.tsmiTrayDestinations.Image = global::ShareX.Properties.Resources.drive_globe; this.tsmiTrayDestinations.Name = "tsmiTrayDestinations"; - this.tsmiTrayDestinations.Size = new System.Drawing.Size(188, 22); + this.tsmiTrayDestinations.Size = new System.Drawing.Size(189, 22); this.tsmiTrayDestinations.Text = "Destinations"; this.tsmiTrayDestinations.DropDownOpened += new System.EventHandler(this.tsddbDestinations_DropDownOpened); // @@ -1432,13 +1445,13 @@ private void InitializeComponent() // tssTray1 // this.tssTray1.Name = "tssTray1"; - this.tssTray1.Size = new System.Drawing.Size(185, 6); + this.tssTray1.Size = new System.Drawing.Size(186, 6); // // tsmiTrayApplicationSettings // this.tsmiTrayApplicationSettings.Image = global::ShareX.Properties.Resources.application_pencil; this.tsmiTrayApplicationSettings.Name = "tsmiTrayApplicationSettings"; - this.tsmiTrayApplicationSettings.Size = new System.Drawing.Size(188, 22); + this.tsmiTrayApplicationSettings.Size = new System.Drawing.Size(189, 22); this.tsmiTrayApplicationSettings.Text = "Application settings..."; this.tsmiTrayApplicationSettings.Click += new System.EventHandler(this.tsbApplicationSettings_Click); // @@ -1446,7 +1459,7 @@ private void InitializeComponent() // this.tsmiTrayTaskSettings.Image = global::ShareX.Properties.Resources.hammer_pencil; this.tsmiTrayTaskSettings.Name = "tsmiTrayTaskSettings"; - this.tsmiTrayTaskSettings.Size = new System.Drawing.Size(188, 22); + this.tsmiTrayTaskSettings.Size = new System.Drawing.Size(189, 22); this.tsmiTrayTaskSettings.Text = "Task settings..."; this.tsmiTrayTaskSettings.Click += new System.EventHandler(this.tsbTaskSettings_Click); // @@ -1454,7 +1467,7 @@ private void InitializeComponent() // this.tsmiTrayHotkeySettings.Image = global::ShareX.Properties.Resources.keyboard_pencil; this.tsmiTrayHotkeySettings.Name = "tsmiTrayHotkeySettings"; - this.tsmiTrayHotkeySettings.Size = new System.Drawing.Size(188, 22); + this.tsmiTrayHotkeySettings.Size = new System.Drawing.Size(189, 22); this.tsmiTrayHotkeySettings.Text = "Hotkey settings..."; this.tsmiTrayHotkeySettings.Click += new System.EventHandler(this.tsbHotkeySettings_Click); // @@ -1462,14 +1475,14 @@ private void InitializeComponent() // this.tsmiTrayDestinationSettings.Image = global::ShareX.Properties.Resources.globe_pencil; this.tsmiTrayDestinationSettings.Name = "tsmiTrayDestinationSettings"; - this.tsmiTrayDestinationSettings.Size = new System.Drawing.Size(188, 22); + this.tsmiTrayDestinationSettings.Size = new System.Drawing.Size(189, 22); this.tsmiTrayDestinationSettings.Text = "Destination settings..."; this.tsmiTrayDestinationSettings.Click += new System.EventHandler(this.tsbDestinationSettings_Click); // // tssTray2 // this.tssTray2.Name = "tssTray2"; - this.tssTray2.Size = new System.Drawing.Size(185, 6); + this.tssTray2.Size = new System.Drawing.Size(186, 6); // // tsmiTrayTools // @@ -1482,7 +1495,7 @@ private void InitializeComponent() this.tsmiTrayDNSChanger}); this.tsmiTrayTools.Image = global::ShareX.Properties.Resources.toolbox; this.tsmiTrayTools.Name = "tsmiTrayTools"; - this.tsmiTrayTools.Size = new System.Drawing.Size(188, 22); + this.tsmiTrayTools.Size = new System.Drawing.Size(189, 22); this.tsmiTrayTools.Text = "Tools"; // // tsmiTrayScreenColorPicker @@ -1537,7 +1550,7 @@ private void InitializeComponent() // this.tsmiScreenshotsFolder.Image = global::ShareX.Properties.Resources.folder_open_image; this.tsmiScreenshotsFolder.Name = "tsmiScreenshotsFolder"; - this.tsmiScreenshotsFolder.Size = new System.Drawing.Size(188, 22); + this.tsmiScreenshotsFolder.Size = new System.Drawing.Size(189, 22); this.tsmiScreenshotsFolder.Text = "Screenshots folder..."; this.tsmiScreenshotsFolder.Click += new System.EventHandler(this.tsbScreenshotsFolder_Click); // @@ -1545,7 +1558,7 @@ private void InitializeComponent() // this.tsmiTrayHistory.Image = global::ShareX.Properties.Resources.address_book_blue; this.tsmiTrayHistory.Name = "tsmiTrayHistory"; - this.tsmiTrayHistory.Size = new System.Drawing.Size(188, 22); + this.tsmiTrayHistory.Size = new System.Drawing.Size(189, 22); this.tsmiTrayHistory.Text = "History..."; this.tsmiTrayHistory.Click += new System.EventHandler(this.tsbHistory_Click); // @@ -1553,7 +1566,7 @@ private void InitializeComponent() // this.tsmiTrayImageHistory.Image = global::ShareX.Properties.Resources.application_icon_large; this.tsmiTrayImageHistory.Name = "tsmiTrayImageHistory"; - this.tsmiTrayImageHistory.Size = new System.Drawing.Size(188, 22); + this.tsmiTrayImageHistory.Size = new System.Drawing.Size(189, 22); this.tsmiTrayImageHistory.Text = "Image history..."; this.tsmiTrayImageHistory.Click += new System.EventHandler(this.tsbImageHistory_Click); // @@ -1561,7 +1574,7 @@ private void InitializeComponent() // this.tsmiTrayDonate.Image = global::ShareX.Properties.Resources.present; this.tsmiTrayDonate.Name = "tsmiTrayDonate"; - this.tsmiTrayDonate.Size = new System.Drawing.Size(188, 22); + this.tsmiTrayDonate.Size = new System.Drawing.Size(189, 22); this.tsmiTrayDonate.Text = "Donate..."; this.tsmiTrayDonate.Click += new System.EventHandler(this.tsbDonate_Click); // @@ -1569,20 +1582,20 @@ private void InitializeComponent() // this.tsmiTrayAbout.Image = global::ShareX.Properties.Resources.application_browser; this.tsmiTrayAbout.Name = "tsmiTrayAbout"; - this.tsmiTrayAbout.Size = new System.Drawing.Size(188, 22); + this.tsmiTrayAbout.Size = new System.Drawing.Size(189, 22); this.tsmiTrayAbout.Text = "About..."; this.tsmiTrayAbout.Click += new System.EventHandler(this.tsbAbout_Click); // // tssTray3 // this.tssTray3.Name = "tssTray3"; - this.tssTray3.Size = new System.Drawing.Size(185, 6); + this.tssTray3.Size = new System.Drawing.Size(186, 6); // // tsmiTrayShow // this.tsmiTrayShow.Image = global::ShareX.Properties.Resources.tick_button; this.tsmiTrayShow.Name = "tsmiTrayShow"; - this.tsmiTrayShow.Size = new System.Drawing.Size(188, 22); + this.tsmiTrayShow.Size = new System.Drawing.Size(189, 22); this.tsmiTrayShow.Text = "Show ShareX window"; this.tsmiTrayShow.Click += new System.EventHandler(this.tsmiTrayShow_Click); // @@ -1590,7 +1603,7 @@ private void InitializeComponent() // this.tsmiTrayExit.Image = global::ShareX.Properties.Resources.cross_button; this.tsmiTrayExit.Name = "tsmiTrayExit"; - this.tsmiTrayExit.Size = new System.Drawing.Size(188, 22); + this.tsmiTrayExit.Size = new System.Drawing.Size(189, 22); this.tsmiTrayExit.Text = "Exit"; this.tsmiTrayExit.Click += new System.EventHandler(this.tsmiTrayExit_Click); // @@ -1600,6 +1613,14 @@ private void InitializeComponent() this.ssToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.ssToolStripMenuItem.Text = "ss"; // + // tsmiTrayDragDropUpload + // + this.tsmiTrayDragDropUpload.Image = global::ShareX.Properties.Resources.inbox_plus; + this.tsmiTrayDragDropUpload.Name = "tsmiTrayDragDropUpload"; + this.tsmiTrayDragDropUpload.Size = new System.Drawing.Size(189, 22); + this.tsmiTrayDragDropUpload.Text = "Drag && drop upload..."; + this.tsmiTrayDragDropUpload.Click += new System.EventHandler(this.tsbDragDropUpload_Click); + // // MainForm // this.AllowDrop = true; @@ -1790,5 +1811,7 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem tsmiTrayShow; private System.Windows.Forms.ToolStripMenuItem tsmiDNSChanger; private System.Windows.Forms.ToolStripMenuItem tsmiTrayDNSChanger; + private System.Windows.Forms.ToolStripButton tsbDragDropUpload; + private System.Windows.Forms.ToolStripMenuItem tsmiTrayDragDropUpload; } } \ No newline at end of file diff --git a/ShareX/Forms/MainForm.cs b/ShareX/Forms/MainForm.cs index 1275e15f6..cd4af5778 100644 --- a/ShareX/Forms/MainForm.cs +++ b/ShareX/Forms/MainForm.cs @@ -685,6 +685,11 @@ private void tsbFileUpload_Click(object sender, EventArgs e) UploadManager.UploadFile(); } + private void tsbDragDropUpload_Click(object sender, EventArgs e) + { + new DropForm().Show(); + } + private void tsddbDestinations_DropDownOpened(object sender, EventArgs e) { UpdateDestinationStates(); diff --git a/ShareX/Properties/Resources.Designer.cs b/ShareX/Properties/Resources.Designer.cs index e8d6934e9..9e52afecc 100644 --- a/ShareX/Properties/Resources.Designer.cs +++ b/ShareX/Properties/Resources.Designer.cs @@ -519,6 +519,16 @@ public static System.Drawing.Bitmap image_saturation { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap inbox_plus { + get { + object obj = ResourceManager.GetObject("inbox_plus", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -644,7 +654,7 @@ public static System.Drawing.Bitmap navigation_090_button { /// public static System.Drawing.Bitmap network_ip { get { - object obj = ResourceManager.GetObject("network-ip", resourceCulture); + object obj = ResourceManager.GetObject("network_ip", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } diff --git a/ShareX/Properties/Resources.resx b/ShareX/Properties/Resources.resx index c4dbd88d8..2cab1f5a3 100644 --- a/ShareX/Properties/Resources.resx +++ b/ShareX/Properties/Resources.resx @@ -117,7 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + ..\Resources\layer.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -169,6 +169,9 @@ ..\Resources\folder-open-image.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\navigation-090-button.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\layers-ungroup.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -193,9 +196,6 @@ ..\Resources\image-export.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\au.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\keyboard--pencil.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -205,6 +205,9 @@ ..\Resources\hammer.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Window.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\Polygon.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -235,9 +238,6 @@ ..\Resources\address-book-blue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\pencil.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\block.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -313,14 +313,17 @@ ..\Resources\application--pencil.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\network-ip.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\pipette.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Window.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\pencil.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\navigation-090-button.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\au.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\checkbox_uncheck.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -340,8 +343,7 @@ ..\Resources\application-task.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\network-ip.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\inbox--plus.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a \ No newline at end of file diff --git a/ShareX/Resources/inbox--plus.png b/ShareX/Resources/inbox--plus.png new file mode 100644 index 0000000000000000000000000000000000000000..b8c1a5dde4ca460ff86345d5100b3e26fac7415a GIT binary patch literal 600 zcmV-e0;m0nP)&GDnFVc%5p1c(-p$Gj7ya+`Q5B&pL4^{BglSf4n@hr9$1tADk3pHY? zhNjtMKi+p==UrGyN-35OEDX#1p4n$+)=)~}Ad$iWgWgswqzv5V{M0_#)kxtHv4LUg z=`W4ndT?hy^oOVS=KW@Um}G>ZBWKFvUb~I&)hcY;hGkhWO|uJ-QX&jP1VMn}$OtsE z_U`!*Nu`R)NSSVed-wOBxZqVDE6PM1IeCN?t1PUJO9VFar$S4fv~1(eF= zxcKGbB8aFSL?~KQU(KF?aMPG)tj`74Ts6 zlf;dwsa;n$vveO9C$8fC>lbmoW~mjz@z}fIu1VB*ot<&F@dls5Uva)Ax1fB9%d2xp zk2;rFKsf;mbbj*A6@J{VVc`0?INubTI6QGS&OiTH&l(S}V4CZv_qw`gqv@0Dhs<~_ zgO#zKjVCK^JS)q1MGP|yg0000 AutoCaptureForm.cs + + Form + Form @@ -444,6 +447,7 @@ +