mirror of
https://github.com/greenshot/greenshot
synced 2025-08-21 14:03:23 -07:00
Refactored PluginUtils to have the GetExePath and GetExeIcon, which was needed for giving the ExternalCommandPlugin an icon.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2057 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
99e672a76d
commit
91385b074e
13 changed files with 119 additions and 83 deletions
|
@ -49,7 +49,7 @@ namespace ExternalCommand {
|
|||
private static bool hasPaintDotNet = false;
|
||||
static ExternalCommandConfiguration() {
|
||||
try {
|
||||
paintPath = AbstractDestination.GetExePath("pbrush.exe");
|
||||
paintPath = PluginUtils.GetExePath("pbrush.exe");
|
||||
hasPaint = !string.IsNullOrEmpty(paintPath) && File.Exists(paintPath);
|
||||
paintDotNetPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"Paint.NET\PaintDotNet.exe");
|
||||
hasPaintDotNet = !string.IsNullOrEmpty(paintDotNetPath) && File.Exists(paintDotNetPath);
|
||||
|
|
|
@ -24,6 +24,8 @@ using System.Diagnostics;
|
|||
using System.IO;
|
||||
using Greenshot.Plugin;
|
||||
using Greenshot.IniFile;
|
||||
using System.Windows.Forms;
|
||||
using GreenshotPlugin.Core;
|
||||
|
||||
namespace ExternalCommand {
|
||||
/// <summary>
|
||||
|
@ -65,13 +67,29 @@ namespace ExternalCommand {
|
|||
}
|
||||
this.host = pluginHost;
|
||||
this.myAttributes = myAttributes;
|
||||
|
||||
|
||||
ToolStripMenuItem itemPlugInRoot = new ToolStripMenuItem();
|
||||
itemPlugInRoot.Text = Language.GetString("externalcommand", "contextmenu_configure");
|
||||
itemPlugInRoot.Tag = host;
|
||||
string exePath = PluginUtils.GetExePath("cmd.exe");
|
||||
if (exePath != null && File.Exists(exePath)) {
|
||||
itemPlugInRoot.Image = PluginUtils.GetExeIcon(exePath, 0);
|
||||
}
|
||||
itemPlugInRoot.Click += new System.EventHandler(ConfigMenuClick);
|
||||
|
||||
PluginUtils.AddToContextMenu(host, itemPlugInRoot);
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual void Shutdown() {
|
||||
LOG.Debug("Shutdown of " + myAttributes.Name);
|
||||
}
|
||||
|
||||
|
||||
private void ConfigMenuClick(object sender, EventArgs eventArgs) {
|
||||
Configure();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of the IPlugin.Configure
|
||||
/// </summary>
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace ExternalCommand {
|
|||
Image icon = null;
|
||||
if (File.Exists(config.commandlines[exepath])) {
|
||||
try {
|
||||
icon = AbstractDestination.GetExeIcon(config.commandlines[exepath], 0);
|
||||
icon = PluginUtils.GetExeIcon(config.commandlines[exepath], 0);
|
||||
} catch (Exception ex) {
|
||||
LOG.Warn("Problem loading icon for " + config.commandlines[exepath], ex);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<language description="English" ietf="en-US" version="1.0.0">
|
||||
<resources>
|
||||
<resource name="settings_title">
|
||||
<resource name="contextmenu_configure">
|
||||
Configure external commands
|
||||
</resource>
|
||||
<resource name="settings_title">
|
||||
External command settings
|
||||
</resource>
|
||||
<resource name="settings_detail_title">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue