Making the initial stuff working, getting an installer, when running from VS.

This commit is contained in:
Krom, Robertus 2020-02-04 15:29:10 +01:00
parent a63bf734d4
commit 57e2044839
1023 changed files with 20896 additions and 19456 deletions

View file

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<Project ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<NoWarn>1685</NoWarn>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<FileAlignment>4096</FileAlignment>
<DebugType>Full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<NoWarn>1685</NoWarn>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<FileAlignment>4096</FileAlignment>
<DebugType>Full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<NoWarn>1685</NoWarn>
<OutputPath>bin\Release\</OutputPath>
<Optimize>true</Optimize>
<FileAlignment>4096</FileAlignment>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
</PropertyGroup>
</Project>

77
Directory.Build.props Normal file
View file

@ -0,0 +1,77 @@
<Project>
<PropertyGroup>
<Copyright>Copyright © Greenshot 2004-2020</Copyright>
<Authors>Greenshot</Authors>
<PackageIconUrl>https://getgreenshot.org/favicon.ico</PackageIconUrl>
<RepositoryUrl>https://github.com/greenshot/greenshot</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageProjectUrl>https://github.com/greenshot/greenshot</PackageProjectUrl>
<PackageLicenseUrl>https://www.gnu.org/licenses/gpl.html</PackageLicenseUrl>
<PackageLicenseExpression>GPL</PackageLicenseExpression>
<LangVersion>latest</LangVersion>
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
<RuntimeIdentifiers>win10-x64;win10-x86;win-x64;win-x86</RuntimeIdentifiers>
<!-- Optional: Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<!-- Optional: Embed source files that are not tracked by the source control manager in the PDB -->
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<TargetFramework>net471</TargetFramework>
</PropertyGroup>
<!-- ILLinker and single file settings -->
<ItemGroup Condition="$(MSBuildProjectName) == 'Greenshot'">
<TrimmerRootAssembly Include="netstandard" />
</ItemGroup>
<PropertyGroup Condition="$(MSBuildProjectName) == 'Greenshot'">
<IncludeSymbolsInSingleFile>false</IncludeSymbolsInSingleFile>
<ShowLinkerSizeComparison>true</ShowLinkerSizeComparison>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' != 'Debug' And !$(MSBuildProjectName.Contains('Test')) And !$(MSBuildProjectName.Contains('Demo'))">
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<IsPackable>true</IsPackable>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
</PropertyGroup>
<PropertyGroup Condition="$(MSBuildProjectName.Contains('Tests')) Or $(MSBuildProjectName.Contains('Demo'))">
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugSymbols>True</DebugSymbols>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<DebugType>embedded</DebugType>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<Optimize>true</Optimize>
<DebugType>embedded</DebugType>
<DebugSymbols>True</DebugSymbols>
</PropertyGroup>
<ItemGroup Condition="!$(MSBuildProjectName.Contains('Tests')) And $(MSBuildProjectName.StartsWith('Greenshot'))">
<PackageReference Include="Nerdbank.GitVersioning" Version="3.0.50">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
</ItemGroup>
<Target Name="PostBuild" BeforeTargets="PostBuildEvent" Condition="'$(BuildingInsideVisualStudio)' == 'true' And $(MSBuildProjectName.Contains('Plugin')) And !$(MSBuildProjectName.Contains('Test')) And !$(MSBuildProjectName.Contains('Demo'))">
<Exec Command="
xcopy /q /y /d &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(SolutionDir)$(SolutionName)\$(OutDir)&quot;&#xD;&#xA;
xcopy /q /y /d &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)$(SolutionName)\$(OutDir)&quot;&#xD;&#xA;
xcopy /q /y /d &quot;$(TargetDir)*.xml&quot; &quot;$(SolutionDir)$(SolutionName)\$(OutDir)&quot;&#xD;&#xA;&#xD;&#xA;
IF EXIST &quot;$(TargetDir)Languages&quot; (&#xD;&#xA;
IF NOT EXIST &quot;$(SolutionDir)$(SolutionName)\$(OutDir)Languages&quot; (&#xD;&#xA;
mkdir &quot;$(SolutionDir)$(SolutionName)\$(OutDir)Languages&quot;&#xD;&#xA;
)&#xD;&#xA;
xcopy /q /y /d &quot;$(TargetDir)Languages\*.xml&quot; &quot;$(SolutionDir)$(SolutionName)\$(OutDir)Languages&quot;&#xD;&#xA;
)" />
</Target>
</Project>

View file

@ -3,13 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16 # Visual Studio Version 16
VisualStudioVersion = 16.0.29728.190 VisualStudioVersion = 16.0.29728.190
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Greenshot", "Greenshot\Greenshot.csproj", "{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Greenshot", "Greenshot\Greenshot.csproj", "{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotPlugin", "GreenshotPlugin\GreenshotPlugin.csproj", "{5B924697-4DCD-4F98-85F1-105CB84B7341}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GreenshotPlugin", "GreenshotPlugin\GreenshotPlugin.csproj", "{5B924697-4DCD-4F98-85F1-105CB84B7341}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotExternalCommandPlugin", "GreenshotExternalCommandPlugin\GreenshotExternalCommandPlugin.csproj", "{47F23C86-604E-4CC3-8767-B3D4088F30BB}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotExternalCommandPlugin", "GreenshotExternalCommandPlugin\GreenshotExternalCommandPlugin.csproj", "{47F23C86-604E-4CC3-8767-B3D4088F30BB}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotConfluencePlugin", "GreenshotConfluencePlugin\GreenshotConfluencePlugin.csproj", "{C3052651-598A-44E2-AAB3-2E41311D50F9}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GreenshotConfluencePlugin", "GreenshotConfluencePlugin\GreenshotConfluencePlugin.csproj", "{C3052651-598A-44E2-AAB3-2E41311D50F9}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotImgurPlugin", "GreenshotImgurPlugin\GreenshotImgurPlugin.csproj", "{80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotImgurPlugin", "GreenshotImgurPlugin\GreenshotImgurPlugin.csproj", "{80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}"
EndProject EndProject
@ -22,7 +22,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotOCRCommand", "Gree
{C6988EE8-2FEE-4349-9F09-F9628A0D8965} = {C6988EE8-2FEE-4349-9F09-F9628A0D8965} {C6988EE8-2FEE-4349-9F09-F9628A0D8965} = {C6988EE8-2FEE-4349-9F09-F9628A0D8965}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotBoxPlugin", "GreenshotBoxPlugin\GreenshotBoxPlugin.csproj", "{697CF066-9077-4F22-99D9-D989CCE7282B}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GreenshotBoxPlugin", "GreenshotBoxPlugin\GreenshotBoxPlugin.csproj", "{697CF066-9077-4F22-99D9-D989CCE7282B}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotDropboxPlugin", "GreenshotDropboxPlugin\GreenshotDropboxPlugin.csproj", "{AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotDropboxPlugin", "GreenshotDropboxPlugin\GreenshotDropboxPlugin.csproj", "{AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}"
EndProject EndProject
@ -30,11 +30,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotFlickrPlugin", "Gr
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotPicasaPlugin", "GreenshotPicasaPlugin\GreenshotPicasaPlugin.csproj", "{1893A2E4-A78A-4713-A8E7-E70058DABEE0}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotPicasaPlugin", "GreenshotPicasaPlugin\GreenshotPicasaPlugin.csproj", "{1893A2E4-A78A-4713-A8E7-E70058DABEE0}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotOfficePlugin", "GreenshotOfficePlugin\GreenshotOfficePlugin.csproj", "{92599C09-FF29-4ABD-B6E6-C48ECD781BAB}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GreenshotOfficePlugin", "GreenshotOfficePlugin\GreenshotOfficePlugin.csproj", "{92599C09-FF29-4ABD-B6E6-C48ECD781BAB}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotPhotobucketPlugin", "GreenshotPhotobucketPlugin\GreenshotPhotobucketPlugin.csproj", "{9C0ECC4C-7807-4111-916A-4F57BB29788A}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GreenshotPhotobucketPlugin", "GreenshotPhotobucketPlugin\GreenshotPhotobucketPlugin.csproj", "{9C0ECC4C-7807-4111-916A-4F57BB29788A}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotWin10Plugin", "GreenshotWin10Plugin\GreenshotWin10Plugin.csproj", "{9801F62C-540F-4BFE-9211-6405DEDE563B}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GreenshotWin10Plugin", "GreenshotWin10Plugin\GreenshotWin10Plugin.csproj", "{9801F62C-540F-4BFE-9211-6405DEDE563B}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -49,136 +49,152 @@ Global
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Debug|Any CPU.Build.0 = Debug|Any CPU {CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Debug|x86.ActiveCfg = Debug|x86 {CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Debug|x86.Build.0 = Debug|x86 {CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Debug|x86.ActiveCfg = Debug|Any CPU
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Debug|x86.Build.0 = Debug|Any CPU
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Release|Any CPU.ActiveCfg = Release|Any CPU {CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Release|Any CPU.Build.0 = Release|Any CPU {CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Release|Any CPU.Build.0 = Release|Any CPU
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Release|x86.ActiveCfg = Release|x86 {CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Release|x86.ActiveCfg = Release|Any CPU
{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}.Release|x86.Build.0 = Release|Any CPU
{5B924697-4DCD-4F98-85F1-105CB84B7341}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5B924697-4DCD-4F98-85F1-105CB84B7341}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5B924697-4DCD-4F98-85F1-105CB84B7341}.Debug|Any CPU.Build.0 = Debug|Any CPU {5B924697-4DCD-4F98-85F1-105CB84B7341}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5B924697-4DCD-4F98-85F1-105CB84B7341}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {5B924697-4DCD-4F98-85F1-105CB84B7341}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{5B924697-4DCD-4F98-85F1-105CB84B7341}.Debug|x86.ActiveCfg = Debug|x86 {5B924697-4DCD-4F98-85F1-105CB84B7341}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{5B924697-4DCD-4F98-85F1-105CB84B7341}.Debug|x86.Build.0 = Debug|x86 {5B924697-4DCD-4F98-85F1-105CB84B7341}.Debug|x86.ActiveCfg = Debug|Any CPU
{5B924697-4DCD-4F98-85F1-105CB84B7341}.Debug|x86.Build.0 = Debug|Any CPU
{5B924697-4DCD-4F98-85F1-105CB84B7341}.Release|Any CPU.ActiveCfg = Release|Any CPU {5B924697-4DCD-4F98-85F1-105CB84B7341}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5B924697-4DCD-4F98-85F1-105CB84B7341}.Release|Any CPU.Build.0 = Release|Any CPU {5B924697-4DCD-4F98-85F1-105CB84B7341}.Release|Any CPU.Build.0 = Release|Any CPU
{5B924697-4DCD-4F98-85F1-105CB84B7341}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {5B924697-4DCD-4F98-85F1-105CB84B7341}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{5B924697-4DCD-4F98-85F1-105CB84B7341}.Release|x86.ActiveCfg = Release|x86 {5B924697-4DCD-4F98-85F1-105CB84B7341}.Release|x86.ActiveCfg = Release|Any CPU
{5B924697-4DCD-4F98-85F1-105CB84B7341}.Release|x86.Build.0 = Release|Any CPU
{47F23C86-604E-4CC3-8767-B3D4088F30BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {47F23C86-604E-4CC3-8767-B3D4088F30BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{47F23C86-604E-4CC3-8767-B3D4088F30BB}.Debug|Any CPU.Build.0 = Debug|Any CPU {47F23C86-604E-4CC3-8767-B3D4088F30BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47F23C86-604E-4CC3-8767-B3D4088F30BB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {47F23C86-604E-4CC3-8767-B3D4088F30BB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{47F23C86-604E-4CC3-8767-B3D4088F30BB}.Debug|x86.ActiveCfg = Debug|x86 {47F23C86-604E-4CC3-8767-B3D4088F30BB}.Debug|x86.ActiveCfg = Debug|Any CPU
{47F23C86-604E-4CC3-8767-B3D4088F30BB}.Debug|x86.Build.0 = Debug|x86 {47F23C86-604E-4CC3-8767-B3D4088F30BB}.Debug|x86.Build.0 = Debug|Any CPU
{47F23C86-604E-4CC3-8767-B3D4088F30BB}.Release|Any CPU.ActiveCfg = Release|Any CPU {47F23C86-604E-4CC3-8767-B3D4088F30BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{47F23C86-604E-4CC3-8767-B3D4088F30BB}.Release|Any CPU.Build.0 = Release|Any CPU {47F23C86-604E-4CC3-8767-B3D4088F30BB}.Release|Any CPU.Build.0 = Release|Any CPU
{47F23C86-604E-4CC3-8767-B3D4088F30BB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {47F23C86-604E-4CC3-8767-B3D4088F30BB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{47F23C86-604E-4CC3-8767-B3D4088F30BB}.Release|x86.ActiveCfg = Release|x86 {47F23C86-604E-4CC3-8767-B3D4088F30BB}.Release|x86.ActiveCfg = Release|Any CPU
{47F23C86-604E-4CC3-8767-B3D4088F30BB}.Release|x86.Build.0 = Release|Any CPU
{C3052651-598A-44E2-AAB3-2E41311D50F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C3052651-598A-44E2-AAB3-2E41311D50F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C3052651-598A-44E2-AAB3-2E41311D50F9}.Debug|Any CPU.Build.0 = Debug|Any CPU {C3052651-598A-44E2-AAB3-2E41311D50F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C3052651-598A-44E2-AAB3-2E41311D50F9}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {C3052651-598A-44E2-AAB3-2E41311D50F9}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{C3052651-598A-44E2-AAB3-2E41311D50F9}.Debug|x86.ActiveCfg = Debug|x86 {C3052651-598A-44E2-AAB3-2E41311D50F9}.Debug|x86.ActiveCfg = Debug|Any CPU
{C3052651-598A-44E2-AAB3-2E41311D50F9}.Debug|x86.Build.0 = Debug|x86 {C3052651-598A-44E2-AAB3-2E41311D50F9}.Debug|x86.Build.0 = Debug|Any CPU
{C3052651-598A-44E2-AAB3-2E41311D50F9}.Release|Any CPU.ActiveCfg = Release|Any CPU {C3052651-598A-44E2-AAB3-2E41311D50F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C3052651-598A-44E2-AAB3-2E41311D50F9}.Release|Any CPU.Build.0 = Release|Any CPU {C3052651-598A-44E2-AAB3-2E41311D50F9}.Release|Any CPU.Build.0 = Release|Any CPU
{C3052651-598A-44E2-AAB3-2E41311D50F9}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {C3052651-598A-44E2-AAB3-2E41311D50F9}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{C3052651-598A-44E2-AAB3-2E41311D50F9}.Release|x86.ActiveCfg = Release|x86 {C3052651-598A-44E2-AAB3-2E41311D50F9}.Release|x86.ActiveCfg = Release|Any CPU
{C3052651-598A-44E2-AAB3-2E41311D50F9}.Release|x86.Build.0 = Release|Any CPU
{80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}.Debug|Any CPU.Build.0 = Debug|Any CPU {80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}.Debug|Any CPU.Build.0 = Debug|Any CPU
{80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}.Debug|x86.ActiveCfg = Debug|x86 {80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}.Debug|x86.ActiveCfg = Debug|Any CPU
{80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}.Debug|x86.Build.0 = Debug|x86 {80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}.Debug|x86.Build.0 = Debug|Any CPU
{80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}.Release|Any CPU.ActiveCfg = Release|Any CPU {80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}.Release|Any CPU.ActiveCfg = Release|Any CPU
{80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}.Release|Any CPU.Build.0 = Release|Any CPU {80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}.Release|Any CPU.Build.0 = Release|Any CPU
{80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}.Release|x86.ActiveCfg = Release|x86 {80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}.Release|x86.ActiveCfg = Release|Any CPU
{80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}.Release|x86.Build.0 = Release|Any CPU
{19FEEF09-313F-43C7-819D-F1BCA782B08B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {19FEEF09-313F-43C7-819D-F1BCA782B08B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{19FEEF09-313F-43C7-819D-F1BCA782B08B}.Debug|Any CPU.Build.0 = Debug|Any CPU {19FEEF09-313F-43C7-819D-F1BCA782B08B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19FEEF09-313F-43C7-819D-F1BCA782B08B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {19FEEF09-313F-43C7-819D-F1BCA782B08B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{19FEEF09-313F-43C7-819D-F1BCA782B08B}.Debug|x86.ActiveCfg = Debug|x86 {19FEEF09-313F-43C7-819D-F1BCA782B08B}.Debug|x86.ActiveCfg = Debug|Any CPU
{19FEEF09-313F-43C7-819D-F1BCA782B08B}.Debug|x86.Build.0 = Debug|x86 {19FEEF09-313F-43C7-819D-F1BCA782B08B}.Debug|x86.Build.0 = Debug|Any CPU
{19FEEF09-313F-43C7-819D-F1BCA782B08B}.Release|Any CPU.ActiveCfg = Release|Any CPU {19FEEF09-313F-43C7-819D-F1BCA782B08B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{19FEEF09-313F-43C7-819D-F1BCA782B08B}.Release|Any CPU.Build.0 = Release|Any CPU {19FEEF09-313F-43C7-819D-F1BCA782B08B}.Release|Any CPU.Build.0 = Release|Any CPU
{19FEEF09-313F-43C7-819D-F1BCA782B08B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {19FEEF09-313F-43C7-819D-F1BCA782B08B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{19FEEF09-313F-43C7-819D-F1BCA782B08B}.Release|x86.ActiveCfg = Release|x86 {19FEEF09-313F-43C7-819D-F1BCA782B08B}.Release|x86.ActiveCfg = Release|Any CPU
{19FEEF09-313F-43C7-819D-F1BCA782B08B}.Release|x86.Build.0 = Release|Any CPU
{C6988EE8-2FEE-4349-9F09-F9628A0D8965}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C6988EE8-2FEE-4349-9F09-F9628A0D8965}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C6988EE8-2FEE-4349-9F09-F9628A0D8965}.Debug|Any CPU.Build.0 = Debug|Any CPU {C6988EE8-2FEE-4349-9F09-F9628A0D8965}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C6988EE8-2FEE-4349-9F09-F9628A0D8965}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {C6988EE8-2FEE-4349-9F09-F9628A0D8965}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{C6988EE8-2FEE-4349-9F09-F9628A0D8965}.Debug|x86.ActiveCfg = Debug|x86 {C6988EE8-2FEE-4349-9F09-F9628A0D8965}.Debug|x86.ActiveCfg = Debug|Any CPU
{C6988EE8-2FEE-4349-9F09-F9628A0D8965}.Debug|x86.Build.0 = Debug|x86 {C6988EE8-2FEE-4349-9F09-F9628A0D8965}.Debug|x86.Build.0 = Debug|Any CPU
{C6988EE8-2FEE-4349-9F09-F9628A0D8965}.Release|Any CPU.ActiveCfg = Release|Any CPU {C6988EE8-2FEE-4349-9F09-F9628A0D8965}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C6988EE8-2FEE-4349-9F09-F9628A0D8965}.Release|Any CPU.Build.0 = Release|Any CPU {C6988EE8-2FEE-4349-9F09-F9628A0D8965}.Release|Any CPU.Build.0 = Release|Any CPU
{C6988EE8-2FEE-4349-9F09-F9628A0D8965}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {C6988EE8-2FEE-4349-9F09-F9628A0D8965}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{C6988EE8-2FEE-4349-9F09-F9628A0D8965}.Release|x86.ActiveCfg = Release|x86 {C6988EE8-2FEE-4349-9F09-F9628A0D8965}.Release|x86.ActiveCfg = Release|Any CPU
{D61E6ECE-E0B6-4467-B492-F08A06BA8F02}.Debug|Any CPU.ActiveCfg = Debug|x86 {C6988EE8-2FEE-4349-9F09-F9628A0D8965}.Release|x86.Build.0 = Release|Any CPU
{D61E6ECE-E0B6-4467-B492-F08A06BA8F02}.Debug|Any CPU.Build.0 = Debug|x86 {D61E6ECE-E0B6-4467-B492-F08A06BA8F02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D61E6ECE-E0B6-4467-B492-F08A06BA8F02}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 {D61E6ECE-E0B6-4467-B492-F08A06BA8F02}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D61E6ECE-E0B6-4467-B492-F08A06BA8F02}.Debug|x86.ActiveCfg = Debug|x86 {D61E6ECE-E0B6-4467-B492-F08A06BA8F02}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{D61E6ECE-E0B6-4467-B492-F08A06BA8F02}.Debug|x86.Build.0 = Debug|x86 {D61E6ECE-E0B6-4467-B492-F08A06BA8F02}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{D61E6ECE-E0B6-4467-B492-F08A06BA8F02}.Release|Any CPU.ActiveCfg = Release|x86 {D61E6ECE-E0B6-4467-B492-F08A06BA8F02}.Debug|x86.ActiveCfg = Debug|Any CPU
{D61E6ECE-E0B6-4467-B492-F08A06BA8F02}.Release|Any CPU.Build.0 = Release|x86 {D61E6ECE-E0B6-4467-B492-F08A06BA8F02}.Debug|x86.Build.0 = Debug|Any CPU
{D61E6ECE-E0B6-4467-B492-F08A06BA8F02}.Release|Mixed Platforms.ActiveCfg = Release|x86 {D61E6ECE-E0B6-4467-B492-F08A06BA8F02}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D61E6ECE-E0B6-4467-B492-F08A06BA8F02}.Release|x86.ActiveCfg = Release|x86 {D61E6ECE-E0B6-4467-B492-F08A06BA8F02}.Release|Any CPU.Build.0 = Release|Any CPU
{D61E6ECE-E0B6-4467-B492-F08A06BA8F02}.Release|x86.Build.0 = Release|x86 {D61E6ECE-E0B6-4467-B492-F08A06BA8F02}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{D61E6ECE-E0B6-4467-B492-F08A06BA8F02}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{D61E6ECE-E0B6-4467-B492-F08A06BA8F02}.Release|x86.ActiveCfg = Release|Any CPU
{D61E6ECE-E0B6-4467-B492-F08A06BA8F02}.Release|x86.Build.0 = Release|Any CPU
{697CF066-9077-4F22-99D9-D989CCE7282B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {697CF066-9077-4F22-99D9-D989CCE7282B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{697CF066-9077-4F22-99D9-D989CCE7282B}.Debug|Any CPU.Build.0 = Debug|Any CPU {697CF066-9077-4F22-99D9-D989CCE7282B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{697CF066-9077-4F22-99D9-D989CCE7282B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {697CF066-9077-4F22-99D9-D989CCE7282B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{697CF066-9077-4F22-99D9-D989CCE7282B}.Debug|x86.ActiveCfg = Debug|x86 {697CF066-9077-4F22-99D9-D989CCE7282B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{697CF066-9077-4F22-99D9-D989CCE7282B}.Debug|x86.Build.0 = Debug|x86 {697CF066-9077-4F22-99D9-D989CCE7282B}.Debug|x86.ActiveCfg = Debug|Any CPU
{697CF066-9077-4F22-99D9-D989CCE7282B}.Debug|x86.Build.0 = Debug|Any CPU
{697CF066-9077-4F22-99D9-D989CCE7282B}.Release|Any CPU.ActiveCfg = Release|Any CPU {697CF066-9077-4F22-99D9-D989CCE7282B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{697CF066-9077-4F22-99D9-D989CCE7282B}.Release|Any CPU.Build.0 = Release|Any CPU {697CF066-9077-4F22-99D9-D989CCE7282B}.Release|Any CPU.Build.0 = Release|Any CPU
{697CF066-9077-4F22-99D9-D989CCE7282B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {697CF066-9077-4F22-99D9-D989CCE7282B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{697CF066-9077-4F22-99D9-D989CCE7282B}.Release|x86.ActiveCfg = Release|x86 {697CF066-9077-4F22-99D9-D989CCE7282B}.Release|x86.ActiveCfg = Release|Any CPU
{697CF066-9077-4F22-99D9-D989CCE7282B}.Release|x86.Build.0 = Release|Any CPU
{AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}.Debug|Any CPU.Build.0 = Debug|Any CPU {AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}.Debug|x86.ActiveCfg = Debug|x86 {AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}.Debug|x86.ActiveCfg = Debug|Any CPU
{AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}.Debug|x86.Build.0 = Debug|x86 {AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}.Debug|x86.Build.0 = Debug|Any CPU
{AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}.Release|Any CPU.ActiveCfg = Release|Any CPU {AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}.Release|Any CPU.Build.0 = Release|Any CPU {AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}.Release|Any CPU.Build.0 = Release|Any CPU
{AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}.Release|x86.ActiveCfg = Release|x86 {AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}.Release|x86.ActiveCfg = Release|Any CPU
{AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}.Release|x86.Build.0 = Release|Any CPU
{7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}.Debug|Any CPU.Build.0 = Debug|Any CPU {7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}.Debug|x86.ActiveCfg = Debug|x86 {7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}.Debug|x86.ActiveCfg = Debug|Any CPU
{7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}.Debug|x86.Build.0 = Debug|x86 {7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}.Debug|x86.Build.0 = Debug|Any CPU
{7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}.Release|Any CPU.ActiveCfg = Release|Any CPU {7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}.Release|Any CPU.Build.0 = Release|Any CPU {7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}.Release|Any CPU.Build.0 = Release|Any CPU
{7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}.Release|x86.ActiveCfg = Release|x86 {7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}.Release|x86.ActiveCfg = Release|Any CPU
{7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}.Release|x86.Build.0 = Release|Any CPU
{1893A2E4-A78A-4713-A8E7-E70058DABEE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1893A2E4-A78A-4713-A8E7-E70058DABEE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1893A2E4-A78A-4713-A8E7-E70058DABEE0}.Debug|Any CPU.Build.0 = Debug|Any CPU {1893A2E4-A78A-4713-A8E7-E70058DABEE0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1893A2E4-A78A-4713-A8E7-E70058DABEE0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {1893A2E4-A78A-4713-A8E7-E70058DABEE0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{1893A2E4-A78A-4713-A8E7-E70058DABEE0}.Debug|x86.ActiveCfg = Debug|x86 {1893A2E4-A78A-4713-A8E7-E70058DABEE0}.Debug|x86.ActiveCfg = Debug|Any CPU
{1893A2E4-A78A-4713-A8E7-E70058DABEE0}.Debug|x86.Build.0 = Debug|x86 {1893A2E4-A78A-4713-A8E7-E70058DABEE0}.Debug|x86.Build.0 = Debug|Any CPU
{1893A2E4-A78A-4713-A8E7-E70058DABEE0}.Release|Any CPU.ActiveCfg = Release|Any CPU {1893A2E4-A78A-4713-A8E7-E70058DABEE0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1893A2E4-A78A-4713-A8E7-E70058DABEE0}.Release|Any CPU.Build.0 = Release|Any CPU {1893A2E4-A78A-4713-A8E7-E70058DABEE0}.Release|Any CPU.Build.0 = Release|Any CPU
{1893A2E4-A78A-4713-A8E7-E70058DABEE0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {1893A2E4-A78A-4713-A8E7-E70058DABEE0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{1893A2E4-A78A-4713-A8E7-E70058DABEE0}.Release|x86.ActiveCfg = Release|x86 {1893A2E4-A78A-4713-A8E7-E70058DABEE0}.Release|x86.ActiveCfg = Release|Any CPU
{1893A2E4-A78A-4713-A8E7-E70058DABEE0}.Release|x86.Build.0 = Release|Any CPU
{92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Debug|Any CPU.Build.0 = Debug|Any CPU {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Debug|x86.ActiveCfg = Debug|x86 {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Debug|x86.ActiveCfg = Debug|Any CPU
{92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Debug|x86.Build.0 = Debug|x86 {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Debug|x86.Build.0 = Debug|Any CPU
{92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Release|Any CPU.ActiveCfg = Release|Any CPU {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Release|Any CPU.Build.0 = Release|Any CPU {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Release|Any CPU.Build.0 = Release|Any CPU
{92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Release|Mixed Platforms.Build.0 = Release|Any CPU {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Release|x86.ActiveCfg = Release|x86 {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Release|x86.ActiveCfg = Release|Any CPU
{92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Release|x86.Build.0 = Release|x86 {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}.Release|x86.Build.0 = Release|Any CPU
{9C0ECC4C-7807-4111-916A-4F57BB29788A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9C0ECC4C-7807-4111-916A-4F57BB29788A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C0ECC4C-7807-4111-916A-4F57BB29788A}.Debug|Any CPU.Build.0 = Debug|Any CPU {9C0ECC4C-7807-4111-916A-4F57BB29788A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C0ECC4C-7807-4111-916A-4F57BB29788A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {9C0ECC4C-7807-4111-916A-4F57BB29788A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{9C0ECC4C-7807-4111-916A-4F57BB29788A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {9C0ECC4C-7807-4111-916A-4F57BB29788A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{9C0ECC4C-7807-4111-916A-4F57BB29788A}.Debug|x86.ActiveCfg = Debug|x86 {9C0ECC4C-7807-4111-916A-4F57BB29788A}.Debug|x86.ActiveCfg = Debug|Any CPU
{9C0ECC4C-7807-4111-916A-4F57BB29788A}.Debug|x86.Build.0 = Debug|x86 {9C0ECC4C-7807-4111-916A-4F57BB29788A}.Debug|x86.Build.0 = Debug|Any CPU
{9C0ECC4C-7807-4111-916A-4F57BB29788A}.Release|Any CPU.ActiveCfg = Release|Any CPU {9C0ECC4C-7807-4111-916A-4F57BB29788A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C0ECC4C-7807-4111-916A-4F57BB29788A}.Release|Any CPU.Build.0 = Release|Any CPU {9C0ECC4C-7807-4111-916A-4F57BB29788A}.Release|Any CPU.Build.0 = Release|Any CPU
{9C0ECC4C-7807-4111-916A-4F57BB29788A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {9C0ECC4C-7807-4111-916A-4F57BB29788A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{9C0ECC4C-7807-4111-916A-4F57BB29788A}.Release|Mixed Platforms.Build.0 = Release|Any CPU {9C0ECC4C-7807-4111-916A-4F57BB29788A}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{9C0ECC4C-7807-4111-916A-4F57BB29788A}.Release|x86.ActiveCfg = Release|x86 {9C0ECC4C-7807-4111-916A-4F57BB29788A}.Release|x86.ActiveCfg = Release|Any CPU
{9C0ECC4C-7807-4111-916A-4F57BB29788A}.Release|x86.Build.0 = Release|x86 {9C0ECC4C-7807-4111-916A-4F57BB29788A}.Release|x86.Build.0 = Release|Any CPU
{9801F62C-540F-4BFE-9211-6405DEDE563B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9801F62C-540F-4BFE-9211-6405DEDE563B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9801F62C-540F-4BFE-9211-6405DEDE563B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {9801F62C-540F-4BFE-9211-6405DEDE563B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{9801F62C-540F-4BFE-9211-6405DEDE563B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {9801F62C-540F-4BFE-9211-6405DEDE563B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU

View file

@ -1,13 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<startup useLegacyV2RuntimeActivationPolicy="true"> <!--<system.windows.forms jitDebugging="true" />-->
<supportedRuntime version="v4.0"/> <startup>
<supportedRuntime version="v2.0.50727"/> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup> </startup>
<runtime> <runtime>
<loadFromRemoteSources enabled="true"/> <loadFromRemoteSources enabled="true" />
<relativeBindForResources enabled="true" />
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="App\Greenshot"/> <probing privatePath="Addons" />
<probing privatePath="App\Greenshot" />
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
</configuration> </configuration>

View file

@ -1,44 +0,0 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/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.Reflection;
using System.Runtime.InteropServices;
// 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")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Greenshot")]
[assembly: AssemblyProduct("Greenshot")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 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, replaced by build scripts
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyInformationalVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -55,11 +55,11 @@ namespace Greenshot.Controls {
brush = new HatchBrush(HatchStyle.Percent50, Color.White, Color.Gray); brush = new HatchBrush(HatchStyle.Percent50, Color.White, Color.Gray);
} }
if (Image != null) { if (Image != null)
using (Graphics graphics = Graphics.FromImage(Image)) { {
graphics.FillRectangle(brush, new Rectangle(4,17,16,3)); using Graphics graphics = Graphics.FromImage(Image);
} graphics.FillRectangle(brush, new Rectangle(4,17,16,3));
} }
// cleanup GDI Object // cleanup GDI Object
brush.Dispose(); brush.Dispose();

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -98,24 +98,23 @@ namespace Greenshot.Controls {
/// <param name="fontStyle"></param> /// <param name="fontStyle"></param>
/// <param name="bounds"></param> /// <param name="bounds"></param>
/// <param name="text"></param> /// <param name="text"></param>
private void DrawText(Graphics graphics, FontFamily fontFamily, FontStyle fontStyle, Rectangle bounds, string text) { private void DrawText(Graphics graphics, FontFamily fontFamily, FontStyle fontStyle, Rectangle bounds, string text)
using (Font font = new Font(fontFamily, Font.Size + 5, fontStyle, GraphicsUnit.Pixel)) { {
// Make sure the text is visible by centering it in the line using Font font = new Font(fontFamily, Font.Size + 5, fontStyle, GraphicsUnit.Pixel);
using (StringFormat stringFormat = new StringFormat()) { // Make sure the text is visible by centering it in the line
stringFormat.LineAlignment = StringAlignment.Center; using StringFormat stringFormat = new StringFormat
graphics.DrawString(text, font, Brushes.Black, bounds, stringFormat); {
} LineAlignment = StringAlignment.Center
} };
} graphics.DrawString(text, font, Brushes.Black, bounds, stringFormat);
}
private void BindableToolStripComboBox_SelectedIndexChanged(object sender, EventArgs e) { private void BindableToolStripComboBox_SelectedIndexChanged(object sender, EventArgs e) {
if (PropertyChanged != null) { if (PropertyChanged == null) return;
PropertyChanged(this, new PropertyChangedEventArgs("Text")); PropertyChanged(this, new PropertyChangedEventArgs("Text"));
PropertyChanged(this, new PropertyChangedEventArgs("FontFamily")); PropertyChanged(this, new PropertyChangedEventArgs("FontFamily"));
PropertyChanged(this, new PropertyChangedEventArgs("SelectedIndex")); PropertyChanged(this, new PropertyChangedEventArgs("SelectedIndex"));
PropertyChanged(this, new PropertyChangedEventArgs("SelectedItem")); PropertyChanged(this, new PropertyChangedEventArgs("SelectedItem"));
}
}
}
} }
} }

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -56,17 +56,16 @@ namespace Greenshot.Controls {
/// <param name="hotspotX">Hotspot X coordinate</param> /// <param name="hotspotX">Hotspot X coordinate</param>
/// <param name="hotspotY">Hotspot Y coordinate</param> /// <param name="hotspotY">Hotspot Y coordinate</param>
/// <returns>Cursor</returns> /// <returns>Cursor</returns>
private static Cursor CreateCursor(Bitmap bitmap, int hotspotX, int hotspotY) { private static Cursor CreateCursor(Bitmap bitmap, int hotspotX, int hotspotY)
using (SafeIconHandle iconHandle = new SafeIconHandle( bitmap.GetHicon())) { {
IconInfo iconInfo; using SafeIconHandle iconHandle = new SafeIconHandle( bitmap.GetHicon());
User32.GetIconInfo(iconHandle, out iconInfo); User32.GetIconInfo(iconHandle, out var iconInfo);
iconInfo.xHotspot = hotspotX; iconInfo.xHotspot = hotspotX;
iconInfo.yHotspot = hotspotY; iconInfo.yHotspot = hotspotY;
iconInfo.fIcon = false; iconInfo.fIcon = false;
var icon = User32.CreateIconIndirect(ref iconInfo); var icon = User32.CreateIconIndirect(ref iconInfo);
return new Cursor(icon); return new Cursor(icon);
} }
}
/// <summary> /// <summary>
/// The bulk of the clean-up code is implemented in Dispose(bool) /// The bulk of the clean-up code is implemented in Dispose(bool)
@ -151,9 +150,7 @@ namespace Greenshot.Controls {
base.OnMouseCaptureChanged(e); base.OnMouseCaptureChanged(e);
} }
#region IMessageFilter Members public bool PreFilterMessage(ref Message m) {
public bool PreFilterMessage(ref Message m) {
if (_dragging) { if (_dragging) {
if (m.Msg == (int)WindowsMessages.WM_CHAR) { if (m.Msg == (int)WindowsMessages.WM_CHAR) {
if ((int)m.WParam == VkEsc) { if ((int)m.WParam == VkEsc) {
@ -163,9 +160,7 @@ namespace Greenshot.Controls {
} }
return false; return false;
} }
}
#endregion
}
public class PipetteUsedArgs : EventArgs { public class PipetteUsedArgs : EventArgs {
public Color Color; public Color Color;

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -53,11 +53,11 @@ namespace Greenshot.Controls {
brush = new HatchBrush(HatchStyle.Percent50, Color.White, Color.Gray); brush = new HatchBrush(HatchStyle.Percent50, Color.White, Color.Gray);
} }
if (Image != null) { if (Image != null)
using (Graphics graphics = Graphics.FromImage(Image)) { {
graphics.FillRectangle(brush, new Rectangle(0,13,16,3)); using Graphics graphics = Graphics.FromImage(Image);
} graphics.FillRectangle(brush, new Rectangle(0,13,16,3));
} }
// cleanup GDI Object // cleanup GDI Object
brush.Dispose(); brush.Dispose();

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -118,20 +118,19 @@ namespace Greenshot.Destinations {
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(Designation, Description); ExportInformation exportInformation = new ExportInformation(Designation, Description);
PrinterSettings printerSettings; PrinterSettings printerSettings;
if (!string.IsNullOrEmpty(printerName)) { if (!string.IsNullOrEmpty(printerName))
using (PrintHelper printHelper = new PrintHelper(surface, captureDetails)) { {
printerSettings = printHelper.PrintTo(printerName); using PrintHelper printHelper = new PrintHelper(surface, captureDetails);
} printerSettings = printHelper.PrintTo(printerName);
} else if (!manuallyInitiated) { } else if (!manuallyInitiated) {
PrinterSettings settings = new PrinterSettings(); PrinterSettings settings = new PrinterSettings();
using (PrintHelper printHelper = new PrintHelper(surface, captureDetails)) { using PrintHelper printHelper = new PrintHelper(surface, captureDetails);
printerSettings = printHelper.PrintTo(settings.PrinterName); printerSettings = printHelper.PrintTo(settings.PrinterName);
} } else
} else { {
using (PrintHelper printHelper = new PrintHelper(surface, captureDetails)) { using PrintHelper printHelper = new PrintHelper(surface, captureDetails);
printerSettings = printHelper.PrintWithDialog(); printerSettings = printHelper.PrintWithDialog();
} }
}
if (printerSettings != null) { if (printerSettings != null) {
exportInformation.ExportMade = true; exportInformation.ExportMade = true;
} }

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/ * The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/ * The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/ * The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/ * The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -68,27 +68,27 @@ namespace Greenshot.Drawing {
int alpha = basealpha; int alpha = basealpha;
int steps = 5; int steps = 5;
int currentStep = 1; int currentStep = 1;
while (currentStep <= steps) { while (currentStep <= steps)
using (Pen shadowCapPen = new Pen(Color.FromArgb(alpha, 100, 100, 100), lineThickness)) { {
SetArrowHeads(heads, shadowCapPen); using Pen shadowCapPen = new Pen(Color.FromArgb(alpha, 100, 100, 100), lineThickness);
SetArrowHeads(heads, shadowCapPen);
graphics.DrawLine(shadowCapPen, graphics.DrawLine(shadowCapPen,
Left + currentStep, Left + currentStep,
Top + currentStep, Top + currentStep,
Left + currentStep + Width, Left + currentStep + Width,
Top + currentStep + Height); Top + currentStep + Height);
currentStep++; currentStep++;
alpha = alpha - basealpha / steps; alpha -= basealpha / steps;
} }
}
} }
using (Pen pen = new Pen(lineColor, lineThickness)) {
SetArrowHeads(heads, pen); using Pen pen = new Pen(lineColor, lineThickness);
graphics.DrawLine(pen, Left, Top, Left + Width, Top + Height); SetArrowHeads(heads, pen);
} graphics.DrawLine(pen, Left, Top, Left + Width, Top + Height);
} }
} }
} }
@ -104,36 +104,37 @@ namespace Greenshot.Drawing {
public override Rectangle DrawingBounds { public override Rectangle DrawingBounds {
get { get {
int lineThickness = GetFieldValueAsInt(FieldType.LINE_THICKNESS); int lineThickness = GetFieldValueAsInt(FieldType.LINE_THICKNESS);
if (lineThickness > 0) { if (lineThickness > 0)
using (Pen pen = new Pen(Color.White)) { {
pen.Width = lineThickness; using Pen pen = new Pen(Color.White)
SetArrowHeads((ArrowHeadCombination)GetFieldValue(FieldType.ARROWHEADS), pen); {
using (GraphicsPath path = new GraphicsPath()) { Width = lineThickness
path.AddLine(Left, Top, Left + Width, Top + Height); };
using (Matrix matrix = new Matrix()) { SetArrowHeads((ArrowHeadCombination)GetFieldValue(FieldType.ARROWHEADS), pen);
Rectangle drawingBounds = Rectangle.Round(path.GetBounds(matrix, pen)); using GraphicsPath path = new GraphicsPath();
drawingBounds.Inflate(2, 2); path.AddLine(Left, Top, Left + Width, Top + Height);
return drawingBounds; using Matrix matrix = new Matrix();
} Rectangle drawingBounds = Rectangle.Round(path.GetBounds(matrix, pen));
} drawingBounds.Inflate(2, 2);
} return drawingBounds;
} }
return Rectangle.Empty; return Rectangle.Empty;
} }
} }
public override bool ClickableAt(int x, int y) { public override bool ClickableAt(int x, int y) {
int lineThickness = GetFieldValueAsInt(FieldType.LINE_THICKNESS) + 10; int lineThickness = GetFieldValueAsInt(FieldType.LINE_THICKNESS) + 10;
if (lineThickness > 0) { if (lineThickness > 0)
using (Pen pen = new Pen(Color.White)) { {
pen.Width = lineThickness; using Pen pen = new Pen(Color.White)
SetArrowHeads((ArrowHeadCombination)GetFieldValue(FieldType.ARROWHEADS), pen); {
using (GraphicsPath path = new GraphicsPath()) { Width = lineThickness
path.AddLine(Left, Top, Left + Width, Top + Height); };
return path.IsOutlineVisible(x, y, pen); SetArrowHeads((ArrowHeadCombination)GetFieldValue(FieldType.ARROWHEADS), pen);
} using GraphicsPath path = new GraphicsPath();
} path.AddLine(Left, Top, Left + Width, Top + Height);
} return path.IsOutlineVisible(x, y, pen);
}
return false; return false;
} }
} }

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -64,22 +64,22 @@ namespace Greenshot.Drawing {
{ {
return; return;
} }
using (Brush cropBrush = new SolidBrush(Color.FromArgb(100, 150, 150, 100))) {
Rectangle cropRectangle = GuiRectangle.GetGuiRectangle(Left, Top, Width, Height);
Rectangle selectionRect = new Rectangle(cropRectangle.Left - 1, cropRectangle.Top - 1, cropRectangle.Width + 1, cropRectangle.Height + 1);
DrawSelectionBorder(g, selectionRect); using Brush cropBrush = new SolidBrush(Color.FromArgb(100, 150, 150, 100));
Rectangle cropRectangle = GuiRectangle.GetGuiRectangle(Left, Top, Width, Height);
Rectangle selectionRect = new Rectangle(cropRectangle.Left - 1, cropRectangle.Top - 1, cropRectangle.Width + 1, cropRectangle.Height + 1);
// top DrawSelectionBorder(g, selectionRect);
g.FillRectangle(cropBrush, new Rectangle(0, 0, _parent.Width, cropRectangle.Top));
// left // top
g.FillRectangle(cropBrush, new Rectangle(0, cropRectangle.Top, cropRectangle.Left, cropRectangle.Height)); g.FillRectangle(cropBrush, new Rectangle(0, 0, _parent.Width, cropRectangle.Top));
// right // left
g.FillRectangle(cropBrush, new Rectangle(cropRectangle.Left + cropRectangle.Width, cropRectangle.Top, _parent.Width - (cropRectangle.Left + cropRectangle.Width), cropRectangle.Height)); g.FillRectangle(cropBrush, new Rectangle(0, cropRectangle.Top, cropRectangle.Left, cropRectangle.Height));
// bottom // right
g.FillRectangle(cropBrush, new Rectangle(0, cropRectangle.Top + cropRectangle.Height, _parent.Width, _parent.Height - (cropRectangle.Top + cropRectangle.Height))); g.FillRectangle(cropBrush, new Rectangle(cropRectangle.Left + cropRectangle.Width, cropRectangle.Top, _parent.Width - (cropRectangle.Left + cropRectangle.Width), cropRectangle.Height));
} // bottom
} g.FillRectangle(cropBrush, new Rectangle(0, cropRectangle.Top + cropRectangle.Height, _parent.Width, _parent.Height - (cropRectangle.Top + cropRectangle.Height)));
}
public override bool HasContextMenu { public override bool HasContextMenu {
get { get {

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -89,11 +89,11 @@ namespace Greenshot.Drawing {
if (!File.Exists(filename)) { if (!File.Exists(filename)) {
return; return;
} }
using (Cursor fileCursor = new Cursor(filename)) {
Cursor = fileCursor; using Cursor fileCursor = new Cursor(filename);
LOG.Debug("Loaded file: " + filename + " with resolution: " + Height + "," + Width); Cursor = fileCursor;
} LOG.Debug("Loaded file: " + filename + " with resolution: " + Height + "," + Width);
} }
public override void Draw(Graphics graphics, RenderMode rm) { public override void Draw(Graphics graphics, RenderMode rm) {
if (cursor == null) { if (cursor == null) {

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -408,13 +408,15 @@ namespace Greenshot.Drawing
return r.Contains(x, y); return r.Contains(x, y);
} }
protected void DrawSelectionBorder(Graphics g, Rectangle rect) { protected void DrawSelectionBorder(Graphics g, Rectangle rect)
using (Pen pen = new Pen(Color.MediumSeaGreen)) { {
pen.DashPattern = new float[]{1,2}; using Pen pen = new Pen(Color.MediumSeaGreen)
pen.Width = 1; {
g.DrawRectangle(pen, rect); DashPattern = new float[] { 1, 2 },
} Width = 1
} };
g.DrawRectangle(pen, rect);
}
public void ResizeTo(int width, int height, int anchorPosition) { public void ResizeTo(int width, int height, int anchorPosition) {

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -483,10 +483,12 @@ namespace Greenshot.Drawing {
}; };
menu.Items.Add(item); menu.Items.Add(item);
// Delete // Delete
item = new ToolStripMenuItem(Language.GetString(LangKey.editor_deleteelement)); item = new ToolStripMenuItem(Language.GetString(LangKey.editor_deleteelement))
item.Image = (Image)EditorFormResources.GetObject("removeObjectToolStripMenuItem.Image"); {
item.Click += delegate { Image = (Image)EditorFormResources.GetObject("removeObjectToolStripMenuItem.Image")
};
item.Click += delegate {
surface.RemoveElements(this); surface.RemoveElements(this);
}; };
menu.Items.Add(item); menu.Items.Add(item);
@ -556,8 +558,7 @@ namespace Greenshot.Drawing {
} }
} }
#region IDisposable Support private bool _disposedValue; // To detect redundant calls
private bool _disposedValue; // To detect redundant calls
protected virtual void Dispose(bool disposing) protected virtual void Dispose(bool disposing)
{ {
@ -581,6 +582,5 @@ namespace Greenshot.Drawing {
// Do not change this code. Put cleanup code in Dispose(bool disposing) above. // Do not change this code. Put cleanup code in Dispose(bool disposing) above.
Dispose(true); Dispose(true);
} }
#endregion }
}
} }

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -75,27 +75,29 @@ namespace Greenshot.Drawing {
int alpha = basealpha; int alpha = basealpha;
int steps = 5; int steps = 5;
int currentStep = lineVisible ? 1 : 0; int currentStep = lineVisible ? 1 : 0;
while (currentStep <= steps) { while (currentStep <= steps)
using (Pen shadowPen = new Pen(Color.FromArgb(alpha, 100, 100, 100))) { {
shadowPen.Width = lineVisible ? lineThickness : 1; using Pen shadowPen = new Pen(Color.FromArgb(alpha, 100, 100, 100))
Rectangle shadowRect = GuiRectangle.GetGuiRectangle(rect.Left + currentStep, rect.Top + currentStep, rect.Width, rect.Height); {
graphics.DrawEllipse(shadowPen, shadowRect); Width = lineVisible ? lineThickness : 1
currentStep++; };
alpha = alpha - basealpha / steps; Rectangle shadowRect = GuiRectangle.GetGuiRectangle(rect.Left + currentStep, rect.Top + currentStep, rect.Width, rect.Height);
} graphics.DrawEllipse(shadowPen, shadowRect);
} currentStep++;
alpha -= basealpha / steps;
}
} }
//draw the original shape //draw the original shape
if (Colors.IsVisible(fillColor)) { if (Colors.IsVisible(fillColor))
using (Brush brush = new SolidBrush(fillColor)) { {
graphics.FillEllipse(brush, rect); using Brush brush = new SolidBrush(fillColor);
} graphics.FillEllipse(brush, rect);
} }
if (lineVisible) { if (lineVisible)
using (Pen pen = new Pen(lineColor, lineThickness)) { {
graphics.DrawEllipse(pen, rect); using Pen pen = new Pen(lineColor, lineThickness);
} graphics.DrawEllipse(pen, rect);
} }
} }
public override bool Contains(int x, int y) { public override bool Contains(int x, int y) {
@ -133,14 +135,13 @@ namespace Greenshot.Drawing {
} }
// check the rest of the lines // check the rest of the lines
if (lineThickness > 0) { if (lineThickness > 0)
using (Pen pen = new Pen(Color.White, lineThickness)) { {
using (GraphicsPath path = new GraphicsPath()) { using Pen pen = new Pen(Color.White, lineThickness);
path.AddEllipse(rect); using GraphicsPath path = new GraphicsPath();
return path.IsOutlineVisible(x, y, pen); path.AddEllipse(rect);
} return path.IsOutlineVisible(x, y, pen);
} }
}
return false; return false;
} }
} }

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -135,8 +135,7 @@ namespace Greenshot.Drawing.Fields
return GetField(fieldType)?.Value; return GetField(fieldType)?.Value;
} }
#region convenience methods to save us some casts outside public string GetFieldValueAsString(IFieldType fieldType)
public string GetFieldValueAsString(IFieldType fieldType)
{ {
return Convert.ToString(GetFieldValue(fieldType)); return Convert.ToString(GetFieldValue(fieldType));
} }
@ -166,13 +165,12 @@ namespace Greenshot.Drawing.Fields
return Convert.ToBoolean(GetFieldValue(fieldType)); return Convert.ToBoolean(GetFieldValue(fieldType));
} }
public Color GetFieldValueAsColor(IFieldType fieldType, Color defaultColor = default(Color)) public Color GetFieldValueAsColor(IFieldType fieldType, Color defaultColor = default)
{ {
return (Color)(GetFieldValue(fieldType) ?? defaultColor); return (Color)(GetFieldValue(fieldType) ?? defaultColor);
} }
#endregion
public bool HasField(IFieldType fieldType) public bool HasField(IFieldType fieldType)
{ {
return _fieldsByType.ContainsKey(fieldType); return _fieldsByType.ContainsKey(fieldType);
} }

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -45,7 +45,7 @@ namespace Greenshot.Drawing.Fields
remove { childrenChanged -= value; } remove { childrenChanged -= value; }
} }
public List<IFieldHolder> Children = new List<IFieldHolder>(); public IList<IFieldHolder> Children = new List<IFieldHolder>();
public AbstractFieldHolderWithChildren() public AbstractFieldHolderWithChildren()
{ {

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -115,8 +115,7 @@ namespace Greenshot.Drawing.Fields
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
var other = obj as Field; if (!(obj is Field other))
if (other == null)
{ {
return false; return false;
} }

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -80,8 +80,7 @@ namespace Greenshot.Drawing.Fields
public void BindElement(IDrawableContainer dc) public void BindElement(IDrawableContainer dc)
{ {
DrawableContainer container = dc as DrawableContainer; if (!(dc is DrawableContainer container) || _boundContainers.Contains(container))
if (container == null || _boundContainers.Contains(container))
{ {
return; return;
} }
@ -100,8 +99,7 @@ namespace Greenshot.Drawing.Fields
public void UpdateElement(IDrawableContainer dc) public void UpdateElement(IDrawableContainer dc)
{ {
DrawableContainer container = dc as DrawableContainer; if (!(dc is DrawableContainer container))
if (container == null)
{ {
return; return;
} }
@ -168,30 +166,26 @@ namespace Greenshot.Drawing.Fields
if (_boundContainers.Count > 0) if (_boundContainers.Count > 0)
{ {
// take all fields from the least selected container... // take all fields from the least selected container...
DrawableContainer leastSelectedContainer = _boundContainers[_boundContainers.Count - 1] as DrawableContainer; if (_boundContainers[_boundContainers.Count - 1] is DrawableContainer leastSelectedContainer)
if (leastSelectedContainer != null)
{ {
returnFields = leastSelectedContainer.GetFields(); returnFields = leastSelectedContainer.GetFields();
for (int i = 0; i < _boundContainers.Count - 1; i++) for (int i = 0; i < _boundContainers.Count - 1; i++)
{ {
DrawableContainer dc = _boundContainers[i] as DrawableContainer; if (!(_boundContainers[i] is DrawableContainer dc)) continue;
if (dc != null) IList<IField> fieldsToRemove = new List<IField>();
{ foreach (IField field in returnFields)
IList<IField> fieldsToRemove = new List<IField>(); {
foreach (IField field in returnFields) // ... throw out those that do not apply to one of the other containers
{ if (!dc.HasField(field.FieldType))
// ... throw out those that do not apply to one of the other containers {
if (!dc.HasField(field.FieldType)) fieldsToRemove.Add(field);
{ }
fieldsToRemove.Add(field); }
} foreach (var field in fieldsToRemove)
} {
foreach (var field in fieldsToRemove) returnFields.Remove(field);
{ }
returnFields.Remove(field); }
}
}
}
} }
} }
return returnFields ?? new List<IField>(); return returnFields ?? new List<IField>();

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,53 +0,0 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2015 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/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.Collections.Generic;
namespace Greenshot.Drawing.Fields {
/// <summary>
/// Any element holding Fields must provide access to it.
/// AbstractFieldHolder is the basic implementation.
/// If you need the fieldHolder to have child fieldHolders,
/// you should consider using IFieldHolderWithChildren.
/// </summary>
public interface IFieldHolder {
event FieldChangedEventHandler FieldChanged;
void AddField(Field field);
void RemoveField(Field field);
List<Field> GetFields();
Field GetField(FieldType fieldType);
bool HasField(FieldType fieldType);
void SetFieldValue(FieldType fieldType, object value);
}
/// <summary>
/// Extended fieldHolder which has fieldHolder children.
/// Implementations should pass field values to and from
/// their children.
/// AbstractFieldHolderWithChildren is the basic implementation.
/// </summary>
public interface IFieldHolderWithChildren : IFieldHolder {
void AddChild(IFieldHolder fieldHolder);
void RemoveChild(IFieldHolder fieldHolder);
}
}

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -77,21 +77,21 @@ namespace Greenshot.Drawing {
int alpha = basealpha; int alpha = basealpha;
int steps = 5; int steps = 5;
int currentStep = lineVisible ? 1 : 0; int currentStep = lineVisible ? 1 : 0;
while (currentStep <= steps) { while (currentStep <= steps)
using (Pen shadowPen = new Pen(Color.FromArgb(alpha, 100, 100, 100), lineThickness)) { {
Rectangle shadowRect = GuiRectangle.GetGuiRectangle(Left + currentStep, Top + currentStep, Width, Height); using Pen shadowPen = new Pen(Color.FromArgb(alpha, 100, 100, 100), lineThickness);
graphics.DrawRectangle(shadowPen, shadowRect); Rectangle shadowRect = GuiRectangle.GetGuiRectangle(Left + currentStep, Top + currentStep, Width, Height);
currentStep++; graphics.DrawRectangle(shadowPen, shadowRect);
alpha = alpha - basealpha / steps; currentStep++;
} alpha -= basealpha / steps;
} }
} }
Rectangle rect = GuiRectangle.GetGuiRectangle(Left, Top, Width, Height); Rectangle rect = GuiRectangle.GetGuiRectangle(Left, Top, Width, Height);
if (lineThickness > 0) { if (lineThickness > 0)
using (Pen pen = new Pen(lineColor, lineThickness)) { {
graphics.DrawRectangle(pen, rect); using Pen pen = new Pen(lineColor, lineThickness);
} graphics.DrawRectangle(pen, rect);
} }
} }
} }
} }

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -54,12 +54,12 @@ namespace Greenshot.Drawing.Filters {
} }
if (GDIplus.IsBlurPossible(blurRadius)) { if (GDIplus.IsBlurPossible(blurRadius)) {
GDIplus.DrawWithBlur(graphics, applyBitmap, applyRect, null, null, blurRadius, false); GDIplus.DrawWithBlur(graphics, applyBitmap, applyRect, null, null, blurRadius, false);
} else { } else
using (IFastBitmap fastBitmap = FastBitmap.CreateCloneOf(applyBitmap, applyRect)) { {
ImageHelper.ApplyBoxBlur(fastBitmap, blurRadius); using IFastBitmap fastBitmap = FastBitmap.CreateCloneOf(applyBitmap, applyRect);
fastBitmap.DrawTo(graphics, applyRect); ImageHelper.ApplyBoxBlur(fastBitmap, blurRadius);
} fastBitmap.DrawTo(graphics, applyRect);
} }
graphics.Restore(state); graphics.Restore(state);
} }
} }

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -48,37 +48,37 @@ namespace Greenshot.Drawing.Filters {
if (rect.Height < pixelSize) { if (rect.Height < pixelSize) {
pixelSize = rect.Height; pixelSize = rect.Height;
} }
using (IFastBitmap dest = FastBitmap.CreateCloneOf(applyBitmap, rect)) {
using (IFastBitmap src = FastBitmap.Create(applyBitmap, rect)) { using IFastBitmap dest = FastBitmap.CreateCloneOf(applyBitmap, rect);
List<Color> colors = new List<Color>(); using (IFastBitmap src = FastBitmap.Create(applyBitmap, rect)) {
int halbPixelSize = pixelSize / 2; List<Color> colors = new List<Color>();
for (int y = src.Top - halbPixelSize; y < src.Bottom + halbPixelSize; y = y + pixelSize) { int halbPixelSize = pixelSize / 2;
for (int x = src.Left - halbPixelSize; x <= src.Right + halbPixelSize; x = x + pixelSize) { for (int y = src.Top - halbPixelSize; y < src.Bottom + halbPixelSize; y += pixelSize) {
colors.Clear(); for (int x = src.Left - halbPixelSize; x <= src.Right + halbPixelSize; x += pixelSize) {
for (int yy = y; yy < y + pixelSize; yy++) { colors.Clear();
if (yy >= src.Top && yy < src.Bottom) { for (int yy = y; yy < y + pixelSize; yy++) {
for (int xx = x; xx < x + pixelSize; xx++) { if (yy >= src.Top && yy < src.Bottom) {
if (xx >= src.Left && xx < src.Right) { for (int xx = x; xx < x + pixelSize; xx++) {
colors.Add(src.GetColorAt(xx, yy)); if (xx >= src.Left && xx < src.Right) {
} colors.Add(src.GetColorAt(xx, yy));
} }
} }
} }
Color currentAvgColor = Colors.Mix(colors); }
for (int yy = y; yy <= y + pixelSize; yy++) { Color currentAvgColor = Colors.Mix(colors);
if (yy >= src.Top && yy < src.Bottom) { for (int yy = y; yy <= y + pixelSize; yy++) {
for (int xx = x; xx <= x + pixelSize; xx++) { if (yy >= src.Top && yy < src.Bottom) {
if (xx >= src.Left && xx < src.Right) { for (int xx = x; xx <= x + pixelSize; xx++) {
dest.SetColorAt(xx, yy, currentAvgColor); if (xx >= src.Left && xx < src.Right) {
} dest.SetColorAt(xx, yy, currentAvgColor);
} }
} }
} }
} }
} }
} }
dest.DrawTo(graphics, rect.Location); }
} dest.DrawTo(graphics, rect.Location);
} }
} }
} }

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -182,31 +182,32 @@ namespace Greenshot.Drawing {
int lineThickness = GetFieldValueAsInt(FieldType.LINE_THICKNESS); int lineThickness = GetFieldValueAsInt(FieldType.LINE_THICKNESS);
Color lineColor = GetFieldValueAsColor(FieldType.LINE_COLOR); Color lineColor = GetFieldValueAsColor(FieldType.LINE_COLOR);
using (var pen = new Pen(lineColor)) { using var pen = new Pen(lineColor)
pen.Width = lineThickness; {
if (!(pen.Width > 0)) Width = lineThickness
{ };
return; if (!(pen.Width > 0))
} {
// Make sure the lines are nicely rounded return;
pen.EndCap = LineCap.Round; }
pen.StartCap = LineCap.Round; // Make sure the lines are nicely rounded
pen.LineJoin = LineJoin.Round; pen.EndCap = LineCap.Round;
// Move to where we need to draw pen.StartCap = LineCap.Round;
graphics.TranslateTransform(Left, Top); pen.LineJoin = LineJoin.Round;
lock (_freehandPathLock) // Move to where we need to draw
{ graphics.TranslateTransform(Left, Top);
if (isRecalculated && Selected && renderMode == RenderMode.EDIT) lock (_freehandPathLock)
{ {
DrawSelectionBorder(graphics, pen, freehandPath); if (isRecalculated && Selected && renderMode == RenderMode.EDIT)
} {
graphics.DrawPath(pen, freehandPath); DrawSelectionBorder(graphics, pen, freehandPath);
} }
graphics.DrawPath(pen, freehandPath);
}
// Move back, otherwise everything is shifted // Move back, otherwise everything is shifted
graphics.TranslateTransform(-Left,-Top); graphics.TranslateTransform(-Left,-Top);
} }
}
/// <summary> /// <summary>
/// Draw a selectionborder around the freehand path /// Draw a selectionborder around the freehand path
@ -214,20 +215,19 @@ namespace Greenshot.Drawing {
/// <param name="graphics">Graphics</param> /// <param name="graphics">Graphics</param>
/// <param name="linePen">Pen</param> /// <param name="linePen">Pen</param>
/// <param name="path">GraphicsPath</param> /// <param name="path">GraphicsPath</param>
protected static void DrawSelectionBorder(Graphics graphics, Pen linePen, GraphicsPath path) { protected static void DrawSelectionBorder(Graphics graphics, Pen linePen, GraphicsPath path)
using (var selectionPen = (Pen) linePen.Clone()) { {
using (var selectionPath = (GraphicsPath)path.Clone()) { using var selectionPen = (Pen) linePen.Clone();
selectionPen.Width += 5; using var selectionPath = (GraphicsPath)path.Clone();
selectionPen.Color = Color.FromArgb(120, Color.LightSeaGreen); selectionPen.Width += 5;
graphics.DrawPath(selectionPen, selectionPath); selectionPen.Color = Color.FromArgb(120, Color.LightSeaGreen);
selectionPath.Widen(selectionPen); graphics.DrawPath(selectionPen, selectionPath);
selectionPen.DashPattern = new float[]{2,2}; selectionPath.Widen(selectionPen);
selectionPen.Color = Color.LightSeaGreen; selectionPen.DashPattern = new float[]{2,2};
selectionPen.Width = 1; selectionPen.Color = Color.LightSeaGreen;
graphics.DrawPath(selectionPen, selectionPath); selectionPen.Width = 1;
} graphics.DrawPath(selectionPen, selectionPath);
} }
}
/// <summary> /// <summary>
/// Get the bounds in which we have something drawn, plus safety margin, these are not the normal bounds... /// Get the bounds in which we have something drawn, plus safety margin, these are not the normal bounds...
@ -254,8 +254,8 @@ namespace Greenshot.Drawing {
{ {
return false; return false;
} }
var other = obj as FreehandContainer;
if (other != null && Equals(freehandPath, other.freehandPath)) { if (obj is FreehandContainer other && Equals(freehandPath, other.freehandPath)) {
ret = true; ret = true;
} }
return ret; return ret;
@ -272,14 +272,15 @@ namespace Greenshot.Drawing {
bool returnValue = base.ClickableAt(x, y); bool returnValue = base.ClickableAt(x, y);
if (returnValue) { if (returnValue) {
int lineThickness = GetFieldValueAsInt(FieldType.LINE_THICKNESS); int lineThickness = GetFieldValueAsInt(FieldType.LINE_THICKNESS);
using (var pen = new Pen(Color.White)) { using var pen = new Pen(Color.White)
pen.Width = lineThickness + 10; {
lock (_freehandPathLock) Width = lineThickness + 10
{ };
returnValue = freehandPath.IsOutlineVisible(x - Left, y - Top, pen); lock (_freehandPathLock)
} {
returnValue = freehandPath.IsOutlineVisible(x - Left, y - Top, pen);
} }
} }
return returnValue; return returnValue;
} }
} }

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -84,9 +84,11 @@ namespace Greenshot.Drawing {
Add(blurFilter); Add(blurFilter);
break; break;
case PreparedFilter.GRAYSCALE: case PreparedFilter.GRAYSCALE:
AbstractFilter f = new GrayscaleFilter(this); AbstractFilter f = new GrayscaleFilter(this)
f.Invert = true; {
Add(f); Invert = true
};
Add(f);
break; break;
case PreparedFilter.MAGNIFICATION: case PreparedFilter.MAGNIFICATION:
Add(new MagnifierFilter(this)); Add(new MagnifierFilter(this));

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -79,12 +79,12 @@ namespace Greenshot.Drawing {
} }
public void Load(string filename) { public void Load(string filename) {
if (File.Exists(filename)) { if (File.Exists(filename))
using (Icon fileIcon = new Icon(filename)) { {
Icon = fileIcon; using Icon fileIcon = new Icon(filename);
Log.Debug("Loaded file: " + filename + " with resolution: " + Height + "," + Width); Icon = fileIcon;
} Log.Debug("Loaded file: " + filename + " with resolution: " + Height + "," + Width);
} }
} }
public override void Draw(Graphics graphics, RenderMode rm) { public override void Draw(Graphics graphics, RenderMode rm) {

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -92,14 +92,14 @@ namespace Greenshot.Drawing {
CheckShadow(true); CheckShadow(true);
Width = _shadowBitmap.Width; Width = _shadowBitmap.Width;
Height = _shadowBitmap.Height; Height = _shadowBitmap.Height;
Left = Left - _shadowOffset.X; Left -= _shadowOffset.X;
Top = Top - _shadowOffset.Y; Top -= _shadowOffset.Y;
} else { } else {
Width = image.Width; Width = image.Width;
Height = image.Height; Height = image.Height;
if (_shadowBitmap != null) { if (_shadowBitmap != null) {
Left = Left + _shadowOffset.X; Left += _shadowOffset.X;
Top = Top + _shadowOffset.Y; Top += _shadowOffset.Y;
} }
} }
} }
@ -118,8 +118,8 @@ namespace Greenshot.Drawing {
} else { } else {
Width = _shadowBitmap.Width; Width = _shadowBitmap.Width;
Height = _shadowBitmap.Height; Height = _shadowBitmap.Height;
Left = Left - _shadowOffset.X; Left -= _shadowOffset.X;
Top = Top - _shadowOffset.Y; Top -= _shadowOffset.Y;
} }
} }
get { return image; } get { return image; }
@ -160,13 +160,12 @@ namespace Greenshot.Drawing {
if (rotateAngle != 0) { if (rotateAngle != 0) {
Log.DebugFormat("Rotating element with {0} degrees.", rotateAngle); Log.DebugFormat("Rotating element with {0} degrees.", rotateAngle);
DisposeShadow(); DisposeShadow();
using (var tmpMatrix = new Matrix()) { using var tmpMatrix = new Matrix();
using (image) using (image)
{ {
image = ImageHelper.ApplyEffect(image, new RotateEffect(rotateAngle), tmpMatrix); image = ImageHelper.ApplyEffect(image, new RotateEffect(rotateAngle), tmpMatrix);
} }
} }
}
base.Transform(matrix); base.Transform(matrix);
} }
@ -192,11 +191,11 @@ namespace Greenshot.Drawing {
/// </summary> /// </summary>
/// <param name="shadow"></param> /// <param name="shadow"></param>
private void CheckShadow(bool shadow) { private void CheckShadow(bool shadow) {
if (shadow && _shadowBitmap == null) { if (shadow && _shadowBitmap == null)
using (var matrix = new Matrix()) { {
_shadowBitmap = ImageHelper.ApplyEffect(image, new DropShadowEffect(), matrix); using var matrix = new Matrix();
} _shadowBitmap = ImageHelper.ApplyEffect(image, new DropShadowEffect(), matrix);
} }
} }
/// <summary> /// <summary>

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -73,37 +73,37 @@ namespace Greenshot.Drawing {
int alpha = basealpha; int alpha = basealpha;
int steps = 5; int steps = 5;
int currentStep = 1; int currentStep = 1;
while (currentStep <= steps) { while (currentStep <= steps)
using (Pen shadowCapPen = new Pen(Color.FromArgb(alpha, 100, 100, 100), lineThickness)) { {
graphics.DrawLine(shadowCapPen, using Pen shadowCapPen = new Pen(Color.FromArgb(alpha, 100, 100, 100), lineThickness);
Left + currentStep, graphics.DrawLine(shadowCapPen,
Top + currentStep, Left + currentStep,
Left + currentStep + Width, Top + currentStep,
Top + currentStep + Height); Left + currentStep + Width,
Top + currentStep + Height);
currentStep++; currentStep++;
alpha = alpha - basealpha / steps; alpha -= basealpha / steps;
} }
}
} }
using (Pen pen = new Pen(lineColor, lineThickness)) { using Pen pen = new Pen(lineColor, lineThickness);
graphics.DrawLine(pen, Left, Top, Left + Width, Top + Height); graphics.DrawLine(pen, Left, Top, Left + Width, Top + Height);
} }
}
} }
public override bool ClickableAt(int x, int y) { public override bool ClickableAt(int x, int y) {
int lineThickness = GetFieldValueAsInt(FieldType.LINE_THICKNESS) +5; int lineThickness = GetFieldValueAsInt(FieldType.LINE_THICKNESS) +5;
if (lineThickness > 0) { if (lineThickness > 0)
using (Pen pen = new Pen(Color.White)) { {
pen.Width = lineThickness; using Pen pen = new Pen(Color.White)
using (GraphicsPath path = new GraphicsPath()) { {
path.AddLine(Left, Top, Left + Width, Top + Height); Width = lineThickness
return path.IsOutlineVisible(x, y, pen); };
} using GraphicsPath path = new GraphicsPath();
} path.AddLine(Left, Top, Left + Width, Top + Height);
} return path.IsOutlineVisible(x, y, pen);
}
return false; return false;
} }

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/ * The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -93,34 +93,36 @@ namespace Greenshot.Drawing {
int alpha = basealpha; int alpha = basealpha;
int steps = 5; int steps = 5;
int currentStep = lineVisible ? 1 : 0; int currentStep = lineVisible ? 1 : 0;
while (currentStep <= steps) { while (currentStep <= steps)
using (Pen shadowPen = new Pen(Color.FromArgb(alpha, 100, 100, 100))) { {
shadowPen.Width = lineVisible ? lineThickness : 1; using Pen shadowPen = new Pen(Color.FromArgb(alpha, 100, 100, 100))
Rectangle shadowRect = GuiRectangle.GetGuiRectangle( {
rect.Left + currentStep, Width = lineVisible ? lineThickness : 1
rect.Top + currentStep, };
rect.Width, Rectangle shadowRect = GuiRectangle.GetGuiRectangle(
rect.Height); rect.Left + currentStep,
graphics.DrawRectangle(shadowPen, shadowRect); rect.Top + currentStep,
currentStep++; rect.Width,
alpha = alpha - basealpha / steps; rect.Height);
} graphics.DrawRectangle(shadowPen, shadowRect);
} currentStep++;
alpha -= basealpha / steps;
}
} }
if (Colors.IsVisible(fillColor)) { if (Colors.IsVisible(fillColor))
using (Brush brush = new SolidBrush(fillColor)) { {
graphics.FillRectangle(brush, rect); using Brush brush = new SolidBrush(fillColor);
} graphics.FillRectangle(brush, rect);
} }
graphics.SmoothingMode = SmoothingMode.HighSpeed; graphics.SmoothingMode = SmoothingMode.HighSpeed;
if (lineVisible) { if (lineVisible)
using (Pen pen = new Pen(lineColor, lineThickness)) { {
graphics.DrawRectangle(pen, rect); using Pen pen = new Pen(lineColor, lineThickness);
} graphics.DrawRectangle(pen, rect);
} }
} }
public override bool ClickableAt(int x, int y) { public override bool ClickableAt(int x, int y) {
@ -142,14 +144,13 @@ namespace Greenshot.Drawing {
} }
// check the rest of the lines // check the rest of the lines
if (lineThickness > 0) { if (lineThickness > 0)
using (Pen pen = new Pen(Color.White, lineThickness)) { {
using (GraphicsPath path = new GraphicsPath()) { using Pen pen = new Pen(Color.White, lineThickness);
path.AddRectangle(rect); using GraphicsPath path = new GraphicsPath();
return path.IsOutlineVisible(x, y, pen); path.AddRectangle(rect);
} return path.IsOutlineVisible(x, y, pen);
} }
}
return false; return false;
} }
} }

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -38,8 +38,7 @@ namespace Greenshot.Drawing
private Point _initialGripperPoint; private Point _initialGripperPoint;
#region TargetGripper serializing code // Only used for serializing the TargetGripper location
// Only used for serializing the TargetGripper location
private Point _storedTargetGripperLocation; private Point _storedTargetGripperLocation;
/// <summary> /// <summary>
@ -62,9 +61,8 @@ namespace Greenshot.Drawing
base.OnDeserialized(streamingContext); base.OnDeserialized(streamingContext);
InitAdorner(Color.Green, _storedTargetGripperLocation); InitAdorner(Color.Green, _storedTargetGripperLocation);
} }
#endregion
public SpeechbubbleContainer(Surface parent) public SpeechbubbleContainer(Surface parent)
: base(parent) { : base(parent) {
} }
@ -132,13 +130,11 @@ namespace Greenshot.Drawing
int lineThickness = GetFieldValueAsInt(FieldType.LINE_THICKNESS); int lineThickness = GetFieldValueAsInt(FieldType.LINE_THICKNESS);
Color lineColor = GetFieldValueAsColor(FieldType.LINE_COLOR); Color lineColor = GetFieldValueAsColor(FieldType.LINE_COLOR);
bool shadow = GetFieldValueAsBool(FieldType.SHADOW); bool shadow = GetFieldValueAsBool(FieldType.SHADOW);
using (Pen pen = new Pen(lineColor, lineThickness)) { using Pen pen = new Pen(lineColor, lineThickness);
int inflateValue = lineThickness + 2 + (shadow ? 6 : 0); int inflateValue = lineThickness + 2 + (shadow ? 6 : 0);
using (GraphicsPath tailPath = CreateTail()) { using GraphicsPath tailPath = CreateTail();
return Rectangle.Inflate(Rectangle.Union(Rectangle.Round(tailPath.GetBounds(new Matrix(), pen)), GuiRectangle.GetGuiRectangle(Left, Top, Width, Height)), inflateValue, inflateValue); return Rectangle.Inflate(Rectangle.Union(Rectangle.Round(tailPath.GetBounds(new Matrix(), pen)), GuiRectangle.GetGuiRectangle(Left, Top, Width, Height)), inflateValue, inflateValue);
} }
}
}
return Rectangle.Empty; return Rectangle.Empty;
} }
} }
@ -239,32 +235,30 @@ namespace Greenshot.Drawing
int alpha = basealpha; int alpha = basealpha;
const int steps = 5; const int steps = 5;
int currentStep = lineVisible ? 1 : 0; int currentStep = lineVisible ? 1 : 0;
using (Matrix shadowMatrix = new Matrix()) using Matrix shadowMatrix = new Matrix();
using (GraphicsPath bubbleClone = (GraphicsPath)bubble.Clone()) using GraphicsPath bubbleClone = (GraphicsPath)bubble.Clone();
using (GraphicsPath tailClone = (GraphicsPath)tail.Clone()) { using GraphicsPath tailClone = (GraphicsPath)tail.Clone();
shadowMatrix.Translate(1, 1); shadowMatrix.Translate(1, 1);
while (currentStep <= steps) { while (currentStep <= steps) {
using (Pen shadowPen = new Pen(Color.FromArgb(alpha, 100, 100, 100))) { using (Pen shadowPen = new Pen(Color.FromArgb(alpha, 100, 100, 100))) {
shadowPen.Width = lineVisible ? lineThickness : 1; shadowPen.Width = lineVisible ? lineThickness : 1;
tailClone.Transform(shadowMatrix); tailClone.Transform(shadowMatrix);
graphics.DrawPath(shadowPen, tailClone); graphics.DrawPath(shadowPen, tailClone);
bubbleClone.Transform(shadowMatrix); bubbleClone.Transform(shadowMatrix);
graphics.DrawPath(shadowPen, bubbleClone); graphics.DrawPath(shadowPen, bubbleClone);
} }
currentStep++; currentStep++;
alpha = alpha - basealpha / steps; alpha -= basealpha / steps;
} }
} }
}
GraphicsState state = graphics.Save(); GraphicsState state = graphics.Save();
// draw the tail border where the bubble is not visible // draw the tail border where the bubble is not visible
using (Region clipRegion = new Region(bubble)) { using (Region clipRegion = new Region(bubble)) {
graphics.SetClip(clipRegion, CombineMode.Exclude); graphics.SetClip(clipRegion, CombineMode.Exclude);
using (Pen pen = new Pen(lineColor, lineThickness)) { using Pen pen = new Pen(lineColor, lineThickness);
graphics.DrawPath(pen, tail); graphics.DrawPath(pen, tail);
} }
}
graphics.Restore(state); graphics.Restore(state);
if (Colors.IsVisible(fillColor)) { if (Colors.IsVisible(fillColor)) {
@ -282,11 +276,10 @@ namespace Greenshot.Drawing
// Draw bubble where the Tail is not visible. // Draw bubble where the Tail is not visible.
using (Region clipRegion = new Region(tail)) { using (Region clipRegion = new Region(tail)) {
graphics.SetClip(clipRegion, CombineMode.Exclude); graphics.SetClip(clipRegion, CombineMode.Exclude);
using (Pen pen = new Pen(lineColor, lineThickness)) { using Pen pen = new Pen(lineColor, lineThickness);
//pen.EndCap = pen.StartCap = LineCap.Round; //pen.EndCap = pen.StartCap = LineCap.Round;
graphics.DrawPath(pen, bubble); graphics.DrawPath(pen, bubble);
} }
}
graphics.Restore(state); graphics.Restore(state);
} }
@ -315,21 +308,20 @@ namespace Greenshot.Drawing
if (Status != EditStatus.UNDRAWN) { if (Status != EditStatus.UNDRAWN) {
int lineThickness = GetFieldValueAsInt(FieldType.LINE_THICKNESS); int lineThickness = GetFieldValueAsInt(FieldType.LINE_THICKNESS);
Color lineColor = GetFieldValueAsColor(FieldType.LINE_COLOR); Color lineColor = GetFieldValueAsColor(FieldType.LINE_COLOR);
using (Pen pen = new Pen(lineColor, lineThickness)) { using Pen pen = new Pen(lineColor, lineThickness);
using (GraphicsPath bubblePath = CreateBubble(lineThickness)) { using (GraphicsPath bubblePath = CreateBubble(lineThickness)) {
bubblePath.Widen(pen); bubblePath.Widen(pen);
if (bubblePath.IsVisible(clickedPoint)) { if (bubblePath.IsVisible(clickedPoint)) {
return true; return true;
} }
} }
using (GraphicsPath tailPath = CreateTail()) {
tailPath.Widen(pen); using GraphicsPath tailPath = CreateTail();
if (tailPath.IsVisible(clickedPoint)) { tailPath.Widen(pen);
return true; if (tailPath.IsVisible(clickedPoint)) {
} return true;
} }
} }
}
return false; return false;
} }

View file

@ -54,8 +54,7 @@ namespace Greenshot.Drawing {
CreateDefaultAdorners(); CreateDefaultAdorners();
} }
#region Number serializing // Used to store the number of this label, so when deserializing it can be placed back to the StepLabels list in the right location
// Used to store the number of this label, so when deserializing it can be placed back to the StepLabels list in the right location
private int _number; private int _number;
// Used to store the counter start of the Surface, as the surface is NOT stored. // Used to store the counter start of the Surface, as the surface is NOT stored.
private int _counterStart = 1; private int _counterStart = 1;
@ -79,9 +78,8 @@ namespace Greenshot.Drawing {
_counterStart = ((Surface) Parent).CounterStart; _counterStart = ((Surface) Parent).CounterStart;
} }
} }
#endregion
/// <summary> /// <summary>
/// Restore values that don't serialize /// Restore values that don't serialize
/// </summary> /// </summary>
/// <param name="context"></param> /// <param name="context"></param>
@ -211,12 +209,11 @@ namespace Greenshot.Drawing {
} else { } else {
EllipseContainer.DrawEllipse(rect, graphics, rm, 0, Color.Transparent, fillColor, false); EllipseContainer.DrawEllipse(rect, graphics, rm, 0, Color.Transparent, fillColor, false);
} }
using (FontFamily fam = new FontFamily(FontFamily.GenericSansSerif.Name)) {
using (Font font = new Font(fam, fontSize, FontStyle.Bold, GraphicsUnit.Pixel)) { using FontFamily fam = new FontFamily(FontFamily.GenericSansSerif.Name);
TextContainer.DrawText(graphics, rect, 0, lineColor, false, _stringFormat, text, font); using Font font = new Font(fam, fontSize, FontStyle.Bold, GraphicsUnit.Pixel);
} TextContainer.DrawText(graphics, rect, 0, lineColor, false, _stringFormat, text, font);
} }
}
public override bool ClickableAt(int x, int y) { public override bool ClickableAt(int x, int y) {
Rectangle rect = GuiRectangle.GetGuiRectangle(Left, Top, Width, Height); Rectangle rect = GuiRectangle.GetGuiRectangle(Left, Top, Width, Height);

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -913,16 +913,14 @@ namespace Greenshot.Drawing
string possibleUrl = ClipboardHelper.GetText(e.Data); string possibleUrl = ClipboardHelper.GetText(e.Data);
// Test if it's an url and try to download the image so we have it in the original form // Test if it's an url and try to download the image so we have it in the original form
if (possibleUrl != null && possibleUrl.StartsWith("http")) if (possibleUrl != null && possibleUrl.StartsWith("http"))
{ {
using (Image image = NetworkHelper.DownloadImage(possibleUrl)) using Image image = NetworkHelper.DownloadImage(possibleUrl);
{ if (image != null)
if (image != null) {
{ AddImageContainer(image, mouse.X, mouse.Y);
AddImageContainer(image, mouse.X, mouse.Y); return;
return; }
} }
}
}
} }
foreach (Image image in ClipboardHelper.GetImages(e.Data)) foreach (Image image in ClipboardHelper.GetImages(e.Data))
@ -1537,10 +1535,9 @@ namespace Greenshot.Drawing
public void AddElement(IDrawableContainer element, bool makeUndoable = true, bool invalidate = true) public void AddElement(IDrawableContainer element, bool makeUndoable = true, bool invalidate = true)
{ {
_elements.Add(element); _elements.Add(element);
DrawableContainer container = element as DrawableContainer; if (element is DrawableContainer container)
if (container != null)
{ {
container.FieldChanged += element_FieldChanged; container.FieldChanged += Element_FieldChanged;
} }
element.Parent = this; element.Parent = this;
if (element.Status == EditStatus.UNDRAWN) if (element.Status == EditStatus.UNDRAWN)
@ -1602,10 +1599,9 @@ namespace Greenshot.Drawing
{ {
DeselectElement(elementToRemove, generateEvents); DeselectElement(elementToRemove, generateEvents);
_elements.Remove(elementToRemove); _elements.Remove(elementToRemove);
DrawableContainer element = elementToRemove as DrawableContainer; if (elementToRemove is DrawableContainer element)
if (element != null)
{ {
element.FieldChanged -= element_FieldChanged; element.FieldChanged -= Element_FieldChanged;
} }
if (elementToRemove != null) if (elementToRemove != null)
{ {
@ -2099,7 +2095,7 @@ namespace Greenshot.Drawing
return _elements.CanPushDown(selectedElements); return _elements.CanPushDown(selectedElements);
} }
public void element_FieldChanged(object sender, FieldChangedEventArgs e) public void Element_FieldChanged(object sender, FieldChangedEventArgs e)
{ {
selectedElements.HandleFieldChangedEvent(sender, e); selectedElements.HandleFieldChangedEvent(sender, e);
} }

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -334,43 +334,41 @@ namespace Greenshot.Drawing
FontStyle fontStyle = FontStyle.Regular; FontStyle fontStyle = FontStyle.Regular;
bool hasStyle = false; bool hasStyle = false;
using (var fontFamily = new FontFamily(fontFamilyName)) using var fontFamily = new FontFamily(fontFamilyName);
bool boldAvailable = fontFamily.IsStyleAvailable(FontStyle.Bold);
if (fontBold && boldAvailable)
{ {
bool boldAvailable = fontFamily.IsStyleAvailable(FontStyle.Bold); fontStyle |= FontStyle.Bold;
if (fontBold && boldAvailable) hasStyle = true;
{
fontStyle |= FontStyle.Bold;
hasStyle = true;
}
bool italicAvailable = fontFamily.IsStyleAvailable(FontStyle.Italic);
if (fontItalic && italicAvailable)
{
fontStyle |= FontStyle.Italic;
hasStyle = true;
}
if (!hasStyle)
{
bool regularAvailable = fontFamily.IsStyleAvailable(FontStyle.Regular);
if (regularAvailable)
{
fontStyle = FontStyle.Regular;
}
else
{
if (boldAvailable)
{
fontStyle = FontStyle.Bold;
}
else if (italicAvailable)
{
fontStyle = FontStyle.Italic;
}
}
}
return new Font(fontFamily, fontSize, fontStyle, GraphicsUnit.Pixel);
} }
bool italicAvailable = fontFamily.IsStyleAvailable(FontStyle.Italic);
if (fontItalic && italicAvailable)
{
fontStyle |= FontStyle.Italic;
hasStyle = true;
}
if (!hasStyle)
{
bool regularAvailable = fontFamily.IsStyleAvailable(FontStyle.Regular);
if (regularAvailable)
{
fontStyle = FontStyle.Regular;
}
else
{
if (boldAvailable)
{
fontStyle = FontStyle.Bold;
}
else if (italicAvailable)
{
fontStyle = FontStyle.Italic;
}
}
}
return new Font(fontFamily, fontSize, fontStyle, GraphicsUnit.Pixel);
} }
/// <summary> /// <summary>
@ -592,12 +590,11 @@ namespace Greenshot.Drawing
{ {
shadowRect.Inflate(-textOffset, -textOffset); shadowRect.Inflate(-textOffset, -textOffset);
} }
using (Brush fontBrush = new SolidBrush(Color.FromArgb(alpha, 100, 100, 100)))
{ using Brush fontBrush = new SolidBrush(Color.FromArgb(alpha, 100, 100, 100));
graphics.DrawString(text, font, fontBrush, shadowRect, stringFormat); graphics.DrawString(text, font, fontBrush, shadowRect, stringFormat);
currentStep++; currentStep++;
alpha = alpha - basealpha / steps; alpha -= basealpha / steps;
}
} }
} }

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -211,17 +211,16 @@ namespace Greenshot {
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
private void LinkLabelClicked(object sender, LinkLabelLinkClickedEventArgs e) { private void LinkLabelClicked(object sender, LinkLabelLinkClickedEventArgs e)
LinkLabel linkLabel = sender as LinkLabel; {
if (linkLabel != null) { if (!(sender is LinkLabel linkLabel)) return;
try { try {
linkLabel.LinkVisited = true; linkLabel.LinkVisited = true;
Process.Start(linkLabel.Text); Process.Start(linkLabel.Text);
} catch (Exception) { } catch (Exception) {
MessageBox.Show(Language.GetFormattedString(LangKey.error_openlink, linkLabel.Text), Language.GetString(LangKey.error)); MessageBox.Show(Language.GetFormattedString(LangKey.error_openlink, linkLabel.Text), Language.GetString(LangKey.error));
} }
} }
}
/// <summary> /// <summary>
/// Called from the AnimatingForm, for every frame /// Called from the AnimatingForm, for every frame
@ -274,20 +273,19 @@ namespace Greenshot {
graphics.TranslateTransform(2, -2); graphics.TranslateTransform(2, -2);
graphics.RotateTransform(20); graphics.RotateTransform(20);
using (SolidBrush brush = new SolidBrush(_pixelColor)) { using SolidBrush brush = new SolidBrush(_pixelColor);
int index = 0; int index = 0;
// We asume there is nothing to animate in the next Animate loop // We asume there is nothing to animate in the next Animate loop
_hasAnimationsLeft = false; _hasAnimationsLeft = false;
// Pixels of the G // Pixels of the G
foreach (RectangleAnimator pixel in _pixels) { foreach (RectangleAnimator pixel in _pixels) {
brush.Color = _pixelColors[index++]; brush.Color = _pixelColors[index++];
graphics.FillEllipse(brush, pixel.Current); graphics.FillEllipse(brush, pixel.Current);
// If a pixel still has frames left, the hasAnimationsLeft will be true // If a pixel still has frames left, the hasAnimationsLeft will be true
_hasAnimationsLeft = _hasAnimationsLeft | pixel.HasNext; _hasAnimationsLeft |= pixel.HasNext;
pixel.Next(); pixel.Next();
} }
} }
}
pictureBox1.Invalidate(); pictureBox1.Invalidate();
} }

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -185,9 +185,7 @@ namespace Greenshot.Forms {
} }
} }
#region key handling private void CaptureFormKeyUp(object sender, KeyEventArgs e) {
private void CaptureFormKeyUp(object sender, KeyEventArgs e) {
switch(e.KeyCode) { switch(e.KeyCode) {
case Keys.ShiftKey: case Keys.ShiftKey:
_fixMode = FixMode.None; _fixMode = FixMode.None;
@ -306,10 +304,8 @@ namespace Greenshot.Forms {
break; break;
} }
} }
#endregion
#region events /// <summary>
/// <summary>
/// The mousedown handler of the capture form /// The mousedown handler of the capture form
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
@ -568,7 +564,7 @@ namespace Greenshot.Forms {
screenBounds.Location = WindowCapture.GetLocationRelativeToScreenBounds(screenBounds.Location); screenBounds.Location = WindowCapture.GetLocationRelativeToScreenBounds(screenBounds.Location);
int relativeZoomSize = Math.Min(screenBounds.Width, screenBounds.Height) / 5; int relativeZoomSize = Math.Min(screenBounds.Width, screenBounds.Height) / 5;
// Make sure the final size is a plural of 4, this makes it look better // Make sure the final size is a plural of 4, this makes it look better
relativeZoomSize = relativeZoomSize - relativeZoomSize % 4; relativeZoomSize -= relativeZoomSize % 4;
Size zoomSize = new Size(relativeZoomSize, relativeZoomSize); Size zoomSize = new Size(relativeZoomSize, relativeZoomSize);
Point zoomOffset = new Point(20, 20); Point zoomOffset = new Point(20, 20);
@ -742,40 +738,40 @@ namespace Greenshot.Forms {
Pen rulerPen = new Pen(Color.SeaGreen); Pen rulerPen = new Pen(Color.SeaGreen);
// horizontal ruler // horizontal ruler
if (fixedRect.Width > hSpace + 3) { if (fixedRect.Width > hSpace + 3)
using (GraphicsPath p = RoundedRectangle.Create2( {
fixedRect.X + (fixedRect.Width / 2 - hSpace / 2) + 3, using GraphicsPath p = RoundedRectangle.Create2(
fixedRect.Y - dist - 7, fixedRect.X + (fixedRect.Width / 2 - hSpace / 2) + 3,
measureWidth.Width - 3, fixedRect.Y - dist - 7,
measureWidth.Height, measureWidth.Width - 3,
3)) { measureWidth.Height,
graphics.FillPath(bgBrush, p); 3);
graphics.DrawPath(rulerPen, p); graphics.FillPath(bgBrush, p);
graphics.DrawString(captureWidth, rulerFont, rulerPen.Brush, fixedRect.X + (fixedRect.Width / 2 - hSpace / 2) + 3, fixedRect.Y - dist - 7); graphics.DrawPath(rulerPen, p);
graphics.DrawLine(rulerPen, fixedRect.X, fixedRect.Y - dist, fixedRect.X + (fixedRect.Width / 2 - hSpace / 2), fixedRect.Y - dist); graphics.DrawString(captureWidth, rulerFont, rulerPen.Brush, fixedRect.X + (fixedRect.Width / 2 - hSpace / 2) + 3, fixedRect.Y - dist - 7);
graphics.DrawLine(rulerPen, fixedRect.X + fixedRect.Width / 2 + hSpace / 2, fixedRect.Y - dist, fixedRect.X + fixedRect.Width, fixedRect.Y - dist); graphics.DrawLine(rulerPen, fixedRect.X, fixedRect.Y - dist, fixedRect.X + (fixedRect.Width / 2 - hSpace / 2), fixedRect.Y - dist);
graphics.DrawLine(rulerPen, fixedRect.X, fixedRect.Y - dist - 3, fixedRect.X, fixedRect.Y - dist + 3); graphics.DrawLine(rulerPen, fixedRect.X + fixedRect.Width / 2 + hSpace / 2, fixedRect.Y - dist, fixedRect.X + fixedRect.Width, fixedRect.Y - dist);
graphics.DrawLine(rulerPen, fixedRect.X + fixedRect.Width, fixedRect.Y - dist - 3, fixedRect.X + fixedRect.Width, fixedRect.Y - dist + 3); graphics.DrawLine(rulerPen, fixedRect.X, fixedRect.Y - dist - 3, fixedRect.X, fixedRect.Y - dist + 3);
} graphics.DrawLine(rulerPen, fixedRect.X + fixedRect.Width, fixedRect.Y - dist - 3, fixedRect.X + fixedRect.Width, fixedRect.Y - dist + 3);
} }
// vertical ruler // vertical ruler
if (fixedRect.Height > vSpace + 3) { if (fixedRect.Height > vSpace + 3)
using (GraphicsPath p = RoundedRectangle.Create2( {
fixedRect.X - measureHeight.Width + 1, using GraphicsPath p = RoundedRectangle.Create2(
fixedRect.Y + (fixedRect.Height / 2 - vSpace / 2) + 2, fixedRect.X - measureHeight.Width + 1,
measureHeight.Width - 3, fixedRect.Y + (fixedRect.Height / 2 - vSpace / 2) + 2,
measureHeight.Height - 1, measureHeight.Width - 3,
3)) { measureHeight.Height - 1,
graphics.FillPath(bgBrush, p); 3);
graphics.DrawPath(rulerPen, p); graphics.FillPath(bgBrush, p);
graphics.DrawString(captureHeight, rulerFont, rulerPen.Brush, fixedRect.X - measureHeight.Width + 1, fixedRect.Y + (fixedRect.Height / 2 - vSpace / 2) + 2); graphics.DrawPath(rulerPen, p);
graphics.DrawLine(rulerPen, fixedRect.X - dist, fixedRect.Y, fixedRect.X - dist, fixedRect.Y + (fixedRect.Height / 2 - vSpace / 2)); graphics.DrawString(captureHeight, rulerFont, rulerPen.Brush, fixedRect.X - measureHeight.Width + 1, fixedRect.Y + (fixedRect.Height / 2 - vSpace / 2) + 2);
graphics.DrawLine(rulerPen, fixedRect.X - dist, fixedRect.Y + fixedRect.Height / 2 + vSpace / 2, fixedRect.X - dist, fixedRect.Y + fixedRect.Height); graphics.DrawLine(rulerPen, fixedRect.X - dist, fixedRect.Y, fixedRect.X - dist, fixedRect.Y + (fixedRect.Height / 2 - vSpace / 2));
graphics.DrawLine(rulerPen, fixedRect.X - dist - 3, fixedRect.Y, fixedRect.X - dist + 3, fixedRect.Y); graphics.DrawLine(rulerPen, fixedRect.X - dist, fixedRect.Y + fixedRect.Height / 2 + vSpace / 2, fixedRect.X - dist, fixedRect.Y + fixedRect.Height);
graphics.DrawLine(rulerPen, fixedRect.X - dist - 3, fixedRect.Y + fixedRect.Height, fixedRect.X - dist + 3, fixedRect.Y + fixedRect.Height); graphics.DrawLine(rulerPen, fixedRect.X - dist - 3, fixedRect.Y, fixedRect.X - dist + 3, fixedRect.Y);
} graphics.DrawLine(rulerPen, fixedRect.X - dist - 3, fixedRect.Y + fixedRect.Height, fixedRect.X - dist + 3, fixedRect.Y + fixedRect.Height);
} }
rulerPen.Dispose(); rulerPen.Dispose();
bgBrush.Dispose(); bgBrush.Dispose();
@ -783,43 +779,41 @@ namespace Greenshot.Forms {
// Display size of selected rectangle // Display size of selected rectangle
// Prepare the font and text. // Prepare the font and text.
using (Font sizeFont = new Font( FontFamily.GenericSansSerif, 12 )) { using Font sizeFont = new Font( FontFamily.GenericSansSerif, 12 );
// When capturing a Region we need to add 1 to the height/width for correction // When capturing a Region we need to add 1 to the height/width for correction
string sizeText; string sizeText;
if (_captureMode == CaptureMode.Region) { if (_captureMode == CaptureMode.Region) {
// correct the GUI width to real width for the shown size // correct the GUI width to real width for the shown size
sizeText = _captureRect.Width + 1 + " x " + (_captureRect.Height + 1); sizeText = _captureRect.Width + 1 + " x " + (_captureRect.Height + 1);
} else { } else {
sizeText = _captureRect.Width + " x " + _captureRect.Height; sizeText = _captureRect.Width + " x " + _captureRect.Height;
} }
// Calculate the scaled font size. // Calculate the scaled font size.
SizeF extent = graphics.MeasureString( sizeText, sizeFont ); SizeF extent = graphics.MeasureString( sizeText, sizeFont );
float hRatio = _captureRect.Height / (extent.Height * 2); float hRatio = _captureRect.Height / (extent.Height * 2);
float wRatio = _captureRect.Width / (extent.Width * 2); float wRatio = _captureRect.Width / (extent.Width * 2);
float ratio = hRatio < wRatio ? hRatio : wRatio; float ratio = hRatio < wRatio ? hRatio : wRatio;
float newSize = sizeFont.Size * ratio; float newSize = sizeFont.Size * ratio;
if ( newSize >= 4 ) { if ( newSize >= 4 ) {
// Only show if 4pt or larger. // Only show if 4pt or larger.
if (newSize > 20) { if (newSize > 20) {
newSize = 20; newSize = 20;
} }
// Draw the size. // Draw the size.
using (Font newSizeFont = new Font(FontFamily.GenericSansSerif, newSize, FontStyle.Bold)) { using Font newSizeFont = new Font(FontFamily.GenericSansSerif, newSize, FontStyle.Bold);
PointF sizeLocation = new PointF(fixedRect.X + _captureRect.Width / 2 - extent.Width / 2, fixedRect.Y + _captureRect.Height / 2 - newSizeFont.GetHeight() / 2); PointF sizeLocation = new PointF(fixedRect.X + _captureRect.Width / 2 - extent.Width / 2, fixedRect.Y + _captureRect.Height / 2 - newSizeFont.GetHeight() / 2);
graphics.DrawString(sizeText, newSizeFont, Brushes.LightSeaGreen, sizeLocation); graphics.DrawString(sizeText, newSizeFont, Brushes.LightSeaGreen, sizeLocation);
if (_showDebugInfo && _selectedCaptureWindow != null) if (_showDebugInfo && _selectedCaptureWindow != null)
{ {
string title = $"#{_selectedCaptureWindow.Handle.ToInt64():X} - {(_selectedCaptureWindow.Text.Length > 0 ? _selectedCaptureWindow.Text : _selectedCaptureWindow.Process.ProcessName)}"; string title = $"#{_selectedCaptureWindow.Handle.ToInt64():X} - {(_selectedCaptureWindow.Text.Length > 0 ? _selectedCaptureWindow.Text : _selectedCaptureWindow.Process.ProcessName)}";
PointF debugLocation = new PointF(fixedRect.X, fixedRect.Y); PointF debugLocation = new PointF(fixedRect.X, fixedRect.Y);
graphics.DrawString(title, sizeFont, Brushes.DarkOrange, debugLocation); graphics.DrawString(title, sizeFont, Brushes.DarkOrange, debugLocation);
} }
} }
} } else {
}
} else {
if (!IsTerminalServerSession) { if (!IsTerminalServerSession) {
using (Pen pen = new Pen(Color.LightSeaGreen)) { using (Pen pen = new Pen(Color.LightSeaGreen)) {
pen.DashStyle = DashStyle.Dot; pen.DashStyle = DashStyle.Dot;
@ -829,20 +823,18 @@ namespace Greenshot.Forms {
} }
string xy = _cursorPos.X + " x " + _cursorPos.Y; string xy = _cursorPos.X + " x " + _cursorPos.Y;
using (Font f = new Font(FontFamily.GenericSansSerif, 8)) { using Font f = new Font(FontFamily.GenericSansSerif, 8);
Size xySize = TextRenderer.MeasureText(xy, f); Size xySize = TextRenderer.MeasureText(xy, f);
using (GraphicsPath gp = RoundedRectangle.Create2(_cursorPos.X + 5, _cursorPos.Y + 5, xySize.Width - 3, xySize.Height, 3)) { using GraphicsPath gp = RoundedRectangle.Create2(_cursorPos.X + 5, _cursorPos.Y + 5, xySize.Width - 3, xySize.Height, 3);
using (Brush bgBrush = new SolidBrush(Color.FromArgb(200, 217, 240, 227))) { using (Brush bgBrush = new SolidBrush(Color.FromArgb(200, 217, 240, 227))) {
graphics.FillPath(bgBrush, gp); graphics.FillPath(bgBrush, gp);
} }
using (Pen pen = new Pen(Color.SeaGreen)) { using (Pen pen = new Pen(Color.SeaGreen)) {
graphics.DrawPath(pen, gp); graphics.DrawPath(pen, gp);
Point coordinatePosition = new Point(_cursorPos.X + 5, _cursorPos.Y + 5); Point coordinatePosition = new Point(_cursorPos.X + 5, _cursorPos.Y + 5);
graphics.DrawString(xy, f, pen.Brush, coordinatePosition); graphics.DrawString(xy, f, pen.Brush, coordinatePosition);
} }
} }
}
}
} }
// Zoom // Zoom
@ -857,6 +849,5 @@ namespace Greenshot.Forms {
DrawZoom(graphics, sourceRectangle, destinationRectangle); DrawZoom(graphics, sourceRectangle, destinationRectangle);
} }
} }
#endregion }
}
} }

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -35,7 +35,7 @@ namespace Greenshot {
/// </summary> /// </summary>
public partial class ColorDialog : BaseForm { public partial class ColorDialog : BaseForm {
private static readonly EditorConfiguration EditorConfig = IniConfig.GetIniSection<EditorConfiguration>(); private static readonly EditorConfiguration EditorConfig = IniConfig.GetIniSection<EditorConfiguration>();
private static ColorDialog _instance;
public ColorDialog() { public ColorDialog() {
SuspendLayout(); SuspendLayout();
InitializeComponent(); InitializeComponent();
@ -44,7 +44,10 @@ namespace Greenshot {
CreateLastUsedColorButtonRow(5, 190, 15, 15); CreateLastUsedColorButtonRow(5, 190, 15, 15);
ResumeLayout(); ResumeLayout();
UpdateRecentColorsButtonRow(); UpdateRecentColorsButtonRow();
} _instance = this;
}
public static ColorDialog GetInstance() => _instance;
private readonly List<Button> _colorButtons = new List<Button>(); private readonly List<Button> _colorButtons = new List<Button>();
private readonly List<Button> _recentColorButtons = new List<Button>(); private readonly List<Button> _recentColorButtons = new List<Button>();
@ -56,8 +59,9 @@ namespace Greenshot {
set { PreviewColor(value, this); } set { PreviewColor(value, this); }
} }
#region user interface generation public IList<Color> RecentColors => EditorConfig.RecentColors;
private void CreateColorPalette(int x, int y, int w, int h) {
private void CreateColorPalette(int x, int y, int w, int h) {
CreateColorButtonColumn(255, 0, 0, x, y, w, h, 11); CreateColorButtonColumn(255, 0, 0, x, y, w, h, 11);
x += w; x += w;
CreateColorButtonColumn(255, 255 / 2, 0, x, y, w, h, 11); CreateColorButtonColumn(255, 255 / 2, 0, x, y, w, h, 11);
@ -123,10 +127,8 @@ namespace Greenshot {
} }
Controls.AddRange(_recentColorButtons.ToArray()); Controls.AddRange(_recentColorButtons.ToArray());
} }
#endregion
#region update user interface private void UpdateRecentColorsButtonRow() {
private void UpdateRecentColorsButtonRow() {
for (int i = 0; i < EditorConfig.RecentColors.Count && i < 12; i++) { for (int i = 0; i < EditorConfig.RecentColors.Count && i < 12; i++) {
_recentColorButtons[i].BackColor = EditorConfig.RecentColors[i]; _recentColorButtons[i].BackColor = EditorConfig.RecentColors[i];
_recentColorButtons[i].Enabled = true; _recentColorButtons[i].Enabled = true;
@ -156,19 +158,15 @@ namespace Greenshot {
} }
UpdateRecentColorsButtonRow(); UpdateRecentColorsButtonRow();
} }
#endregion
#region textbox event handlers private void TextBoxHexadecimalTextChanged(object sender, EventArgs e) {
private void TextBoxHexadecimalTextChanged(object sender, EventArgs e) {
if (_updateInProgress) { if (_updateInProgress) {
return; return;
} }
TextBox textBox = (TextBox)sender; TextBox textBox = (TextBox)sender;
string text = textBox.Text.Replace("#", ""); string text = textBox.Text.Replace("#", "");
int i; Color c;
Color c; if (int.TryParse(text, NumberStyles.AllowHexSpecifier, Thread.CurrentThread.CurrentCulture, out var i)) {
if (int.TryParse(text, NumberStyles.AllowHexSpecifier, Thread.CurrentThread.CurrentCulture, out i)) {
c = Color.FromArgb(i); c = Color.FromArgb(i);
} else { } else {
try try
@ -200,11 +198,8 @@ namespace Greenshot {
AddToRecentColors(colorPanel.BackColor); AddToRecentColors(colorPanel.BackColor);
} }
} }
#endregion
#region button event handlers private void ColorButtonClick(object sender, EventArgs e) {
private void ColorButtonClick(object sender, EventArgs e) {
Button b = (Button)sender; Button b = (Button)sender;
PreviewColor(b.BackColor, b); PreviewColor(b.BackColor, b);
} }
@ -218,12 +213,9 @@ namespace Greenshot {
Hide(); Hide();
AddToRecentColors(colorPanel.BackColor); AddToRecentColors(colorPanel.BackColor);
} }
#endregion
#region helper functions private int GetColorPartIntFromString(string s) {
private int GetColorPartIntFromString(string s) { int.TryParse(s, out var ret);
int ret;
int.TryParse(s, out ret);
if (ret < 0) if (ret < 0)
{ {
ret = 0; ret = 0;
@ -235,9 +227,7 @@ namespace Greenshot {
return ret; return ret;
} }
#endregion private void PipetteUsed(object sender, PipetteUsedArgs e) {
private void PipetteUsed(object sender, PipetteUsedArgs e) {
Color = e.Color; Color = e.Color;
} }
} }

View file

@ -112,12 +112,12 @@
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="pipette.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="pipette.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8

View file

@ -1,50 +1,73 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/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;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.Windows.Forms; using System.Windows.Forms;
using System.Diagnostics; using System.Diagnostics;
namespace GreenShot namespace Greenshot
{ {
public delegate void ColorPickerEventHandler(object o, ColorPickerEventArgs e); public delegate void ColorPickerEventHandler(object o, ColorPickerEventArgs e);
public class ColorPickerToolStripButton : System.Windows.Forms.ToolStripButton public class ColorPickerToolStripButton : ToolStripButton
{ {
private Color color; private Color _color;
public Point Offset = new Point(0,0); public Point Offset = new Point(0,0);
public event ColorPickerEventHandler ColorPicked; public event ColorPickerEventHandler ColorPicked;
private ColorDialog cd; private readonly Greenshot.ColorDialog _cd;
public ColorPickerToolStripButton() public ColorPickerToolStripButton()
{ {
cd = ColorDialog.GetInstance(); _cd = Greenshot.ColorDialog.GetInstance();
this.Click += new System.EventHandler(this.ToolStripButton1Click); Click += ToolStripButton1Click;
} }
public Color Color { public Color Color {
set {color = value;this.Invalidate();} set {_color = value;Invalidate();}
get {return color;} get {return _color;}
} }
protected override void OnPaint (PaintEventArgs e) { protected override void OnPaint (PaintEventArgs e) {
base.OnPaint(e); base.OnPaint(e);
if(color != null) { if(_color != null) {
// replace transparent color with selected color // replace transparent color with selected color
Graphics g = e.Graphics; Graphics g = e.Graphics;
//Graphics g = Graphics.FromImage(Image); //Graphics g = Graphics.FromImage(Image);
ColorMap[] colorMap = new ColorMap[1]; ColorMap[] colorMap = new ColorMap[1];
colorMap[0] = new ColorMap(); colorMap[0] = new ColorMap
colorMap[0].OldColor = Color.Magenta;//this.ImageTransparentColor; {
colorMap[0].NewColor = color; OldColor = Color.Magenta,//this.ImageTransparentColor;
ImageAttributes attr = new ImageAttributes(); NewColor = _color
};
ImageAttributes attr = new ImageAttributes();
attr.SetRemapTable(colorMap); attr.SetRemapTable(colorMap);
Rectangle rect = new Rectangle(0, 0, Image.Width, Image.Height); Rectangle rect = new Rectangle(0, 0, Image.Width, Image.Height);
// todo find a way to retrieve transparency offset automatically // todo find a way to retrieve transparency offset automatically
// for now, we use the public variable Offset to define this manually // for now, we use the public variable Offset to define this manually
rect.Offset(Offset.X,Offset.Y); rect.Offset(Offset.X,Offset.Y);
//Image. //Image.
Debug.WriteLine("paint!"+this.Text+": "+color); Debug.WriteLine("paint!"+Text+": "+_color);
//ssif(color.Equals(Color.Transparent)) ((Bitmap)Image).MakeTransparent(Color.Magenta); //ssif(color.Equals(Color.Transparent)) ((Bitmap)Image).MakeTransparent(Color.Magenta);
g.DrawImage(Image, rect, 0, 0, rect.Width, rect.Height, GraphicsUnit.Pixel, attr); g.DrawImage(Image, rect, 0, 0, rect.Width, rect.Height, GraphicsUnit.Pixel, attr);
//this.Image.In //this.Image.In
@ -52,22 +75,18 @@ namespace GreenShot
} }
} }
void ToolStripButton1Click(object sender, System.EventArgs e) void ToolStripButton1Click(object sender, EventArgs e)
{ {
cd.ShowDialog(this.Owner); _cd.ShowDialog(Owner);
Color = cd.Color; Color = _cd.Color;
if(ColorPicked != null) { ColorPicked?.Invoke(this, new ColorPickerEventArgs(Color));
ColorPicked(this, new ColorPickerEventArgs(Color, cd.RecentColors));
}
} }
} }
public class ColorPickerEventArgs : System.EventArgs { public class ColorPickerEventArgs : EventArgs {
public Color Color; public Color Color;
public Color[] RecentColors; public ColorPickerEventArgs(Color color) {
public ColorPickerEventArgs(Color color, Color[] recentColors) {
Color = color; Color = color;
RecentColors = recentColors;
} }
} }

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -162,7 +162,7 @@ namespace Greenshot {
_surface.MovingElementChanged += delegate { _surface.MovingElementChanged += delegate {
RefreshEditorControls(); RefreshEditorControls();
}; };
_surface.DrawingModeChanged += surface_DrawingModeChanged; _surface.DrawingModeChanged += Surface_DrawingModeChanged;
_surface.SurfaceSizeChanged += SurfaceSizeChanged; _surface.SurfaceSizeChanged += SurfaceSizeChanged;
_surface.SurfaceMessage += SurfaceMessageReceived; _surface.SurfaceMessage += SurfaceMessageReceived;
_surface.FieldAggregator.FieldChanged += FieldAggregatorFieldChanged; _surface.FieldAggregator.FieldChanged += FieldAggregatorFieldChanged;
@ -218,26 +218,26 @@ namespace Greenshot {
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
private void PropertiesToolStrip_Paint(object sender, PaintEventArgs e) { private void PropertiesToolStrip_Paint(object sender, PaintEventArgs e)
using (Pen cbBorderPen = new Pen(SystemColors.ActiveBorder)) { {
// Loop over all items in the propertiesToolStrip using Pen cbBorderPen = new Pen(SystemColors.ActiveBorder);
foreach (ToolStripItem item in propertiesToolStrip.Items) { // Loop over all items in the propertiesToolStrip
ToolStripComboBox cb = item as ToolStripComboBox; foreach (ToolStripItem item in propertiesToolStrip.Items) {
// Only ToolStripComboBox that are visible ToolStripComboBox cb = item as ToolStripComboBox;
if (cb == null || !cb.Visible) { // Only ToolStripComboBox that are visible
continue; if (cb == null || !cb.Visible) {
} continue;
// Calculate the rectangle }
if (cb.ComboBox != null) // Calculate the rectangle
{ if (cb.ComboBox != null)
Rectangle r = new Rectangle(cb.ComboBox.Location.X - 1, cb.ComboBox.Location.Y - 1, cb.ComboBox.Size.Width + 1, cb.ComboBox.Size.Height + 1); {
Rectangle r = new Rectangle(cb.ComboBox.Location.X - 1, cb.ComboBox.Location.Y - 1, cb.ComboBox.Size.Width + 1, cb.ComboBox.Size.Height + 1);
// Draw the rectangle // Draw the rectangle
e.Graphics.DrawRectangle(cbBorderPen, r); e.Graphics.DrawRectangle(cbBorderPen, r);
} }
} }
} }
}
/// <summary> /// <summary>
/// Get all the destinations and display them in the file menu and the buttons /// Get all the destinations and display them in the file menu and the buttons
@ -337,8 +337,7 @@ namespace Greenshot {
/// <param name="items"></param> /// <param name="items"></param>
private void ClearItems(ToolStripItemCollection items) { private void ClearItems(ToolStripItemCollection items) {
foreach(var item in items) { foreach(var item in items) {
ToolStripMenuItem menuItem = item as ToolStripMenuItem; if (item is ToolStripMenuItem menuItem && menuItem.ShortcutKeys != Keys.None) {
if (menuItem != null && menuItem.ShortcutKeys != Keys.None) {
menuItem.ShortcutKeys = Keys.None; menuItem.ShortcutKeys = Keys.None;
} }
} }
@ -440,7 +439,7 @@ namespace Greenshot {
Text = Path.GetFileName(fullpath) + " - " + Language.GetString(LangKey.editor_title); Text = Path.GetFileName(fullpath) + " - " + Language.GetString(LangKey.editor_title);
} }
private void surface_DrawingModeChanged(object source, SurfaceDrawingModeEventArgs eventArgs) { private void Surface_DrawingModeChanged(object source, SurfaceDrawingModeEventArgs eventArgs) {
switch (eventArgs.DrawingMode) { switch (eventArgs.DrawingMode) {
case DrawingModes.None: case DrawingModes.None:
SetButtonChecked(btnCursor); SetButtonChecked(btnCursor);
@ -481,9 +480,7 @@ namespace Greenshot {
} }
} }
#region plugin interfaces /**
/**
* Interfaces for plugins, see GreenshotInterface for more details! * Interfaces for plugins, see GreenshotInterface for more details!
*/ */
@ -500,11 +497,8 @@ namespace Greenshot {
public ToolStripMenuItem GetFileMenuItem() { public ToolStripMenuItem GetFileMenuItem() {
return fileStripMenuItem; return fileStripMenuItem;
} }
#endregion
#region filesystem options private void BtnSaveClick(object sender, EventArgs e) {
private void BtnSaveClick(object sender, EventArgs e) {
string destinationDesignation = FileDestination.DESIGNATION; string destinationDesignation = FileDestination.DESIGNATION;
if (_surface.LastSaveFullPath == null) { if (_surface.LastSaveFullPath == null) {
destinationDesignation = FileWithDialogDestination.DESIGNATION; destinationDesignation = FileWithDialogDestination.DESIGNATION;
@ -526,11 +520,8 @@ namespace Greenshot {
private void CloseToolStripMenuItemClick(object sender, EventArgs e) { private void CloseToolStripMenuItemClick(object sender, EventArgs e) {
Close(); Close();
} }
#endregion
#region drawing options private void BtnEllipseClick(object sender, EventArgs e) {
private void BtnEllipseClick(object sender, EventArgs e) {
_surface.DrawingMode = DrawingModes.Ellipse; _surface.DrawingMode = DrawingModes.Ellipse;
RefreshFieldControls(); RefreshFieldControls();
} }
@ -642,11 +633,8 @@ namespace Greenshot {
private void BtnDeleteClick(object sender, EventArgs e) { private void BtnDeleteClick(object sender, EventArgs e) {
RemoveObjectToolStripMenuItemClick(sender, e); RemoveObjectToolStripMenuItemClick(sender, e);
} }
#endregion
#region copy&paste options private void CutToolStripMenuItemClick(object sender, EventArgs e) {
private void CutToolStripMenuItemClick(object sender, EventArgs e) {
_surface.CutSelectedElements(); _surface.CutSelectedElements();
UpdateClipboardSurfaceDependencies(); UpdateClipboardSurfaceDependencies();
} }
@ -695,11 +683,8 @@ namespace Greenshot {
_surface.DuplicateSelectedElements(); _surface.DuplicateSelectedElements();
UpdateClipboardSurfaceDependencies(); UpdateClipboardSurfaceDependencies();
} }
#endregion
#region element properties private void UpOneLevelToolStripMenuItemClick(object sender, EventArgs e) {
private void UpOneLevelToolStripMenuItemClick(object sender, EventArgs e) {
_surface.PullElementsUp(); _surface.PullElementsUp();
} }
@ -716,11 +701,7 @@ namespace Greenshot {
} }
#endregion private void HelpToolStripMenuItem1Click(object sender, EventArgs e) {
#region help
private void HelpToolStripMenuItem1Click(object sender, EventArgs e) {
HelpFileLoader.LoadHelp(); HelpFileLoader.LoadHelp();
} }
@ -739,11 +720,8 @@ namespace Greenshot {
private void BtnHelpClick(object sender, EventArgs e) { private void BtnHelpClick(object sender, EventArgs e) {
HelpToolStripMenuItem1Click(sender, e); HelpToolStripMenuItem1Click(sender, e);
} }
#endregion
#region image editor event handlers private void ImageEditorFormActivated(object sender, EventArgs e) {
private void ImageEditorFormActivated(object sender, EventArgs e) {
UpdateClipboardSurfaceDependencies(); UpdateClipboardSurfaceDependencies();
UpdateUndoRedoSurfaceDependencies(); UpdateUndoRedoSurfaceDependencies();
} }
@ -882,10 +860,8 @@ namespace Greenshot {
private void PanelMouseWheel(object sender, MouseEventArgs e) { private void PanelMouseWheel(object sender, MouseEventArgs e) {
panel1.Focus(); panel1.Focus();
} }
#endregion
#region key handling protected override bool ProcessKeyPreview(ref Message msg) {
protected override bool ProcessKeyPreview(ref Message msg) {
// disable default key handling if surface has requested a lock // disable default key handling if surface has requested a lock
if (!_surface.KeysLocked) { if (!_surface.KeysLocked) {
return base.ProcessKeyPreview(ref msg); return base.ProcessKeyPreview(ref msg);
@ -919,11 +895,8 @@ namespace Greenshot {
} }
return false; return false;
} }
#endregion
#region helpers private void UpdateUndoRedoSurfaceDependencies() {
private void UpdateUndoRedoSurfaceDependencies() {
if (_surface == null) { if (_surface == null) {
return; return;
} }
@ -980,19 +953,12 @@ namespace Greenshot {
pasteToolStripMenuItem.Enabled = hasClipboard && !_controlsDisabledDueToConfirmable; pasteToolStripMenuItem.Enabled = hasClipboard && !_controlsDisabledDueToConfirmable;
} }
#endregion private void UpdateStatusLabel(string text, ContextMenuStrip contextMenu = null) {
#region status label handling
private void UpdateStatusLabel(string text, ContextMenuStrip contextMenu = null) {
statusLabel.Text = text; statusLabel.Text = text;
statusStrip1.ContextMenuStrip = contextMenu; statusStrip1.ContextMenuStrip = contextMenu;
} }
private void ClearStatusLabel() { private void StatusLabelClicked(object sender, MouseEventArgs e) {
UpdateStatusLabel(null);
}
private void StatusLabelClicked(object sender, MouseEventArgs e) {
ToolStrip ss = (StatusStrip)((ToolStripStatusLabel)sender).Owner; ToolStrip ss = (StatusStrip)((ToolStripStatusLabel)sender).Owner;
ss.ContextMenuStrip?.Show(ss, e.X, e.Y); ss.ContextMenuStrip?.Show(ss, e.X, e.Y);
} }
@ -1004,9 +970,8 @@ namespace Greenshot {
private void OpenDirectoryMenuItemClick(object sender, EventArgs e) { private void OpenDirectoryMenuItemClick(object sender, EventArgs e) {
ExplorerHelper.OpenInExplorer(_surface.LastSaveFullPath); ExplorerHelper.OpenInExplorer(_surface.LastSaveFullPath);
} }
#endregion
private void BindFieldControls() { private void BindFieldControls() {
// TODO: This is actually risky, if there are no references than the objects may be garbage collected // TODO: This is actually risky, if there are no references than the objects may be garbage collected
new BidirectionalBinding(btnFillColor, "SelectedColor", _surface.FieldAggregator.GetField(FieldType.FILL_COLOR), "Value", NotNullValidator.GetInstance()); new BidirectionalBinding(btnFillColor, "SelectedColor", _surface.FieldAggregator.GetField(FieldType.FILL_COLOR), "Value", NotNullValidator.GetInstance());
new BidirectionalBinding(btnLineColor, "SelectedColor", _surface.FieldAggregator.GetField(FieldType.LINE_COLOR), "Value", NotNullValidator.GetInstance()); new BidirectionalBinding(btnLineColor, "SelectedColor", _surface.FieldAggregator.GetField(FieldType.LINE_COLOR), "Value", NotNullValidator.GetInstance());
@ -1221,11 +1186,11 @@ namespace Greenshot {
FileName = FilenameHelper.GetFilenameWithoutExtensionFromPattern(coreConfiguration.OutputFileFilenamePattern, _surface.CaptureDetails) FileName = FilenameHelper.GetFilenameWithoutExtensionFromPattern(coreConfiguration.OutputFileFilenamePattern, _surface.CaptureDetails)
}; };
DialogResult dialogResult = saveFileDialog.ShowDialog(); DialogResult dialogResult = saveFileDialog.ShowDialog();
if(dialogResult.Equals(DialogResult.OK)) { if(dialogResult.Equals(DialogResult.OK))
using (Stream streamWrite = File.OpenWrite(saveFileDialog.FileName)) { {
_surface.SaveElementsToStream(streamWrite); using Stream streamWrite = File.OpenWrite(saveFileDialog.FileName);
} _surface.SaveElementsToStream(streamWrite);
} }
} }
private void LoadElementsToolStripMenuItemClick(object sender, EventArgs e) { private void LoadElementsToolStripMenuItemClick(object sender, EventArgs e) {
@ -1243,8 +1208,7 @@ namespace Greenshot {
private void DestinationToolStripMenuItemClick(object sender, EventArgs e) { private void DestinationToolStripMenuItemClick(object sender, EventArgs e) {
IDestination clickedDestination = null; IDestination clickedDestination = null;
var control = sender as Control; if (sender is Control control) {
if (control != null) {
Control clickedControl = control; Control clickedControl = control;
if (clickedControl.ContextMenuStrip != null) { if (clickedControl.ContextMenuStrip != null) {
clickedControl.ContextMenuStrip.Show(Cursor.Position); clickedControl.ContextMenuStrip.Show(Cursor.Position);
@ -1254,8 +1218,7 @@ namespace Greenshot {
} }
else else
{ {
var item = sender as ToolStripMenuItem; if (sender is ToolStripMenuItem item) {
if (item != null) {
ToolStripMenuItem clickedMenuItem = item; ToolStripMenuItem clickedMenuItem = item;
clickedDestination = (IDestination)clickedMenuItem.Tag; clickedDestination = (IDestination)clickedMenuItem.Tag;
} }

View file

@ -112,12 +112,12 @@
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="btnCursor.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="btnCursor.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
@ -940,90 +940,90 @@
</value> </value>
</data> </data>
<data name="btnStepLabel01.Image" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="btnStepLabel01.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\notification-counter-01.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icons\notification-counter-01.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="btnStepLabel02.Image" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="btnStepLabel02.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\notification-counter-02.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icons\notification-counter-02.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="btnStepLabel03.Image" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="btnStepLabel03.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\notification-counter-03.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icons\notification-counter-03.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="btnStepLabel04.Image" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="btnStepLabel04.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\notification-counter-04.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icons\notification-counter-04.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="btnStepLabel05.Image" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="btnStepLabel05.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\notification-counter-05.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icons\notification-counter-05.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="btnStepLabel06.Image" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="btnStepLabel06.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\notification-counter-06.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icons\notification-counter-06.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="btnStepLabel07.Image" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="btnStepLabel07.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\notification-counter-07.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icons\notification-counter-07.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="btnStepLabel08.Image" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="btnStepLabel08.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\notification-counter-08.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icons\notification-counter-08.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="btnStepLabel09.Image" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="btnStepLabel09.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\notification-counter-09.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icons\notification-counter-09.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="btnStepLabel10.Image" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="btnStepLabel10.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\notification-counter-10.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icons\notification-counter-10.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="btnStepLabel11.Image" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="btnStepLabel11.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\notification-counter-11.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icons\notification-counter-11.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="btnStepLabel12.Image" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="btnStepLabel12.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\notification-counter-12.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icons\notification-counter-12.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="btnStepLabel13.Image" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="btnStepLabel13.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\notification-counter-13.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icons\notification-counter-13.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="btnStepLabel14.Image" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="btnStepLabel14.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\notification-counter-14.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icons\notification-counter-14.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="btnStepLabel15.Image" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="btnStepLabel15.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\notification-counter-15.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icons\notification-counter-15.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="btnStepLabel16.Image" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="btnStepLabel16.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\notification-counter-16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icons\notification-counter-16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="btnStepLabel17.Image" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="btnStepLabel17.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\notification-counter-17.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icons\notification-counter-17.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="btnStepLabel18.Image" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="btnStepLabel18.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\notification-counter-18.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icons\notification-counter-18.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="btnStepLabel19.Image" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="btnStepLabel19.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\notification-counter-19.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icons\notification-counter-19.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="btnStepLabel20+.Image" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="btnStepLabel20+.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\notification-counter-20-plus.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icons\notification-counter-20-plus.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="btnStepLabel20.Image" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="btnStepLabel20.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\notification-counter-20.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icons\notification-counter-20.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="btnSpeechBubble.Image" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="btnSpeechBubble.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\balloon.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icons\balloon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="btnResize.Image" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="btnResize.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\resize.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\icons\resize.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>551, 17</value> <value>551, 17</value>
</metadata> </metadata>
<metadata name="toolStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="toolStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 54</value> <value>17, 54</value>
</metadata> </metadata>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>662, 17</value> <value>662, 17</value>
</metadata> </metadata>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>452, 17</value> <value>452, 17</value>
</metadata> </metadata>
<metadata name="propertiesToolStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="propertiesToolStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>116, 54</value> <value>116, 54</value>
</metadata> </metadata>
<metadata name="fileSavedStatusContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="fileSavedStatusContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
</root> </root>

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -30,7 +30,7 @@ using System.Reflection;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Forms.Integration;
using Greenshot.Configuration; using Greenshot.Configuration;
using Greenshot.Experimental; using Greenshot.Experimental;
using Greenshot.Forms; using Greenshot.Forms;
@ -219,27 +219,30 @@ namespace Greenshot {
} }
greenshotProcess.Dispose(); greenshotProcess.Dispose();
} }
if (!matchedThisProcess) { if (!matchedThisProcess)
using (Process currentProcess = Process.GetCurrentProcess()) { {
instanceInfo.Append(index + ": ").AppendLine(Kernel32.GetProcessPath(currentProcess.Id)); using Process currentProcess = Process.GetCurrentProcess();
} instanceInfo.Append(index + ": ").AppendLine(Kernel32.GetProcessPath(currentProcess.Id));
} }
// A dirty fix to make sure the messagebox is visible as a Greenshot window on the taskbar // A dirty fix to make sure the message box is visible as a Greenshot window on the taskbar
using (Form dummyForm = new Form()) { using Form dummyForm = new Form
dummyForm.Icon = GreenshotResources.getGreenshotIcon(); {
dummyForm.ShowInTaskbar = true; Icon = GreenshotResources.getGreenshotIcon(),
dummyForm.FormBorderStyle = FormBorderStyle.None; ShowInTaskbar = true,
dummyForm.Location = new Point(int.MinValue, int.MinValue); FormBorderStyle = FormBorderStyle.None,
dummyForm.Load += delegate { dummyForm.Size = Size.Empty; }; Location = new Point(int.MinValue, int.MinValue)
dummyForm.Show(); };
MessageBox.Show(dummyForm, Language.GetString(LangKey.error_multipleinstances) + "\r\n" + instanceInfo, Language.GetString(LangKey.error), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); dummyForm.Load += delegate { dummyForm.Size = Size.Empty; };
} dummyForm.Show();
} MessageBox.Show(dummyForm, Language.GetString(LangKey.error_multipleinstances) + "\r\n" + instanceInfo, Language.GetString(LangKey.error), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
FreeMutex(); FreeMutex();
Application.Exit(); Application.Exit();
return; return;
} }
// Make sure we can use forms
WindowsFormsHost.EnableWindowsFormsInterop();
// BUG-1809: Add message filter, to filter out all the InputLangChanged messages which go to a target control with a handle > 32 bit. // BUG-1809: Add message filter, to filter out all the InputLangChanged messages which go to a target control with a handle > 32 bit.
Application.AddMessageFilter(new WmInputLangChangeRequestFilter()); Application.AddMessageFilter(new WmInputLangChangeRequestFilter());
@ -489,9 +492,7 @@ namespace Greenshot {
base.WndProc(ref m); base.WndProc(ref m);
} }
#region hotkeys /// <summary>
/// <summary>
/// Helper method to cleanly register a hotkey /// Helper method to cleanly register a hotkey
/// </summary> /// </summary>
/// <param name="failedKeys"></param> /// <param name="failedKeys"></param>
@ -653,9 +654,8 @@ namespace Greenshot {
} }
return success; return success;
} }
#endregion
public void UpdateUi() { public void UpdateUi() {
// As the form is never loaded, call ApplyLanguage ourselves // As the form is never loaded, call ApplyLanguage ourselves
ApplyLanguage(); ApplyLanguage();
@ -668,9 +668,7 @@ namespace Greenshot {
} }
#region mainform events private void MainFormFormClosing(object sender, FormClosingEventArgs e) {
private void MainFormFormClosing(object sender, FormClosingEventArgs e) {
LOG.DebugFormat("Mainform closing, reason: {0}", e.CloseReason); LOG.DebugFormat("Mainform closing, reason: {0}", e.CloseReason);
_instance = null; _instance = null;
Exit(); Exit();
@ -680,11 +678,8 @@ namespace Greenshot {
Hide(); Hide();
ShowInTaskbar = false; ShowInTaskbar = false;
} }
#endregion
#region key handlers private void CaptureRegion() {
private void CaptureRegion() {
CaptureHelper.CaptureRegion(true); CaptureHelper.CaptureRegion(true);
} }
@ -721,12 +716,9 @@ namespace Greenshot {
CaptureHelper.CaptureWindow(true); CaptureHelper.CaptureWindow(true);
} }
} }
#endregion
#region contextmenu private void ContextMenuOpening(object sender, CancelEventArgs e) {
private void ContextMenuOpening(object sender, CancelEventArgs e) {
contextmenu_captureclipboard.Enabled = ClipboardHelper.ContainsImage(); contextmenu_captureclipboard.Enabled = ClipboardHelper.ContainsImage();
contextmenu_capturelastregion.Enabled = coreConfiguration.LastCapturedRegion != Rectangle.Empty; contextmenu_capturelastregion.Enabled = coreConfiguration.LastCapturedRegion != Rectangle.Empty;
@ -880,15 +872,13 @@ namespace Greenshot {
} }
private void ShowThumbnailOnEnter(object sender, EventArgs e) { private void ShowThumbnailOnEnter(object sender, EventArgs e) {
ToolStripMenuItem captureWindowItem = sender as ToolStripMenuItem; if (!(sender is ToolStripMenuItem captureWindowItem)) return;
if (captureWindowItem != null) { WindowDetails window = captureWindowItem.Tag as WindowDetails;
WindowDetails window = captureWindowItem.Tag as WindowDetails; if (_thumbnailForm == null) {
if (_thumbnailForm == null) { _thumbnailForm = new ThumbnailForm();
_thumbnailForm = new ThumbnailForm(); }
} _thumbnailForm.ShowThumbnail(window, captureWindowItem.GetCurrentParent().TopLevelControl);
_thumbnailForm.ShowThumbnail(window, captureWindowItem.GetCurrentParent().TopLevelControl); }
}
}
private void HideThumbnailOnLeave(object sender, EventArgs e) private void HideThumbnailOnLeave(object sender, EventArgs e)
{ {
@ -1083,8 +1073,7 @@ namespace Greenshot {
} }
private void CheckStateChangedHandler(object sender, EventArgs e) { private void CheckStateChangedHandler(object sender, EventArgs e) {
ToolStripMenuSelectListItem captureMouseItem = sender as ToolStripMenuSelectListItem; if (sender is ToolStripMenuSelectListItem captureMouseItem) {
if (captureMouseItem != null) {
_conf.CaptureMousepointer = captureMouseItem.Checked; _conf.CaptureMousepointer = captureMouseItem.Checked;
} }
} }
@ -1191,8 +1180,7 @@ namespace Greenshot {
private void QuickSettingBoolItemChanged(object sender, EventArgs e) { private void QuickSettingBoolItemChanged(object sender, EventArgs e) {
ToolStripMenuSelectListItem item = ((ItemCheckedChangedEventArgs)e).Item; ToolStripMenuSelectListItem item = ((ItemCheckedChangedEventArgs)e).Item;
IniValue iniValue = item.Data as IniValue; if (item.Data is IniValue iniValue) {
if (iniValue != null) {
iniValue.Value = item.Checked; iniValue.Value = item.Checked;
IniConfig.Save(); IniConfig.Save();
} }
@ -1228,9 +1216,8 @@ namespace Greenshot {
// Rebuild the quick settings menu with the new settings. // Rebuild the quick settings menu with the new settings.
InitializeQuickSettingsMenu(); InitializeQuickSettingsMenu();
} }
#endregion
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) {
Exception exceptionToLog = e.ExceptionObject as Exception; Exception exceptionToLog = e.ExceptionObject as Exception;
string exceptionText = EnvironmentInfo.BuildReport(exceptionToLog); string exceptionText = EnvironmentInfo.BuildReport(exceptionToLog);
LOG.Error("Exception caught in the UnhandledException handler."); LOG.Error("Exception caught in the UnhandledException handler.");

View file

@ -112,15 +112,15 @@
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="contextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="contextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>293, 17</value> <value>293, 17</value>
</metadata> </metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="contextmenu_capturearea.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="contextmenu_capturearea.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
@ -290,10 +290,10 @@
+SFiYP97gICHXEhM7AyNjTWERES8ohKJlsECgPwD74Vfj6xWOBYAAAAASUVORK5CYII= +SFiYP97gICHXEhM7AyNjTWERES8ohKJlsECgPwD74Vfj6xWOBYAAAAASUVORK5CYII=
</value> </value>
</data> </data>
<metadata name="notifyIcon.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="notifyIcon.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>193, 17</value> <value>193, 17</value>
</metadata> </metadata>
<metadata name="backgroundWorkerTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="backgroundWorkerTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
</root> </root>

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -85,16 +85,16 @@ namespace Greenshot.Forms {
/// </summary> /// </summary>
/// <param name="screenCoordinates">Point with the coordinates</param> /// <param name="screenCoordinates">Point with the coordinates</param>
/// <returns>Color at the specified screenCoordinates</returns> /// <returns>Color at the specified screenCoordinates</returns>
private static Color GetPixelColor(Point screenCoordinates) { private static Color GetPixelColor(Point screenCoordinates)
using (SafeWindowDcHandle screenDC = SafeWindowDcHandle.FromDesktop()) { {
try { using SafeWindowDcHandle screenDC = SafeWindowDcHandle.FromDesktop();
uint pixel = GDI32.GetPixel(screenDC, screenCoordinates.X, screenCoordinates.Y); try {
Color color = Color.FromArgb(255, (int)(pixel & 0xFF), (int)(pixel & 0xFF00) >> 8, (int)(pixel & 0xFF0000) >> 16); uint pixel = GDI32.GetPixel(screenDC, screenCoordinates.X, screenCoordinates.Y);
return color; Color color = Color.FromArgb(255, (int)(pixel & 0xFF), (int)(pixel & 0xFF00) >> 8, (int)(pixel & 0xFF0000) >> 16);
} catch (Exception) { return color;
return Color.Empty; } catch (Exception) {
} return Color.Empty;
} }
} }
} }
} }

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot

View file

@ -1,6 +1,6 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
* For more information see: http://getgreenshot.org/ * For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
@ -65,10 +65,8 @@ namespace Greenshot.Forms {
} }
private static bool Validate(object sender) { private static bool Validate(object sender) {
TextBox textbox = sender as TextBox; if (sender is TextBox textbox) {
if (textbox != null) { if (!double.TryParse(textbox.Text, out var numberEntered)) {
double numberEntered;
if (!double.TryParse(textbox.Text, out numberEntered)) {
textbox.BackColor = Color.Red; textbox.BackColor = Color.Red;
return false; return false;
} }

Some files were not shown because too many files have changed in this diff Show more