mirror of
https://github.com/greenshot/greenshot
synced 2025-07-30 11:40:40 -07:00
Fixes for Bug #3579467, context menu entries are updated when changing the language / hotkeys.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2200 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
eeca9ec0de
commit
8b331ee3a4
8 changed files with 71 additions and 14 deletions
|
@ -407,9 +407,6 @@ namespace Greenshot {
|
||||||
coreConfiguration.DWMBackgroundColor = colorButton_window_background.SelectedColor;
|
coreConfiguration.DWMBackgroundColor = colorButton_window_background.SelectedColor;
|
||||||
coreConfiguration.UpdateCheckInterval = (int)numericUpDown_daysbetweencheck.Value;
|
coreConfiguration.UpdateCheckInterval = (int)numericUpDown_daysbetweencheck.Value;
|
||||||
|
|
||||||
// Make sure the current language & settings are reflected in the Main-context menu
|
|
||||||
MainForm.Instance.UpdateUI();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Check if the Run for all is set
|
// Check if the Run for all is set
|
||||||
if(!StartupHelper.checkRunAll()) {
|
if(!StartupHelper.checkRunAll()) {
|
||||||
|
@ -438,6 +435,9 @@ namespace Greenshot {
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
StoreFields();
|
StoreFields();
|
||||||
MainForm.RegisterHotkeys();
|
MainForm.RegisterHotkeys();
|
||||||
|
|
||||||
|
// Make sure the current language & settings are reflected in the Main-context menu
|
||||||
|
MainForm.Instance.UpdateUI();
|
||||||
DialogResult = DialogResult.OK;
|
DialogResult = DialogResult.OK;
|
||||||
} else {
|
} else {
|
||||||
this.tabcontrol.SelectTab(this.tab_output);
|
this.tabcontrol.SelectTab(this.tab_output);
|
||||||
|
|
|
@ -39,6 +39,7 @@ namespace GreenshotBoxPlugin {
|
||||||
public static PluginAttribute Attributes;
|
public static PluginAttribute Attributes;
|
||||||
private IGreenshotHost host;
|
private IGreenshotHost host;
|
||||||
private ComponentResourceManager resources;
|
private ComponentResourceManager resources;
|
||||||
|
private ToolStripMenuItem itemPlugInConfig;
|
||||||
|
|
||||||
public BoxPlugin() {
|
public BoxPlugin() {
|
||||||
}
|
}
|
||||||
|
@ -65,16 +66,22 @@ namespace GreenshotBoxPlugin {
|
||||||
config = IniConfig.GetIniSection<BoxConfiguration>();
|
config = IniConfig.GetIniSection<BoxConfiguration>();
|
||||||
resources = new ComponentResourceManager(typeof(BoxPlugin));
|
resources = new ComponentResourceManager(typeof(BoxPlugin));
|
||||||
|
|
||||||
ToolStripMenuItem itemPlugInConfig = new ToolStripMenuItem();
|
itemPlugInConfig = new ToolStripMenuItem();
|
||||||
itemPlugInConfig.Image = (Image)resources.GetObject("Box");
|
itemPlugInConfig.Image = (Image)resources.GetObject("Box");
|
||||||
itemPlugInConfig.Text = Language.GetString("box", LangKey.Configure);
|
itemPlugInConfig.Text = Language.GetString("box", LangKey.Configure);
|
||||||
itemPlugInConfig.Click += new System.EventHandler(ConfigMenuClick);
|
itemPlugInConfig.Click += new System.EventHandler(ConfigMenuClick);
|
||||||
|
|
||||||
PluginUtils.AddToContextMenu(host, itemPlugInConfig);
|
PluginUtils.AddToContextMenu(host, itemPlugInConfig);
|
||||||
|
Language.LanguageChanged += new LanguageChangedHandler(OnLanguageChanged);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnLanguageChanged() {
|
||||||
|
if (itemPlugInConfig != null) {
|
||||||
|
itemPlugInConfig.Text = Language.GetString("box", LangKey.Configure);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void Shutdown() {
|
public virtual void Shutdown() {
|
||||||
LOG.Debug("Box Plugin shutdown.");
|
LOG.Debug("Box Plugin shutdown.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ namespace GreenshotDropboxPlugin {
|
||||||
public static PluginAttribute Attributes;
|
public static PluginAttribute Attributes;
|
||||||
private IGreenshotHost host;
|
private IGreenshotHost host;
|
||||||
private ComponentResourceManager resources;
|
private ComponentResourceManager resources;
|
||||||
|
private ToolStripMenuItem itemPlugInConfig;
|
||||||
|
|
||||||
public DropboxPlugin() {
|
public DropboxPlugin() {
|
||||||
}
|
}
|
||||||
|
@ -65,17 +66,23 @@ namespace GreenshotDropboxPlugin {
|
||||||
config = IniConfig.GetIniSection<DropboxPluginConfiguration>();
|
config = IniConfig.GetIniSection<DropboxPluginConfiguration>();
|
||||||
resources = new ComponentResourceManager(typeof(DropboxPlugin));
|
resources = new ComponentResourceManager(typeof(DropboxPlugin));
|
||||||
|
|
||||||
ToolStripMenuItem itemPlugInConfig = new ToolStripMenuItem();
|
itemPlugInConfig = new ToolStripMenuItem();
|
||||||
itemPlugInConfig.Text = Language.GetString("dropbox", LangKey.Configure);
|
itemPlugInConfig.Text = Language.GetString("dropbox", LangKey.Configure);
|
||||||
itemPlugInConfig.Tag = host;
|
itemPlugInConfig.Tag = host;
|
||||||
itemPlugInConfig.Click += new System.EventHandler(ConfigMenuClick);
|
itemPlugInConfig.Click += new System.EventHandler(ConfigMenuClick);
|
||||||
itemPlugInConfig.Image = (Image)resources.GetObject("Dropbox");
|
itemPlugInConfig.Image = (Image)resources.GetObject("Dropbox");
|
||||||
|
|
||||||
PluginUtils.AddToContextMenu(host, itemPlugInConfig);
|
PluginUtils.AddToContextMenu(host, itemPlugInConfig);
|
||||||
|
Language.LanguageChanged += new LanguageChangedHandler(OnLanguageChanged);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnLanguageChanged() {
|
||||||
|
if (itemPlugInConfig != null) {
|
||||||
|
itemPlugInConfig.Text = Language.GetString("dropbox", LangKey.Configure);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void Shutdown() {
|
public virtual void Shutdown() {
|
||||||
LOG.Debug("Dropbox Plugin shutdown.");
|
LOG.Debug("Dropbox Plugin shutdown.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ namespace ExternalCommand {
|
||||||
private static ExternalCommandConfiguration config = IniConfig.GetIniSection<ExternalCommandConfiguration>();
|
private static ExternalCommandConfiguration config = IniConfig.GetIniSection<ExternalCommandConfiguration>();
|
||||||
private IGreenshotHost host;
|
private IGreenshotHost host;
|
||||||
private PluginAttribute myAttributes;
|
private PluginAttribute myAttributes;
|
||||||
|
private ToolStripMenuItem itemPlugInRoot;
|
||||||
|
|
||||||
public ExternalCommandPlugin() {
|
public ExternalCommandPlugin() {
|
||||||
}
|
}
|
||||||
|
@ -68,7 +69,7 @@ namespace ExternalCommand {
|
||||||
this.myAttributes = myAttributes;
|
this.myAttributes = myAttributes;
|
||||||
|
|
||||||
|
|
||||||
ToolStripMenuItem itemPlugInRoot = new ToolStripMenuItem();
|
itemPlugInRoot = new ToolStripMenuItem();
|
||||||
itemPlugInRoot.Text = Language.GetString("externalcommand", "contextmenu_configure");
|
itemPlugInRoot.Text = Language.GetString("externalcommand", "contextmenu_configure");
|
||||||
itemPlugInRoot.Tag = host;
|
itemPlugInRoot.Tag = host;
|
||||||
string exePath = PluginUtils.GetExePath("cmd.exe");
|
string exePath = PluginUtils.GetExePath("cmd.exe");
|
||||||
|
@ -78,9 +79,16 @@ namespace ExternalCommand {
|
||||||
itemPlugInRoot.Click += new System.EventHandler(ConfigMenuClick);
|
itemPlugInRoot.Click += new System.EventHandler(ConfigMenuClick);
|
||||||
|
|
||||||
PluginUtils.AddToContextMenu(host, itemPlugInRoot);
|
PluginUtils.AddToContextMenu(host, itemPlugInRoot);
|
||||||
|
Language.LanguageChanged += new LanguageChangedHandler(OnLanguageChanged);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnLanguageChanged() {
|
||||||
|
if (itemPlugInRoot != null) {
|
||||||
|
itemPlugInRoot.Text = Language.GetString("externalcommand", "contextmenu_configure");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void Shutdown() {
|
public virtual void Shutdown() {
|
||||||
LOG.Debug("Shutdown of " + myAttributes.Name);
|
LOG.Debug("Shutdown of " + myAttributes.Name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ namespace GreenshotFlickrPlugin
|
||||||
public static PluginAttribute Attributes;
|
public static PluginAttribute Attributes;
|
||||||
private IGreenshotHost host;
|
private IGreenshotHost host;
|
||||||
private ComponentResourceManager resources;
|
private ComponentResourceManager resources;
|
||||||
|
private ToolStripMenuItem itemPlugInConfig;
|
||||||
|
|
||||||
public FlickrPlugin() {
|
public FlickrPlugin() {
|
||||||
}
|
}
|
||||||
|
@ -67,17 +68,23 @@ namespace GreenshotFlickrPlugin
|
||||||
config = IniConfig.GetIniSection<FlickrConfiguration>();
|
config = IniConfig.GetIniSection<FlickrConfiguration>();
|
||||||
resources = new ComponentResourceManager(typeof(FlickrPlugin));
|
resources = new ComponentResourceManager(typeof(FlickrPlugin));
|
||||||
|
|
||||||
ToolStripMenuItem itemPlugInConfig = new ToolStripMenuItem();
|
itemPlugInConfig = new ToolStripMenuItem();
|
||||||
itemPlugInConfig.Text = Language.GetString("flickr", LangKey.Configure);
|
itemPlugInConfig.Text = Language.GetString("flickr", LangKey.Configure);
|
||||||
itemPlugInConfig.Tag = host;
|
itemPlugInConfig.Tag = host;
|
||||||
itemPlugInConfig.Image = (Image)resources.GetObject("flickr");
|
itemPlugInConfig.Image = (Image)resources.GetObject("flickr");
|
||||||
itemPlugInConfig.Click += new System.EventHandler(ConfigMenuClick);
|
itemPlugInConfig.Click += new System.EventHandler(ConfigMenuClick);
|
||||||
|
|
||||||
PluginUtils.AddToContextMenu(host, itemPlugInConfig);
|
PluginUtils.AddToContextMenu(host, itemPlugInConfig);
|
||||||
|
Language.LanguageChanged += new LanguageChangedHandler(OnLanguageChanged);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnLanguageChanged() {
|
||||||
|
if (itemPlugInConfig != null) {
|
||||||
|
itemPlugInConfig.Text = Language.GetString("flickr", LangKey.Configure);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void Shutdown() {
|
public virtual void Shutdown() {
|
||||||
LOG.Debug("Flickr Plugin shutdown.");
|
LOG.Debug("Flickr Plugin shutdown.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@ namespace GreenshotImgurPlugin {
|
||||||
private IGreenshotHost host;
|
private IGreenshotHost host;
|
||||||
private ComponentResourceManager resources;
|
private ComponentResourceManager resources;
|
||||||
private ToolStripMenuItem historyMenuItem = null;
|
private ToolStripMenuItem historyMenuItem = null;
|
||||||
|
private ToolStripMenuItem itemPlugInConfig;
|
||||||
|
|
||||||
public ImgurPlugin() {
|
public ImgurPlugin() {
|
||||||
}
|
}
|
||||||
|
@ -78,7 +79,7 @@ namespace GreenshotImgurPlugin {
|
||||||
};
|
};
|
||||||
itemPlugInRoot.DropDownItems.Add(historyMenuItem);
|
itemPlugInRoot.DropDownItems.Add(historyMenuItem);
|
||||||
|
|
||||||
ToolStripMenuItem itemPlugInConfig = new ToolStripMenuItem(Language.GetString("imgur", LangKey.configure));
|
itemPlugInConfig = new ToolStripMenuItem(Language.GetString("imgur", LangKey.configure));
|
||||||
itemPlugInConfig.Tag = host;
|
itemPlugInConfig.Tag = host;
|
||||||
itemPlugInConfig.Click += delegate {
|
itemPlugInConfig.Click += delegate {
|
||||||
config.ShowConfigDialog();
|
config.ShowConfigDialog();
|
||||||
|
@ -86,6 +87,7 @@ namespace GreenshotImgurPlugin {
|
||||||
itemPlugInRoot.DropDownItems.Add(itemPlugInConfig);
|
itemPlugInRoot.DropDownItems.Add(itemPlugInConfig);
|
||||||
|
|
||||||
PluginUtils.AddToContextMenu(host, itemPlugInRoot);
|
PluginUtils.AddToContextMenu(host, itemPlugInRoot);
|
||||||
|
Language.LanguageChanged += new LanguageChangedHandler(OnLanguageChanged);
|
||||||
|
|
||||||
// retrieve history in the background
|
// retrieve history in the background
|
||||||
Thread backgroundTask = new Thread (new ThreadStart(CheckHistory));
|
Thread backgroundTask = new Thread (new ThreadStart(CheckHistory));
|
||||||
|
@ -95,7 +97,16 @@ namespace GreenshotImgurPlugin {
|
||||||
backgroundTask.Start();
|
backgroundTask.Start();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnLanguageChanged() {
|
||||||
|
if (itemPlugInConfig != null) {
|
||||||
|
itemPlugInConfig.Text = Language.GetString("imgur", LangKey.configure);
|
||||||
|
}
|
||||||
|
if (historyMenuItem != null) {
|
||||||
|
historyMenuItem.Text = Language.GetString("imgur", LangKey.history);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void CheckHistory() {
|
private void CheckHistory() {
|
||||||
try {
|
try {
|
||||||
ImgurUtils.LoadHistory();
|
ImgurUtils.LoadHistory();
|
||||||
|
|
|
@ -38,6 +38,7 @@ namespace GreenshotPicasaPlugin {
|
||||||
public static PluginAttribute Attributes;
|
public static PluginAttribute Attributes;
|
||||||
private IGreenshotHost host;
|
private IGreenshotHost host;
|
||||||
private ComponentResourceManager resources;
|
private ComponentResourceManager resources;
|
||||||
|
private ToolStripMenuItem itemPlugInRoot;
|
||||||
|
|
||||||
public PicasaPlugin() {
|
public PicasaPlugin() {
|
||||||
}
|
}
|
||||||
|
@ -65,18 +66,25 @@ namespace GreenshotPicasaPlugin {
|
||||||
config = IniConfig.GetIniSection<PicasaConfiguration>();
|
config = IniConfig.GetIniSection<PicasaConfiguration>();
|
||||||
resources = new ComponentResourceManager(typeof(PicasaPlugin));
|
resources = new ComponentResourceManager(typeof(PicasaPlugin));
|
||||||
|
|
||||||
ToolStripMenuItem itemPlugInRoot = new ToolStripMenuItem();
|
itemPlugInRoot = new ToolStripMenuItem();
|
||||||
itemPlugInRoot.Text = Language.GetString("picasa", LangKey.Configure);
|
itemPlugInRoot.Text = Language.GetString("picasa", LangKey.Configure);
|
||||||
itemPlugInRoot.Tag = host;
|
itemPlugInRoot.Tag = host;
|
||||||
itemPlugInRoot.Image = (Image)resources.GetObject("Picasa");
|
itemPlugInRoot.Image = (Image)resources.GetObject("Picasa");
|
||||||
itemPlugInRoot.Click += new System.EventHandler(ConfigMenuClick);
|
itemPlugInRoot.Click += new System.EventHandler(ConfigMenuClick);
|
||||||
PluginUtils.AddToContextMenu(host, itemPlugInRoot);
|
PluginUtils.AddToContextMenu(host, itemPlugInRoot);
|
||||||
|
Language.LanguageChanged += new LanguageChangedHandler(OnLanguageChanged);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnLanguageChanged() {
|
||||||
|
if (itemPlugInRoot != null) {
|
||||||
|
itemPlugInRoot.Text = Language.GetString("picasa", LangKey.Configure);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void Shutdown() {
|
public virtual void Shutdown() {
|
||||||
LOG.Debug("Picasa Plugin shutdown.");
|
LOG.Debug("Picasa Plugin shutdown.");
|
||||||
|
Language.LanguageChanged -= new LanguageChangedHandler(OnLanguageChanged);
|
||||||
//host.OnImageEditorOpen -= new OnImageEditorOpenHandler(ImageEditorOpened);
|
//host.OnImageEditorOpen -= new OnImageEditorOpenHandler(ImageEditorOpened);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ using Greenshot.IniFile;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
|
||||||
namespace GreenshotPlugin.Core {
|
namespace GreenshotPlugin.Core {
|
||||||
|
public delegate void LanguageChangedHandler();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This class supplies the GUI with translations, based upon keys.
|
/// This class supplies the GUI with translations, based upon keys.
|
||||||
/// The language resources are loaded from the language files found on fixed or supplied paths
|
/// The language resources are loaded from the language files found on fixed or supplied paths
|
||||||
|
@ -49,6 +50,8 @@ namespace GreenshotPlugin.Core {
|
||||||
private static string currentLanguage = null;
|
private static string currentLanguage = null;
|
||||||
private static CoreConfiguration coreConfig = null;
|
private static CoreConfiguration coreConfig = null;
|
||||||
|
|
||||||
|
public static event LanguageChangedHandler LanguageChanged;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Static initializer for the language code
|
/// Static initializer for the language code
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -197,6 +200,12 @@ namespace GreenshotPlugin.Core {
|
||||||
if (currentLanguage == null || !currentLanguage.Equals(ietf)) {
|
if (currentLanguage == null || !currentLanguage.Equals(ietf)) {
|
||||||
currentLanguage = ietf;
|
currentLanguage = ietf;
|
||||||
Reload();
|
Reload();
|
||||||
|
if (LanguageChanged != null) {
|
||||||
|
try {
|
||||||
|
LanguageChanged();
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue