mirror of
https://github.com/greenshot/greenshot
synced 2025-08-20 21:43:24 -07:00
Add clipboard features for file path and file
Related to #545 Add functionality to copy file path and file itself to clipboard using key combinations. * **src/Greenshot/Forms/MainForm.Designer.cs** - Add new context menu items for copying the file path and the file itself to the clipboard. - Update the context menu to include the new items. * **src/Greenshot/Destinations/ClipboardDestination.cs** - Add logic to differentiate between different key combinations. - Implement functionality to copy the file path to the clipboard. - Implement functionality to copy the file itself to the clipboard. * **src/Greenshot/Helpers/CaptureHelper.cs** - Add functionality to handle the new key combinations. - Update the capture logic to include the new functionality. - Ensure the new functionality is integrated with the existing capture process. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/greenshot/greenshot/issues/545?shareId=XXXX-XXXX-XXXX-XXXX).
This commit is contained in:
parent
bb7a374390
commit
5e6b527c42
3 changed files with 1642 additions and 1600 deletions
|
@ -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)
|
||||
{
|
||||
|
|
20
src/Greenshot/Forms/MainForm.Designer.cs
generated
20
src/Greenshot/Forms/MainForm.Designer.cs
generated
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue