This commit is contained in:
M.F.M Fazrin 2025-08-13 16:27:13 -04:00 committed by GitHub
commit e31b523766
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 1642 additions and 1600 deletions

View file

@ -61,8 +61,32 @@ namespace Greenshot.Destinations
ExportInformation exportInformation = new ExportInformation(Designation, Description);
try
{
ClipboardHelper.SetClipboardData(surface);
exportInformation.ExportMade = true;
if (Control.ModifierKeys == Keys.Control)
{
// Copy file itself to clipboard
string filePath = captureDetails.Filename;
if (!string.IsNullOrEmpty(filePath))
{
Clipboard.SetFileDropList(new System.Collections.Specialized.StringCollection { filePath });
exportInformation.ExportMade = true;
}
}
else if (Control.ModifierKeys == Keys.None)
{
// Copy file path to clipboard
string filePath = captureDetails.Filename;
if (!string.IsNullOrEmpty(filePath))
{
Clipboard.SetText(filePath);
exportInformation.ExportMade = true;
}
}
else
{
// Copy image to clipboard
ClipboardHelper.SetClipboardData(surface);
exportInformation.ExportMade = true;
}
}
catch (Exception)
{

View file

@ -102,7 +102,9 @@ namespace Greenshot.Forms {
this.contextmenu_donate,
this.contextmenu_about,
this.toolStripCloseSeparator,
this.contextmenu_exit});
this.contextmenu_exit,
this.contextmenu_copyfilepath,
this.contextmenu_copyfile});
this.contextMenu.Name = "contextMenu";
this.contextMenu.Closing += new System.Windows.Forms.ToolStripDropDownClosingEventHandler(this.ContextMenuClosing);
this.contextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuOpening);
@ -250,6 +252,20 @@ namespace Greenshot.Forms {
this.contextmenu_exit.Size = new System.Drawing.Size(170, 22);
this.contextmenu_exit.Click += new System.EventHandler(this.Contextmenu_ExitClick);
//
// contextmenu_copyfilepath
//
this.contextmenu_copyfilepath.Image = ((System.Drawing.Image)(resources.GetObject("contextmenu_copyfilepath.Image")));
this.contextmenu_copyfilepath.Name = "contextmenu_copyfilepath";
this.contextmenu_copyfilepath.Size = new System.Drawing.Size(170, 22);
this.contextmenu_copyfilepath.Click += new System.EventHandler(this.Contextmenu_CopyFilePathClick);
//
// contextmenu_copyfile
//
this.contextmenu_copyfile.Image = ((System.Drawing.Image)(resources.GetObject("contextmenu_copyfile.Image")));
this.contextmenu_copyfile.Name = "contextmenu_copyfile";
this.contextmenu_copyfile.Size = new System.Drawing.Size(170, 22);
this.contextmenu_copyfile.Click += new System.EventHandler(this.Contextmenu_CopyFileClick);
//
// notifyIcon
//
this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
@ -297,5 +313,7 @@ namespace Greenshot.Forms {
private GreenshotToolStripMenuItem contextmenu_exit;
private System.Windows.Forms.ContextMenuStrip contextMenu;
private GreenshotToolStripMenuItem contextmenu_settings;
private GreenshotToolStripMenuItem contextmenu_copyfilepath;
private GreenshotToolStripMenuItem contextmenu_copyfile;
}
}