moved all sources to trunk directory

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@693 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
JKlingen 2010-07-25 08:48:59 +00:00
commit a22b7578bd
392 changed files with 61489 additions and 0 deletions

View file

@ -0,0 +1,66 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2010 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.Xml;
using System.Xml.Serialization;
namespace RunAtOutput {
/// <summary>
/// Description of Configuration.
/// </summary>
[XmlRoot("RunAtOutput")]
public class Configuration {
public Configuration() {
Commands = new List<Commando>();
}
[XmlElement("Commando")]
public List<Commando> Commands {
get;
set;
}
}
public class Commando {
public Commando() {
}
[XmlAttribute("Name")]
public string Name {
get;
set;
}
[XmlElement("Commandline")]
public string Commandline {
get;
set;
}
[XmlElement("Arguments")]
public string Arguments {
get;
set;
}
[XmlAttribute("Active")]
public bool Active{
get;
set;
}
}
}

View file

@ -0,0 +1,73 @@
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{47F23C86-604E-4CC3-8767-B3D4088F30BB}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<OutputType>Library</OutputType>
<RootNamespace>Greenshot_RunAtOutput_Plugin</RootNamespace>
<AssemblyName>Greenshot-RunAtOutput-Plugin</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<AppDesignerFolder>Properties</AppDesignerFolder>
<SourceAnalysisOverrideSettingsFile>C:\Users\Robin\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'x86' ">
<PlatformTarget>x86</PlatformTarget>
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<FileAlignment>4096</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin\Debug\</OutputPath>
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<Optimize>False</Optimize>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin\Release\</OutputPath>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<Optimize>True</Optimize>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup>
<Reference Include="log4net">
<HintPath>..\Greenshot\Lib\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Configuration.cs" />
<Compile Include="RunAtOutput.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SettingsForm.cs" />
<Compile Include="SettingsForm.Designer.cs">
<DependentUpon>SettingsForm.cs</DependentUpon>
</Compile>
<None Include="Properties\AssemblyInfo.cs.template" />
<None Include="runatoutput.properties" />
</ItemGroup>
<PropertyGroup>
<PreBuildEvent>"$(SolutionDir)\tools\TortoiseSVN\SubWCRev.exe" "$(ProjectDir)\" "$(ProjectDir)\Properties\AssemblyInfo.cs.template" "$(ProjectDir)\Properties\AssemblyInfo.cs"</PreBuildEvent>
<PostBuildEvent>mkdir "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)"
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"</PostBuildEvent>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\GreenshotPlugin\GreenshotPlugin.csproj">
<Project>{5B924697-4DCD-4F98-85F1-105CB84B7341}</Project>
<Name>GreenshotPlugin</Name>
</ProjectReference>
</ItemGroup>
</Project>

View file

@ -0,0 +1,53 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2010 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/>.
*/
#region Using directives
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using Greenshot.Plugin;
#endregion
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Greenshot-RunAtOutput-Plugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Greenshot-RunAtOutput-Plugin")]
[assembly: AssemblyCopyright("Copyright 2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: PluginAttribute("RunAtOutput.RunAtOutputPlugin", true)]
// This sets the default COM visibility of types in the assembly to invisible.
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
[assembly: ComVisible(false)]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.$WCREV$")]

View file

@ -0,0 +1,125 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2010 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.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Xml.Serialization;
using Greenshot.Plugin;
namespace RunAtOutput {
/// <summary>
/// An Plugin to run commands after an image was written
/// </summary>
public class RunAtOutputPlugin : IGreenshotPlugin {
private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(RunAtOutputPlugin));
private IGreenshotPluginHost host;
private ICaptureHost captureHost = null;
private PluginAttribute myAttributes;
private Configuration config = new Configuration();
public RunAtOutputPlugin() {
}
/// <summary>
/// Implementation of the IGreenshotPlugin.Initialize
/// </summary>
/// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
/// <param name="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param>
/// <param name="pluginAttribute">My own attributes</param>
public virtual void Initialize(IGreenshotPluginHost pluginHost, ICaptureHost captureHost, PluginAttribute myAttributes) {
LOG.Debug("Initialize called of " + myAttributes.Name);
this.host = (IGreenshotPluginHost)pluginHost;
this.captureHost = captureHost;
this.myAttributes = myAttributes;
this.host.OnImageOutput += new OnImageOutputHandler(ImageOutput);
LoadConfig();
}
public virtual void Shutdown() {
LOG.Debug("Shutdown of " + myAttributes.Name);
this.host.OnImageOutput -= new OnImageOutputHandler(ImageOutput);
}
/// <summary>
/// Implementation of the IPlugin.Configure
/// </summary>
public virtual void Configure() {
LOG.Debug("Configure called");
SettingsForm settingsForm = new SettingsForm(config);
if (settingsForm.ShowDialog() == DialogResult.OK) {
SaveConfig();
}
settingsForm.Dispose();
}
private void LoadConfig() {
XmlSerializer xmlSerializer = new XmlSerializer(typeof(Configuration));
string filename = Path.Combine(host.ConfigurationPath, "RunAtOutputPlugin.xml");
if (File.Exists(filename)) {
using (TextReader reader = new StreamReader(filename)) {
config = (Configuration)xmlSerializer.Deserialize(reader);
}
}
}
private void SaveConfig() {
XmlSerializer xmlSerializer = new XmlSerializer(typeof(Configuration));
string filename = Path.Combine(host.ConfigurationPath, "RunAtOutputPlugin.xml");
using (TextWriter writer = new StreamWriter(filename)) {
xmlSerializer.Serialize(writer, config);
}
}
/// <summary>
/// Handling of the OnImageOutputHandler event from the IGreenshotPlugin
/// </summary>
/// <param name="ImageOutputEventArgs">Has the FullPath to the image</param>
private void ImageOutput(object sender, ImageOutputEventArgs eventArgs) {
LOG.Debug("ImageOutput called with full path: " + eventArgs.FullPath);
foreach(Commando commando in config.Commands) {
if (commando.Active) {
if (commando.Commandline != null && commando.Commandline.Length > 0) {
Process p = new Process();
p.StartInfo.FileName = commando.Commandline;
p.StartInfo.Arguments = String.Format(commando.Arguments, eventArgs.FullPath);
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
LOG.Info("Starting : " + p.StartInfo.FileName + " " + p.StartInfo.Arguments);
p.Start();
string output = p.StandardOutput.ReadToEnd();
if (output != null && output.Trim().Length > 0) {
LOG.Info("Output:\n" + output);
}
LOG.Info("Finished : " + p.StartInfo.FileName + " " + p.StartInfo.Arguments);
}
}
}
}
}
}

View file

@ -0,0 +1,211 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2010 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/>.
*/
namespace RunAtOutput {
partial class SettingsForm {
/// <summary>
/// Designer variable used to keep track of non-visual components.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Disposes resources used by the form.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing) {
if (components != null) {
components.Dispose();
}
}
base.Dispose(disposing);
}
/// <summary>
/// This method is required for Windows Forms designer support.
/// Do not change the method contents inside the source code editor. The Forms designer might
/// not be able to load this method if it was changed manually.
/// </summary>
private void InitializeComponent()
{
this.textBox_commandline = new System.Windows.Forms.TextBox();
this.buttonCancel = new System.Windows.Forms.Button();
this.buttonOk = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.textBox_arguments = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.listView1 = new System.Windows.Forms.ListView();
this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.textBox_name = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// textBox_commandline
//
this.textBox_commandline.Location = new System.Drawing.Point(229, 245);
this.textBox_commandline.Name = "textBox_commandline";
this.textBox_commandline.Size = new System.Drawing.Size(184, 20);
this.textBox_commandline.TabIndex = 2;
//
// buttonCancel
//
this.buttonCancel.Location = new System.Drawing.Point(339, 302);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 7;
this.buttonCancel.Text = "Cancel";
this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancelClick);
//
// buttonOk
//
this.buttonOk.Location = new System.Drawing.Point(258, 302);
this.buttonOk.Name = "buttonOk";
this.buttonOk.Size = new System.Drawing.Size(75, 23);
this.buttonOk.TabIndex = 6;
this.buttonOk.Text = "OK";
this.buttonOk.UseVisualStyleBackColor = true;
this.buttonOk.Click += new System.EventHandler(this.ButtonOkClick);
//
// label1
//
this.label1.Location = new System.Drawing.Point(153, 248);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 17);
this.label1.TabIndex = 3;
this.label1.Text = "Command";
//
// textBox_arguments
//
this.textBox_arguments.Location = new System.Drawing.Point(229, 271);
this.textBox_arguments.Name = "textBox_arguments";
this.textBox_arguments.Size = new System.Drawing.Size(184, 20);
this.textBox_arguments.TabIndex = 3;
//
// label2
//
this.label2.Location = new System.Drawing.Point(153, 274);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(70, 17);
this.label2.TabIndex = 5;
this.label2.Text = "Arguments";
//
// listView1
//
this.listView1.CheckBoxes = true;
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1,
this.columnHeader2});
this.listView1.FullRowSelect = true;
this.listView1.Location = new System.Drawing.Point(13, 13);
this.listView1.MultiSelect = false;
this.listView1.Name = "listView1";
this.listView1.Size = new System.Drawing.Size(400, 183);
this.listView1.Sorting = System.Windows.Forms.SortOrder.Ascending;
this.listView1.TabIndex = 0;
this.listView1.UseCompatibleStateImageBehavior = false;
this.listView1.View = System.Windows.Forms.View.Details;
this.listView1.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.ListView1ItemChecked);
this.listView1.SelectedIndexChanged += new System.EventHandler(this.ListView1ItemSelectionChanged);
//
// columnHeader1
//
this.columnHeader1.Text = "Active";
//
// columnHeader2
//
this.columnHeader2.Text = "Name";
this.columnHeader2.Width = 311;
//
// button1
//
this.button1.Location = new System.Drawing.Point(13, 202);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 4;
this.button1.Text = "Add";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.ButtonAddClick);
//
// button2
//
this.button2.Location = new System.Drawing.Point(12, 231);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 5;
this.button2.Text = "Delete";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.ButtonDeleteClick);
//
// label3
//
this.label3.Location = new System.Drawing.Point(154, 222);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(56, 17);
this.label3.TabIndex = 10;
this.label3.Text = "Name";
//
// textBox_name
//
this.textBox_name.Location = new System.Drawing.Point(230, 219);
this.textBox_name.Name = "textBox_name";
this.textBox_name.Size = new System.Drawing.Size(184, 20);
this.textBox_name.TabIndex = 1;
//
// SettingsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(426, 336);
this.Controls.Add(this.label3);
this.Controls.Add(this.textBox_name);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.listView1);
this.Controls.Add(this.label2);
this.Controls.Add(this.textBox_arguments);
this.Controls.Add(this.label1);
this.Controls.Add(this.buttonOk);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.textBox_commandline);
this.Name = "SettingsForm";
this.Text = "Command Editor";
this.ResumeLayout(false);
this.PerformLayout();
}
private System.Windows.Forms.TextBox textBox_name;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.ColumnHeader columnHeader2;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ListView listView1;
private System.Windows.Forms.TextBox textBox_arguments;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox_commandline;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button buttonOk;
private System.Windows.Forms.Button buttonCancel;
}
}

View file

@ -0,0 +1,98 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2010 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.Drawing;
using System.Windows.Forms;
namespace RunAtOutput {
/// <summary>
/// Description of SettingsForm.
/// </summary>
public partial class SettingsForm : Form {
private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(SettingsForm));
private Configuration config;
public SettingsForm(Configuration config) {
this.config = config;
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
UpdateView();
}
void ButtonOkClick(object sender, EventArgs e) {
DialogResult = DialogResult.OK;
}
void ButtonCancelClick(object sender, EventArgs e) {
DialogResult = DialogResult.Cancel;
}
void ShowSelectedItem() {
foreach ( ListViewItem item in listView1.SelectedItems ) {
Commando commando = item.Tag as Commando;
textBox_arguments.Text = commando.Arguments;
textBox_commandline.Text = commando.Commandline;
textBox_name.Text = commando.Name;
}
}
void ButtonAddClick(object sender, EventArgs e) {
Commando commando = new Commando();
commando.Arguments = textBox_arguments.Text;
commando.Commandline = textBox_commandline.Text;
commando.Name = textBox_name.Text;
config.Commands.Add(commando);
UpdateView();
}
void ButtonDeleteClick(object sender, EventArgs e) {
foreach ( ListViewItem item in listView1.SelectedItems ) {
Commando commando = item.Tag as Commando;
config.Commands.Remove(commando);
}
UpdateView();
}
void UpdateView() {
listView1.Items.Clear();
foreach(Commando commando in config.Commands) {
ListViewItem item = new ListViewItem("");
item.SubItems.Add(commando.Name);
item.Checked = commando.Active;
item.Tag = commando;
listView1.Items.Add(item);
}
}
void ListView1ItemSelectionChanged(object sender, EventArgs e) {
ShowSelectedItem();
}
void ListView1ItemChecked(object sender, ItemCheckedEventArgs e) {
Commando commando = e.Item.Tag as Commando;
LOG.Debug("ItemChecked " + commando.Name + " to " + e.Item.Checked);
commando.Active = e.Item.Checked;
}
}
}

View file

@ -0,0 +1,4 @@
active=OptiPNG,Paint.NET
command.Paint.NET=C:\Programme\Paint.NET\PaintDotNet.exe {0}
pattern.OptiPNG=*.png
command.OptiPNG=D:\05018085\downloads\optipng-0.6.4-exe\optipng.exe {0}