Made ini-binding for the form

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1784 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-04-17 14:42:41 +00:00
parent 53af559d22
commit 72b3f774ce
4 changed files with 46 additions and 11 deletions

View file

@ -0,0 +1,29 @@
/*
* 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.Collections.Generic;
using System.Text;
using GreenshotPlugin.Controls;
namespace PluginExample {
public class ExampleForm : GreenshotForm{
}
}

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<ProjectGuid>{6BD38118-B27F-43A1-951C-FB6464D39260}</ProjectGuid> <ProjectGuid>{6BD38118-B27F-43A1-951C-FB6464D39260}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -49,13 +49,18 @@
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="ExampleForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GreyscaleProcessor.cs" /> <Compile Include="GreyscaleProcessor.cs" />
<Compile Include="PluginExampleConfiguration.cs" /> <Compile Include="PluginExampleConfiguration.cs" />
<Compile Include="SimpleOutputDestination.cs" /> <Compile Include="SimpleOutputDestination.cs" />
<Compile Include="AnnotateProcessor.cs" /> <Compile Include="AnnotateProcessor.cs" />
<Compile Include="PluginExample.cs" /> <Compile Include="PluginExample.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SettingsForm.cs" /> <Compile Include="SettingsForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SettingsForm.Designer.cs"> <Compile Include="SettingsForm.Designer.cs">
<DependentUpon>SettingsForm.cs</DependentUpon> <DependentUpon>SettingsForm.cs</DependentUpon>
</Compile> </Compile>

View file

@ -48,16 +48,18 @@ namespace PluginExample
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.checkBox1 = new System.Windows.Forms.CheckBox(); this.checkBox1 = new GreenshotPlugin.Controls.GreenshotCheckBox();
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button();
this.checkBox2 = new System.Windows.Forms.CheckBox(); this.checkBox2 = new GreenshotPlugin.Controls.GreenshotCheckBox();
this.SuspendLayout(); this.SuspendLayout();
// //
// checkBox1 // checkBox1
// //
this.checkBox1.Location = new System.Drawing.Point(12, 12); this.checkBox1.Location = new System.Drawing.Point(12, 12);
this.checkBox1.Name = "checkBox1"; this.checkBox1.Name = "checkBox1";
this.checkBox1.PropertyName = "AnnotationProcessor";
this.checkBox1.SectionName = "PluginExample";
this.checkBox1.Size = new System.Drawing.Size(152, 24); this.checkBox1.Size = new System.Drawing.Size(152, 24);
this.checkBox1.TabIndex = 0; this.checkBox1.TabIndex = 0;
this.checkBox1.Text = "Annotation processor"; this.checkBox1.Text = "Annotation processor";
@ -87,6 +89,8 @@ namespace PluginExample
// //
this.checkBox2.Location = new System.Drawing.Point(12, 42); this.checkBox2.Location = new System.Drawing.Point(12, 42);
this.checkBox2.Name = "checkBox2"; this.checkBox2.Name = "checkBox2";
this.checkBox2.PropertyName = "GreyScaleProcessor";
this.checkBox2.SectionName = "PluginExample";
this.checkBox2.Size = new System.Drawing.Size(152, 24); this.checkBox2.Size = new System.Drawing.Size(152, 24);
this.checkBox2.TabIndex = 3; this.checkBox2.TabIndex = 3;
this.checkBox2.Text = "Greyscale processor"; this.checkBox2.Text = "Greyscale processor";
@ -104,10 +108,11 @@ namespace PluginExample
this.Name = "SettingsForm"; this.Name = "SettingsForm";
this.Text = "Plugin example settings"; this.Text = "Plugin example settings";
this.ResumeLayout(false); this.ResumeLayout(false);
} }
private System.Windows.Forms.CheckBox checkBox2; private GreenshotPlugin.Controls.GreenshotCheckBox checkBox2;
private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button1;
private System.Windows.Forms.CheckBox checkBox1; private GreenshotPlugin.Controls.GreenshotCheckBox checkBox1;
} }
} }

View file

@ -28,7 +28,7 @@ namespace PluginExample {
/// <summary> /// <summary>
/// Description of SettingsForm. /// Description of SettingsForm.
/// </summary> /// </summary>
public partial class SettingsForm : Form { public partial class SettingsForm : ExampleForm {
private static PluginExampleConfiguration conf = IniConfig.GetIniSection<PluginExampleConfiguration>(); private static PluginExampleConfiguration conf = IniConfig.GetIniSection<PluginExampleConfiguration>();
public SettingsForm() { public SettingsForm() {
@ -36,13 +36,9 @@ namespace PluginExample {
// The InitializeComponent() call is required for Windows Forms designer support. // The InitializeComponent() call is required for Windows Forms designer support.
// //
InitializeComponent(); InitializeComponent();
checkBox1.Checked = conf.AnnotationProcessor;
checkBox2.Checked = conf.GreyscaleProcessor;
} }
void Button1Click(object sender, EventArgs e) { void Button1Click(object sender, EventArgs e) {
conf.AnnotationProcessor = checkBox1.Checked;
conf.GreyscaleProcessor = checkBox2.Checked;
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
} }