mirror of
https://github.com/greenshot/greenshot
synced 2025-07-16 10:03:44 -07:00
Added some new Controls, were needed for the editor.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1833 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
5a5da6a423
commit
00819deecd
5 changed files with 136 additions and 12 deletions
|
@ -13,7 +13,8 @@ namespace GreenshotPlugin.Controls {
|
||||||
public abstract class GreenshotForm : Form, IGreenshotLanguageBindable {
|
public abstract class GreenshotForm : Form, IGreenshotLanguageBindable {
|
||||||
private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(GreenshotForm));
|
private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(GreenshotForm));
|
||||||
private IComponentChangeService m_changeService;
|
private IComponentChangeService m_changeService;
|
||||||
private bool isLanguageSet = false;
|
private bool isDesignModeLanguageSet = false;
|
||||||
|
private bool applyLanguageManually = false;
|
||||||
private IDictionary<string, Control> designTimeControls;
|
private IDictionary<string, Control> designTimeControls;
|
||||||
private IDictionary<string, ToolStripItem> designTimeToolStripItems;
|
private IDictionary<string, ToolStripItem> designTimeToolStripItems;
|
||||||
[Category("Greenshot"), DefaultValue(null), Description("Specifies key of the language file to use when displaying the text.")]
|
[Category("Greenshot"), DefaultValue(null), Description("Specifies key of the language file to use when displaying the text.")]
|
||||||
|
@ -22,6 +23,15 @@ namespace GreenshotPlugin.Controls {
|
||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected bool ManualLanguageApply {
|
||||||
|
get {
|
||||||
|
return applyLanguageManually;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
applyLanguageManually = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Code to initialize the language etc during design time
|
/// Code to initialize the language etc during design time
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -57,8 +67,8 @@ namespace GreenshotPlugin.Controls {
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
protected override void OnPaint(PaintEventArgs e) {
|
protected override void OnPaint(PaintEventArgs e) {
|
||||||
if (this.DesignMode) {
|
if (this.DesignMode) {
|
||||||
if (!isLanguageSet) {
|
if (!isDesignModeLanguageSet) {
|
||||||
isLanguageSet = true;
|
isDesignModeLanguageSet = true;
|
||||||
try {
|
try {
|
||||||
ApplyLanguage();
|
ApplyLanguage();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
@ -71,7 +81,9 @@ namespace GreenshotPlugin.Controls {
|
||||||
|
|
||||||
protected override void OnLoad(EventArgs e) {
|
protected override void OnLoad(EventArgs e) {
|
||||||
if (!this.DesignMode) {
|
if (!this.DesignMode) {
|
||||||
ApplyLanguage();
|
if (!applyLanguageManually) {
|
||||||
|
ApplyLanguage();
|
||||||
|
}
|
||||||
FillFields();
|
FillFields();
|
||||||
base.OnLoad(e);
|
base.OnLoad(e);
|
||||||
} else {
|
} else {
|
||||||
|
@ -265,8 +277,8 @@ namespace GreenshotPlugin.Controls {
|
||||||
}
|
}
|
||||||
// Reset the text values for all GreenshotControls
|
// Reset the text values for all GreenshotControls
|
||||||
foreach (FieldInfo field in this.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)) {
|
foreach (FieldInfo field in this.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)) {
|
||||||
if (!field.FieldType.IsSubclassOf(typeof(Control))) {
|
if (!field.FieldType.IsSubclassOf(typeof(Control)) && !field.FieldType.IsSubclassOf(typeof(ToolStripItem))) {
|
||||||
LOG.DebugFormat("No control: {0}", field.Name);
|
LOG.DebugFormat("No Control or ToolStripItem: {0}", field.Name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Object controlObject = field.GetValue(this);
|
Object controlObject = field.GetValue(this);
|
||||||
|
@ -274,13 +286,17 @@ namespace GreenshotPlugin.Controls {
|
||||||
LOG.DebugFormat("No value: {0}", field.Name);
|
LOG.DebugFormat("No value: {0}", field.Name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Control applyTo = controlObject as Control;
|
Control applyToControl = controlObject as Control;
|
||||||
if (applyTo == null) {
|
if (applyToControl == null) {
|
||||||
// not a control
|
ToolStripItem applyToItem = controlObject as ToolStripItem;
|
||||||
LOG.DebugFormat("No control: {0}", field.Name);
|
if (applyToItem == null) {
|
||||||
continue;
|
LOG.DebugFormat("No Control or ToolStripItem: {0}", field.Name);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ApplyLanguage(applyToItem);
|
||||||
|
} else {
|
||||||
|
ApplyLanguage(applyToControl);
|
||||||
}
|
}
|
||||||
ApplyLanguage(applyTo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DesignMode) {
|
if (DesignMode) {
|
||||||
|
|
33
GreenshotPlugin/Controls/GreenshotToolDropDownButton.cs
Normal file
33
GreenshotPlugin/Controls/GreenshotToolDropDownButton.cs
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* Greenshot - a free and open source screenshot tool
|
||||||
|
* Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
|
||||||
|
*
|
||||||
|
* For more information see: http://getgreenshot.org/
|
||||||
|
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
|
||||||
|
*
|
||||||
|
* 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 1 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace GreenshotPlugin.Controls {
|
||||||
|
public class GreenshotToolStripDropDownButton : ToolStripDropDownButton, IGreenshotLanguageBindable {
|
||||||
|
[Category("Greenshot"), DefaultValue(null), Description("Specifies key of the language file to use when displaying the text.")]
|
||||||
|
public string LanguageKey {
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
33
GreenshotPlugin/Controls/GreenshotToolStripButton.cs
Normal file
33
GreenshotPlugin/Controls/GreenshotToolStripButton.cs
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* Greenshot - a free and open source screenshot tool
|
||||||
|
* Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
|
||||||
|
*
|
||||||
|
* For more information see: http://getgreenshot.org/
|
||||||
|
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
|
||||||
|
*
|
||||||
|
* 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 1 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace GreenshotPlugin.Controls {
|
||||||
|
public class GreenshotToolStripButton : ToolStripButton, IGreenshotLanguageBindable {
|
||||||
|
[Category("Greenshot"), DefaultValue(null), Description("Specifies key of the language file to use when displaying the text.")]
|
||||||
|
public string LanguageKey {
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
33
GreenshotPlugin/Controls/GreenshotToolStripLabel.cs
Normal file
33
GreenshotPlugin/Controls/GreenshotToolStripLabel.cs
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* Greenshot - a free and open source screenshot tool
|
||||||
|
* Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
|
||||||
|
*
|
||||||
|
* For more information see: http://getgreenshot.org/
|
||||||
|
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
|
||||||
|
*
|
||||||
|
* 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 1 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
using System;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace GreenshotPlugin.Controls {
|
||||||
|
public class GreenshotToolStripLabel : ToolStripLabel, IGreenshotLanguageBindable {
|
||||||
|
[Category("Greenshot"), DefaultValue(null), Description("Specifies key of the language file to use when displaying the text.")]
|
||||||
|
public string LanguageKey {
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -214,6 +214,15 @@
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Controls\IGreenshotConfigBindable.cs" />
|
<Compile Include="Controls\IGreenshotConfigBindable.cs" />
|
||||||
<Compile Include="Controls\IGreenshotLanguageBindable.cs" />
|
<Compile Include="Controls\IGreenshotLanguageBindable.cs" />
|
||||||
|
<Compile Include="Controls\GreenshotToolStripButton.cs">
|
||||||
|
<SubType>Component</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Controls\GreenshotToolStripLabel.cs">
|
||||||
|
<SubType>Component</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Controls\GreenshotToolDropDownButton.cs">
|
||||||
|
<SubType>Component</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Core\AbstractDestination.cs" />
|
<Compile Include="Core\AbstractDestination.cs" />
|
||||||
<Compile Include="Core\AbstractProcessor.cs" />
|
<Compile Include="Core\AbstractProcessor.cs" />
|
||||||
<Compile Include="Core\AccessibleHelper.cs" />
|
<Compile Include="Core\AccessibleHelper.cs" />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue