diff --git a/src/Greenshot.Addon.Box/BoxAddonModule.cs b/src/Greenshot.Addon.Box/BoxAddonModule.cs index 2b59028b0..ca32029ae 100644 --- a/src/Greenshot.Addon.Box/BoxAddonModule.cs +++ b/src/Greenshot.Addon.Box/BoxAddonModule.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Autofac; using Dapplo.Addons; using Dapplo.CaliburnMicro.Configuration; diff --git a/src/Greenshot.Addon.Box/BoxDestination.cs b/src/Greenshot.Addon.Box/BoxDestination.cs index b1c0481e4..7fc8f2b44 100644 --- a/src/Greenshot.Addon.Box/BoxDestination.cs +++ b/src/Greenshot.Addon.Box/BoxDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,13 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; -using System.Drawing; using System.IO; using System.Net.Http; using System.Net.Http.Headers; @@ -49,8 +42,6 @@ using Greenshot.Addons.Extensions; using Greenshot.Addons.Interfaces; using Greenshot.Gfx; -#endregion - namespace Greenshot.Addon.Box { [Destination("Box")] @@ -107,7 +98,7 @@ namespace Greenshot.Addon.Box public override string Description => _boxLanguage.UploadMenuItem; - public override Bitmap DisplayIcon + public override IBitmapWithNativeSupport DisplayIcon { get { diff --git a/src/Greenshot.Addon.Box/Configuration/IBoxConfiguration.cs b/src/Greenshot.Addon.Box/Configuration/IBoxConfiguration.cs index d83f79b2b..59dc4c142 100644 --- a/src/Greenshot.Addon.Box/Configuration/IBoxConfiguration.cs +++ b/src/Greenshot.Addon.Box/Configuration/IBoxConfiguration.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,18 +17,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using System.Runtime.Serialization; using Dapplo.Config.Ini; using Dapplo.HttpExtensions.OAuth; using Greenshot.Addons.Core; -#endregion - namespace Greenshot.Addon.Box.Configuration { /// diff --git a/src/Greenshot.Addon.Box/Configuration/IBoxLanguage.cs b/src/Greenshot.Addon.Box/Configuration/IBoxLanguage.cs index 4ae0e6803..51aa2561e 100644 --- a/src/Greenshot.Addon.Box/Configuration/IBoxLanguage.cs +++ b/src/Greenshot.Addon.Box/Configuration/IBoxLanguage.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Dapplo.Config.Language; namespace Greenshot.Addon.Box.Configuration diff --git a/src/Greenshot.Addon.Box/Configuration/Impl/BoxConfigurationImpl.cs b/src/Greenshot.Addon.Box/Configuration/Impl/BoxConfigurationImpl.cs index ecc266164..c6e8f15ed 100644 --- a/src/Greenshot.Addon.Box/Configuration/Impl/BoxConfigurationImpl.cs +++ b/src/Greenshot.Addon.Box/Configuration/Impl/BoxConfigurationImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.ComponentModel; using Dapplo.Config.Ini; @@ -31,8 +27,6 @@ namespace Greenshot.Addon.Box.Configuration.Impl { internal class BoxConfigurationImpl : IniSectionBase, IBoxConfiguration { - #region Implementation of IFileConfiguration - public string OutputFilePath { get; set; } public bool OutputFileAllowOverwrite { get; set; } public string OutputFileFilenamePattern { get; set; } @@ -46,16 +40,8 @@ namespace Greenshot.Addon.Box.Configuration.Impl public string OptimizePNGCommand { get; set; } public string OptimizePNGCommandArguments { get; set; } - #endregion - - #region Implementation of IDestinationFileConfiguration - public bool UseOwnSettings { get; set; } - #endregion - - #region Implementation of IOAuth2Token - [TypeConverter(typeof(StringEncryptionTypeConverter))] public string OAuth2AccessToken { get; set; } @@ -64,16 +50,10 @@ namespace Greenshot.Addon.Box.Configuration.Impl [TypeConverter(typeof(StringEncryptionTypeConverter))] public string OAuth2RefreshToken { get; set; } - #endregion - - #region Implementation of IBoxConfiguration - public bool AfterUploadLinkToClipBoard { get; set; } public bool UseSharedLink { get; set; } public string FolderId { get; set; } public string ClientId { get; set; } public string ClientSecret { get; set; } - - #endregion } } diff --git a/src/Greenshot.Addon.Box/Configuration/Impl/BoxLanguageImpl.cs b/src/Greenshot.Addon.Box/Configuration/Impl/BoxLanguageImpl.cs index 78d36f31a..7abd2ec9d 100644 --- a/src/Greenshot.Addon.Box/Configuration/Impl/BoxLanguageImpl.cs +++ b/src/Greenshot.Addon.Box/Configuration/Impl/BoxLanguageImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Diagnostics.CodeAnalysis; using Dapplo.Config.Language; @@ -33,8 +29,6 @@ namespace Greenshot.Addon.Box.Configuration.Impl #pragma warning disable CS1591 public class BoxLanguageImpl : LanguageBase, IBoxLanguage { - #region Implementation of IBoxLanguage - public string CommunicationWait { get; } public string Configure { get; } public string LabelAfterUpload { get; } @@ -44,7 +38,5 @@ namespace Greenshot.Addon.Box.Configuration.Impl public string UploadFailure { get; } public string UploadMenuItem { get; } public string UploadSuccess { get; } - - #endregion } } diff --git a/src/Greenshot.Addon.Box/Greenshot.Addon.Box.csproj b/src/Greenshot.Addon.Box/Greenshot.Addon.Box.csproj index b39c4d528..0bf60c9af 100644 --- a/src/Greenshot.Addon.Box/Greenshot.Addon.Box.csproj +++ b/src/Greenshot.Addon.Box/Greenshot.Addon.Box.csproj @@ -1,4 +1,4 @@ - + Greenshot.Addon.Box @@ -49,7 +49,7 @@ - + all runtime; build; native; contentfiles; analyzers diff --git a/src/Greenshot.Addon.Box/ViewModels/BoxConfigViewModel.cs b/src/Greenshot.Addon.Box/ViewModels/BoxConfigViewModel.cs index 52599ae9c..1f9c972f1 100644 --- a/src/Greenshot.Addon.Box/ViewModels/BoxConfigViewModel.cs +++ b/src/Greenshot.Addon.Box/ViewModels/BoxConfigViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Reactive.Disposables; using Dapplo.CaliburnMicro.Configuration; using Dapplo.CaliburnMicro.Extensions; diff --git a/src/Greenshot.Addon.Confluence/Configuration/IConfluenceConfiguration.cs b/src/Greenshot.Addon.Confluence/Configuration/IConfluenceConfiguration.cs index 0137f54d9..a8afb6329 100644 --- a/src/Greenshot.Addon.Confluence/Configuration/IConfluenceConfiguration.cs +++ b/src/Greenshot.Addon.Confluence/Configuration/IConfluenceConfiguration.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,16 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using Dapplo.Config.Ini; using Greenshot.Core.Enums; -#endregion - namespace Greenshot.Addon.Confluence.Configuration { /// diff --git a/src/Greenshot.Addon.Confluence/Configuration/IConfluenceLanguage.cs b/src/Greenshot.Addon.Confluence/Configuration/IConfluenceLanguage.cs index dc9ed6b7d..589aa9812 100644 --- a/src/Greenshot.Addon.Confluence/Configuration/IConfluenceLanguage.cs +++ b/src/Greenshot.Addon.Confluence/Configuration/IConfluenceLanguage.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Dapplo.Config.Language; namespace Greenshot.Addon.Confluence.Configuration diff --git a/src/Greenshot.Addon.Confluence/Configuration/Impl/ConfluenceConfigurationImpl.cs b/src/Greenshot.Addon.Confluence/Configuration/Impl/ConfluenceConfigurationImpl.cs index 0c04f17ce..1e4b580d5 100644 --- a/src/Greenshot.Addon.Confluence/Configuration/Impl/ConfluenceConfigurationImpl.cs +++ b/src/Greenshot.Addon.Confluence/Configuration/Impl/ConfluenceConfigurationImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Dapplo.Config.Ini; using Greenshot.Core.Enums; @@ -28,8 +24,6 @@ namespace Greenshot.Addon.Confluence.Configuration.Impl { internal class ConfluenceConfigurationImpl : IniSectionBase, IConfluenceConfiguration { - #region Implementation of IConfluenceConfiguration - public string Url { get; set; } public int Timeout { get; set; } public OutputFormats UploadFormat { get; set; } @@ -40,7 +34,5 @@ namespace Greenshot.Addon.Confluence.Configuration.Impl public bool CopyWikiMarkupForImageToClipboard { get; set; } public string SearchSpaceKey { get; set; } public bool IncludePersonSpaces { get; set; } - - #endregion } } diff --git a/src/Greenshot.Addon.Confluence/Configuration/Impl/ConfluenceLanguageImpl.cs b/src/Greenshot.Addon.Confluence/Configuration/Impl/ConfluenceLanguageImpl.cs index d187a34a7..10bda771e 100644 --- a/src/Greenshot.Addon.Confluence/Configuration/Impl/ConfluenceLanguageImpl.cs +++ b/src/Greenshot.Addon.Confluence/Configuration/Impl/ConfluenceLanguageImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Diagnostics.CodeAnalysis; using Dapplo.Config.Language; @@ -33,8 +29,6 @@ namespace Greenshot.Addon.Confluence.Configuration.Impl #pragma warning disable CS1591 public class ConfluenceLanguageImpl : LanguageBase, IConfluenceLanguage { - #region Implementation of IConfluenceLanguage - public string PluginSettings { get; } public string LoginError { get; } public string LabelUrl { get; } @@ -58,7 +52,5 @@ namespace Greenshot.Addon.Confluence.Configuration.Impl public string Loading { get; } public string IncludePersonSpaces { get; } public string CommunicationWait { get; } - - #endregion } } diff --git a/src/Greenshot.Addon.Confluence/ConfluenceAddonModule.cs b/src/Greenshot.Addon.Confluence/ConfluenceAddonModule.cs index 8ccfdf5bc..ab62fe052 100644 --- a/src/Greenshot.Addon.Confluence/ConfluenceAddonModule.cs +++ b/src/Greenshot.Addon.Confluence/ConfluenceAddonModule.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Autofac; using Dapplo.Addons; using Dapplo.CaliburnMicro.Configuration; diff --git a/src/Greenshot.Addon.Confluence/ConfluenceDestination.cs b/src/Greenshot.Addon.Confluence/ConfluenceDestination.cs index 4ba520885..b5db8e1f5 100644 --- a/src/Greenshot.Addon.Confluence/ConfluenceDestination.cs +++ b/src/Greenshot.Addon.Confluence/ConfluenceDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Diagnostics; -using System.Drawing; using System.Threading; using System.Windows; using Autofac.Features.OwnedInstances; @@ -42,8 +35,6 @@ using Greenshot.Addons.Interfaces; using Greenshot.Addons.Interfaces.Plugin; using Greenshot.Gfx; -#endregion - namespace Greenshot.Addon.Confluence { /// @@ -53,7 +44,7 @@ namespace Greenshot.Addon.Confluence public class ConfluenceDestination : AbstractDestination { private static readonly LogSource Log = new LogSource(); - private static readonly Bitmap ConfluenceIcon; + private static readonly IBitmapWithNativeSupport ConfluenceIcon; private readonly ExportNotification _exportNotification; private readonly IConfluenceConfiguration _confluenceConfiguration; private readonly IConfluenceLanguage _confluenceLanguage; @@ -125,7 +116,7 @@ namespace Greenshot.Addon.Confluence public override bool IsActive => base.IsActive && !string.IsNullOrEmpty(_confluenceConfiguration.Url); - public override Bitmap DisplayIcon => ConfluenceIcon; + public override IBitmapWithNativeSupport DisplayIcon => ConfluenceIcon; public override IEnumerable DynamicDestinations() { diff --git a/src/Greenshot.Addon.Confluence/ConfluenceUtils.cs b/src/Greenshot.Addon.Confluence/ConfluenceUtils.cs index ecfbb84f7..1bfb200d8 100644 --- a/src/Greenshot.Addon.Confluence/ConfluenceUtils.cs +++ b/src/Greenshot.Addon.Confluence/ConfluenceUtils.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Linq; @@ -34,8 +28,6 @@ using Dapplo.Confluence.Query; using Dapplo.Log; using Greenshot.Addon.InternetExplorer; -#endregion - namespace Greenshot.Addon.Confluence { /// diff --git a/src/Greenshot.Addon.Confluence/Greenshot.Addon.Confluence.csproj b/src/Greenshot.Addon.Confluence/Greenshot.Addon.Confluence.csproj index 0aff705ac..04217a904 100644 --- a/src/Greenshot.Addon.Confluence/Greenshot.Addon.Confluence.csproj +++ b/src/Greenshot.Addon.Confluence/Greenshot.Addon.Confluence.csproj @@ -1,4 +1,4 @@ - + Greenshot.Addon.Confluence @@ -55,7 +55,7 @@ - + all diff --git a/src/Greenshot.Addon.Confluence/ViewModels/ConfluenceConfigViewModel.cs b/src/Greenshot.Addon.Confluence/ViewModels/ConfluenceConfigViewModel.cs index 88a69aa84..bf8794767 100644 --- a/src/Greenshot.Addon.Confluence/ViewModels/ConfluenceConfigViewModel.cs +++ b/src/Greenshot.Addon.Confluence/ViewModels/ConfluenceConfigViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Collections.Generic; using System.Reactive.Disposables; using Dapplo.CaliburnMicro.Configuration; diff --git a/src/Greenshot.Addon.Dropbox/Configuration/IDropboxConfiguration.cs b/src/Greenshot.Addon.Dropbox/Configuration/IDropboxConfiguration.cs index 7db934fc6..0d2ce599f 100644 --- a/src/Greenshot.Addon.Dropbox/Configuration/IDropboxConfiguration.cs +++ b/src/Greenshot.Addon.Dropbox/Configuration/IDropboxConfiguration.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,18 +17,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using System.Runtime.Serialization; using Dapplo.Config.Ini; using Dapplo.HttpExtensions.OAuth; using Greenshot.Addons.Core; -#endregion - namespace Greenshot.Addon.Dropbox.Configuration { /// diff --git a/src/Greenshot.Addon.Dropbox/Configuration/IDropboxLanguage.cs b/src/Greenshot.Addon.Dropbox/Configuration/IDropboxLanguage.cs index a69f8c071..c160b1174 100644 --- a/src/Greenshot.Addon.Dropbox/Configuration/IDropboxLanguage.cs +++ b/src/Greenshot.Addon.Dropbox/Configuration/IDropboxLanguage.cs @@ -17,12 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#region Usings - using Dapplo.Config.Language; -#endregion - namespace Greenshot.Addon.Dropbox.Configuration { [Language("Dropbox")] diff --git a/src/Greenshot.Addon.Dropbox/Configuration/Impl/DropboxConfigurationImpl.cs b/src/Greenshot.Addon.Dropbox/Configuration/Impl/DropboxConfigurationImpl.cs index 6a7726621..5b4712b60 100644 --- a/src/Greenshot.Addon.Dropbox/Configuration/Impl/DropboxConfigurationImpl.cs +++ b/src/Greenshot.Addon.Dropbox/Configuration/Impl/DropboxConfigurationImpl.cs @@ -27,8 +27,6 @@ namespace Greenshot.Addon.Dropbox.Configuration.Impl { public class DropboxConfigurationImpl : IniSectionBase, IDropboxConfiguration { - #region Implementation of IFileConfiguration - public string OutputFilePath { get; set; } public bool OutputFileAllowOverwrite { get; set; } public string OutputFileFilenamePattern { get; set; } @@ -42,16 +40,8 @@ namespace Greenshot.Addon.Dropbox.Configuration.Impl public string OptimizePNGCommand { get; set; } public string OptimizePNGCommandArguments { get; set; } - #endregion - - #region Implementation of IDestinationFileConfiguration - public bool UseOwnSettings { get; set; } - #endregion - - #region Implementation of IOAuth2Token - [TypeConverter(typeof(StringEncryptionTypeConverter))] public string OAuth2AccessToken { get; set; } @@ -60,14 +50,8 @@ namespace Greenshot.Addon.Dropbox.Configuration.Impl [TypeConverter(typeof(StringEncryptionTypeConverter))] public string OAuth2RefreshToken { get; set; } - #endregion - - #region Implementation of IDropboxConfiguration - public bool AfterUploadLinkToClipBoard { get; set; } public string ClientId { get; set; } public string ClientSecret { get; set; } - - #endregion } } diff --git a/src/Greenshot.Addon.Dropbox/Configuration/Impl/DropboxLanguageImpl.cs b/src/Greenshot.Addon.Dropbox/Configuration/Impl/DropboxLanguageImpl.cs index 62ffdb1e2..d4a00c429 100644 --- a/src/Greenshot.Addon.Dropbox/Configuration/Impl/DropboxLanguageImpl.cs +++ b/src/Greenshot.Addon.Dropbox/Configuration/Impl/DropboxLanguageImpl.cs @@ -29,8 +29,6 @@ namespace Greenshot.Addon.Dropbox.Configuration.Impl [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] public class DropboxLanguageImpl: LanguageBase, IDropboxLanguage { - #region Implementation of IDropboxLanguage - public string CommunicationWait { get; } public string Configure { get; } public string LabelAfterUpload { get; } @@ -40,7 +38,5 @@ namespace Greenshot.Addon.Dropbox.Configuration.Impl public string UploadFailure { get; } public string UploadMenuItem { get; } public string UploadSuccess { get; } - - #endregion } } diff --git a/src/Greenshot.Addon.Dropbox/DropboxAddonModule.cs b/src/Greenshot.Addon.Dropbox/DropboxAddonModule.cs index 550aa6074..6c7ec0351 100644 --- a/src/Greenshot.Addon.Dropbox/DropboxAddonModule.cs +++ b/src/Greenshot.Addon.Dropbox/DropboxAddonModule.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Autofac; using Dapplo.Addons; using Dapplo.CaliburnMicro.Configuration; diff --git a/src/Greenshot.Addon.Dropbox/DropboxDestination.cs b/src/Greenshot.Addon.Dropbox/DropboxDestination.cs index 3ec3bf145..7f6ff18b3 100644 --- a/src/Greenshot.Addon.Dropbox/DropboxDestination.cs +++ b/src/Greenshot.Addon.Dropbox/DropboxDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,13 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; -using System.Drawing; using System.IO; using System.Net.Http; using System.Net.Http.Headers; @@ -50,8 +43,6 @@ using Greenshot.Addons.Interfaces; using Greenshot.Gfx; using Newtonsoft.Json; -#endregion - namespace Greenshot.Addon.Dropbox { [Destination("Dropbox")] @@ -114,7 +105,7 @@ namespace Greenshot.Addon.Dropbox httpBehaviour.HttpSettings = httpConfiguration; } - public override Bitmap DisplayIcon + public override IBitmapWithNativeSupport DisplayIcon { get { diff --git a/src/Greenshot.Addon.Dropbox/Entities/CreateLinkReply.cs b/src/Greenshot.Addon.Dropbox/Entities/CreateLinkReply.cs index 9291c239d..922bc25f2 100644 --- a/src/Greenshot.Addon.Dropbox/Entities/CreateLinkReply.cs +++ b/src/Greenshot.Addon.Dropbox/Entities/CreateLinkReply.cs @@ -17,12 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#region Usings - using Newtonsoft.Json; -#endregion - namespace Greenshot.Addon.Dropbox.Entities { internal class CreateLinkReply diff --git a/src/Greenshot.Addon.Dropbox/Entities/CreateLinkRequest.cs b/src/Greenshot.Addon.Dropbox/Entities/CreateLinkRequest.cs index db0f1ed40..d71b505b7 100644 --- a/src/Greenshot.Addon.Dropbox/Entities/CreateLinkRequest.cs +++ b/src/Greenshot.Addon.Dropbox/Entities/CreateLinkRequest.cs @@ -17,12 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#region Usings - using Newtonsoft.Json; -#endregion - namespace Greenshot.Addon.Dropbox.Entities { internal class CreateLinkRequest diff --git a/src/Greenshot.Addon.Dropbox/Entities/Error.cs b/src/Greenshot.Addon.Dropbox/Entities/Error.cs index 57c50516b..d17c984e6 100644 --- a/src/Greenshot.Addon.Dropbox/Entities/Error.cs +++ b/src/Greenshot.Addon.Dropbox/Entities/Error.cs @@ -17,12 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#region Usings - using Newtonsoft.Json; -#endregion - namespace Greenshot.Addon.Dropbox.Entities { internal class Error diff --git a/src/Greenshot.Addon.Dropbox/Entities/Upload.cs b/src/Greenshot.Addon.Dropbox/Entities/Upload.cs index b0b577f92..8213ef73e 100644 --- a/src/Greenshot.Addon.Dropbox/Entities/Upload.cs +++ b/src/Greenshot.Addon.Dropbox/Entities/Upload.cs @@ -17,14 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#region Usings - using System.Collections.Generic; using System.Net.Http; using Dapplo.HttpExtensions.Support; -#endregion - namespace Greenshot.Addon.Dropbox.Entities { /// diff --git a/src/Greenshot.Addon.Dropbox/Entities/UploadReply.cs b/src/Greenshot.Addon.Dropbox/Entities/UploadReply.cs index f1ff202a9..6dd078cee 100644 --- a/src/Greenshot.Addon.Dropbox/Entities/UploadReply.cs +++ b/src/Greenshot.Addon.Dropbox/Entities/UploadReply.cs @@ -17,14 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#region Usings - using System; using System.Runtime.Serialization; using Newtonsoft.Json; -#endregion - namespace Greenshot.Addon.Dropbox.Entities { [DataContract] diff --git a/src/Greenshot.Addon.Dropbox/Entities/UploadRequest.cs b/src/Greenshot.Addon.Dropbox/Entities/UploadRequest.cs index 4c6a9ab6f..943b8fa0e 100644 --- a/src/Greenshot.Addon.Dropbox/Entities/UploadRequest.cs +++ b/src/Greenshot.Addon.Dropbox/Entities/UploadRequest.cs @@ -17,12 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#region Usings - using Newtonsoft.Json; -#endregion - namespace Greenshot.Addon.Dropbox.Entities { internal class UploadRequest diff --git a/src/Greenshot.Addon.Dropbox/Greenshot.Addon.Dropbox.csproj b/src/Greenshot.Addon.Dropbox/Greenshot.Addon.Dropbox.csproj index de81e0c9e..6568b5a18 100644 --- a/src/Greenshot.Addon.Dropbox/Greenshot.Addon.Dropbox.csproj +++ b/src/Greenshot.Addon.Dropbox/Greenshot.Addon.Dropbox.csproj @@ -1,4 +1,4 @@ - + Greenshot.Addon.Dropbox @@ -51,7 +51,7 @@ - + all runtime; build; native; contentfiles; analyzers diff --git a/src/Greenshot.Addon.Dropbox/ViewModels/DropboxConfigViewModel.cs b/src/Greenshot.Addon.Dropbox/ViewModels/DropboxConfigViewModel.cs index a374d28a2..f538d4ca2 100644 --- a/src/Greenshot.Addon.Dropbox/ViewModels/DropboxConfigViewModel.cs +++ b/src/Greenshot.Addon.Dropbox/ViewModels/DropboxConfigViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Reactive.Disposables; using Dapplo.CaliburnMicro.Configuration; using Dapplo.CaliburnMicro.Extensions; diff --git a/src/Greenshot.Addon.ExternalCommand/Configuration/ExternalCommandConfigurationExtensions.cs b/src/Greenshot.Addon.ExternalCommand/Configuration/ExternalCommandConfigurationExtensions.cs index 09dd9177c..ab25ec0e5 100644 --- a/src/Greenshot.Addon.ExternalCommand/Configuration/ExternalCommandConfigurationExtensions.cs +++ b/src/Greenshot.Addon.ExternalCommand/Configuration/ExternalCommandConfigurationExtensions.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.IO; using Greenshot.Addon.ExternalCommand.Entities; diff --git a/src/Greenshot.Addon.ExternalCommand/Configuration/IExternalCommandConfiguration.cs b/src/Greenshot.Addon.ExternalCommand/Configuration/IExternalCommandConfiguration.cs index 73680e07e..86dc1b523 100644 --- a/src/Greenshot.Addon.ExternalCommand/Configuration/IExternalCommandConfiguration.cs +++ b/src/Greenshot.Addon.ExternalCommand/Configuration/IExternalCommandConfiguration.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics.CodeAnalysis; @@ -30,8 +24,6 @@ using Dapplo.Config.Ini; using Greenshot.Addon.ExternalCommand.Entities; using Greenshot.Addons.Core; -#endregion - namespace Greenshot.Addon.ExternalCommand.Configuration { /// diff --git a/src/Greenshot.Addon.ExternalCommand/Configuration/IExternalCommandLanguage.cs b/src/Greenshot.Addon.ExternalCommand/Configuration/IExternalCommandLanguage.cs index 66f2b991a..8c4776686 100644 --- a/src/Greenshot.Addon.ExternalCommand/Configuration/IExternalCommandLanguage.cs +++ b/src/Greenshot.Addon.ExternalCommand/Configuration/IExternalCommandLanguage.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Diagnostics.CodeAnalysis; using Dapplo.Config.Language; diff --git a/src/Greenshot.Addon.ExternalCommand/Configuration/Impl/ExternalCommandConfigurationImpl.cs b/src/Greenshot.Addon.ExternalCommand/Configuration/Impl/ExternalCommandConfigurationImpl.cs index 1c6ac8333..386e965b4 100644 --- a/src/Greenshot.Addon.ExternalCommand/Configuration/Impl/ExternalCommandConfigurationImpl.cs +++ b/src/Greenshot.Addon.ExternalCommand/Configuration/Impl/ExternalCommandConfigurationImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Collections.Generic; using Dapplo.Config.Ini; using Greenshot.Addon.ExternalCommand.Entities; @@ -30,18 +26,12 @@ namespace Greenshot.Addon.ExternalCommand.Configuration.Impl { internal class ExternalCommandConfigurationImpl : IniSectionBase, IExternalCommandConfiguration { - #region Overrides of IniSectionBase - public override void AfterLoad() { ExternalCommandConfigurationExtensions.AfterLoad(this); base.AfterLoad(); } - #endregion - - #region Implementation of IFileConfiguration - public string OutputFilePath { get; set; } public bool OutputFileAllowOverwrite { get; set; } public string OutputFileFilenamePattern { get; set; } @@ -55,23 +45,13 @@ namespace Greenshot.Addon.ExternalCommand.Configuration.Impl public string OptimizePNGCommand { get; set; } public string OptimizePNGCommandArguments { get; set; } - #endregion - - #region Implementation of IDestinationFileConfiguration - public bool UseOwnSettings { get; set; } - #endregion - - #region Implementation of IExternalCommandConfiguration - public IList Commands { get; set; } public IDictionary Commandline { get; set; } public IDictionary Argument { get; set; } public IDictionary RunInbackground { get; set; } public IDictionary Behaviors { get; set; } public IList DeletedBuildInCommands { get; set; } - - #endregion } } diff --git a/src/Greenshot.Addon.ExternalCommand/Configuration/Impl/ExternalCommandLanguageImpl.cs b/src/Greenshot.Addon.ExternalCommand/Configuration/Impl/ExternalCommandLanguageImpl.cs index 33b59feab..d3d7aa2c2 100644 --- a/src/Greenshot.Addon.ExternalCommand/Configuration/Impl/ExternalCommandLanguageImpl.cs +++ b/src/Greenshot.Addon.ExternalCommand/Configuration/Impl/ExternalCommandLanguageImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Diagnostics.CodeAnalysis; using Dapplo.Config.Language; @@ -33,8 +29,6 @@ namespace Greenshot.Addon.ExternalCommand.Configuration.Impl #pragma warning disable CS1591 public class ExternalCommandLanguageImpl : LanguageBase, IExternalCommandLanguage { - #region Implementation of IExternalCommandLanguage - public string ContextmenuConfigure { get; } public string SettingsEdit { get; } public string SettingsDelete { get; } @@ -45,7 +39,5 @@ namespace Greenshot.Addon.ExternalCommand.Configuration.Impl public string LabelCommand { get; } public string LabelInformation { get; } public string LabelName { get; } - - #endregion } } diff --git a/src/Greenshot.Addon.ExternalCommand/Entities/CommandBehaviors.cs b/src/Greenshot.Addon.ExternalCommand/Entities/CommandBehaviors.cs index 36227186c..90f6b1732 100644 --- a/src/Greenshot.Addon.ExternalCommand/Entities/CommandBehaviors.cs +++ b/src/Greenshot.Addon.ExternalCommand/Entities/CommandBehaviors.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; namespace Greenshot.Addon.ExternalCommand.Entities diff --git a/src/Greenshot.Addon.ExternalCommand/Entities/ExternalCommandDefinition.cs b/src/Greenshot.Addon.ExternalCommand/Entities/ExternalCommandDefinition.cs index d3bc80617..2275586fe 100644 --- a/src/Greenshot.Addon.ExternalCommand/Entities/ExternalCommandDefinition.cs +++ b/src/Greenshot.Addon.ExternalCommand/Entities/ExternalCommandDefinition.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addon.ExternalCommand.Entities { public class ExternalCommandDefinition diff --git a/src/Greenshot.Addon.ExternalCommand/ExternalCommandAddonModule.cs b/src/Greenshot.Addon.ExternalCommand/ExternalCommandAddonModule.cs index 51e898cbd..25931e6b9 100644 --- a/src/Greenshot.Addon.ExternalCommand/ExternalCommandAddonModule.cs +++ b/src/Greenshot.Addon.ExternalCommand/ExternalCommandAddonModule.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Autofac; using Dapplo.Addons; using Dapplo.CaliburnMicro.Configuration; diff --git a/src/Greenshot.Addon.ExternalCommand/ExternalCommandDestination.cs b/src/Greenshot.Addon.ExternalCommand/ExternalCommandDestination.cs index 2264e41da..14b416102 100644 --- a/src/Greenshot.Addon.ExternalCommand/ExternalCommandDestination.cs +++ b/src/Greenshot.Addon.ExternalCommand/ExternalCommandDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,11 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - -using System.Drawing; using System.IO; using System.Text.RegularExpressions; using System.Threading.Tasks; @@ -36,8 +29,7 @@ using Greenshot.Addons.Components; using Greenshot.Addons.Core; using Greenshot.Addons.Extensions; using Greenshot.Addons.Interfaces; - -#endregion +using Greenshot.Gfx; namespace Greenshot.Addon.ExternalCommand { @@ -72,7 +64,7 @@ namespace Greenshot.Addon.ExternalCommand public override string Description => _externalCommandDefinition.Name; /// - public override Bitmap GetDisplayIcon(double dpi) + public override IBitmapWithNativeSupport GetDisplayIcon(double dpi) { return IconCache.IconForCommand(_externalCommandDefinition, dpi > 100); } diff --git a/src/Greenshot.Addon.ExternalCommand/ExternalCommandDestinationProvider.cs b/src/Greenshot.Addon.ExternalCommand/ExternalCommandDestinationProvider.cs index 2547b00fc..ebb321f42 100644 --- a/src/Greenshot.Addon.ExternalCommand/ExternalCommandDestinationProvider.cs +++ b/src/Greenshot.Addon.ExternalCommand/ExternalCommandDestinationProvider.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.IO; @@ -35,8 +29,6 @@ using Greenshot.Addons; using Greenshot.Addons.Components; using Greenshot.Addons.Core; -#endregion - namespace Greenshot.Addon.ExternalCommand { /// diff --git a/src/Greenshot.Addon.ExternalCommand/Greenshot.Addon.ExternalCommand.csproj b/src/Greenshot.Addon.ExternalCommand/Greenshot.Addon.ExternalCommand.csproj index 3f2df9b4e..adbdb2def 100644 --- a/src/Greenshot.Addon.ExternalCommand/Greenshot.Addon.ExternalCommand.csproj +++ b/src/Greenshot.Addon.ExternalCommand/Greenshot.Addon.ExternalCommand.csproj @@ -1,4 +1,4 @@ - + Greenshot.Addon.ExternalCommand @@ -40,7 +40,7 @@ - + all diff --git a/src/Greenshot.Addon.ExternalCommand/IconCache.cs b/src/Greenshot.Addon.ExternalCommand/IconCache.cs index d66e81b15..3339fedd7 100644 --- a/src/Greenshot.Addon.ExternalCommand/IconCache.cs +++ b/src/Greenshot.Addon.ExternalCommand/IconCache.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,18 +17,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; -using System.Drawing; using System.IO; using Dapplo.Log; using Greenshot.Addon.ExternalCommand.Entities; using Greenshot.Addons.Core; - -#endregion +using Greenshot.Gfx; namespace Greenshot.Addon.ExternalCommand { @@ -47,9 +39,9 @@ namespace Greenshot.Addon.ExternalCommand /// string /// true to use the large icon /// Bitmap - public static Bitmap IconForCommand(ExternalCommandDefinition externalCommandDefinition, bool useLargeIcons) + public static IBitmapWithNativeSupport IconForCommand(ExternalCommandDefinition externalCommandDefinition, bool useLargeIcons) { - Bitmap icon = null; + IBitmapWithNativeSupport icon = null; if (externalCommandDefinition == null) { return null; diff --git a/src/Greenshot.Addon.ExternalCommand/ViewModels/ExternalCommandConfigViewModel.cs b/src/Greenshot.Addon.ExternalCommand/ViewModels/ExternalCommandConfigViewModel.cs index d9d79f3e9..659a84b10 100644 --- a/src/Greenshot.Addon.ExternalCommand/ViewModels/ExternalCommandConfigViewModel.cs +++ b/src/Greenshot.Addon.ExternalCommand/ViewModels/ExternalCommandConfigViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Reactive.Disposables; using Caliburn.Micro; using Dapplo.CaliburnMicro.Configuration; diff --git a/src/Greenshot.Addon.ExternalCommand/ViewModels/ExternalCommandDetailsViewModel.cs b/src/Greenshot.Addon.ExternalCommand/ViewModels/ExternalCommandDetailsViewModel.cs index 567e5f782..ddcfd7d4d 100644 --- a/src/Greenshot.Addon.ExternalCommand/ViewModels/ExternalCommandDetailsViewModel.cs +++ b/src/Greenshot.Addon.ExternalCommand/ViewModels/ExternalCommandDetailsViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Caliburn.Micro; using Greenshot.Addon.ExternalCommand.Configuration; using Greenshot.Addon.ExternalCommand.Entities; diff --git a/src/Greenshot.Addon.ExternalCommand/ViewModels/ExternalCommandMasterViewModel.cs b/src/Greenshot.Addon.ExternalCommand/ViewModels/ExternalCommandMasterViewModel.cs index b42a6abd4..f96dddaa4 100644 --- a/src/Greenshot.Addon.ExternalCommand/ViewModels/ExternalCommandMasterViewModel.cs +++ b/src/Greenshot.Addon.ExternalCommand/ViewModels/ExternalCommandMasterViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Linq; using Caliburn.Micro; using Greenshot.Addon.ExternalCommand.Configuration; diff --git a/src/Greenshot.Addon.Flickr/Configuration/IFlickrConfiguration.cs b/src/Greenshot.Addon.Flickr/Configuration/IFlickrConfiguration.cs index 7ea2f7848..c0bd2a278 100644 --- a/src/Greenshot.Addon.Flickr/Configuration/IFlickrConfiguration.cs +++ b/src/Greenshot.Addon.Flickr/Configuration/IFlickrConfiguration.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using System.Diagnostics.CodeAnalysis; using System.Runtime.Serialization; @@ -30,8 +24,6 @@ using Dapplo.Config.Ini; using Dapplo.HttpExtensions.OAuth; using Greenshot.Addons.Core; -#endregion - namespace Greenshot.Addon.Flickr.Configuration { /// diff --git a/src/Greenshot.Addon.Flickr/Configuration/IFlickrLanguage.cs b/src/Greenshot.Addon.Flickr/Configuration/IFlickrLanguage.cs index 279e65656..e9c6336ca 100644 --- a/src/Greenshot.Addon.Flickr/Configuration/IFlickrLanguage.cs +++ b/src/Greenshot.Addon.Flickr/Configuration/IFlickrLanguage.cs @@ -17,13 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#region Usings - using System.Diagnostics.CodeAnalysis; using Dapplo.Config.Language; -#endregion - namespace Greenshot.Addon.Flickr.Configuration { [Language("Flickr")] diff --git a/src/Greenshot.Addon.Flickr/Configuration/Impl/FlickrConfigurationImpl.cs b/src/Greenshot.Addon.Flickr/Configuration/Impl/FlickrConfigurationImpl.cs index c45483262..8c3f315d6 100644 --- a/src/Greenshot.Addon.Flickr/Configuration/Impl/FlickrConfigurationImpl.cs +++ b/src/Greenshot.Addon.Flickr/Configuration/Impl/FlickrConfigurationImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.ComponentModel; using Dapplo.Config.Ini; using Dapplo.Config.Ini.Converters; @@ -30,8 +26,6 @@ namespace Greenshot.Addon.Flickr.Configuration.Impl { internal class FlickrConfigurationImpl : IniSectionBase, IFlickrConfiguration { - #region Implementation of IFileConfiguration - public string OutputFilePath { get; set; } public bool OutputFileAllowOverwrite { get; set; } public string OutputFileFilenamePattern { get; set; } @@ -45,16 +39,8 @@ namespace Greenshot.Addon.Flickr.Configuration.Impl public string OptimizePNGCommand { get; set; } public string OptimizePNGCommandArguments { get; set; } - #endregion - - #region Implementation of IDestinationFileConfiguration - public bool UseOwnSettings { get; set; } - #endregion - - #region Implementation of IOAuth1Token - [TypeConverter(typeof(StringEncryptionTypeConverter))] public string OAuthToken { get; set; } @@ -64,10 +50,6 @@ namespace Greenshot.Addon.Flickr.Configuration.Impl [TypeConverter(typeof(StringEncryptionTypeConverter))] public string OAuthTokenVerifier { get; set; } - #endregion - - #region Implementation of IFlickrConfiguration - public bool IsPublic { get; set; } public bool IsFamily { get; set; } public bool IsFriend { get; set; } @@ -77,7 +59,5 @@ namespace Greenshot.Addon.Flickr.Configuration.Impl public bool UsePageLink { get; set; } public string ClientId { get; set; } public string ClientSecret { get; set; } - - #endregion } } diff --git a/src/Greenshot.Addon.Flickr/Configuration/Impl/FlickrLanguageImpl.cs b/src/Greenshot.Addon.Flickr/Configuration/Impl/FlickrLanguageImpl.cs index d59572fad..72d86d401 100644 --- a/src/Greenshot.Addon.Flickr/Configuration/Impl/FlickrLanguageImpl.cs +++ b/src/Greenshot.Addon.Flickr/Configuration/Impl/FlickrLanguageImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Diagnostics.CodeAnalysis; using Dapplo.Config.Language; @@ -33,8 +29,6 @@ namespace Greenshot.Addon.Flickr.Configuration.Impl [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] public class FlickrLanguageImpl : LanguageBase, IFlickrLanguage { - #region Implementation of IFlickrLanguage - public string CommunicationWait { get; } public string Configure { get; } public string LabelAfterUpload { get; } @@ -49,7 +43,5 @@ namespace Greenshot.Addon.Flickr.Configuration.Impl public string Public { get; } public string Family { get; } public string Friend { get; } - - #endregion } } diff --git a/src/Greenshot.Addon.Flickr/Configuration/SafetyLevel.cs b/src/Greenshot.Addon.Flickr/Configuration/SafetyLevel.cs index 6949bbf7d..3285ca192 100644 --- a/src/Greenshot.Addon.Flickr/Configuration/SafetyLevel.cs +++ b/src/Greenshot.Addon.Flickr/Configuration/SafetyLevel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addon.Flickr.Configuration { /// diff --git a/src/Greenshot.Addon.Flickr/FlickrAddonModule.cs b/src/Greenshot.Addon.Flickr/FlickrAddonModule.cs index b7f08a5a4..ddace7428 100644 --- a/src/Greenshot.Addon.Flickr/FlickrAddonModule.cs +++ b/src/Greenshot.Addon.Flickr/FlickrAddonModule.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Autofac; using Dapplo.Addons; using Dapplo.CaliburnMicro.Configuration; diff --git a/src/Greenshot.Addon.Flickr/FlickrDestination.cs b/src/Greenshot.Addon.Flickr/FlickrDestination.cs index d2c899a5b..1a601ed0b 100644 --- a/src/Greenshot.Addon.Flickr/FlickrDestination.cs +++ b/src/Greenshot.Addon.Flickr/FlickrDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,13 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; -using System.Drawing; using System.IO; using System.Linq; using System.Net.Http; @@ -50,8 +43,6 @@ using Greenshot.Addons.Extensions; using Greenshot.Addons.Interfaces; using Greenshot.Gfx; -#endregion - namespace Greenshot.Addon.Flickr { /// @@ -129,7 +120,7 @@ namespace Greenshot.Addon.Flickr public override string Description => _flickrLanguage.UploadMenuItem; - public override Bitmap DisplayIcon + public override IBitmapWithNativeSupport DisplayIcon { get { diff --git a/src/Greenshot.Addon.Flickr/Greenshot.Addon.Flickr.csproj b/src/Greenshot.Addon.Flickr/Greenshot.Addon.Flickr.csproj index f8ce79a82..61cf1c559 100644 --- a/src/Greenshot.Addon.Flickr/Greenshot.Addon.Flickr.csproj +++ b/src/Greenshot.Addon.Flickr/Greenshot.Addon.Flickr.csproj @@ -1,4 +1,4 @@ - + Greenshot.Addon.Flickr @@ -49,7 +49,7 @@ - + all runtime; build; native; contentfiles; analyzers diff --git a/src/Greenshot.Addon.Flickr/ViewModels/FlickrConfigViewModel.cs b/src/Greenshot.Addon.Flickr/ViewModels/FlickrConfigViewModel.cs index d2cca2bcb..0767fe1fc 100644 --- a/src/Greenshot.Addon.Flickr/ViewModels/FlickrConfigViewModel.cs +++ b/src/Greenshot.Addon.Flickr/ViewModels/FlickrConfigViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Collections.Generic; using System.Reactive.Disposables; using Dapplo.CaliburnMicro.Configuration; diff --git a/src/Greenshot.Addon.GooglePhotos/Configuration/IGooglePhotosConfiguration.cs b/src/Greenshot.Addon.GooglePhotos/Configuration/IGooglePhotosConfiguration.cs index e43f7cd1b..5b1313607 100644 --- a/src/Greenshot.Addon.GooglePhotos/Configuration/IGooglePhotosConfiguration.cs +++ b/src/Greenshot.Addon.GooglePhotos/Configuration/IGooglePhotosConfiguration.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using System.Diagnostics.CodeAnalysis; using System.Runtime.Serialization; @@ -30,8 +24,6 @@ using Dapplo.Config.Ini; using Dapplo.HttpExtensions.OAuth; using Greenshot.Addons.Core; -#endregion - namespace Greenshot.Addon.GooglePhotos.Configuration { /// diff --git a/src/Greenshot.Addon.GooglePhotos/Configuration/IGooglePhotosLanguage.cs b/src/Greenshot.Addon.GooglePhotos/Configuration/IGooglePhotosLanguage.cs index d80abff88..3990eb979 100644 --- a/src/Greenshot.Addon.GooglePhotos/Configuration/IGooglePhotosLanguage.cs +++ b/src/Greenshot.Addon.GooglePhotos/Configuration/IGooglePhotosLanguage.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Diagnostics.CodeAnalysis; using Dapplo.Config.Language; diff --git a/src/Greenshot.Addon.GooglePhotos/Configuration/Impl/GooglePhotosConfigurationImpl.cs b/src/Greenshot.Addon.GooglePhotos/Configuration/Impl/GooglePhotosConfigurationImpl.cs index 0ddeb83d4..279a08bbf 100644 --- a/src/Greenshot.Addon.GooglePhotos/Configuration/Impl/GooglePhotosConfigurationImpl.cs +++ b/src/Greenshot.Addon.GooglePhotos/Configuration/Impl/GooglePhotosConfigurationImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.ComponentModel; using Dapplo.Config.Ini; @@ -31,8 +27,6 @@ namespace Greenshot.Addon.GooglePhotos.Configuration.Impl { internal class GooglePhotosConfigurationImpl : IniSectionBase, IGooglePhotosConfiguration { - #region Implementation of IFileConfiguration - public string OutputFilePath { get; set; } public bool OutputFileAllowOverwrite { get; set; } public string OutputFileFilenamePattern { get; set; } @@ -46,16 +40,8 @@ namespace Greenshot.Addon.GooglePhotos.Configuration.Impl public string OptimizePNGCommand { get; set; } public string OptimizePNGCommandArguments { get; set; } - #endregion - - #region Implementation of IDestinationFileConfiguration - public bool UseOwnSettings { get; set; } - #endregion - - #region Implementation of IOAuth2Token - [TypeConverter(typeof(StringEncryptionTypeConverter))] public string OAuth2AccessToken { get; set; } @@ -64,17 +50,11 @@ namespace Greenshot.Addon.GooglePhotos.Configuration.Impl [TypeConverter(typeof(StringEncryptionTypeConverter))] public string OAuth2RefreshToken { get; set; } - #endregion - - #region Implementation of IGooglePhotosConfiguration - public bool AfterUploadLinkToClipBoard { get; set; } public bool AddFilename { get; set; } public string UploadUser { get; set; } public string UploadAlbum { get; set; } public string ClientId { get; set; } public string ClientSecret { get; set; } - - #endregion } } diff --git a/src/Greenshot.Addon.GooglePhotos/Configuration/Impl/GooglePhotosLanguageImpl.cs b/src/Greenshot.Addon.GooglePhotos/Configuration/Impl/GooglePhotosLanguageImpl.cs index 22059919d..4307b470b 100644 --- a/src/Greenshot.Addon.GooglePhotos/Configuration/Impl/GooglePhotosLanguageImpl.cs +++ b/src/Greenshot.Addon.GooglePhotos/Configuration/Impl/GooglePhotosLanguageImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Diagnostics.CodeAnalysis; using Dapplo.Config.Language; @@ -33,8 +29,6 @@ namespace Greenshot.Addon.GooglePhotos.Configuration.Impl #pragma warning disable CS1591 public class GooglePhotosLanguageImpl : LanguageBase, IGooglePhotosLanguage { - #region Implementation of IGooglePhotosLanguage - public string CommunicationWait { get; } public string Configure { get; } public string LabelAfterUpload { get; } @@ -44,7 +38,5 @@ namespace Greenshot.Addon.GooglePhotos.Configuration.Impl public string UploadFailure { get; } public string UploadMenuItem { get; } public string UploadSuccess { get; } - - #endregion } } diff --git a/src/Greenshot.Addon.GooglePhotos/GooglePhotosAddonModule.cs b/src/Greenshot.Addon.GooglePhotos/GooglePhotosAddonModule.cs index 68d76015e..b3463e1e0 100644 --- a/src/Greenshot.Addon.GooglePhotos/GooglePhotosAddonModule.cs +++ b/src/Greenshot.Addon.GooglePhotos/GooglePhotosAddonModule.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Autofac; using Dapplo.Addons; using Dapplo.CaliburnMicro.Configuration; diff --git a/src/Greenshot.Addon.GooglePhotos/GooglePhotosDestination.cs b/src/Greenshot.Addon.GooglePhotos/GooglePhotosDestination.cs index 920099295..833ad7738 100644 --- a/src/Greenshot.Addon.GooglePhotos/GooglePhotosDestination.cs +++ b/src/Greenshot.Addon.GooglePhotos/GooglePhotosDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,13 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; -using System.Drawing; using System.IO; using System.Net.Http; using System.Threading; @@ -48,8 +41,6 @@ using Greenshot.Addons.Extensions; using Greenshot.Addons.Interfaces; using Greenshot.Gfx; -#endregion - namespace Greenshot.Addon.GooglePhotos { [Destination("GooglePhotos")] @@ -105,7 +96,7 @@ namespace Greenshot.Addon.GooglePhotos public override string Description => _googlePhotosLanguage.UploadMenuItem; - public override Bitmap DisplayIcon + public override IBitmapWithNativeSupport DisplayIcon { get { diff --git a/src/Greenshot.Addon.GooglePhotos/Greenshot.Addon.GooglePhotos.csproj b/src/Greenshot.Addon.GooglePhotos/Greenshot.Addon.GooglePhotos.csproj index bd1470cad..44a510474 100644 --- a/src/Greenshot.Addon.GooglePhotos/Greenshot.Addon.GooglePhotos.csproj +++ b/src/Greenshot.Addon.GooglePhotos/Greenshot.Addon.GooglePhotos.csproj @@ -1,4 +1,4 @@ - + Greenshot.Addon.GooglePhotos @@ -49,7 +49,7 @@ - + all runtime; build; native; contentfiles; analyzers diff --git a/src/Greenshot.Addon.GooglePhotos/ViewModels/GooglePhotosConfigViewModel.cs b/src/Greenshot.Addon.GooglePhotos/ViewModels/GooglePhotosConfigViewModel.cs index 6288c82d8..12830b5d2 100644 --- a/src/Greenshot.Addon.GooglePhotos/ViewModels/GooglePhotosConfigViewModel.cs +++ b/src/Greenshot.Addon.GooglePhotos/ViewModels/GooglePhotosConfigViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Reactive.Disposables; using Dapplo.CaliburnMicro.Configuration; using Dapplo.CaliburnMicro.Extensions; diff --git a/src/Greenshot.Addon.Imgur/Configuration/IImgurConfiguration.cs b/src/Greenshot.Addon.Imgur/Configuration/IImgurConfiguration.cs index d2791f6df..22588059a 100644 --- a/src/Greenshot.Addon.Imgur/Configuration/IImgurConfiguration.cs +++ b/src/Greenshot.Addon.Imgur/Configuration/IImgurConfiguration.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Collections.Generic; using System.ComponentModel; using System.Runtime.Serialization; @@ -31,8 +25,6 @@ using Dapplo.HttpExtensions.OAuth; using Greenshot.Addon.Imgur.Entities; using Greenshot.Addons.Core; -#endregion - namespace Greenshot.Addon.Imgur.Configuration { /// diff --git a/src/Greenshot.Addon.Imgur/Configuration/IImgurLanguage.cs b/src/Greenshot.Addon.Imgur/Configuration/IImgurLanguage.cs index 84611849a..185478d4f 100644 --- a/src/Greenshot.Addon.Imgur/Configuration/IImgurLanguage.cs +++ b/src/Greenshot.Addon.Imgur/Configuration/IImgurLanguage.cs @@ -17,13 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#region Usings - using System.Diagnostics.CodeAnalysis; using Dapplo.Config.Language; -#endregion - namespace Greenshot.Addon.Imgur.Configuration { [Language("Imgur")] diff --git a/src/Greenshot.Addon.Imgur/Configuration/Impl/ImgurConfigurationImpl.cs b/src/Greenshot.Addon.Imgur/Configuration/Impl/ImgurConfigurationImpl.cs index f24bdc4d2..ed587a5d1 100644 --- a/src/Greenshot.Addon.Imgur/Configuration/Impl/ImgurConfigurationImpl.cs +++ b/src/Greenshot.Addon.Imgur/Configuration/Impl/ImgurConfigurationImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Collections.Generic; using System.ComponentModel; @@ -33,8 +29,6 @@ namespace Greenshot.Addon.Imgur.Configuration.Impl { internal class ImgurConfigurationImpl : IniSectionBase, IImgurConfiguration { - #region Implementation of IFileConfiguration - public string OutputFilePath { get; set; } public bool OutputFileAllowOverwrite { get; set; } public string OutputFileFilenamePattern { get; set; } @@ -48,16 +42,8 @@ namespace Greenshot.Addon.Imgur.Configuration.Impl public string OptimizePNGCommand { get; set; } public string OptimizePNGCommandArguments { get; set; } - #endregion - - #region Implementation of IDestinationFileConfiguration - public bool UseOwnSettings { get; set; } - #endregion - - #region Implementation of IOAuth2Token - [TypeConverter(typeof(StringEncryptionTypeConverter))] public string OAuth2AccessToken { get; set; } @@ -66,10 +52,6 @@ namespace Greenshot.Addon.Imgur.Configuration.Impl [TypeConverter(typeof(StringEncryptionTypeConverter))] public string OAuth2RefreshToken { get; set; } - #endregion - - #region Implementation of IImgurConfiguration - public string ImgurApi3Url { get; set; } public bool CopyLinkToClipboard { get; set; } public bool UsePageLink { get; set; } @@ -84,7 +66,5 @@ namespace Greenshot.Addon.Imgur.Configuration.Impl public IDictionary ImgurUploadHistory { get; set; } public int Credits { get; set; } public IDictionary RuntimeImgurHistory { get; set; } - - #endregion } } diff --git a/src/Greenshot.Addon.Imgur/Configuration/Impl/ImgurLanguageImpl.cs b/src/Greenshot.Addon.Imgur/Configuration/Impl/ImgurLanguageImpl.cs index 1716e7955..4ed940a5b 100644 --- a/src/Greenshot.Addon.Imgur/Configuration/Impl/ImgurLanguageImpl.cs +++ b/src/Greenshot.Addon.Imgur/Configuration/Impl/ImgurLanguageImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Diagnostics.CodeAnalysis; using Dapplo.Config.Language; @@ -33,8 +29,6 @@ namespace Greenshot.Addon.Imgur.Configuration.Impl [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] public class ImgurLanguageImpl : LanguageBase, IImgurLanguage { - #region Implementation of IImgurLanguage - public string Cancel { get; } public string ClearQuestion { get; } public string CommunicationWait { get; } @@ -53,7 +47,5 @@ namespace Greenshot.Addon.Imgur.Configuration.Impl public string UsePageLink { get; } public string AnonymousAccess { get; } public string ResetCredentialsButton { get; } - - #endregion } } diff --git a/src/Greenshot.Addon.Imgur/Entities/ImgurData.cs b/src/Greenshot.Addon.Imgur/Entities/ImgurData.cs index 79ed742ef..90ad4cb6a 100644 --- a/src/Greenshot.Addon.Imgur/Entities/ImgurData.cs +++ b/src/Greenshot.Addon.Imgur/Entities/ImgurData.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Collections.Generic; using Newtonsoft.Json; diff --git a/src/Greenshot.Addon.Imgur/Entities/ImgurImage.cs b/src/Greenshot.Addon.Imgur/Entities/ImgurImage.cs index 26e64732d..25f30f9de 100644 --- a/src/Greenshot.Addon.Imgur/Entities/ImgurImage.cs +++ b/src/Greenshot.Addon.Imgur/Entities/ImgurImage.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,9 +17,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -using System.Windows.Media; +using Greenshot.Gfx; using Newtonsoft.Json; namespace Greenshot.Addon.Imgur.Entities @@ -32,7 +28,7 @@ namespace Greenshot.Addon.Imgur.Entities public class ImgurImage { [JsonIgnore] - public ImageSource Image { get; set; } + public IBitmapWithNativeSupport Image { get; set; } [JsonProperty("data")] public ImgurData Data { get; set; } diff --git a/src/Greenshot.Addon.Imgur/Greenshot.Addon.Imgur.csproj b/src/Greenshot.Addon.Imgur/Greenshot.Addon.Imgur.csproj index 0da2c38a7..7c68ca899 100644 --- a/src/Greenshot.Addon.Imgur/Greenshot.Addon.Imgur.csproj +++ b/src/Greenshot.Addon.Imgur/Greenshot.Addon.Imgur.csproj @@ -1,4 +1,4 @@ - + Greenshot.Addon.Imgur @@ -50,7 +50,7 @@ - + all runtime; build; native; contentfiles; analyzers diff --git a/src/Greenshot.Addon.Imgur/ImgurAddonModule.cs b/src/Greenshot.Addon.Imgur/ImgurAddonModule.cs index 901d12f21..897655326 100644 --- a/src/Greenshot.Addon.Imgur/ImgurAddonModule.cs +++ b/src/Greenshot.Addon.Imgur/ImgurAddonModule.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Autofac; using Dapplo.Addons; using Dapplo.CaliburnMicro.Configuration; diff --git a/src/Greenshot.Addon.Imgur/ImgurApi.cs b/src/Greenshot.Addon.Imgur/ImgurApi.cs index 3bb538680..a6c6d8198 100644 --- a/src/Greenshot.Addon.Imgur/ImgurApi.cs +++ b/src/Greenshot.Addon.Imgur/ImgurApi.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,18 +17,14 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; +using System.Drawing; using System.IO; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; -using System.Windows.Media.Imaging; using Dapplo.HttpExtensions; using Dapplo.HttpExtensions.Factory; using Dapplo.HttpExtensions.JsonNet; @@ -42,8 +36,7 @@ using Greenshot.Addon.Imgur.Entities; using Greenshot.Addons.Core; using Greenshot.Addons.Extensions; using Greenshot.Addons.Interfaces; - -#endregion +using Greenshot.Gfx; namespace Greenshot.Addon.Imgur { @@ -263,7 +256,7 @@ namespace Greenshot.Addon.Imgur } Log.Debug().WriteLine("Retrieving Imgur image for {0} with url {1}", imgurImage.Data.Id, imgurImage.Data.LinkThumbnail); ImageHttpBehaviour.MakeCurrent(); - imgurImage.Image = await imgurImage.Data.LinkThumbnail.GetAsAsync(token).ConfigureAwait(true); + imgurImage.Image = BitmapWrapper.FromBitmap(await imgurImage.Data.LinkThumbnail.GetAsAsync(token).ConfigureAwait(true)); } /// diff --git a/src/Greenshot.Addon.Imgur/ImgurDestination.cs b/src/Greenshot.Addon.Imgur/ImgurDestination.cs index e8a724fb7..a901ed32c 100644 --- a/src/Greenshot.Addon.Imgur/ImgurDestination.cs +++ b/src/Greenshot.Addon.Imgur/ImgurDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,12 +17,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; -using System.Drawing; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; @@ -32,7 +25,6 @@ using Autofac.Features.OwnedInstances; using Dapplo.Addons; using Dapplo.Log; using Dapplo.Windows.Clipboard; -using Dapplo.Windows.Extensions; using Greenshot.Addon.Imgur.Configuration; using Greenshot.Addon.Imgur.Entities; using Greenshot.Addon.Imgur.ViewModels; @@ -44,8 +36,6 @@ using Greenshot.Addons.Extensions; using Greenshot.Addons.Interfaces; using Greenshot.Gfx; -#endregion - namespace Greenshot.Addon.Imgur { /// @@ -88,7 +78,7 @@ namespace Greenshot.Addon.Imgur public override string Description => _imgurLanguage.UploadMenuItem; - public override Bitmap DisplayIcon + public override IBitmapWithNativeSupport DisplayIcon { get { @@ -140,7 +130,7 @@ namespace Greenshot.Addon.Imgur using (var tmpImage = surfaceToUpload.GetBitmapForExport()) using (var thumbnail = tmpImage.CreateThumbnail(90, 90)) { - imgurImage.Image = thumbnail.ToBitmapSource(); + imgurImage.Image = thumbnail; } if (_imgurConfiguration.AnonymousAccess && _imgurConfiguration.TrackHistory) { diff --git a/src/Greenshot.Addon.Imgur/ViewModels/ImgurConfigViewModel.cs b/src/Greenshot.Addon.Imgur/ViewModels/ImgurConfigViewModel.cs index cfa003269..c62f35394 100644 --- a/src/Greenshot.Addon.Imgur/ViewModels/ImgurConfigViewModel.cs +++ b/src/Greenshot.Addon.Imgur/ViewModels/ImgurConfigViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Reactive.Disposables; using Autofac.Features.OwnedInstances; diff --git a/src/Greenshot.Addon.Imgur/ViewModels/ImgurHistoryViewModel.cs b/src/Greenshot.Addon.Imgur/ViewModels/ImgurHistoryViewModel.cs index b25e9f508..5fa697569 100644 --- a/src/Greenshot.Addon.Imgur/ViewModels/ImgurHistoryViewModel.cs +++ b/src/Greenshot.Addon.Imgur/ViewModels/ImgurHistoryViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Collections.ObjectModel; using System.Diagnostics; diff --git a/src/Greenshot.Addon.Imgur/Views/ImgurConfigView.xaml b/src/Greenshot.Addon.Imgur/Views/ImgurConfigView.xaml index a297fcd4b..60796b198 100644 --- a/src/Greenshot.Addon.Imgur/Views/ImgurConfigView.xaml +++ b/src/Greenshot.Addon.Imgur/Views/ImgurConfigView.xaml @@ -4,7 +4,6 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:viewModels="clr-namespace:Greenshot.Addon.Imgur.ViewModels" - xmlns:cal="http://www.caliburnproject.org" mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:ImgurConfigViewModel,IsDesignTimeCreatable=False}" > diff --git a/src/Greenshot.Addon.InternetExplorer/AccessibleHelper.cs b/src/Greenshot.Addon.InternetExplorer/AccessibleHelper.cs index daf628e68..36eccbd94 100644 --- a/src/Greenshot.Addon.InternetExplorer/AccessibleHelper.cs +++ b/src/Greenshot.Addon.InternetExplorer/AccessibleHelper.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,17 +17,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Runtime.InteropServices; using Accessibility; -#endregion - namespace Greenshot.Addon.InternetExplorer { /// @@ -365,9 +357,7 @@ namespace Greenshot.Addon.InternetExplorer OBJID_WINDOW = 0x00000000 } -#region Interop - - private static int AccessibleObjectFromWindow(IntPtr hWnd, OBJID idObject, ref IAccessible acc) + private static int AccessibleObjectFromWindow(IntPtr hWnd, OBJID idObject, ref IAccessible acc) { var guid = new Guid("{618736e0-3c3d-11cf-810c-00aa00389b71}"); // IAccessible object obj = null; @@ -386,7 +376,5 @@ namespace Greenshot.Addon.InternetExplorer [DllImport("oleacc.dll", PreserveSig = false)] [return: MarshalAs(UnmanagedType.Interface)] public static extern object ObjectFromLresult(UIntPtr lResult, [MarshalAs(UnmanagedType.LPStruct)] Guid refiid, IntPtr wParam); - -#endregion - } + } } \ No newline at end of file diff --git a/src/Greenshot.Addon.InternetExplorer/Greenshot.Addon.InternetExplorer.csproj b/src/Greenshot.Addon.InternetExplorer/Greenshot.Addon.InternetExplorer.csproj index a57c06f79..bed6acaea 100644 --- a/src/Greenshot.Addon.InternetExplorer/Greenshot.Addon.InternetExplorer.csproj +++ b/src/Greenshot.Addon.InternetExplorer/Greenshot.Addon.InternetExplorer.csproj @@ -1,4 +1,4 @@ - + net472;netcoreapp3.0 @@ -30,10 +30,10 @@ - 0.8.17 + 0.8.18 - 0.8.17 + 0.8.18 diff --git a/src/Greenshot.Addon.InternetExplorer/InternetExplorerAddonModule.cs b/src/Greenshot.Addon.InternetExplorer/InternetExplorerAddonModule.cs index adbd45b16..bbd4d8c27 100644 --- a/src/Greenshot.Addon.InternetExplorer/InternetExplorerAddonModule.cs +++ b/src/Greenshot.Addon.InternetExplorer/InternetExplorerAddonModule.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Autofac; using Dapplo.Addons; diff --git a/src/Greenshot.Addon.InternetExplorer/InternetExplorerCaptureHelper.cs b/src/Greenshot.Addon.InternetExplorer/InternetExplorerCaptureHelper.cs index 47d9dc976..2c7737695 100644 --- a/src/Greenshot.Addon.InternetExplorer/InternetExplorerCaptureHelper.cs +++ b/src/Greenshot.Addon.InternetExplorer/InternetExplorerCaptureHelper.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Drawing; -using System.Drawing.Imaging; using System.Linq; using System.Runtime.InteropServices; using Dapplo.Log; @@ -37,15 +30,13 @@ using Dapplo.Windows.Desktop; using Dapplo.Windows.Messages; using Dapplo.Windows.User32; using Greenshot.Addon.InternetExplorer.InternetExplorerInterop; -using Greenshot.Addons.Config.Impl; using Greenshot.Addons.Controls; using Greenshot.Addons.Core; using Greenshot.Addons.Interfaces; using Greenshot.Gfx; +using Greenshot.Gfx.Structs; using mshtml; -#endregion - namespace Greenshot.Addon.InternetExplorer { /// @@ -427,7 +418,7 @@ namespace Greenshot.Addon.InternetExplorer } // bitmap to return - Bitmap returnBitmap = null; + IBitmapWithNativeSupport returnBitmap = null; try { var pageSize = PrepareCapture(documentContainer, capture); @@ -649,15 +640,15 @@ namespace Greenshot.Addon.InternetExplorer /// The document wrapped in a container /// /// Bitmap with the page content as an image - private Bitmap CapturePage(DocumentContainer documentContainer, Size pageSize) + private IBitmapWithNativeSupport CapturePage(DocumentContainer documentContainer, Size pageSize) { var contentWindowDetails = documentContainer.ContentWindow; //Create a target bitmap to draw into with the calculated page size - var returnBitmap = new Bitmap(pageSize.Width, pageSize.Height, PixelFormat.Format24bppRgb); - using (var graphicsTarget = Graphics.FromImage(returnBitmap)) + var returnBitmap = new UnmanagedBitmap(pageSize.Width, pageSize.Height); + using (var graphicsTarget = Graphics.FromImage(returnBitmap.NativeBitmap)) { - // Clear the target with the backgroundcolor + // Clear the target with the background color var clearColor = documentContainer.BackgroundColor; Log.Debug().WriteLine("Clear color: {0}", clearColor); graphicsTarget.Clear(clearColor); @@ -665,10 +656,10 @@ namespace Greenshot.Addon.InternetExplorer // Get the base document & draw it DrawDocument(documentContainer, contentWindowDetails, graphicsTarget); - // Loop over the frames and clear their source area so we don't see any artefacts + // Loop over the frames and clear their source area so we don't see any artifacts foreach (var frameDocument in documentContainer.Frames) { - using (Brush brush = new SolidBrush(clearColor)) + using (var brush = new SolidBrush(clearColor)) { graphicsTarget.FillRectangle(brush, frameDocument.SourceRectangle); } @@ -764,7 +755,7 @@ namespace Greenshot.Addon.InternetExplorer targetLocation = targetLocation.Offset(targetOffset); Log.Debug().WriteLine("After offsetting the fragment targetLocation is {0}", targetLocation); Log.Debug().WriteLine("Drawing fragment of size {0} to {1}", fragment.Size, targetLocation); - graphicsTarget.DrawImage(fragment, targetLocation); + graphicsTarget.DrawImage(fragment.NativeBitmap, targetLocation); graphicsTarget.Flush(); } else diff --git a/src/Greenshot.Addon.InternetExplorer/InternetExplorerInterop/DocumentContainer.cs b/src/Greenshot.Addon.InternetExplorer/InternetExplorerInterop/DocumentContainer.cs index 667bb8c72..e26eb8a7f 100644 --- a/src/Greenshot.Addon.InternetExplorer/InternetExplorerInterop/DocumentContainer.cs +++ b/src/Greenshot.Addon.InternetExplorer/InternetExplorerInterop/DocumentContainer.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Drawing; @@ -35,8 +29,6 @@ using Dapplo.Windows.Desktop; using mshtml; using IServiceProvider = Greenshot.Addons.Interop.IServiceProvider; -#endregion - namespace Greenshot.Addon.InternetExplorer.InternetExplorerInterop { public class DocumentContainer diff --git a/src/Greenshot.Addon.InternetExplorer/InternetExplorerInterop/IWebBrowser2.cs b/src/Greenshot.Addon.InternetExplorer/InternetExplorerInterop/IWebBrowser2.cs index 006550574..0305f3097 100644 --- a/src/Greenshot.Addon.InternetExplorer/InternetExplorerInterop/IWebBrowser2.cs +++ b/src/Greenshot.Addon.InternetExplorer/InternetExplorerInterop/IWebBrowser2.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Runtime.InteropServices; -#endregion - namespace Greenshot.Addon.InternetExplorer.InternetExplorerInterop { // IWebBrowser: EAB22AC1-30C1-11CF-A7EB-0000C05BAE0B diff --git a/src/Greenshot.Addon.InternetExplorer/InternetExplorerSource.cs b/src/Greenshot.Addon.InternetExplorer/InternetExplorerSource.cs index 8cc2f294a..033559fcf 100644 --- a/src/Greenshot.Addon.InternetExplorer/InternetExplorerSource.cs +++ b/src/Greenshot.Addon.InternetExplorer/InternetExplorerSource.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Threading; using System.Threading.Tasks; diff --git a/src/Greenshot.Addon.Jira/Configuration/IJiraConfiguration.cs b/src/Greenshot.Addon.Jira/Configuration/IJiraConfiguration.cs index 06a62eb5f..4a5adcfe7 100644 --- a/src/Greenshot.Addon.Jira/Configuration/IJiraConfiguration.cs +++ b/src/Greenshot.Addon.Jira/Configuration/IJiraConfiguration.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,16 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using Dapplo.Config.Ini; using Greenshot.Addons.Core; -#endregion - namespace Greenshot.Addon.Jira.Configuration { /// diff --git a/src/Greenshot.Addon.Jira/Configuration/IJiraLanguage.cs b/src/Greenshot.Addon.Jira/Configuration/IJiraLanguage.cs index 7a4783b78..d5a229925 100644 --- a/src/Greenshot.Addon.Jira/Configuration/IJiraLanguage.cs +++ b/src/Greenshot.Addon.Jira/Configuration/IJiraLanguage.cs @@ -17,17 +17,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#region Usings - using System.ComponentModel; using Dapplo.Config.Language; -#endregion - namespace Greenshot.Addon.Jira.Configuration { [Language("Jira")] - public interface IJiraLanguage : ILanguage, INotifyPropertyChanged + public interface IJiraLanguage : ILanguage { string Cancel { get; } diff --git a/src/Greenshot.Addon.Jira/Configuration/Impl/JiraConfigurationImpl.cs b/src/Greenshot.Addon.Jira/Configuration/Impl/JiraConfigurationImpl.cs index 8356e2f3a..b1f0c18da 100644 --- a/src/Greenshot.Addon.Jira/Configuration/Impl/JiraConfigurationImpl.cs +++ b/src/Greenshot.Addon.Jira/Configuration/Impl/JiraConfigurationImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Dapplo.Config.Ini; using Greenshot.Core.Enums; @@ -28,8 +24,6 @@ namespace Greenshot.Addon.Jira.Configuration.Impl { internal class JiraConfigurationImpl : IniSectionBase, IJiraConfiguration { - #region Implementation of IFileConfiguration - public string OutputFilePath { get; set; } public bool OutputFileAllowOverwrite { get; set; } public string OutputFileFilenamePattern { get; set; } @@ -43,20 +37,10 @@ namespace Greenshot.Addon.Jira.Configuration.Impl public string OptimizePNGCommand { get; set; } public string OptimizePNGCommandArguments { get; set; } - #endregion - - #region Implementation of IDestinationFileConfiguration - public bool UseOwnSettings { get; set; } - #endregion - - #region Implementation of IJiraConfiguration - public string Url { get; set; } public int Timeout { get; set; } public int MaxEntries { get; set; } - - #endregion } } diff --git a/src/Greenshot.Addon.Jira/Configuration/Impl/JiraLanguageImpl.cs b/src/Greenshot.Addon.Jira/Configuration/Impl/JiraLanguageImpl.cs index e25c06d9f..2e2bd418b 100644 --- a/src/Greenshot.Addon.Jira/Configuration/Impl/JiraLanguageImpl.cs +++ b/src/Greenshot.Addon.Jira/Configuration/Impl/JiraLanguageImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Diagnostics.CodeAnalysis; using Dapplo.Config.Language; @@ -33,8 +29,6 @@ namespace Greenshot.Addon.Jira.Configuration.Impl [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] public class JiraLanguageImpl : LanguageBase, IJiraLanguage { - #region Implementation of IJiraLanguage - public string Cancel { get; } public string ColumnAssignee { get; } public string ColumnCreated { get; } @@ -55,7 +49,5 @@ namespace Greenshot.Addon.Jira.Configuration.Impl public string UploadFailure { get; } public string UploadMenuItem { get; } public string UploadSuccess { get; } - - #endregion } } diff --git a/src/Greenshot.Addon.Jira/Greenshot.Addon.Jira.csproj b/src/Greenshot.Addon.Jira/Greenshot.Addon.Jira.csproj index ff3de05f5..282d8036d 100644 --- a/src/Greenshot.Addon.Jira/Greenshot.Addon.Jira.csproj +++ b/src/Greenshot.Addon.Jira/Greenshot.Addon.Jira.csproj @@ -1,4 +1,4 @@ - + Greenshot.Addon.Jira @@ -53,7 +53,7 @@ - + all diff --git a/src/Greenshot.Addon.Jira/IssueTypeBitmapCache.cs b/src/Greenshot.Addon.Jira/IssueTypeBitmapCache.cs index 0a73d8f8a..18b6ab8b7 100644 --- a/src/Greenshot.Addon.Jira/IssueTypeBitmapCache.cs +++ b/src/Greenshot.Addon.Jira/IssueTypeBitmapCache.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Threading; using System.Threading.Tasks; @@ -31,8 +25,6 @@ using Dapplo.Jira; using Dapplo.Jira.Entities; using Dapplo.Utils; -#endregion - namespace Greenshot.Addon.Jira { /// diff --git a/src/Greenshot.Addon.Jira/JiraAddonModule.cs b/src/Greenshot.Addon.Jira/JiraAddonModule.cs index e78c9cd2c..7966e376a 100644 --- a/src/Greenshot.Addon.Jira/JiraAddonModule.cs +++ b/src/Greenshot.Addon.Jira/JiraAddonModule.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Autofac; using Dapplo.Addons; using Dapplo.CaliburnMicro.Configuration; diff --git a/src/Greenshot.Addon.Jira/JiraConnector.cs b/src/Greenshot.Addon.Jira/JiraConnector.cs index 9e195a747..d429bbc64 100644 --- a/src/Greenshot.Addon.Jira/JiraConnector.cs +++ b/src/Greenshot.Addon.Jira/JiraConnector.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Drawing; @@ -44,8 +38,7 @@ using Greenshot.Addons.Core; using Greenshot.Addons.Core.Credentials; using Greenshot.Addons.Extensions; using Greenshot.Addons.Interfaces; - -#endregion +using Greenshot.Gfx; namespace Greenshot.Addon.Jira { @@ -78,7 +71,7 @@ namespace Greenshot.Addon.Jira _jiraClient = JiraClient.Create(new Uri(jiraConfiguration.Url), httpConfiguration); } - public Bitmap FavIcon { get; private set; } + public IBitmapWithNativeSupport FavIcon { get; private set; } public IEnumerable RecentJiras => _jiraMonitor.RecentJiras; /// @@ -130,7 +123,7 @@ namespace Greenshot.Addon.Jira var favIconUri = _jiraClient.JiraBaseUri.AppendSegments("favicon.ico"); try { - FavIcon = await _jiraClient.Server.GetUriContentAsync(favIconUri, cancellationToken).ConfigureAwait(true); + FavIcon = BitmapWrapper.FromBitmap(await _jiraClient.Server.GetUriContentAsync(favIconUri, cancellationToken).ConfigureAwait(true)); } catch (Exception ex) { @@ -262,9 +255,10 @@ namespace Greenshot.Addon.Jira /// /// Attach the content to the jira /// - /// + /// string /// ISurface - /// + /// string + /// CancellationToken /// Task public async Task AttachAsync(string issueKey, ISurface surface, string filename = null, CancellationToken cancellationToken = default) { diff --git a/src/Greenshot.Addon.Jira/JiraDestination.cs b/src/Greenshot.Addon.Jira/JiraDestination.cs index 8e426e454..9a3b61828 100644 --- a/src/Greenshot.Addon.Jira/JiraDestination.cs +++ b/src/Greenshot.Addon.Jira/JiraDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,13 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; -using System.Drawing; using System.IO.Compression; using System.Windows.Forms; using Autofac.Features.OwnedInstances; @@ -43,8 +36,6 @@ using Greenshot.Addons.Core; using Greenshot.Addons.Interfaces; using Greenshot.Gfx; -#endregion - namespace Greenshot.Addon.Jira { /// @@ -120,11 +111,11 @@ namespace Greenshot.Addon.Jira public override bool IsDynamic => true; - public override Bitmap DisplayIcon + public override IBitmapWithNativeSupport DisplayIcon { get { - Bitmap displayIcon = null; + IBitmapWithNativeSupport displayIcon = null; if (_jiraConnector != null) { if (_jiraIssue != null) @@ -150,7 +141,7 @@ namespace Greenshot.Addon.Jira { using (var gzStream = new GZipStream(bitmapStream, CompressionMode.Decompress)) { - displayIcon = SvgBitmap.FromStream(gzStream).Bitmap; + displayIcon = SvgBitmap.FromStream(gzStream); } //displayIcon = BitmapHelper.FromStream(bitmapStream); } diff --git a/src/Greenshot.Addon.Jira/JiraDetails.cs b/src/Greenshot.Addon.Jira/JiraDetails.cs index 567dd15aa..d6c05710a 100644 --- a/src/Greenshot.Addon.Jira/JiraDetails.cs +++ b/src/Greenshot.Addon.Jira/JiraDetails.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using Dapplo.Jira.Entities; -#endregion - namespace Greenshot.Addon.Jira { public class JiraDetails : IComparable diff --git a/src/Greenshot.Addon.Jira/JiraEventArgs.cs b/src/Greenshot.Addon.Jira/JiraEventArgs.cs index 4c1c89b37..e94cf7e92 100644 --- a/src/Greenshot.Addon.Jira/JiraEventArgs.cs +++ b/src/Greenshot.Addon.Jira/JiraEventArgs.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; -#endregion - namespace Greenshot.Addon.Jira { public class JiraEventArgs : EventArgs diff --git a/src/Greenshot.Addon.Jira/JiraEventTypes.cs b/src/Greenshot.Addon.Jira/JiraEventTypes.cs index be3bc6d5a..6d700fa1d 100644 --- a/src/Greenshot.Addon.Jira/JiraEventTypes.cs +++ b/src/Greenshot.Addon.Jira/JiraEventTypes.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addon.Jira { public enum JiraEventTypes diff --git a/src/Greenshot.Addon.Jira/JiraMonitor.cs b/src/Greenshot.Addon.Jira/JiraMonitor.cs index e329c124d..e74c0296c 100644 --- a/src/Greenshot.Addon.Jira/JiraMonitor.cs +++ b/src/Greenshot.Addon.Jira/JiraMonitor.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Linq; @@ -38,8 +32,6 @@ using Dapplo.Windows.Desktop; using Dapplo.Windows.User32; using Greenshot.Addon.Jira.Configuration; -#endregion - namespace Greenshot.Addon.Jira { /// diff --git a/src/Greenshot.Addon.Jira/ViewModels/JiraConfigViewModel.cs b/src/Greenshot.Addon.Jira/ViewModels/JiraConfigViewModel.cs index 58aa7ef00..05211fbe0 100644 --- a/src/Greenshot.Addon.Jira/ViewModels/JiraConfigViewModel.cs +++ b/src/Greenshot.Addon.Jira/ViewModels/JiraConfigViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Reactive.Disposables; using Dapplo.CaliburnMicro.Configuration; using Dapplo.CaliburnMicro.Extensions; diff --git a/src/Greenshot.Addon.Jira/ViewModels/JiraViewModel.cs b/src/Greenshot.Addon.Jira/ViewModels/JiraViewModel.cs index ea593fbbe..b81307970 100644 --- a/src/Greenshot.Addon.Jira/ViewModels/JiraViewModel.cs +++ b/src/Greenshot.Addon.Jira/ViewModels/JiraViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Collections.Generic; using System.Linq; diff --git a/src/Greenshot.Addon.LegacyEditor/Colors.cs b/src/Greenshot.Addon.LegacyEditor/Colors.cs index c69381185..3faedeef5 100644 --- a/src/Greenshot.Addon.LegacyEditor/Colors.cs +++ b/src/Greenshot.Addon.LegacyEditor/Colors.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Collections.Generic; using System.Drawing; -#endregion - namespace Greenshot.Addon.LegacyEditor { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Configuration/Impl/EditorConfigurationImpl.cs b/src/Greenshot.Addon.LegacyEditor/Configuration/Impl/EditorConfigurationImpl.cs index 26bca1834..77d7e159e 100644 --- a/src/Greenshot.Addon.LegacyEditor/Configuration/Impl/EditorConfigurationImpl.cs +++ b/src/Greenshot.Addon.LegacyEditor/Configuration/Impl/EditorConfigurationImpl.cs @@ -9,8 +9,6 @@ namespace Greenshot.Addon.LegacyEditor.Configuration.Impl { internal class EditorConfigurationImpl : IniSectionBase, IEditorConfiguration { - #region Implementation of IEditorConfiguration - public IList RecentColors { get; set; } public IDictionary LastUsedFieldValues { get; set; } public bool MatchSizeToCapture { get; set; } @@ -24,7 +22,5 @@ namespace Greenshot.Addon.LegacyEditor.Configuration.Impl public bool SuppressSaveDialogAtClose { get; set; } public DropShadowEffect DropShadowEffectSettings { get; set; } public TornEdgeEffect TornEdgeEffectSettings { get; set; } - - #endregion } } diff --git a/src/Greenshot.Addon.LegacyEditor/Configuration/Impl/EditorLanguageImpl.cs b/src/Greenshot.Addon.LegacyEditor/Configuration/Impl/EditorLanguageImpl.cs index fd6ebc101..c205adbcc 100644 --- a/src/Greenshot.Addon.LegacyEditor/Configuration/Impl/EditorLanguageImpl.cs +++ b/src/Greenshot.Addon.LegacyEditor/Configuration/Impl/EditorLanguageImpl.cs @@ -10,8 +10,6 @@ namespace Greenshot.Addon.LegacyEditor.Configuration.Impl #pragma warning disable CS1591 public class EditorLanguageImpl : LanguageBase, IEditorLanguage { - #region Implementation of IEditorLanguage - public string SettingsDestinationEditor { get; } public string EditorAlignBottom { get; } public string EditorAlignCenter { get; } @@ -101,7 +99,5 @@ namespace Greenshot.Addon.LegacyEditor.Configuration.Impl public string EditorUndo { get; } public string EditorUponelevel { get; } public string EditorUptotop { get; } - - #endregion } } diff --git a/src/Greenshot.Addon.LegacyEditor/Controls/BindableToolStripButton.cs b/src/Greenshot.Addon.LegacyEditor/Controls/BindableToolStripButton.cs index 79113f268..b30185f09 100644 --- a/src/Greenshot.Addon.LegacyEditor/Controls/BindableToolStripButton.cs +++ b/src/Greenshot.Addon.LegacyEditor/Controls/BindableToolStripButton.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,17 +17,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.ComponentModel; using System.Windows.Forms; using Greenshot.Addons.Controls; -#endregion - namespace Greenshot.Addon.LegacyEditor.Controls { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Controls/BindableToolStripComboBox.cs b/src/Greenshot.Addon.LegacyEditor/Controls/BindableToolStripComboBox.cs index b0888b17a..fb8f7b43d 100644 --- a/src/Greenshot.Addon.LegacyEditor/Controls/BindableToolStripComboBox.cs +++ b/src/Greenshot.Addon.LegacyEditor/Controls/BindableToolStripComboBox.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,17 +17,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.ComponentModel; using System.Windows.Forms; using Greenshot.Addons.Controls; -#endregion - namespace Greenshot.Addon.LegacyEditor.Controls { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Controls/BindableToolStripDropDownButton.cs b/src/Greenshot.Addon.LegacyEditor/Controls/BindableToolStripDropDownButton.cs index 9a49455d0..a0992591c 100644 --- a/src/Greenshot.Addon.LegacyEditor/Controls/BindableToolStripDropDownButton.cs +++ b/src/Greenshot.Addon.LegacyEditor/Controls/BindableToolStripDropDownButton.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,16 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using System.Windows.Forms; using Greenshot.Addons.Controls; -#endregion - namespace Greenshot.Addon.LegacyEditor.Controls { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Controls/ColorButton.cs b/src/Greenshot.Addon.LegacyEditor/Controls/ColorButton.cs index b622eb098..71ebd6aa9 100644 --- a/src/Greenshot.Addon.LegacyEditor/Controls/ColorButton.cs +++ b/src/Greenshot.Addon.LegacyEditor/Controls/ColorButton.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.ComponentModel; using System.Drawing; @@ -31,8 +25,6 @@ using System.Windows.Forms; using Autofac.Features.OwnedInstances; using Greenshot.Addons.Controls; -#endregion - namespace Greenshot.Addon.LegacyEditor.Controls { /// @@ -102,7 +94,7 @@ namespace Greenshot.Addon.LegacyEditor.Controls } SelectedColor = colorDialog.Color; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("SelectedColor")); - }; + } } } } \ No newline at end of file diff --git a/src/Greenshot.Addon.LegacyEditor/Controls/ColorDialog.Designer.cs b/src/Greenshot.Addon.LegacyEditor/Controls/ColorDialog.Designer.cs index 4632cf023..dfaa20276 100644 --- a/src/Greenshot.Addon.LegacyEditor/Controls/ColorDialog.Designer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Controls/ColorDialog.Designer.cs @@ -233,7 +233,7 @@ namespace Greenshot.Addon.LegacyEditor.Controls { // this.pipette.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.pipette.Cursor = System.Windows.Forms.Cursors.Arrow; - this.pipette.Image = GreenshotResources.Instance.GetBitmap("pipette.Image", GetType()); + this.pipette.Image = GreenshotResources.Instance.GetBitmap("pipette.Image", GetType()).NativeBitmap; this.pipette.Location = new System.Drawing.Point(510, 56); this.pipette.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); this.pipette.Name = "pipette"; diff --git a/src/Greenshot.Addon.LegacyEditor/Controls/ColorDialog.cs b/src/Greenshot.Addon.LegacyEditor/Controls/ColorDialog.cs index 329d80527..8ad1427df 100644 --- a/src/Greenshot.Addon.LegacyEditor/Controls/ColorDialog.cs +++ b/src/Greenshot.Addon.LegacyEditor/Controls/ColorDialog.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Drawing; @@ -33,8 +27,6 @@ using System.Windows.Forms; using Greenshot.Addons; using Greenshot.Addons.Controls; -#endregion - namespace Greenshot.Addon.LegacyEditor.Controls { /// @@ -78,9 +70,7 @@ namespace Greenshot.Addon.LegacyEditor.Controls set => PreviewColor(value, this); } - #region helper functions - - private int GetColorPartIntFromString(string s) + private int GetColorPartIntFromString(string s) { int.TryParse(s, out var ret); if (ret < 0) @@ -94,16 +84,12 @@ namespace Greenshot.Addon.LegacyEditor.Controls return ret; } - #endregion - - private void PipetteUsed(object sender, PipetteUsedArgs e) + private void PipetteUsed(object sender, PipetteUsedArgs e) { Color = e.Color; } - #region user interface generation - - private IList CreateColorPalette(int w, int h) + private IList CreateColorPalette(int w, int h) { int x = 0; int y = 0; @@ -191,11 +177,7 @@ namespace Greenshot.Addon.LegacyEditor.Controls return recentColorButtons; } - #endregion - - #region update user interface - - private void UpdateRecentColorsButtonRow() + private void UpdateRecentColorsButtonRow() { for (var i = 0; i < _editorConfiguration.RecentColors.Count && i < 12; i++) { @@ -233,11 +215,7 @@ namespace Greenshot.Addon.LegacyEditor.Controls UpdateRecentColorsButtonRow(); } - #endregion - - #region textbox event handlers - - private void TextBoxHexadecimalTextChanged(object sender, EventArgs e) + private void TextBoxHexadecimalTextChanged(object sender, EventArgs e) { if (_updateInProgress) { @@ -291,11 +269,7 @@ namespace Greenshot.Addon.LegacyEditor.Controls } } - #endregion - - #region button event handlers - - private void ColorButtonClick(object sender, EventArgs e) + private void ColorButtonClick(object sender, EventArgs e) { var b = (Button) sender; PreviewColor(b.BackColor, b); @@ -312,7 +286,5 @@ namespace Greenshot.Addon.LegacyEditor.Controls Hide(); AddToRecentColors(colorPanel.BackColor); } - - #endregion - } + } } \ No newline at end of file diff --git a/src/Greenshot.Addon.LegacyEditor/Controls/CustomProfessionalColorTable.cs b/src/Greenshot.Addon.LegacyEditor/Controls/CustomProfessionalColorTable.cs index 7ffa6ad95..2254c5b8d 100644 --- a/src/Greenshot.Addon.LegacyEditor/Controls/CustomProfessionalColorTable.cs +++ b/src/Greenshot.Addon.LegacyEditor/Controls/CustomProfessionalColorTable.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Drawing; using System.Windows.Forms; diff --git a/src/Greenshot.Addon.LegacyEditor/Controls/CustomToolStripProfessionalRenderer.cs b/src/Greenshot.Addon.LegacyEditor/Controls/CustomToolStripProfessionalRenderer.cs index fd68d0e34..23859cef3 100644 --- a/src/Greenshot.Addon.LegacyEditor/Controls/CustomToolStripProfessionalRenderer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Controls/CustomToolStripProfessionalRenderer.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Drawing; using System.Windows.Forms; -#endregion - namespace Greenshot.Addon.LegacyEditor.Controls { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Controls/FontFamilyComboBox.cs b/src/Greenshot.Addon.LegacyEditor/Controls/FontFamilyComboBox.cs index b51d3bc8d..fcaa73b6f 100644 --- a/src/Greenshot.Addon.LegacyEditor/Controls/FontFamilyComboBox.cs +++ b/src/Greenshot.Addon.LegacyEditor/Controls/FontFamilyComboBox.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,17 +17,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; -#endregion - namespace Greenshot.Addon.LegacyEditor.Controls { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Controls/MenuStripEx.cs b/src/Greenshot.Addon.LegacyEditor/Controls/MenuStripEx.cs index 339749333..d3cf9538d 100644 --- a/src/Greenshot.Addon.LegacyEditor/Controls/MenuStripEx.cs +++ b/src/Greenshot.Addon.LegacyEditor/Controls/MenuStripEx.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Windows.Forms; -#endregion - namespace Greenshot.Addon.LegacyEditor.Controls { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Controls/NonJumpingPanel.cs b/src/Greenshot.Addon.LegacyEditor/Controls/NonJumpingPanel.cs index 0dc1cf144..13c776c72 100644 --- a/src/Greenshot.Addon.LegacyEditor/Controls/NonJumpingPanel.cs +++ b/src/Greenshot.Addon.LegacyEditor/Controls/NonJumpingPanel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Drawing; using System.Windows.Forms; -#endregion - namespace Greenshot.Addon.LegacyEditor.Controls { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Controls/Pipette.cs b/src/Greenshot.Addon.LegacyEditor/Controls/Pipette.cs index 81b149ba5..48c704e9e 100644 --- a/src/Greenshot.Addon.LegacyEditor/Controls/Pipette.cs +++ b/src/Greenshot.Addon.LegacyEditor/Controls/Pipette.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.Windows.Forms; @@ -33,8 +27,7 @@ using Dapplo.Windows.Messages; using Dapplo.Windows.User32; using Greenshot.Addons.Controls; using Greenshot.Addons.Resources; - -#endregion +using Greenshot.Gfx; namespace Greenshot.Addon.LegacyEditor.Controls { @@ -45,7 +38,7 @@ namespace Greenshot.Addon.LegacyEditor.Controls public sealed class Pipette : Label, IMessageFilter, IDisposable { private const int VkEsc = 27; - private readonly Bitmap _image; + private readonly IBitmapWithNativeSupport _image; private Cursor _cursor; private bool _dragging; private MovableShowColorForm _movableShowColorForm; @@ -55,7 +48,7 @@ namespace Greenshot.Addon.LegacyEditor.Controls BorderStyle = BorderStyle.FixedSingle; _dragging = false; _image = GreenshotResources.Instance.GetBitmap("pipette.Image", GetType()); - Image = _image; + Image = _image.NativeBitmap; _cursor = CreateCursor(_image, 1, 14); _movableShowColorForm = new MovableShowColorForm(); Application.AddMessageFilter(this); @@ -69,9 +62,7 @@ namespace Greenshot.Addon.LegacyEditor.Controls Dispose(true); } - #region IMessageFilter Members - - public bool PreFilterMessage(ref Message m) + public bool PreFilterMessage(ref Message m) { if (_dragging) { @@ -86,20 +77,18 @@ namespace Greenshot.Addon.LegacyEditor.Controls return false; } - #endregion - - public event EventHandler PipetteUsed; + public event EventHandler PipetteUsed; /// - /// Create a cursor from the supplied bitmap and hotspot coordinates + /// Create a cursor from the supplied bitmap and hot-spot coordinates /// /// Bitmap to create an icon from /// Hotspot X coordinate /// Hotspot Y coordinate /// Cursor - private static Cursor CreateCursor(Bitmap bitmap, int hotspotX, int hotspotY) + private static Cursor CreateCursor(IBitmapWithNativeSupport bitmap, int hotspotX, int hotspotY) { - using (var iconHandle = new SafeIconHandle(bitmap.GetHicon())) + using (var iconHandle = new SafeIconHandle(bitmap.NativeBitmap.GetHicon())) { NativeIconMethods.GetIconInfo(iconHandle, out var iconInfo); iconInfo.Hotspot = new NativePoint(hotspotX, hotspotY); @@ -189,7 +178,7 @@ namespace Greenshot.Addon.LegacyEditor.Controls else { _dragging = false; - Image = _image; + Image = _image.NativeBitmap; Cursor = Cursors.Arrow; _movableShowColorForm.Visible = false; } diff --git a/src/Greenshot.Addon.LegacyEditor/Controls/ToolStripColorButton.cs b/src/Greenshot.Addon.LegacyEditor/Controls/ToolStripColorButton.cs index 38fb82d34..4535a0fc5 100644 --- a/src/Greenshot.Addon.LegacyEditor/Controls/ToolStripColorButton.cs +++ b/src/Greenshot.Addon.LegacyEditor/Controls/ToolStripColorButton.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.ComponentModel; using System.Drawing; @@ -31,8 +25,6 @@ using System.Windows.Forms; using Greenshot.Addons; using Greenshot.Addons.Controls; -#endregion - namespace Greenshot.Addon.LegacyEditor.Controls { public class ToolStripColorButton : ToolStripButton, INotifyPropertyChanged, IGreenshotLanguageBindable diff --git a/src/Greenshot.Addon.LegacyEditor/Controls/ToolStripEx.cs b/src/Greenshot.Addon.LegacyEditor/Controls/ToolStripEx.cs index d38b6a58f..240715c08 100644 --- a/src/Greenshot.Addon.LegacyEditor/Controls/ToolStripEx.cs +++ b/src/Greenshot.Addon.LegacyEditor/Controls/ToolStripEx.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Windows.Forms; -#endregion - namespace Greenshot.Addon.LegacyEditor.Controls { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Controls/ToolStripItemEndisabler.cs b/src/Greenshot.Addon.LegacyEditor/Controls/ToolStripItemEndisabler.cs index 30d4d32dd..d01687d72 100644 --- a/src/Greenshot.Addon.LegacyEditor/Controls/ToolStripItemEndisabler.cs +++ b/src/Greenshot.Addon.LegacyEditor/Controls/ToolStripItemEndisabler.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Windows.Forms; -#endregion - namespace Greenshot.Addon.LegacyEditor.Controls { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Controls/ToolStripNumericUpDown.cs b/src/Greenshot.Addon.LegacyEditor/Controls/ToolStripNumericUpDown.cs index 37b1e85db..89a167382 100644 --- a/src/Greenshot.Addon.LegacyEditor/Controls/ToolStripNumericUpDown.cs +++ b/src/Greenshot.Addon.LegacyEditor/Controls/ToolStripNumericUpDown.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,17 +17,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.ComponentModel; using System.Windows.Forms; using System.Windows.Forms.Design; -#endregion - namespace Greenshot.Addon.LegacyEditor.Controls { [ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.ToolStrip | ToolStripItemDesignerAvailability.StatusStrip)] diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/AbstractAdorner.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/AbstractAdorner.cs index b56b0744b..f1e19ebda 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/AbstractAdorner.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/AbstractAdorner.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms; @@ -33,8 +27,6 @@ using Dapplo.Windows.Dpi; using Greenshot.Addons.Interfaces.Drawing; using Greenshot.Addons.Interfaces.Drawing.Adorners; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing.Adorners { public class AbstractAdorner : IAdorner diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/MoveAdorner.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/MoveAdorner.cs index 36b5fc852..1f7b36cc8 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/MoveAdorner.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/MoveAdorner.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms; @@ -31,8 +25,6 @@ using Dapplo.Windows.Common.Structs; using Greenshot.Addons.Interfaces.Drawing; using Greenshot.Gfx.Legacy; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing.Adorners { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/ResizeAdorner.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/ResizeAdorner.cs index b781f8b87..38417ffe0 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/ResizeAdorner.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/ResizeAdorner.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms; @@ -31,8 +25,6 @@ using Dapplo.Windows.Common.Structs; using Greenshot.Addons.Interfaces.Drawing; using Greenshot.Gfx.Legacy; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing.Adorners { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/TargetAdorner.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/TargetAdorner.cs index 6c3bd6b61..bc2263737 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/TargetAdorner.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/TargetAdorner.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms; @@ -30,8 +24,6 @@ using Dapplo.Windows.Common.Extensions; using Dapplo.Windows.Common.Structs; using Greenshot.Addons.Interfaces.Drawing; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing.Adorners { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/ArrowContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/ArrowContainer.cs index 65ede67dc..259bd6cc4 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/ArrowContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/ArrowContainer.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.Drawing.Drawing2D; @@ -31,8 +25,6 @@ using Dapplo.Windows.Common.Structs; using Greenshot.Addon.LegacyEditor.Drawing.Fields; using Greenshot.Addons.Interfaces.Drawing; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/BitmapContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/BitmapContainer.cs index 15ba4db10..91425f845 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/BitmapContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/BitmapContainer.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.Drawing.Drawing2D; @@ -35,8 +29,6 @@ using Greenshot.Addons.Interfaces.Drawing; using Greenshot.Gfx; using Greenshot.Gfx.Effects; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing { /// @@ -51,15 +43,17 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// This is the shadow version of the bitmap, rendered once to save performance /// Do not serialize, as the shadow is recreated from the original bitmap if it's not available /// - [NonSerialized] private Image _shadowBitmap; + [NonSerialized] + private IBitmapWithNativeSupport _shadowBitmap; /// /// This is the offset for the shadow version of the bitmap /// Do not serialize, as the offset is recreated /// - [NonSerialized] private NativePoint _shadowOffset = new NativePoint(-1, -1); + [NonSerialized] + private NativePoint _shadowOffset = new NativePoint(-1, -1); - private Bitmap _bitmap; + private IBitmapWithNativeSupport _bitmap; public BitmapContainer(Surface parent, string filename, IEditorConfiguration editorConfiguration) : this(parent, editorConfiguration) { @@ -76,7 +70,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing public override Size DefaultSize => _bitmap.Size; - public Bitmap Bitmap + public IBitmapWithNativeSupport Bitmap { set { @@ -257,11 +251,11 @@ namespace Greenshot.Addon.LegacyEditor.Drawing if (shadow) { CheckShadow(true); - graphics.DrawImage(_shadowBitmap, Bounds); + graphics.DrawImage(_shadowBitmap.NativeBitmap, Bounds); } else { - graphics.DrawImage(_bitmap, Bounds); + graphics.DrawImage(_bitmap.NativeBitmap, Bounds); } } } diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/CropContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/CropContainer.cs index 891878567..f2850b12d 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/CropContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/CropContainer.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Drawing; using System.Runtime.Serialization; using Dapplo.Windows.Common.Extensions; @@ -30,8 +24,6 @@ using Dapplo.Windows.Common.Structs; using Greenshot.Addon.LegacyEditor.Drawing.Fields; using Greenshot.Addons.Interfaces.Drawing; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/CursorContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/CursorContainer.cs index db892e64f..b5d2f5465 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/CursorContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/CursorContainer.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.Drawing.Drawing2D; @@ -32,8 +26,6 @@ using System.Windows.Forms; using Dapplo.Log; using Greenshot.Addons.Interfaces.Drawing; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/DrawableContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/DrawableContainer.cs index b91bedcc0..1abb2824c 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/DrawableContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/DrawableContainer.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.ComponentModel; @@ -33,7 +27,6 @@ using System.Windows.Forms; using Dapplo.Log; using Dapplo.Windows.Common.Extensions; using Dapplo.Windows.Common.Structs; -using Greenshot.Addon.LegacyEditor.Configuration.Impl; using Greenshot.Addon.LegacyEditor.Drawing.Adorners; using Greenshot.Addon.LegacyEditor.Drawing.Fields; using Greenshot.Addon.LegacyEditor.Drawing.Filters; @@ -41,10 +34,9 @@ using Greenshot.Addon.LegacyEditor.Memento; using Greenshot.Addons.Interfaces; using Greenshot.Addons.Interfaces.Drawing; using Greenshot.Addons.Interfaces.Drawing.Adorners; +using Greenshot.Gfx; using Greenshot.Gfx.Legacy; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing { /// @@ -85,16 +77,16 @@ namespace Greenshot.Addon.LegacyEditor.Drawing [NonSerialized] private TargetAdorner _targetAdorner; - private bool accountForShadowChange; + private bool _accountForShadowChange; - private int height; + private int _height; - private int left; + private int _left; - private int top; + private int _top; - private int width; + private int _width; public DrawableContainer(Surface parent, IEditorConfiguration editorConfiguration) : base(editorConfiguration) { @@ -183,73 +175,73 @@ namespace Greenshot.Addon.LegacyEditor.Drawing public int Left { - get { return left; } + get { return _left; } set { - if (value == left) + if (value == _left) { return; } - left = value; + _left = value; } } public int Top { - get { return top; } + get { return _top; } set { - if (value == top) + if (value == _top) { return; } - top = value; + _top = value; } } public int Width { - get { return width; } + get { return _width; } set { - if (value == width) + if (value == _width) { return; } - width = value; + _width = value; } } public int Height { - get { return height; } + get { return _height; } set { - if (value == height) + if (value == _height) { return; } - height = value; + _height = value; } } public NativePoint Location { - get { return new NativePoint(left, top); } + get { return new NativePoint(_left, _top); } set { - left = value.X; - top = value.Y; + _left = value.X; + _top = value.Y; } } public Size Size { - get { return new Size(width, height); } + get { return new Size(_width, _height); } set { - width = value.Width; - height = value.Height; + _width = value.Width; + _height = value.Height; } } @@ -298,9 +290,9 @@ namespace Greenshot.Addon.LegacyEditor.Drawing var offset = lineThickness / 2; var shadow = 0; - if (accountForShadowChange || HasField(FieldTypes.SHADOW) && GetFieldValueAsBool(FieldTypes.SHADOW)) + if (_accountForShadowChange || HasField(FieldTypes.SHADOW) && GetFieldValueAsBool(FieldTypes.SHADOW)) { - accountForShadowChange = false; + _accountForShadowChange = false; shadow += 10; } return new NativeRect(Bounds.Left - offset, Bounds.Top - offset, Bounds.Width + lineThickness + shadow, Bounds.Height + lineThickness + shadow); @@ -354,7 +346,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing return true; } - public bool hasFilters + public bool HasFilters { get { return Filters.Count > 0; } } @@ -536,7 +528,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing public abstract void Draw(Graphics graphics, RenderMode renderMode); - public virtual void DrawContent(Graphics graphics, Bitmap bmp, RenderMode renderMode, NativeRect clipRectangle) + public virtual void DrawContent(Graphics graphics, IBitmapWithNativeSupport bmp, RenderMode renderMode, NativeRect clipRectangle) { if (Children.Count > 0) { @@ -645,7 +637,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing Log.Debug().WriteLine("Field {0} changed", e.Field.FieldType); if (Equals(e.Field.FieldType, FieldTypes.SHADOW)) { - accountForShadowChange = true; + _accountForShadowChange = true; } } diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/DrawableContainerList.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/DrawableContainerList.cs index 0faa944b7..fba4d4706 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/DrawableContainerList.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/DrawableContainerList.cs @@ -33,6 +33,7 @@ using Greenshot.Addons.Core; using Greenshot.Addons.Interfaces; using Greenshot.Addons.Interfaces.Drawing; using Greenshot.Addons.Resources; +using Greenshot.Gfx; namespace Greenshot.Addon.LegacyEditor.Drawing { /// @@ -95,7 +96,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { return null; } set { - ParentID = value?.ID ?? Guid.NewGuid(); + ParentID = value?.Id ?? Guid.NewGuid(); foreach (var drawableContainer in this) { var dc = (DrawableContainer) drawableContainer; dc.Parent = value; @@ -208,7 +209,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { /// true if an filter intersects public bool HasIntersectingFilters(NativeRect clipRectangle) { foreach(var dc in this) { - if (dc.DrawingBounds.IntersectsWith(clipRectangle) && dc.hasFilters && dc.Status == EditStatus.IDLE) { + if (dc.DrawingBounds.IntersectsWith(clipRectangle) && dc.HasFilters && dc.Status == EditStatus.IDLE) { return true; } } @@ -233,10 +234,10 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { /// Triggers all elements in the list ot be redrawn. /// /// the to the bitmap related Graphics object - /// Bitmap to draw + /// IBitmapWithNativeSupport to draw /// the rendermode in which the element is to be drawn /// - public void Draw(Graphics g, Bitmap bitmap, RenderMode renderMode, NativeRect clipRectangle) { + public void Draw(Graphics g, IBitmapWithNativeSupport bitmap, RenderMode renderMode, NativeRect clipRectangle) { if (Parent == null) { return; @@ -465,7 +466,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { // Copy item = new ToolStripMenuItem(editorLanguage.EditorCopytoclipboard) { - Image = GreenshotResources.Instance.GetBitmap("copyToolStripMenuItem.Image", GetType()) + Image = GreenshotResources.Instance.GetBitmap("copyToolStripMenuItem.Image", GetType()).NativeBitmap }; item.Click += (sender, args) => ClipboardHelper.SetClipboardData(typeof(IDrawableContainerList), this); menu.Items.Add(item); @@ -473,7 +474,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { // Cut item = new ToolStripMenuItem(editorLanguage.EditorCuttoclipboard) { - Image = GreenshotResources.Instance.GetBitmap("btnCut.Image", GetType()) + Image = GreenshotResources.Instance.GetBitmap("btnCut.Image", GetType()).NativeBitmap }; item.Click += (sender, args) => { @@ -485,7 +486,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { // Delete item = new ToolStripMenuItem(editorLanguage.EditorDeleteelement) { - Image = GreenshotResources.Instance.GetBitmap("removeObjectToolStripMenuItem.Image", GetType()) + Image = GreenshotResources.Instance.GetBitmap("removeObjectToolStripMenuItem.Image", GetType()).NativeBitmap }; item.Click += (sender, args) => surface.RemoveElements(this); menu.Items.Add(item); @@ -571,8 +572,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { } } - #region IDisposable Support - private bool _disposedValue; // To detect redundant calls + private bool _disposedValue; // To detect redundant calls protected virtual void Dispose(bool disposing) { @@ -596,6 +596,5 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { // Do not change this code. Put cleanup code in Dispose(bool disposing) above. Dispose(true); } - #endregion - } + } } diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/EllipseContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/EllipseContainer.cs index 337c72ffe..264c056aa 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/EllipseContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/EllipseContainer.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.Drawing.Drawing2D; @@ -31,8 +25,6 @@ using Dapplo.Windows.Common.Structs; using Greenshot.Addon.LegacyEditor.Drawing.Fields; using Greenshot.Addons.Interfaces.Drawing; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/AbstractFieldHolder.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/AbstractFieldHolder.cs index 2204e4a61..225f74cf1 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/AbstractFieldHolder.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/AbstractFieldHolder.cs @@ -25,7 +25,6 @@ using System.ComponentModel; using System.Drawing; using System.Runtime.Serialization; using Dapplo.Log; -using Greenshot.Addon.LegacyEditor.Configuration.Impl; using Greenshot.Addons.Interfaces.Drawing; namespace Greenshot.Addon.LegacyEditor.Drawing.Fields @@ -136,8 +135,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields 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)); } @@ -171,9 +169,8 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields { return (Color)(GetFieldValue(fieldType) ?? defaultColor); } - #endregion - public bool HasField(IFieldType fieldType) + public bool HasField(IFieldType fieldType) { return _fieldsByType.ContainsKey(fieldType); } diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/AbstractFieldHolderWithChildren.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/AbstractFieldHolderWithChildren.cs index 93fca750a..32d35019c 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/AbstractFieldHolderWithChildren.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/AbstractFieldHolderWithChildren.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,17 +17,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Runtime.Serialization; using Greenshot.Addons.Interfaces.Drawing; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing.Fields { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/AbstractBindingConverter.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/AbstractBindingConverter.cs index fd98df1c1..4425a9fd1 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/AbstractBindingConverter.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/AbstractBindingConverter.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing.Fields.Binding { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/BidirectionalBinding.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/BidirectionalBinding.cs index 5463bc4ec..b98979873 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/BidirectionalBinding.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/BidirectionalBinding.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,16 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.ComponentModel; using System.Reflection; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing.Fields.Binding { /// @@ -152,7 +144,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields.Binding } try { - if (_validator == null || _validator.validate(bValue)) + if (_validator == null || _validator.Validate(bValue)) { targetPropertyInfo.SetValue(targetObject, bValue, null); } diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/DecimalDoublePercentageConverter.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/DecimalDoublePercentageConverter.cs index 56487414b..fd56ac11c 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/DecimalDoublePercentageConverter.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/DecimalDoublePercentageConverter.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,12 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing.Fields.Binding { /// @@ -32,7 +24,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields.Binding /// public class DecimalDoublePercentageConverter : AbstractBindingConverter { - private static DecimalDoublePercentageConverter uniqueInstance; + private static DecimalDoublePercentageConverter _uniqueInstance; private DecimalDoublePercentageConverter() { @@ -50,11 +42,11 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields.Binding public static DecimalDoublePercentageConverter GetInstance() { - if (uniqueInstance == null) + if (_uniqueInstance == null) { - uniqueInstance = new DecimalDoublePercentageConverter(); + _uniqueInstance = new DecimalDoublePercentageConverter(); } - return uniqueInstance; + return _uniqueInstance; } } } \ No newline at end of file diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/DecimalFloatConverter.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/DecimalFloatConverter.cs index 519a4e915..7172f7509 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/DecimalFloatConverter.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/DecimalFloatConverter.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,12 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing.Fields.Binding { /// @@ -32,7 +24,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields.Binding /// public class DecimalFloatConverter : AbstractBindingConverter { - private static DecimalFloatConverter uniqueInstance; + private static DecimalFloatConverter _uniqueInstance; private DecimalFloatConverter() { @@ -50,11 +42,11 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields.Binding public static DecimalFloatConverter GetInstance() { - if (uniqueInstance == null) + if (_uniqueInstance == null) { - uniqueInstance = new DecimalFloatConverter(); + _uniqueInstance = new DecimalFloatConverter(); } - return uniqueInstance; + return _uniqueInstance; } } } \ No newline at end of file diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/DecimalIntConverter.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/DecimalIntConverter.cs index 35f8db488..46ca2b48b 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/DecimalIntConverter.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/DecimalIntConverter.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,12 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing.Fields.Binding { /// @@ -32,7 +24,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields.Binding /// public class DecimalIntConverter : AbstractBindingConverter { - private static DecimalIntConverter uniqueInstance; + private static DecimalIntConverter _uniqueInstance; private DecimalIntConverter() { @@ -50,11 +42,11 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields.Binding public static DecimalIntConverter GetInstance() { - if (uniqueInstance == null) + if (_uniqueInstance == null) { - uniqueInstance = new DecimalIntConverter(); + _uniqueInstance = new DecimalIntConverter(); } - return uniqueInstance; + return _uniqueInstance; } } } \ No newline at end of file diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/IBindingConverter.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/IBindingConverter.cs index a71946154..da71b0e8b 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/IBindingConverter.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/IBindingConverter.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing.Fields.Binding { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/IBindingValidator.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/IBindingValidator.cs index acc95c93e..5b34b1de5 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/IBindingValidator.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/IBindingValidator.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing.Fields.Binding { /// @@ -31,6 +27,6 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields.Binding /// public interface IBindingValidator { - bool validate(object o); + bool Validate(object o); } } \ No newline at end of file diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/NotNullValidator.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/NotNullValidator.cs index a3c685bc9..e2a320746 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/NotNullValidator.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/NotNullValidator.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing.Fields.Binding { /// @@ -28,24 +24,24 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields.Binding /// public class NotNullValidator : IBindingValidator { - private static NotNullValidator uniqueInstance; + private static NotNullValidator _uniqueInstance; private NotNullValidator() { } - public bool validate(object o) + public bool Validate(object o) { return o != null; } public static NotNullValidator GetInstance() { - if (uniqueInstance == null) + if (_uniqueInstance == null) { - uniqueInstance = new NotNullValidator(); + _uniqueInstance = new NotNullValidator(); } - return uniqueInstance; + return _uniqueInstance; } } } \ No newline at end of file diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Field.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Field.cs index 335b4bd00..a0e503b0f 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Field.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Field.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,16 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.ComponentModel; using Greenshot.Addons.Interfaces.Drawing; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing.Fields { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldAggregator.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldAggregator.cs index e11bcbb5c..41ef95d81 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldAggregator.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldAggregator.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,20 +17,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; -using Greenshot.Addon.LegacyEditor.Configuration.Impl; using Greenshot.Addons.Interfaces; using Greenshot.Addons.Interfaces.Drawing; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing.Fields { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldType.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldType.cs index 126f51fb2..46ba5aaee 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldType.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldType.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using Greenshot.Addons.Interfaces.Drawing; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing.Fields { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldTypes.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldTypes.cs index 1f08c61de..5ac788ae9 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldTypes.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldTypes.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Drawing; using Greenshot.Addons.Interfaces.Drawing; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing.Fields { /// @@ -38,7 +30,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields { public static readonly IFieldType ARROWHEADS = new FieldType("ARROWHEADS"); public static readonly IFieldType BLUR_RADIUS = new FieldType("BLUR_RADIUS"); - public static readonly IFieldType BRIGHTNESS = new FieldType("BRIGHTNESS"); + public static readonly IFieldType BRIGHTNESS = new FieldType("BRIGHTNESS"); public static readonly IFieldType FILL_COLOR = new FieldType("FILL_COLOR"); public static readonly IFieldType FONT_BOLD = new FieldType("FONT_BOLD"); public static readonly IFieldType FONT_FAMILY = new FieldType("FONT_FAMILY"); diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/FilterContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/FilterContainer.cs index d6f7e1037..da783e041 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/FilterContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/FilterContainer.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.Drawing.Drawing2D; @@ -32,8 +26,6 @@ using Dapplo.Windows.Common.Structs; using Greenshot.Addon.LegacyEditor.Drawing.Fields; using Greenshot.Addons.Interfaces.Drawing; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/AbstractFilter.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/AbstractFilter.cs index 51fb9ba4b..003cc7cfc 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/AbstractFilter.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/AbstractFilter.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,18 +17,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.ComponentModel; using System.Drawing; using Dapplo.Windows.Common.Structs; using Greenshot.Addon.LegacyEditor.Drawing.Fields; using Greenshot.Addons.Interfaces.Drawing; - -#endregion +using Greenshot.Gfx; namespace Greenshot.Addon.LegacyEditor.Drawing.Filters { @@ -42,11 +35,11 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Filters [Serializable] public abstract class AbstractFilter : AbstractFieldHolder, IFilter { - private bool invert; + private bool _invert; protected DrawableContainer parent; - [NonSerialized] private PropertyChangedEventHandler propertyChanged; + [NonSerialized] private PropertyChangedEventHandler _propertyChanged; public AbstractFilter(DrawableContainer parent, IEditorConfiguration editorConfiguration) : base(editorConfiguration) { @@ -55,31 +48,31 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Filters public event PropertyChangedEventHandler PropertyChanged { - add { propertyChanged += value; } - remove { propertyChanged -= value; } - } + add => _propertyChanged += value; + remove => _propertyChanged -= value; + } public bool Invert { - get { return invert; } - set + get => _invert; + set { - invert = value; + _invert = value; OnPropertyChanged("Invert"); } } public DrawableContainer Parent { - get { return parent; } - set { parent = value; } - } + get => parent; + set => parent = value; + } - public abstract void Apply(Graphics graphics, Bitmap applyBitmap, NativeRect rect, RenderMode renderMode); + public abstract void Apply(Graphics graphics, IBitmapWithNativeSupport applyBitmap, NativeRect rect, RenderMode renderMode); protected void OnPropertyChanged(string propertyName) { - propertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + _propertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } } \ No newline at end of file diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/BlurFilter.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/BlurFilter.cs index 23c186940..ac1e666e1 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/BlurFilter.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/BlurFilter.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using Dapplo.Windows.Common.Structs; @@ -31,14 +25,12 @@ using Greenshot.Addons.Interfaces.Drawing; using Greenshot.Gfx; using Greenshot.Gfx.FastBitmap; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing.Filters { [Serializable] public class BlurFilter : AbstractFilter { - public double previewQuality; + private double _previewQuality; public BlurFilter(DrawableContainer parent, IEditorConfiguration editorConfiguration) : base(parent, editorConfiguration) { @@ -48,15 +40,15 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Filters public double PreviewQuality { - get { return previewQuality; } - set + get => _previewQuality; + set { - previewQuality = value; + _previewQuality = value; OnPropertyChanged("PreviewQuality"); } } - public override void Apply(Graphics graphics, Bitmap applyBitmap, NativeRect rect, RenderMode renderMode) + public override void Apply(Graphics graphics, IBitmapWithNativeSupport applyBitmap, NativeRect rect, RenderMode renderMode) { var blurRadius = GetFieldValueAsInt(FieldTypes.BLUR_RADIUS); var applyRect = BitmapHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert); diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/BrightnessFilter.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/BrightnessFilter.cs index 85bfd8787..0fad05d0d 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/BrightnessFilter.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/BrightnessFilter.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using Dapplo.Windows.Common.Structs; @@ -31,8 +25,6 @@ using Greenshot.Addons.Interfaces.Drawing; using Greenshot.Gfx; using Greenshot.Gfx.Effects; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing.Filters { [Serializable] @@ -50,7 +42,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Filters /// /// /// - public override void Apply(Graphics graphics, Bitmap applyBitmap, NativeRect rect, RenderMode renderMode) + public override void Apply(Graphics graphics, IBitmapWithNativeSupport applyBitmap, NativeRect rect, RenderMode renderMode) { var applyRect = BitmapHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert); @@ -69,7 +61,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Filters var brightness = GetFieldValueAsFloat(FieldTypes.BRIGHTNESS); using (var ia = AdjustEffect.CreateAdjustAttributes(brightness, 1f, 1f)) { - graphics.DrawImage(applyBitmap, applyRect, applyRect.X, applyRect.Y, applyRect.Width, applyRect.Height, GraphicsUnit.Pixel, ia); + graphics.DrawImage(applyBitmap.NativeBitmap, applyRect, applyRect.X, applyRect.Y, applyRect.Width, applyRect.Height, GraphicsUnit.Pixel, ia); } graphics.Restore(state); } diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/GrayscaleFilter.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/GrayscaleFilter.cs index 084723cc0..61bc31889 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/GrayscaleFilter.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/GrayscaleFilter.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.Drawing.Imaging; @@ -30,8 +24,6 @@ using Dapplo.Windows.Common.Structs; using Greenshot.Addons.Interfaces.Drawing; using Greenshot.Gfx; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing.Filters { /// @@ -44,7 +36,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Filters { } - public override void Apply(Graphics graphics, Bitmap applyBitmap, NativeRect rect, RenderMode renderMode) + public override void Apply(Graphics graphics, IBitmapWithNativeSupport applyBitmap, NativeRect rect, RenderMode renderMode) { var applyRect = BitmapHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert); @@ -70,7 +62,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Filters using (var ia = new ImageAttributes()) { ia.SetColorMatrix(grayscaleMatrix); - graphics.DrawImage(applyBitmap, applyRect, applyRect.X, applyRect.Y, applyRect.Width, applyRect.Height, GraphicsUnit.Pixel, ia); + graphics.DrawImage(applyBitmap.NativeBitmap, applyRect, applyRect.X, applyRect.Y, applyRect.Width, applyRect.Height, GraphicsUnit.Pixel, ia); } graphics.Restore(state); } diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/HighlightFilter.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/HighlightFilter.cs index a7f9ee247..fd58609de 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/HighlightFilter.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/HighlightFilter.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.Threading.Tasks; @@ -32,8 +26,6 @@ using Greenshot.Addons.Interfaces.Drawing; using Greenshot.Gfx; using Greenshot.Gfx.FastBitmap; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing.Filters { [Serializable] @@ -51,7 +43,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Filters /// /// /// - public override void Apply(Graphics graphics, Bitmap applyBitmap, NativeRect rect, RenderMode renderMode) + public override void Apply(Graphics graphics, IBitmapWithNativeSupport applyBitmap, NativeRect rect, RenderMode renderMode) { var applyRect = BitmapHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert); diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/IFilter.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/IFilter.cs index 03a322691..859f7f302 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/IFilter.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/IFilter.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,16 +17,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using System.Drawing; using Dapplo.Windows.Common.Structs; using Greenshot.Addons.Interfaces.Drawing; - -#endregion +using Greenshot.Gfx; namespace Greenshot.Addon.LegacyEditor.Drawing.Filters { @@ -51,9 +44,9 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Filters /// Apply this filter /// /// Graphics to use - /// Bitmap to apply to + /// IBitmapWithNativeSupport to apply to /// NativeRect with the area /// RenderMode to use - void Apply(Graphics graphics, Bitmap bmp, NativeRect rect, RenderMode renderMode); + void Apply(Graphics graphics, IBitmapWithNativeSupport bmp, NativeRect rect, RenderMode renderMode); } } \ No newline at end of file diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/MagnifierFilter.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/MagnifierFilter.cs index 7817c3e2f..f021e670d 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/MagnifierFilter.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/MagnifierFilter.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.Drawing.Drawing2D; @@ -31,8 +25,6 @@ using Greenshot.Addon.LegacyEditor.Drawing.Fields; using Greenshot.Addons.Interfaces.Drawing; using Greenshot.Gfx; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing.Filters { [Serializable] @@ -43,7 +35,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Filters AddField(GetType(), FieldTypes.MAGNIFICATION_FACTOR, 2); } - public override void Apply(Graphics graphics, Bitmap applyBitmap, NativeRect rect, RenderMode renderMode) + public override void Apply(Graphics graphics, IBitmapWithNativeSupport applyBitmap, NativeRect rect, RenderMode renderMode) { var applyRect = BitmapHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert); @@ -68,7 +60,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Filters var newWidth = rect.Width / magnificationFactor; var newHeight = rect.Height / magnificationFactor; var source = new NativeRect(rect.X + halfWidth - newWidth / 2, rect.Y + halfHeight - newHeight / 2, newWidth, newHeight); - graphics.DrawImage(applyBitmap, rect, source, GraphicsUnit.Pixel); + graphics.DrawImage(applyBitmap.NativeBitmap, rect, source, GraphicsUnit.Pixel); graphics.Restore(state); } } diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/PixelizationFilter.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/PixelizationFilter.cs index 385ab0e20..2026fe01c 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/PixelizationFilter.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/PixelizationFilter.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Drawing; @@ -33,8 +27,6 @@ using Greenshot.Addons.Interfaces.Drawing; using Greenshot.Gfx; using Greenshot.Gfx.FastBitmap; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing.Filters { /// @@ -48,7 +40,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Filters AddField(GetType(), FieldTypes.PIXEL_SIZE, 5); } - public override void Apply(Graphics graphics, Bitmap applyBitmap, NativeRect rect, RenderMode renderMode) + public override void Apply(Graphics graphics, IBitmapWithNativeSupport applyBitmap, NativeRect rect, RenderMode renderMode) { var pixelSize = GetFieldValueAsInt(FieldTypes.PIXEL_SIZE); BitmapHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert); diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/FreehandContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/FreehandContainer.cs index d084a8eba..77a6007c8 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/FreehandContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/FreehandContainer.cs @@ -41,12 +41,12 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { [NonSerialized] private readonly object _freehandPathLock = new object(); - private NativeRect myBounds = NativeRect.Empty; - private NativePoint lastMouse = NativePoint.Empty; - private readonly List capturePoints = new List(); + private NativeRect _myBounds = NativeRect.Empty; + private NativePoint _lastMouse = NativePoint.Empty; + private readonly List _capturePoints = new List(); [NonSerialized] - private GraphicsPath freehandPath = new GraphicsPath(); - private bool isRecalculated; + private GraphicsPath _freehandPath = new GraphicsPath(); + private bool _isRecalculated; /// /// Constructor @@ -65,10 +65,10 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { public override void Transform(Matrix matrix) { - var newPoints = capturePoints.Cast().ToArray(); + var newPoints = _capturePoints.Cast().ToArray(); matrix.TransformPoints(newPoints); - capturePoints.Clear(); - capturePoints.AddRange(newPoints.Cast()); + _capturePoints.Clear(); + _capturePoints.AddRange(newPoints.Cast()); RecalculatePath(); } @@ -84,9 +84,9 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { base.Dispose(disposing); if (disposing) { - freehandPath?.Dispose(); + _freehandPath?.Dispose(); } - freehandPath = null; + _freehandPath = null; } /// @@ -94,8 +94,8 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { /// /// true if the surface doesn't need to handle the event public override bool HandleMouseDown(int mouseX, int mouseY) { - lastMouse = new NativePoint(mouseX, mouseY); - capturePoints.Add(lastMouse); + _lastMouse = new NativePoint(mouseX, mouseY); + _capturePoints.Add(_lastMouse); return true; } @@ -104,23 +104,23 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { /// /// true if the surface doesn't need to handle the event public override bool HandleMouseMove(int mouseX, int mouseY) { - NativePoint previousPoint = capturePoints[capturePoints.Count-1]; + NativePoint previousPoint = _capturePoints[_capturePoints.Count-1]; if (GeometryHelper.Distance2D(previousPoint.X, previousPoint.Y, mouseX, mouseY) >= 2* _editorConfiguration.FreehandSensitivity) { - capturePoints.Add(new NativePoint(mouseX, mouseY)); + _capturePoints.Add(new NativePoint(mouseX, mouseY)); } - if (GeometryHelper.Distance2D(lastMouse.X, lastMouse.Y, mouseX, mouseY) < _editorConfiguration.FreehandSensitivity) + if (GeometryHelper.Distance2D(_lastMouse.X, _lastMouse.Y, mouseX, mouseY) < _editorConfiguration.FreehandSensitivity) { return true; } //path.AddCurve(new NativePoint[]{lastMouse, new NativePoint(mouseX, mouseY)}); - lastMouse = new NativePoint(mouseX, mouseY); + _lastMouse = new NativePoint(mouseX, mouseY); lock (_freehandPathLock) { - freehandPath.AddLine(lastMouse, new NativePoint(mouseX, mouseY)); + _freehandPath.AddLine(_lastMouse, new NativePoint(mouseX, mouseY)); // Only re-calculate the bounds & redraw when we added something to the path - NativeRectFloat rect = freehandPath.GetBounds(); - myBounds = rect.Round(); + NativeRectFloat rect = _freehandPath.GetBounds(); + _myBounds = rect.Round(); } Invalidate(); @@ -132,8 +132,8 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { /// public override void HandleMouseUp(int mouseX, int mouseY) { // Make sure we don't loose the ending point - if (GeometryHelper.Distance2D(lastMouse.X, lastMouse.Y, mouseX, mouseY) >= _editorConfiguration.FreehandSensitivity) { - capturePoints.Add(new NativePoint(mouseX, mouseY)); + if (GeometryHelper.Distance2D(_lastMouse.X, _lastMouse.Y, mouseX, mouseY) >= _editorConfiguration.FreehandSensitivity) { + _capturePoints.Add(new NativePoint(mouseX, mouseY)); } RecalculatePath(); } @@ -144,30 +144,30 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { private void RecalculatePath() { lock (_freehandPathLock) { - isRecalculated = true; + _isRecalculated = true; // Dispose the previous path, if we have one - freehandPath?.Dispose(); - freehandPath = new GraphicsPath(); + _freehandPath?.Dispose(); + _freehandPath = new GraphicsPath(); // Here we can put some cleanup... like losing all the uninteresting points. - if (capturePoints.Count >= 3) + if (_capturePoints.Count >= 3) { int index = 0; - while ((capturePoints.Count - 1) % 3 != 0) + while ((_capturePoints.Count - 1) % 3 != 0) { // duplicate points, first at 50% than 25% than 75% - capturePoints.Insert((int)(capturePoints.Count * PointOffset[index]), capturePoints[(int)(capturePoints.Count * PointOffset[index++])]); + _capturePoints.Insert((int)(_capturePoints.Count * PointOffset[index]), _capturePoints[(int)(_capturePoints.Count * PointOffset[index++])]); } - freehandPath.AddBeziers(capturePoints.Cast().ToArray()); + _freehandPath.AddBeziers(_capturePoints.Cast().ToArray()); } - else if (capturePoints.Count == 2) + else if (_capturePoints.Count == 2) { - freehandPath.AddLine(capturePoints[0], capturePoints[1]); + _freehandPath.AddLine(_capturePoints[0], _capturePoints[1]); } // Recalculate the bounds - NativeRectFloat rect = freehandPath.GetBounds(); - myBounds = rect.Round(); + NativeRectFloat rect = _freehandPath.GetBounds(); + _myBounds = rect.Round(); } @@ -200,11 +200,11 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { graphics.TranslateTransform(Left, Top); lock (_freehandPathLock) { - if (isRecalculated && Selected && renderMode == RenderMode.Edit) + if (_isRecalculated && Selected && renderMode == RenderMode.Edit) { - DrawSelectionBorder(graphics, pen, freehandPath); + DrawSelectionBorder(graphics, pen, _freehandPath); } - graphics.DrawPath(pen, freehandPath); + graphics.DrawPath(pen, _freehandPath); } // Move back, otherwise everything is shifted @@ -238,10 +238,10 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { /// public override NativeRect DrawingBounds { get { - if (!myBounds.IsEmpty) { + if (!_myBounds.IsEmpty) { int lineThickness = Math.Max(10, GetFieldValueAsInt(FieldTypes.LINE_THICKNESS)); int safetymargin = 10; - return new NativeRect(myBounds.Left + Left - (safetymargin+lineThickness), myBounds.Top + Top - (safetymargin+lineThickness), myBounds.Width + 2*(lineThickness+safetymargin), myBounds.Height + 2*(lineThickness+safetymargin)); + return new NativeRect(_myBounds.Left + Left - (safetymargin+lineThickness), _myBounds.Top + Top - (safetymargin+lineThickness), _myBounds.Width + 2*(lineThickness+safetymargin), _myBounds.Height + 2*(lineThickness+safetymargin)); } return new NativeRect(0, 0, _parent?.Width??0, _parent?.Height?? 0); } @@ -259,7 +259,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { return false; } - if (obj is FreehandContainer other && Equals(freehandPath, other.freehandPath)) { + if (obj is FreehandContainer other && Equals(_freehandPath, other._freehandPath)) { ret = true; } return ret; @@ -268,7 +268,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { public override int GetHashCode() { lock (_freehandPathLock) { - return freehandPath?.GetHashCode() ?? 0; + return _freehandPath?.GetHashCode() ?? 0; } } @@ -280,7 +280,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { pen.Width = lineThickness + 10; lock (_freehandPathLock) { - returnValue = freehandPath.IsOutlineVisible(x - Left, y - Top, pen); + returnValue = _freehandPath.IsOutlineVisible(x - Left, y - Top, pen); } } } diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/HighlightContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/HighlightContainer.cs index 4b2aea6d0..eff5b78de 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/HighlightContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/HighlightContainer.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,18 +17,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Runtime.Serialization; using Greenshot.Addon.LegacyEditor.Drawing.Fields; using Greenshot.Addon.LegacyEditor.Drawing.Filters; using Greenshot.Addons.Interfaces.Drawing; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/IconContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/IconContainer.cs index 5c56f417c..f3d071602 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/IconContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/IconContainer.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.Drawing.Drawing2D; @@ -31,8 +25,6 @@ using System.Runtime.Serialization; using Dapplo.Log; using Greenshot.Addons.Interfaces.Drawing; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/LineContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/LineContainer.cs index 9a1ddf9c6..09d1c19bd 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/LineContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/LineContainer.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.Drawing.Drawing2D; @@ -32,8 +26,6 @@ using Greenshot.Addon.LegacyEditor.Drawing.Fields; using Greenshot.Addons.Interfaces.Drawing; using Greenshot.Gfx.Legacy; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/ObfuscateContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/ObfuscateContainer.cs index 9d1f7e4e4..64bb41502 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/ObfuscateContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/ObfuscateContainer.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,18 +17,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Runtime.Serialization; using Greenshot.Addon.LegacyEditor.Drawing.Fields; using Greenshot.Addon.LegacyEditor.Drawing.Filters; using Greenshot.Addons.Interfaces.Drawing; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/SpeechbubbleContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/SpeechbubbleContainer.cs index e924b2b7c..1be21a56d 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/SpeechbubbleContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/SpeechbubbleContainer.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.Drawing.Drawing2D; @@ -34,8 +28,6 @@ using Greenshot.Addon.LegacyEditor.Drawing.Fields; using Greenshot.Addons.Interfaces.Drawing; using Greenshot.Gfx.Legacy; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing { /// @@ -365,9 +357,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing return Contains(x, y); } - #region TargetGripper serializing code - - // Only used for serializing the TargetGripper location + // Only used for serializing the TargetGripper location private NativePoint _storedTargetGripperLocation; /// @@ -392,7 +382,5 @@ namespace Greenshot.Addon.LegacyEditor.Drawing base.OnDeserialized(streamingContext); InitAdorner(Color.Green, _storedTargetGripperLocation); } - - #endregion - } + } } \ No newline at end of file diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/StepLabelContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/StepLabelContainer.cs index c2d3234e1..e4520ba41 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/StepLabelContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/StepLabelContainer.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.Drawing.Drawing2D; @@ -33,8 +27,6 @@ using Dapplo.Windows.Common.Structs; using Greenshot.Addon.LegacyEditor.Drawing.Fields; using Greenshot.Addons.Interfaces.Drawing; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing { /// @@ -48,7 +40,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing [NonSerialized] private StringFormat _stringFormat = new StringFormat(); - private float fontSize = 16; + private float _fontSize = 16; public StepLabelContainer(Surface parent, IEditorConfiguration editorConfiguration) : base(parent, editorConfiguration) { @@ -176,7 +168,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing var heightAfter = rect.Height; var factor = ((float) widthAfter / widthBefore + (float) heightAfter / heightBefore) / 2; - fontSize *= factor; + _fontSize *= factor; } /// @@ -205,7 +197,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing } using (var fam = new FontFamily(FontFamily.GenericSansSerif.Name)) { - using (var font = new Font(fam, fontSize, FontStyle.Bold, GraphicsUnit.Pixel)) + using (var font = new Font(fam, _fontSize, FontStyle.Bold, GraphicsUnit.Pixel)) { TextContainer.DrawText(graphics, rect, 0, lineColor, false, _stringFormat, text, font); } @@ -223,9 +215,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing return EllipseContainer.EllipseClickableAt(rect, 0, fillColor, x, y); } - #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; // Used to store the counter start of the Surface, as the surface is NOT stored. private int _counterStart = 1; @@ -249,7 +239,5 @@ namespace Greenshot.Addon.LegacyEditor.Drawing _counterStart = ((Surface) Parent).CounterStart; } } - - #endregion - } + } } \ No newline at end of file diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Surface.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Surface.cs index f317562ff..aa7e2b4c9 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Surface.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Surface.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.ComponentModel; @@ -38,7 +32,6 @@ using Dapplo.Windows.Common.Extensions; using Dapplo.Windows.Common.Structs; using Greenshot.Addon.LegacyEditor.Drawing.Fields; using Greenshot.Addon.LegacyEditor.Memento; -using Greenshot.Addons.Config.Impl; using Greenshot.Addons.Controls; using Greenshot.Addons.Core; using Greenshot.Addons.Interfaces; @@ -47,8 +40,6 @@ using Greenshot.Addons.Interfaces.Drawing.Adorners; using Greenshot.Gfx; using Greenshot.Gfx.Effects; -#endregion - namespace Greenshot.Addon.LegacyEditor.Drawing { /// @@ -59,7 +50,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing private static readonly LogSource Log = new LogSource(); /// - /// The number of Surfaces in existance + /// The number of Surfaces in existence /// public static int Count { get; private set; } @@ -93,7 +84,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// all selected elements, do not serialize /// [NonSerialized] - private readonly IDrawableContainerList selectedElements; + private readonly IDrawableContainerList _selectedElements; /// /// The buffer is only for drawing on it when using filters (to supply access) @@ -103,7 +94,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// TODO: Check if this buffer is still needed! /// [NonSerialized] - private Bitmap _buffer; + private IBitmapWithNativeSupport _buffer; /// /// This value is used to start counting the step labels @@ -144,7 +135,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// /// The image is the actual captured image, needed with serialization /// - private Bitmap _screenshot; + private IBitmapWithNativeSupport _screenshot; /// /// inUndoRedo makes sure we don't undo/redo while in a undo/redo action @@ -153,13 +144,13 @@ namespace Greenshot.Addon.LegacyEditor.Drawing private bool _inUndoRedo; /// - /// Make only one surfacemove cycle undoable, see SurfaceMouseMove + /// Make only one surface move cycle undoable, see SurfaceMouseMove /// [NonSerialized] private bool _isSurfaceMoveMadeUndoable; /// - /// the keyslocked flag helps with focus issues + /// the keys locked flag helps with focus issues /// [NonSerialized] private bool _keysLocked; @@ -230,10 +221,12 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// public Surface(ICoreConfiguration coreConfiguration, IEditorConfiguration editorConfiguration) { + _editorConfiguration = editorConfiguration; + _coreConfiguration = coreConfiguration; _fieldAggregator = new FieldAggregator(this, editorConfiguration); Count++; - _elements = new DrawableContainerList(ID); - selectedElements = new DrawableContainerList(ID); + _elements = new DrawableContainerList(Id); + _selectedElements = new DrawableContainerList(Id); Log.Debug().WriteLine("Creating surface!"); MouseDown += SurfaceMouseDown; MouseUp += SurfaceMouseUp; @@ -244,7 +237,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing DragDrop += OnDragDrop; DragEnter += OnDragEnter; // bind selected & elements to this, otherwise they can't inform of modifications - selectedElements.Parent = this; + _selectedElements.Parent = this; _elements.Parent = this; // Make sure we are visible Visible = true; @@ -259,18 +252,22 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// /// Surface constructor with an image /// - /// Bitmap - public Surface(ICoreConfiguration coreConfiguration, IEditorConfiguration editorConfiguration, Bitmap newBitmap) : this(coreConfiguration, editorConfiguration) + /// ICoreConfiguration + /// IEditorConfiguration + /// IBitmapWithNativeSupport + public Surface(ICoreConfiguration coreConfiguration, IEditorConfiguration editorConfiguration, IBitmapWithNativeSupport newBitmap) : this(coreConfiguration, editorConfiguration) { Log.Debug().WriteLine("Got Bitmap with dimensions {0} and format {1}", newBitmap.Size, newBitmap.PixelFormat); SetBitmap(newBitmap, true); } - /// - /// Surface contructor with a capture - /// - /// - public Surface(ICoreConfiguration coreConfiguration, IEditorConfiguration editorConfiguration, ICapture capture) : this(coreConfiguration, editorConfiguration) + /// + /// Surface constructor with a capture + /// + /// ICoreConfiguration + /// IEditorConfiguration + /// ICapture + public Surface(ICoreConfiguration coreConfiguration, IEditorConfiguration editorConfiguration, ICapture capture) : this(coreConfiguration, editorConfiguration) { SetCapture(capture); } @@ -308,9 +305,9 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// public FieldAggregator FieldAggregator { - get { return _fieldAggregator; } - set { _fieldAggregator = value; } - } + get => _fieldAggregator; + set => _fieldAggregator = value; + } /// /// The cursor container has it's own accessor so we can find and remove this (when needed) @@ -322,26 +319,26 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// public Brush TransparencyBackgroundBrush { - get { return _transparencyBackgroundBrush; } - set { _transparencyBackgroundBrush = value; } - } + get => _transparencyBackgroundBrush; + set => _transparencyBackgroundBrush = value; + } /// /// Are the keys on this surface locked? /// public bool KeysLocked { - get { return _keysLocked; } - set { _keysLocked = value; } - } + get => _keysLocked; + set => _keysLocked = value; + } /// /// The DrawingMode property specifies the mode for drawing, more or less the element type. /// public DrawingModes DrawingMode { - get { return _drawingMode; } - set + get => _drawingMode; + set { _drawingMode = value; if (_drawingModeChanged != null) @@ -369,46 +366,46 @@ namespace Greenshot.Addon.LegacyEditor.Drawing public event PropertyChangedEventHandler PropertyChanged { - add { _propertyChanged += value; } - remove { _propertyChanged -= value; } - } + add => _propertyChanged += value; + remove => _propertyChanged -= value; + } /// /// The GUID of the surface /// - public Guid ID { get; set; } = Guid.NewGuid(); + public Guid Id { get; set; } = Guid.NewGuid(); public event SurfaceElementEventHandler MovingElementChanged { - add { _movingElementChanged += value; } - remove { _movingElementChanged -= value; } - } + add => _movingElementChanged += value; + remove => _movingElementChanged -= value; + } public event SurfaceDrawingModeEventHandler DrawingModeChanged { - add { _drawingModeChanged += value; } - remove { _drawingModeChanged -= value; } - } + add => _drawingModeChanged += value; + remove => _drawingModeChanged -= value; + } public event SurfaceSizeChangeEventHandler SurfaceSizeChanged { - add { _surfaceSizeChanged += value; } - remove { _surfaceSizeChanged -= value; } - } + add => _surfaceSizeChanged += value; + remove => _surfaceSizeChanged -= value; + } public event SurfaceMessageEventHandler SurfaceMessage { - add { _surfaceMessage += value; } - remove { _surfaceMessage -= value; } - } + add => _surfaceMessage += value; + remove => _surfaceMessage -= value; + } /// /// The start value of the counter objects /// public int CounterStart { - get { return _counterStart; } - set + get => _counterStart; + set { if (_counterStart == value) { @@ -421,10 +418,10 @@ namespace Greenshot.Addon.LegacyEditor.Drawing } } - public Bitmap Screenshot + public IBitmapWithNativeSupport Screenshot { - get { return _screenshot; } - set + get => _screenshot; + set { _screenshot = value; Size = _screenshot.Size; @@ -450,18 +447,18 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// public bool Modified { - get { return _modified; } - set { _modified = value; } - } + get => _modified; + set => _modified = value; + } /// /// Property for accessing the last save "full" path /// public string LastSaveFullPath { - get { return _lastSaveFullPath; } - set { _lastSaveFullPath = value; } - } + get => _lastSaveFullPath; + set => _lastSaveFullPath = value; + } /// /// Property for accessing the URL to which the surface was recently uploaded @@ -621,7 +618,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// This returns the image "result" of this surface, with all the elements rendered on it. /// /// - public Bitmap GetBitmapForExport() + public IBitmapWithNativeSupport GetBitmapForExport() { return GetBitmap(RenderMode.Export); } @@ -747,7 +744,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// Returns if this surface has selected elements /// /// - public bool HasSelectedElements => selectedElements != null && selectedElements.Count > 0; + public bool HasSelectedElements => _selectedElements != null && _selectedElements.Count > 0; /// /// Remove all the selected elements @@ -757,7 +754,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing if (HasSelectedElements) { // As RemoveElement will remove the element from the selectedElements list we need to copy the element to another list. - RemoveElements(selectedElements); + RemoveElements(_selectedElements); if (_movingElementChanged != null) { var eventArgs = new SurfaceElementEventArgs(); @@ -773,7 +770,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { if (HasSelectedElements) { - ClipboardHelper.SetClipboardData(typeof(IDrawableContainerList), selectedElements); + ClipboardHelper.SetClipboardData(typeof(IDrawableContainerList), _selectedElements); RemoveSelectedElements(); } } @@ -785,7 +782,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { if (HasSelectedElements) { - ClipboardHelper.SetClipboardData(typeof(IDrawableContainerList), selectedElements); + ClipboardHelper.SetClipboardData(typeof(IDrawableContainerList), _selectedElements); } } @@ -816,7 +813,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing if (dcs != null) { // Make element(s) only move 10,10 if the surface is the same - var isSameSurface = dcs.ParentID == ID; + var isSameSurface = dcs.ParentID == Id; dcs.Parent = this; var moveOffset = isSameSurface ? new NativePoint(10, 10) : NativePoint.Empty; // Here a fix for bug #1475, first calculate the bounds of the complete IDrawableContainerList @@ -898,16 +895,18 @@ namespace Greenshot.Addon.LegacyEditor.Drawing foreach (var clipboardImage in ClipboardHelper.GetBitmaps(clipboard)) { - if (clipboardImage != null) - { - DeselectAllElements(); - var container = AddImageContainer(clipboardImage as Bitmap, x, y); - SelectElement(container); - clipboardImage.Dispose(); - x += 10; - y += 10; - } - } + if (clipboardImage == null) + { + continue; + } + + DeselectAllElements(); + var container = AddImageContainer(clipboardImage, x, y); + SelectElement(container); + clipboardImage.Dispose(); + x += 10; + y += 10; + } } else if (ClipboardHelper.ContainsText(clipboard)) { @@ -927,8 +926,8 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// public void DuplicateSelectedElements() { - Log.Debug().WriteLine("Duplicating {0} selected elements", selectedElements.Count); - var dcs = selectedElements.Clone(); + Log.Debug().WriteLine("Duplicating {0} selected elements", _selectedElements.Count); + var dcs = _selectedElements.Clone(); dcs.Parent = this; dcs.MoveBy(10, 10); AddElements(dcs); @@ -944,11 +943,11 @@ namespace Greenshot.Addon.LegacyEditor.Drawing public void DeselectElement(IDrawableContainer container, bool generateEvents = true) { container.Selected = false; - selectedElements.Remove(container); + _selectedElements.Remove(container); FieldAggregator.UnbindElement(container); if (generateEvents && _movingElementChanged != null) { - var eventArgs = new SurfaceElementEventArgs {Elements = selectedElements}; + var eventArgs = new SurfaceElementEventArgs {Elements = _selectedElements}; _movingElementChanged(this, eventArgs); } } @@ -958,7 +957,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// public void DeselectAllElements() { - DeselectElements(selectedElements); + DeselectElements(_selectedElements); } /// @@ -969,16 +968,16 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// false to skip event generation public void SelectElement(IDrawableContainer container, bool invalidate = true, bool generateEvents = true) { - if (!selectedElements.Contains(container)) + if (!_selectedElements.Contains(container)) { - selectedElements.Add(container); + _selectedElements.Add(container); container.Selected = true; FieldAggregator.BindElement(container); if (generateEvents && _movingElementChanged != null) { var eventArgs = new SurfaceElementEventArgs { - Elements = selectedElements + Elements = _selectedElements }; _movingElementChanged(this, eventArgs); } @@ -1003,7 +1002,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing } if (_movingElementChanged != null) { - var eventArgs = new SurfaceElementEventArgs {Elements = selectedElements}; + var eventArgs = new SurfaceElementEventArgs {Elements = _selectedElements}; _movingElementChanged(this, eventArgs); } ResumeLayout(); @@ -1060,7 +1059,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// /// The new bitmap /// true if the old bitmap needs to be disposed, when using undo this should not be true!! - public void SetBitmap(Bitmap newBitmap, bool dispose = false) + public void SetBitmap(IBitmapWithNativeSupport newBitmap, bool dispose = false) { // Dispose if (_screenshot != null && dispose) @@ -1245,7 +1244,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing public void Clear(Color newColor) { //create a blank bitmap the same size as original - var newBitmap = Screenshot.CreateEmptyLike(Color.Empty); + var newBitmap = Screenshot.CreateEmptyLike(newColor); if (newBitmap != null) { // Make undoable @@ -1296,11 +1295,11 @@ namespace Greenshot.Addon.LegacyEditor.Drawing if (IsCropPossible(ref cropRectangle)) { var imageRectangle = new NativeRect(NativePoint.Empty, Screenshot.Size); - Bitmap tmpImage; + IBitmapWithNativeSupport tmpImage; // Make sure we have information, this this fails try { - tmpImage = Screenshot.CloneBitmap(PixelFormat.DontCare, cropRectangle) as Bitmap; + tmpImage = Screenshot.CloneBitmap(PixelFormat.DontCare, cropRectangle); } catch (Exception ex) { @@ -1335,7 +1334,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// /// /// - public void UndoBackgroundChange(Bitmap previous, Matrix matrix) + public void UndoBackgroundChange(IBitmapWithNativeSupport previous, Matrix matrix) { SetBitmap(previous, false); if (matrix != null) @@ -1353,7 +1352,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// IAdorner private IAdorner FindActiveAdorner(MouseEventArgs mouseEventArgs) { - foreach (var drawableContainer in selectedElements) + foreach (var drawableContainer in _selectedElements) { foreach (var adorner in drawableContainer.Adorners) { @@ -1391,9 +1390,9 @@ namespace Greenshot.Addon.LegacyEditor.Drawing if (e.Button == MouseButtons.Right) { IDrawableContainerList selectedList = null; - if (selectedElements != null && selectedElements.Count > 0) + if (_selectedElements != null && _selectedElements.Count > 0) { - selectedList = selectedElements; + selectedList = _selectedElements; } else { @@ -1401,7 +1400,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing var rightClickedContainer = _elements.ClickableElementAt(_mouseStart.X, _mouseStart.Y); if (rightClickedContainer != null) { - selectedList = new DrawableContainerList(ID) {rightClickedContainer}; + selectedList = new DrawableContainerList(Id) {rightClickedContainer}; } } if (selectedList != null && selectedList.Count > 0) @@ -1492,7 +1491,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing if (element != null) { element.Invalidate(); - var alreadySelected = selectedElements.Contains(element); + var alreadySelected = _selectedElements.Contains(element); if (shiftModifier) { if (alreadySelected) @@ -1519,10 +1518,10 @@ namespace Greenshot.Addon.LegacyEditor.Drawing } } - if (selectedElements.Count > 0) + if (_selectedElements.Count > 0) { - selectedElements.Invalidate(); - selectedElements.Selected = true; + _selectedElements.Invalidate(); + _selectedElements.Selected = true; } if (_drawingElement != null) @@ -1573,7 +1572,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { // an element is currently dragged _mouseDownElement.Invalidate(); - selectedElements.Invalidate(); + _selectedElements.Invalidate(); // Move the element if (_mouseDownElement.Selected) { @@ -1581,10 +1580,10 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { // Only allow one undoable per mouse-down/move/up "cycle" _isSurfaceMoveMadeUndoable = true; - selectedElements.MakeBoundsChangeUndoable(false); + _selectedElements.MakeBoundsChangeUndoable(false); } // dragged element has been selected before -> move all - selectedElements.MoveBy(currentMouse.X - _mouseStart.X, currentMouse.Y - _mouseStart.Y); + _selectedElements.MoveBy(currentMouse.X - _mouseStart.X, currentMouse.Y - _mouseStart.Y); } else { @@ -1616,8 +1615,8 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// private void SurfaceDoubleClick(object sender, MouseEventArgs e) { - selectedElements.OnDoubleClick(); - selectedElements.Invalidate(); + _selectedElements.OnDoubleClick(); + _selectedElements.Invalidate(); } /// @@ -1625,12 +1624,12 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// /// /// - private Bitmap GetBitmap(RenderMode renderMode) + private IBitmapWithNativeSupport GetBitmap(RenderMode renderMode) { // Generate a copy of the original image with a dpi equal to the default... var clone = _screenshot.CloneBitmap(); // otherwise we would have a problem drawing the image to the surface... :( - using (var graphics = Graphics.FromImage(clone)) + using (var graphics = Graphics.FromImage(clone.NativeBitmap)) { // do not set SmoothingMode, PixelOffsetMode, CompositingQuality and InterpolationMode the containers need to decide this themselves! _elements.Draw(graphics, clone, renderMode, new NativeRect(NativePoint.Empty, clone.Size)); @@ -1666,27 +1665,27 @@ namespace Greenshot.Addon.LegacyEditor.Drawing Log.Debug().WriteLine("Created buffer with size: {0}x{1}", Screenshot.Width, Screenshot.Height); } // Elements might need the bitmap, so we copy the part we need - using (var graphics = Graphics.FromImage(_buffer)) + using (var graphics = Graphics.FromImage(_buffer.NativeBitmap)) { // do not set SmoothingMode, PixelOffsetMode, CompositingQuality and InterpolationMode the containers need to decide this themselves! DrawBackground(graphics, clipRectangle); - graphics.DrawImage(Screenshot, clipRectangle, clipRectangle, GraphicsUnit.Pixel); + graphics.DrawImage(Screenshot.NativeBitmap, clipRectangle, clipRectangle, GraphicsUnit.Pixel); graphics.SetClip(targetGraphics); _elements.Draw(graphics, _buffer, RenderMode.Edit, clipRectangle); } - targetGraphics.DrawImage(_buffer, clipRectangle, clipRectangle, GraphicsUnit.Pixel); + targetGraphics.DrawImage(_buffer.NativeBitmap, clipRectangle, clipRectangle, GraphicsUnit.Pixel); } else { DrawBackground(targetGraphics, clipRectangle); - targetGraphics.DrawImage(Screenshot, clipRectangle, clipRectangle, GraphicsUnit.Pixel); + targetGraphics.DrawImage(Screenshot.NativeBitmap, clipRectangle, clipRectangle, GraphicsUnit.Pixel); _elements.Draw(targetGraphics, null, RenderMode.Edit, clipRectangle); } // No clipping for the adorners targetGraphics.ResetClip(); // Draw adorners last - foreach (var drawableContainer in selectedElements) + foreach (var drawableContainer in _selectedElements) { foreach (var adorner in drawableContainer.Adorners) { @@ -1725,7 +1724,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing public void ConfirmSelectedConfirmableElements(bool confirm) { // create new collection so that we can iterate safely (selectedElements might change due with confirm/cancel) - var selectedDCs = new List(selectedElements); + var selectedDCs = new List(_selectedElements); foreach (var dc in selectedDCs) { if (dc.Equals(_cropContainer)) @@ -1763,7 +1762,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { var eventArgs = new SurfaceElementEventArgs { - Elements = selectedElements + Elements = _selectedElements }; _movingElementChanged(this, eventArgs); } @@ -1785,7 +1784,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// false if no keys were processed public bool ProcessCmdKey(Keys k) { - if (selectedElements.Count > 0) + if (_selectedElements.Count > 0) { var shiftModifier = (ModifierKeys & Keys.Shift) == Keys.Shift; var px = shiftModifier ? 10 : 1; @@ -1835,8 +1834,8 @@ namespace Greenshot.Addon.LegacyEditor.Drawing } if (!NativePoint.Empty.Equals(moveBy)) { - selectedElements.MakeBoundsChangeUndoable(true); - selectedElements.MoveBy(moveBy.X, moveBy.Y); + _selectedElements.MakeBoundsChangeUndoable(true); + _selectedElements.MoveBy(moveBy.X, moveBy.Y); } return true; } @@ -1848,7 +1847,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// public void PullElementsUp() { - _elements.PullElementsUp(selectedElements); + _elements.PullElementsUp(_selectedElements); _elements.Invalidate(); } @@ -1857,7 +1856,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// public void PullElementsToTop() { - _elements.PullElementsToTop(selectedElements); + _elements.PullElementsToTop(_selectedElements); _elements.Invalidate(); } @@ -1866,7 +1865,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// public void PushElementsDown() { - _elements.PushElementsDown(selectedElements); + _elements.PushElementsDown(_selectedElements); _elements.Invalidate(); } @@ -1875,7 +1874,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// public void PushElementsToBottom() { - _elements.PushElementsToBottom(selectedElements); + _elements.PushElementsToBottom(_selectedElements); _elements.Invalidate(); } @@ -1885,7 +1884,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// true if selected elements could be pulled up, false otherwise public bool CanPullSelectionUp() { - return _elements.CanPullUp(selectedElements); + return _elements.CanPullUp(_selectedElements); } /// @@ -1894,17 +1893,15 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// true if selected elements could be pushed down, false otherwise public bool CanPushSelectionDown() { - return _elements.CanPushDown(selectedElements); + return _elements.CanPushDown(_selectedElements); } public void Element_FieldChanged(object sender, FieldChangedEventArgs e) { - selectedElements.HandleFieldChangedEvent(sender, e); + _selectedElements.HandleFieldChangedEvent(sender, e); } - #region Plugin interface implementations - - public IBitmapContainer AddImageContainer(Bitmap bitmap, int x, int y) + public IBitmapContainer AddImageContainer(IBitmapWithNativeSupport bitmap, int x, int y) { var bitmapContainer = new BitmapContainer(this, _editorConfiguration) { @@ -1991,11 +1988,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing return textContainer; } - #endregion - - #region DragDrop - - private void OnDragEnter(object sender, DragEventArgs e) + private void OnDragEnter(object sender, DragEventArgs e) { if (Log.IsDebugEnabled()) { @@ -2043,7 +2036,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { if (image != null) { - AddImageContainer(image, mouse.X, mouse.Y); + AddImageContainer(BitmapWrapper.FromBitmap(image), mouse.X, mouse.Y); return; } } @@ -2062,7 +2055,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { if (image != null) { - AddImageContainer(image, mouse.X, mouse.Y); + AddImageContainer(BitmapWrapper.FromBitmap(image), mouse.X, mouse.Y); return; } } @@ -2076,7 +2069,5 @@ namespace Greenshot.Addon.LegacyEditor.Drawing image.Dispose(); } } - - #endregion - } + } } \ No newline at end of file diff --git a/src/Greenshot.Addon.LegacyEditor/EditorAddonModule.cs b/src/Greenshot.Addon.LegacyEditor/EditorAddonModule.cs index 37fdb897d..a76d0ddca 100644 --- a/src/Greenshot.Addon.LegacyEditor/EditorAddonModule.cs +++ b/src/Greenshot.Addon.LegacyEditor/EditorAddonModule.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Autofac; using Dapplo.Addons; using Dapplo.CaliburnMicro.Configuration; diff --git a/src/Greenshot.Addon.LegacyEditor/EditorConfigurationExtensions.cs b/src/Greenshot.Addon.LegacyEditor/EditorConfigurationExtensions.cs index 33ca1246d..f83d074d0 100644 --- a/src/Greenshot.Addon.LegacyEditor/EditorConfigurationExtensions.cs +++ b/src/Greenshot.Addon.LegacyEditor/EditorConfigurationExtensions.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Collections.Generic; using System.Drawing; diff --git a/src/Greenshot.Addon.LegacyEditor/EditorDestination.cs b/src/Greenshot.Addon.LegacyEditor/EditorDestination.cs index 6bb5b2146..4ccab0e04 100644 --- a/src/Greenshot.Addon.LegacyEditor/EditorDestination.cs +++ b/src/Greenshot.Addon.LegacyEditor/EditorDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,13 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; -using System.Drawing; using System.Linq; using Dapplo.Log; using Greenshot.Addons; @@ -34,8 +27,7 @@ using Greenshot.Addons.Core; using Greenshot.Addons.Interfaces; using Greenshot.Addons.Interfaces.Forms; using Greenshot.Addons.Resources; - -#endregion +using Greenshot.Gfx; namespace Greenshot.Addon.LegacyEditor { @@ -49,7 +41,7 @@ namespace Greenshot.Addon.LegacyEditor private readonly EditorFactory _editorFactory; private readonly IEditorLanguage _editorLanguage; private static readonly LogSource Log = new LogSource(); - private static readonly Bitmap greenshotIcon = GreenshotResources.Instance.GetGreenshotIcon().ToBitmap(); + private static readonly IBitmapWithNativeSupport greenshotIcon = BitmapWrapper.FromBitmap(GreenshotResources.Instance.GetGreenshotIcon().ToBitmap()); private readonly IImageEditor _editor; /// @@ -93,7 +85,7 @@ namespace Greenshot.Addon.LegacyEditor public override bool IsDynamic => true; - public override Bitmap DisplayIcon => greenshotIcon; + public override IBitmapWithNativeSupport DisplayIcon => greenshotIcon; public override IEnumerable DynamicDestinations() { diff --git a/src/Greenshot.Addon.LegacyEditor/EditorFactory.cs b/src/Greenshot.Addon.LegacyEditor/EditorFactory.cs index ac9d8219c..55376c0fc 100644 --- a/src/Greenshot.Addon.LegacyEditor/EditorFactory.cs +++ b/src/Greenshot.Addon.LegacyEditor/EditorFactory.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Collections.Generic; using System.Linq; diff --git a/src/Greenshot.Addon.LegacyEditor/Forms/DropShadowSettingsForm.cs b/src/Greenshot.Addon.LegacyEditor/Forms/DropShadowSettingsForm.cs index 6e93ec54d..c94450c7c 100644 --- a/src/Greenshot.Addon.LegacyEditor/Forms/DropShadowSettingsForm.cs +++ b/src/Greenshot.Addon.LegacyEditor/Forms/DropShadowSettingsForm.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.Windows.Forms; @@ -30,8 +24,6 @@ using Greenshot.Addons; using Greenshot.Addons.Controls; using Greenshot.Gfx.Effects; -#endregion - namespace Greenshot.Addon.LegacyEditor.Forms { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.cs b/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.cs index 2afcd4dde..db8c5794f 100644 --- a/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.cs +++ b/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Drawing; @@ -57,8 +51,6 @@ using Greenshot.Addons.Resources; using Greenshot.Gfx; using Greenshot.Gfx.Effects; -#endregion - namespace Greenshot.Addon.LegacyEditor.Forms { /// @@ -73,6 +65,7 @@ namespace Greenshot.Addon.LegacyEditor.Forms private readonly IEditorLanguage _editorLanguage; private readonly ICoreConfiguration _coreConfiguration; private readonly IGreenshotLanguage _greenshotLanguage; + private readonly Func _converter = bitmap => bitmap?.NativeBitmap; // whether part of the editor controls are disabled depending on selected item(s) private bool _controlsDisabledDueToConfirmable; @@ -80,7 +73,7 @@ namespace Greenshot.Addon.LegacyEditor.Forms private bool _originalItalicCheckState; private Surface _surface; private GreenshotToolStripButton[] _toolbarButtons; - private BitmapScaleHandler _destinationScaleHandler; + private BitmapScaleHandler _destinationScaleHandler; private readonly IDisposable _clipboardSubscription; private readonly EditorFactory _editorFactory; private readonly DestinationHolder _destinationHolder; @@ -151,7 +144,7 @@ namespace Greenshot.Addon.LegacyEditor.Forms private void SetupBitmapScaleHandler() { // Create a BitmapScaleHandler which knows how to locate the icons for the destinations - _destinationScaleHandler = BitmapScaleHandler.Create(FormDpiHandler, (destination, dpi) => destination.GetDisplayIcon(dpi), (bitmap, dpi) => bitmap.ScaleIconForDisplaying(dpi)); + _destinationScaleHandler = BitmapScaleHandler.Create(FormDpiHandler, (destination, dpi) => destination.GetDisplayIcon(dpi), (bitmap, dpi) => bitmap.ScaleIconForDisplaying(dpi)); FormDpiHandler.OnDpiChanged.Subscribe(info => { @@ -168,78 +161,79 @@ namespace Greenshot.Addon.LegacyEditor.Forms Refresh(); }); + // Use the GreenshotForm ScaleHandler to locate the icons and get them scaled - ScaleHandler.AddTarget(btnCursor, "btnCursor.Image"); - ScaleHandler.AddTarget(btnRect, "btnRect.Image"); - ScaleHandler.AddTarget(btnEllipse, "btnEllipse.Image"); - ScaleHandler.AddTarget(btnLine, "btnLine.Image"); - ScaleHandler.AddTarget(btnArrow, "btnArrow.Image"); + ScaleHandler.AddTarget(btnCursor, "btnCursor.Image", _converter); + ScaleHandler.AddTarget(btnRect, "btnRect.Image", _converter); + ScaleHandler.AddTarget(btnEllipse, "btnEllipse.Image", _converter); + ScaleHandler.AddTarget(btnLine, "btnLine.Image", _converter); + ScaleHandler.AddTarget(btnArrow, "btnArrow.Image", _converter); - ScaleHandler.AddTarget(btnFreehand, "btnFreehand.Image"); - ScaleHandler.AddTarget(btnText, "btnText.Image"); - ScaleHandler.AddTarget(btnSpeechBubble, "addSpeechBubbleToolStripMenuItem.Image"); - ScaleHandler.AddTarget(btnHighlight, "btnHighlight.Image"); - ScaleHandler.AddTarget(btnObfuscate, "btnObfuscate.Image"); + ScaleHandler.AddTarget(btnFreehand, "btnFreehand.Image", _converter); + ScaleHandler.AddTarget(btnText, "btnText.Image", _converter); + ScaleHandler.AddTarget(btnSpeechBubble, "addSpeechBubbleToolStripMenuItem.Image", _converter); + ScaleHandler.AddTarget(btnHighlight, "btnHighlight.Image", _converter); + ScaleHandler.AddTarget(btnObfuscate, "btnObfuscate.Image", _converter); - ScaleHandler.AddTarget(toolStripSplitButton1, "toolStripSplitButton1.Image"); - ScaleHandler.AddTarget(btnResize, "btnResize.Image"); - ScaleHandler.AddTarget(btnCrop, "btnCrop.Image"); - ScaleHandler.AddTarget(rotateCwToolstripButton, "rotateCwToolstripButton.Image"); - ScaleHandler.AddTarget(rotateCcwToolstripButton, "rotateCcwToolstripButton.Image"); - ScaleHandler.AddTarget(undoToolStripMenuItem, "undoToolStripMenuItem.Image"); + ScaleHandler.AddTarget(toolStripSplitButton1, "toolStripSplitButton1.Image", _converter); + ScaleHandler.AddTarget(btnResize, "btnResize.Image", _converter); + ScaleHandler.AddTarget(btnCrop, "btnCrop.Image", _converter); + ScaleHandler.AddTarget(rotateCwToolstripButton, "rotateCwToolstripButton.Image", _converter); + ScaleHandler.AddTarget(rotateCcwToolstripButton, "rotateCcwToolstripButton.Image", _converter); + ScaleHandler.AddTarget(undoToolStripMenuItem, "undoToolStripMenuItem.Image", _converter); - ScaleHandler.AddTarget(redoToolStripMenuItem, "redoToolStripMenuItem.Image"); - ScaleHandler.AddTarget(cutToolStripMenuItem, "cutToolStripMenuItem.Image"); - ScaleHandler.AddTarget(copyToolStripMenuItem, "copyToolStripMenuItem.Image"); - ScaleHandler.AddTarget(pasteToolStripMenuItem, "pasteToolStripMenuItem.Image"); - ScaleHandler.AddTarget(preferencesToolStripMenuItem, "preferencesToolStripMenuItem.Image"); - ScaleHandler.AddTarget(addRectangleToolStripMenuItem, "addRectangleToolStripMenuItem.Image"); - ScaleHandler.AddTarget(addEllipseToolStripMenuItem, "addEllipseToolStripMenuItem.Image"); + ScaleHandler.AddTarget(redoToolStripMenuItem, "redoToolStripMenuItem.Image", _converter); + ScaleHandler.AddTarget(cutToolStripMenuItem, "cutToolStripMenuItem.Image", _converter); + ScaleHandler.AddTarget(copyToolStripMenuItem, "copyToolStripMenuItem.Image", _converter); + ScaleHandler.AddTarget(pasteToolStripMenuItem, "pasteToolStripMenuItem.Image", _converter); + ScaleHandler.AddTarget(preferencesToolStripMenuItem, "preferencesToolStripMenuItem.Image", _converter); + ScaleHandler.AddTarget(addRectangleToolStripMenuItem, "addRectangleToolStripMenuItem.Image", _converter); + ScaleHandler.AddTarget(addEllipseToolStripMenuItem, "addEllipseToolStripMenuItem.Image", _converter); - ScaleHandler.AddTarget(drawLineToolStripMenuItem, "drawLineToolStripMenuItem.Image"); - ScaleHandler.AddTarget(drawArrowToolStripMenuItem, "drawArrowToolStripMenuItem.Image"); - ScaleHandler.AddTarget(drawFreehandToolStripMenuItem, "drawFreehandToolStripMenuItem.Image"); - ScaleHandler.AddTarget(addTextBoxToolStripMenuItem, "addTextBoxToolStripMenuItem.Image"); - ScaleHandler.AddTarget(addSpeechBubbleToolStripMenuItem, "addSpeechBubbleToolStripMenuItem.Image"); - ScaleHandler.AddTarget(addCounterToolStripMenuItem, "addCounterToolStripMenuItem.Image"); - ScaleHandler.AddTarget(removeObjectToolStripMenuItem, "removeObjectToolStripMenuItem.Image"); - ScaleHandler.AddTarget(helpToolStripMenuItem1, "helpToolStripMenuItem1.Image"); - ScaleHandler.AddTarget(btnSave, "btnSave.Image"); - ScaleHandler.AddTarget(btnClipboard, "btnClipboard.Image"); - ScaleHandler.AddTarget(btnPrint, "btnPrint.Image"); - ScaleHandler.AddTarget(btnDelete, "btnDelete.Image"); - ScaleHandler.AddTarget(btnCut, "btnCut.Image"); - ScaleHandler.AddTarget(btnCopy, "btnCopy.Image"); - ScaleHandler.AddTarget(btnPaste, "btnPaste.Image"); - ScaleHandler.AddTarget(btnUndo, "btnUndo.Image"); - ScaleHandler.AddTarget(btnRedo, "btnRedo.Image"); - ScaleHandler.AddTarget(btnSettings, "btnSettings.Image"); - ScaleHandler.AddTarget(btnHelp, "btnHelp.Image"); - ScaleHandler.AddTarget(obfuscateModeButton, "obfuscateModeButton.Image"); - ScaleHandler.AddTarget(pixelizeToolStripMenuItem, "pixelizeToolStripMenuItem.Image"); - ScaleHandler.AddTarget(blurToolStripMenuItem, "blurToolStripMenuItem.Image"); - ScaleHandler.AddTarget(highlightModeButton, "highlightModeButton.Image"); - ScaleHandler.AddTarget(textHighlightMenuItem, "textHighlightMenuItem.Image"); - ScaleHandler.AddTarget(areaHighlightMenuItem, "areaHighlightMenuItem.Image"); - ScaleHandler.AddTarget(grayscaleHighlightMenuItem, "grayscaleHighlightMenuItem.Image"); - ScaleHandler.AddTarget(magnifyMenuItem, "magnifyMenuItem.Image"); - ScaleHandler.AddTarget(btnFillColor, "btnFillColor.Image"); - ScaleHandler.AddTarget(btnLineColor, "btnLineColor.Image"); - ScaleHandler.AddTarget(fontBoldButton, "fontBoldButton.Image"); - ScaleHandler.AddTarget(fontItalicButton, "fontItalicButton.Image"); - ScaleHandler.AddTarget(textVerticalAlignmentButton, "btnAlignMiddle.Image"); - ScaleHandler.AddTarget(alignTopToolStripMenuItem, "btnAlignTop.Image"); - ScaleHandler.AddTarget(alignMiddleToolStripMenuItem, "btnAlignMiddle.Image"); - ScaleHandler.AddTarget(alignBottomToolStripMenuItem, "btnAlignBottom.Image"); - ScaleHandler.AddTarget(arrowHeadsDropDownButton, "arrowHeadsDropDownButton.Image"); - ScaleHandler.AddTarget(shadowButton, "shadowButton.Image"); - ScaleHandler.AddTarget(btnConfirm, "btnConfirm.Image"); - ScaleHandler.AddTarget(btnCancel, "btnCancel.Image"); - ScaleHandler.AddTarget(closeToolStripMenuItem, "closeToolStripMenuItem.Image"); - ScaleHandler.AddTarget(textHorizontalAlignmentButton, "btnAlignCenter.Image"); - ScaleHandler.AddTarget(alignLeftToolStripMenuItem, "btnAlignLeft.Image"); - ScaleHandler.AddTarget(alignCenterToolStripMenuItem, "btnAlignCenter.Image"); - ScaleHandler.AddTarget(alignRightToolStripMenuItem, "btnAlignRight.Image"); + ScaleHandler.AddTarget(drawLineToolStripMenuItem, "drawLineToolStripMenuItem.Image", _converter); + ScaleHandler.AddTarget(drawArrowToolStripMenuItem, "drawArrowToolStripMenuItem.Image", _converter); + ScaleHandler.AddTarget(drawFreehandToolStripMenuItem, "drawFreehandToolStripMenuItem.Image", _converter); + ScaleHandler.AddTarget(addTextBoxToolStripMenuItem, "addTextBoxToolStripMenuItem.Image", _converter); + ScaleHandler.AddTarget(addSpeechBubbleToolStripMenuItem, "addSpeechBubbleToolStripMenuItem.Image", _converter); + ScaleHandler.AddTarget(addCounterToolStripMenuItem, "addCounterToolStripMenuItem.Image", _converter); + ScaleHandler.AddTarget(removeObjectToolStripMenuItem, "removeObjectToolStripMenuItem.Image", _converter); + ScaleHandler.AddTarget(helpToolStripMenuItem1, "helpToolStripMenuItem1.Image", _converter); + ScaleHandler.AddTarget(btnSave, "btnSave.Image", _converter); + ScaleHandler.AddTarget(btnClipboard, "btnClipboard.Image", _converter); + ScaleHandler.AddTarget(btnPrint, "btnPrint.Image", _converter); + ScaleHandler.AddTarget(btnDelete, "btnDelete.Image", _converter); + ScaleHandler.AddTarget(btnCut, "btnCut.Image", _converter); + ScaleHandler.AddTarget(btnCopy, "btnCopy.Image", _converter); + ScaleHandler.AddTarget(btnPaste, "btnPaste.Image", _converter); + ScaleHandler.AddTarget(btnUndo, "btnUndo.Image", _converter); + ScaleHandler.AddTarget(btnRedo, "btnRedo.Image", _converter); + ScaleHandler.AddTarget(btnSettings, "btnSettings.Image", _converter); + ScaleHandler.AddTarget(btnHelp, "btnHelp.Image", _converter); + ScaleHandler.AddTarget(obfuscateModeButton, "obfuscateModeButton.Image", _converter); + ScaleHandler.AddTarget(pixelizeToolStripMenuItem, "pixelizeToolStripMenuItem.Image", _converter); + ScaleHandler.AddTarget(blurToolStripMenuItem, "blurToolStripMenuItem.Image", _converter); + ScaleHandler.AddTarget(highlightModeButton, "highlightModeButton.Image", _converter); + ScaleHandler.AddTarget(textHighlightMenuItem, "textHighlightMenuItem.Image", _converter); + ScaleHandler.AddTarget(areaHighlightMenuItem, "areaHighlightMenuItem.Image", _converter); + ScaleHandler.AddTarget(grayscaleHighlightMenuItem, "grayscaleHighlightMenuItem.Image", _converter); + ScaleHandler.AddTarget(magnifyMenuItem, "magnifyMenuItem.Image", _converter); + ScaleHandler.AddTarget(btnFillColor, "btnFillColor.Image", _converter); + ScaleHandler.AddTarget(btnLineColor, "btnLineColor.Image", _converter); + ScaleHandler.AddTarget(fontBoldButton, "fontBoldButton.Image", _converter); + ScaleHandler.AddTarget(fontItalicButton, "fontItalicButton.Image", _converter); + ScaleHandler.AddTarget(textVerticalAlignmentButton, "btnAlignMiddle.Image", _converter); + ScaleHandler.AddTarget(alignTopToolStripMenuItem, "btnAlignTop.Image", _converter); + ScaleHandler.AddTarget(alignMiddleToolStripMenuItem, "btnAlignMiddle.Image", _converter); + ScaleHandler.AddTarget(alignBottomToolStripMenuItem, "btnAlignBottom.Image", _converter); + ScaleHandler.AddTarget(arrowHeadsDropDownButton, "arrowHeadsDropDownButton.Image", _converter); + ScaleHandler.AddTarget(shadowButton, "shadowButton.Image", _converter); + ScaleHandler.AddTarget(btnConfirm, "btnConfirm.Image", _converter); + ScaleHandler.AddTarget(btnCancel, "btnCancel.Image", _converter); + ScaleHandler.AddTarget(closeToolStripMenuItem, "closeToolStripMenuItem.Image", _converter); + ScaleHandler.AddTarget(textHorizontalAlignmentButton, "btnAlignCenter.Image", _converter); + ScaleHandler.AddTarget(alignLeftToolStripMenuItem, "btnAlignLeft.Image", _converter); + ScaleHandler.AddTarget(alignCenterToolStripMenuItem, "btnAlignCenter.Image", _converter); + ScaleHandler.AddTarget(alignRightToolStripMenuItem, "btnAlignRight.Image", _converter); } /// @@ -292,7 +286,7 @@ namespace Greenshot.Addon.LegacyEditor.Forms var backgroundForTransparency = GreenshotResources.Instance.GetBitmap("Checkerboard.Image"); if (_surface != null) { - _surface.TransparencyBackgroundBrush = new TextureBrush(backgroundForTransparency, WrapMode.Tile); + _surface.TransparencyBackgroundBrush = new TextureBrush(backgroundForTransparency.NativeBitmap, WrapMode.Tile); _surface.MovingElementChanged += (sender, args) => RefreshEditorControls(); _surface.DrawingModeChanged += SurfaceDrawingModeChanged; @@ -314,7 +308,7 @@ namespace Greenshot.Addon.LegacyEditor.Forms Activate(); // TODO: Await? - InteropWindowFactory.CreateFor(Handle).ToForegroundAsync(); + _ = InteropWindowFactory.CreateFor(Handle).ToForegroundAsync(); } private void UpdateUi() @@ -425,10 +419,10 @@ namespace Greenshot.Addon.LegacyEditor.Forms DropDownButtonWidth = FormDpiHandler.ScaleWithCurrentDpi(8), DisplayStyle = ToolStripItemDisplayStyle.Image, Text = toolstripDestination.Description, - Image = icon.ScaleIconForDisplaying(FormDpiHandler.Dpi) + Image = icon.ScaleIconForDisplaying(FormDpiHandler.Dpi).NativeBitmap }; - if (!Equals(icon, destinationButton.Image)) + if (!Equals(icon.NativeBitmap, destinationButton.Image)) { destinationButton.Disposed += (sender, args) => { @@ -443,9 +437,9 @@ namespace Greenshot.Addon.LegacyEditor.Forms { DisplayStyle = ToolStripItemDisplayStyle.Image, Tag = toolstripDestination, - Image = icon.ScaleIconForDisplaying(FormDpiHandler.Dpi) + Image = icon.ScaleIconForDisplaying(FormDpiHandler.Dpi).NativeBitmap }; - if (!Equals(icon, defaultItem.Image)) + if (!Equals(icon.NativeBitmap, defaultItem.Image)) { defaultItem.Disposed += (sender, args) => defaultItem.Image.Dispose(); } @@ -466,9 +460,9 @@ namespace Greenshot.Addon.LegacyEditor.Forms var destinationMenuItem = new ToolStripMenuItem(subDestination.Description) { Tag = subDestination, - Image = icon.ScaleIconForDisplaying(96) + Image = icon.ScaleIconForDisplaying(96).NativeBitmap }; - if (!Equals(icon, destinationMenuItem.Image)) + if (!Equals(icon.NativeBitmap, destinationMenuItem.Image)) { // Dispose of the newly generated icon destinationMenuItem.Disposed += (o, a) => @@ -491,10 +485,10 @@ namespace Greenshot.Addon.LegacyEditor.Forms { DisplayStyle = ToolStripItemDisplayStyle.Image, Text = toolstripDestination.Description, - Image = icon.ScaleIconForDisplaying(FormDpiHandler.Dpi) + Image = icon.ScaleIconForDisplaying(FormDpiHandler.Dpi).NativeBitmap }; destinationButton.Click += async (sender, args) => await toolstripDestination.ExportCaptureAsync(true, _surface, _surface.CaptureDetails); - if (!Equals(icon, destinationButton.Image)) + if (!Equals(icon.NativeBitmap, destinationButton.Image)) { destinationButton.Disposed += (sender, args) => { @@ -540,7 +534,7 @@ namespace Greenshot.Addon.LegacyEditor.Forms var icon = destination.GetDisplayIcon(FormDpiHandler.Dpi); item.Text = destination.Description; - item.Image = icon.ScaleIconForDisplaying(FormDpiHandler.Dpi); + item.Image = icon.ScaleIconForDisplaying(FormDpiHandler.Dpi).NativeBitmap; item.ShortcutKeys = destination.EditorShortcutKeys; fileStripMenuItem.DropDownItems.Add(item); } @@ -745,13 +739,13 @@ namespace Greenshot.Addon.LegacyEditor.Forms var stepLabels = _surface.CountStepLabels(null); if (stepLabels <= 20) { - ScaleHandler.AddTarget(btnStepLabel, $"btnStepLabel{stepLabels:00}.Image", FormDpiHandler.Dpi > 0); - ScaleHandler.AddTarget(addCounterToolStripMenuItem, $"btnStepLabel{stepLabels:00}.Image", FormDpiHandler.Dpi > 0); + ScaleHandler.AddTarget(btnStepLabel, $"btnStepLabel{stepLabels:00}.Image", _converter, FormDpiHandler.Dpi > 0); + ScaleHandler.AddTarget(addCounterToolStripMenuItem, $"btnStepLabel{stepLabels:00}.Image", _converter, FormDpiHandler.Dpi > 0); } else { - ScaleHandler.AddTarget(btnStepLabel, $"btnStepLabel20+.Image", FormDpiHandler.Dpi > 0); - ScaleHandler.AddTarget(addCounterToolStripMenuItem, $"btnStepLabel20+.Image", FormDpiHandler.Dpi > 0); + ScaleHandler.AddTarget(btnStepLabel, $"btnStepLabel20+.Image", _converter, FormDpiHandler.Dpi > 0); + ScaleHandler.AddTarget(addCounterToolStripMenuItem, $"btnStepLabel20+.Image", _converter, FormDpiHandler.Dpi > 0); } var props = _surface.FieldAggregator; @@ -1073,7 +1067,7 @@ namespace Greenshot.Addon.LegacyEditor.Forms } /// - /// This is used when the dropshadow button is used + /// This is used when the drop shadow button is used /// /// /// MouseEventArgs @@ -1222,13 +1216,11 @@ namespace Greenshot.Addon.LegacyEditor.Forms private delegate void SurfaceMessageReceivedThreadSafeDelegate(object sender, SurfaceMessageEventArgs eventArgs); - #region plugin interfaces - /** * Interfaces for plugins, see GreenshotInterface for more details! */ - public Image GetImageForExport() + public IBitmapWithNativeSupport GetImageForExport() { return _surface.GetBitmapForExport(); } @@ -1245,10 +1237,6 @@ namespace Greenshot.Addon.LegacyEditor.Forms return fileStripMenuItem; } - #endregion - - #region filesystem options - private void BtnSaveClick(object sender, EventArgs e) { var destinationDesignation = "FileNoDialog"; @@ -1278,10 +1266,6 @@ namespace Greenshot.Addon.LegacyEditor.Forms Close(); } - #endregion - - #region drawing options - private void BtnEllipseClick(object sender, EventArgs e) { _surface.DrawingMode = DrawingModes.Ellipse; @@ -1421,10 +1405,6 @@ namespace Greenshot.Addon.LegacyEditor.Forms RemoveObjectToolStripMenuItemClick(sender, e); } - #endregion - - #region copy&paste options - private void CutToolStripMenuItemClick(object sender, EventArgs e) { _surface.CutSelectedElements(); @@ -1484,10 +1464,6 @@ namespace Greenshot.Addon.LegacyEditor.Forms UpdateClipboardSurfaceDependencies(); } - #endregion - - #region element properties - private void UpOneLevelToolStripMenuItemClick(object sender, EventArgs e) { _surface.PullElementsUp(); @@ -1508,10 +1484,6 @@ namespace Greenshot.Addon.LegacyEditor.Forms _surface.PushElementsToBottom(); } - #endregion - - #region help - private void HelpToolStripMenuItem1Click(object sender, EventArgs e) { // TODO: Fix Help @@ -1540,10 +1512,6 @@ namespace Greenshot.Addon.LegacyEditor.Forms HelpToolStripMenuItem1Click(sender, e); } - #endregion - - #region image editor event handlers - private void ImageEditorFormActivated(object sender, EventArgs e) { UpdateClipboardSurfaceDependencies(); @@ -1699,10 +1667,6 @@ namespace Greenshot.Addon.LegacyEditor.Forms panel1.Focus(); } - #endregion - - #region key handling - /// protected override bool ProcessKeyPreview(ref Message msg) { @@ -1746,10 +1710,6 @@ namespace Greenshot.Addon.LegacyEditor.Forms return base.ProcessCmdKey(ref msg, keys); } - #endregion - - #region helpers - private void UpdateUndoRedoSurfaceDependencies() { if (_surface == null) @@ -1801,21 +1761,12 @@ namespace Greenshot.Addon.LegacyEditor.Forms pasteToolStripMenuItem.Enabled = hasClipboard && !_controlsDisabledDueToConfirmable; } - #endregion - - #region status label handling - private void UpdateStatusLabel(string text, ContextMenuStrip contextMenu = null) { statusLabel.Text = text; statusStrip1.ContextMenuStrip = contextMenu; } - private void ClearStatusLabel() - { - UpdateStatusLabel(null); - } - private void StatusLabelClicked(object sender, MouseEventArgs e) { ToolStrip ss = (StatusStrip) ((ToolStripStatusLabel) sender).Owner; @@ -1831,7 +1782,5 @@ namespace Greenshot.Addon.LegacyEditor.Forms { ExplorerHelper.OpenInExplorer(_surface.LastSaveFullPath); } - - #endregion } } \ No newline at end of file diff --git a/src/Greenshot.Addon.LegacyEditor/Forms/ResizeSettingsForm.cs b/src/Greenshot.Addon.LegacyEditor/Forms/ResizeSettingsForm.cs index ca3ded5f4..7ebfebb63 100644 --- a/src/Greenshot.Addon.LegacyEditor/Forms/ResizeSettingsForm.cs +++ b/src/Greenshot.Addon.LegacyEditor/Forms/ResizeSettingsForm.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.ComponentModel; using System.Drawing; @@ -31,8 +25,6 @@ using Greenshot.Addons; using Greenshot.Addons.Controls; using Greenshot.Gfx.Effects; -#endregion - namespace Greenshot.Addon.LegacyEditor.Forms { /// @@ -69,7 +61,7 @@ namespace Greenshot.Addon.LegacyEditor.Forms private void ButtonOK_Click(object sender, EventArgs e) { - if (_newWidth != _effect.Width || _newHeight != _effect.Height) + if ((int)_newWidth != _effect.Width || (int)_newHeight != _effect.Height) { _effect.Width = (int) _newWidth; _effect.Height = (int) _newHeight; diff --git a/src/Greenshot.Addon.LegacyEditor/Forms/TornEdgeSettingsForm.cs b/src/Greenshot.Addon.LegacyEditor/Forms/TornEdgeSettingsForm.cs index ed5ab61f3..ebe704d8e 100644 --- a/src/Greenshot.Addon.LegacyEditor/Forms/TornEdgeSettingsForm.cs +++ b/src/Greenshot.Addon.LegacyEditor/Forms/TornEdgeSettingsForm.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.Windows.Forms; @@ -30,8 +24,6 @@ using Greenshot.Addons; using Greenshot.Addons.Controls; using Greenshot.Gfx.Effects; -#endregion - namespace Greenshot.Addon.LegacyEditor.Forms { public partial class TornEdgeSettingsForm : GreenshotForm diff --git a/src/Greenshot.Addon.LegacyEditor/Greenshot.Addon.LegacyEditor.csproj b/src/Greenshot.Addon.LegacyEditor/Greenshot.Addon.LegacyEditor.csproj index 8bd8c0ced..572d77a59 100644 --- a/src/Greenshot.Addon.LegacyEditor/Greenshot.Addon.LegacyEditor.csproj +++ b/src/Greenshot.Addon.LegacyEditor/Greenshot.Addon.LegacyEditor.csproj @@ -1,4 +1,4 @@ - + Greenshot.Addon.LegacyEditor @@ -136,8 +136,8 @@ - - + + all runtime; build; native; contentfiles; analyzers diff --git a/src/Greenshot.Addon.LegacyEditor/IEditorConfiguration.cs b/src/Greenshot.Addon.LegacyEditor/IEditorConfiguration.cs index 5b302f58d..e61a01130 100644 --- a/src/Greenshot.Addon.LegacyEditor/IEditorConfiguration.cs +++ b/src/Greenshot.Addon.LegacyEditor/IEditorConfiguration.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Collections.Generic; using System.ComponentModel; using System.Drawing; @@ -31,8 +25,6 @@ using Dapplo.Windows.Common.Structs; using Dapplo.Windows.User32.Enums; using Greenshot.Gfx.Effects; -#endregion - namespace Greenshot.Addon.LegacyEditor { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Memento/AddElementMemento.cs b/src/Greenshot.Addon.LegacyEditor/Memento/AddElementMemento.cs index 8d2a1b098..4ba9d22ef 100644 --- a/src/Greenshot.Addon.LegacyEditor/Memento/AddElementMemento.cs +++ b/src/Greenshot.Addon.LegacyEditor/Memento/AddElementMemento.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,16 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using Greenshot.Addon.LegacyEditor.Drawing; using Greenshot.Addons.Interfaces.Drawing; -#endregion - namespace Greenshot.Addon.LegacyEditor.Memento { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Memento/AddElementsMemento.cs b/src/Greenshot.Addon.LegacyEditor/Memento/AddElementsMemento.cs index 2388ec581..877be194d 100644 --- a/src/Greenshot.Addon.LegacyEditor/Memento/AddElementsMemento.cs +++ b/src/Greenshot.Addon.LegacyEditor/Memento/AddElementsMemento.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using Greenshot.Addon.LegacyEditor.Drawing; using Greenshot.Addons.Interfaces.Drawing; -#endregion - namespace Greenshot.Addon.LegacyEditor.Memento { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Memento/ChangeFieldHolderMemento.cs b/src/Greenshot.Addon.LegacyEditor/Memento/ChangeFieldHolderMemento.cs index efda97437..59843e5d7 100644 --- a/src/Greenshot.Addon.LegacyEditor/Memento/ChangeFieldHolderMemento.cs +++ b/src/Greenshot.Addon.LegacyEditor/Memento/ChangeFieldHolderMemento.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using Greenshot.Addons.Interfaces.Drawing; -#endregion - namespace Greenshot.Addon.LegacyEditor.Memento { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Memento/DeleteElementMemento.cs b/src/Greenshot.Addon.LegacyEditor/Memento/DeleteElementMemento.cs index 87a5d8135..abf5fcda8 100644 --- a/src/Greenshot.Addon.LegacyEditor/Memento/DeleteElementMemento.cs +++ b/src/Greenshot.Addon.LegacyEditor/Memento/DeleteElementMemento.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,16 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using Greenshot.Addon.LegacyEditor.Drawing; using Greenshot.Addons.Interfaces.Drawing; -#endregion - namespace Greenshot.Addon.LegacyEditor.Memento { /// @@ -36,13 +28,13 @@ namespace Greenshot.Addon.LegacyEditor.Memento /// public class DeleteElementMemento : IMemento { - private readonly Surface surface; - private IDrawableContainer drawableContainer; + private readonly Surface _surface; + private IDrawableContainer _drawableContainer; public DeleteElementMemento(Surface surface, IDrawableContainer drawableContainer) { - this.surface = surface; - this.drawableContainer = drawableContainer; + _surface = surface; + _drawableContainer = drawableContainer; } public void Dispose() @@ -59,18 +51,18 @@ namespace Greenshot.Addon.LegacyEditor.Memento public IMemento Restore() { // Before - drawableContainer.Invalidate(); + _drawableContainer.Invalidate(); - var oldState = new AddElementMemento(surface, drawableContainer); - surface.AddElement(drawableContainer, false); + var oldState = new AddElementMemento(_surface, _drawableContainer); + _surface.AddElement(_drawableContainer, false); // The container has a selected flag which represents the state at the moment it was deleted. - if (drawableContainer.Selected) + if (_drawableContainer.Selected) { - surface.SelectElement(drawableContainer); + _surface.SelectElement(_drawableContainer); } // After - drawableContainer.Invalidate(); + _drawableContainer.Invalidate(); return oldState; } @@ -78,10 +70,10 @@ namespace Greenshot.Addon.LegacyEditor.Memento { if (disposing) { - if (drawableContainer != null) + if (_drawableContainer != null) { - drawableContainer.Dispose(); - drawableContainer = null; + _drawableContainer.Dispose(); + _drawableContainer = null; } } } diff --git a/src/Greenshot.Addon.LegacyEditor/Memento/DeleteElementsMemento.cs b/src/Greenshot.Addon.LegacyEditor/Memento/DeleteElementsMemento.cs index f47b606c4..27ef5a6ae 100644 --- a/src/Greenshot.Addon.LegacyEditor/Memento/DeleteElementsMemento.cs +++ b/src/Greenshot.Addon.LegacyEditor/Memento/DeleteElementsMemento.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using Greenshot.Addon.LegacyEditor.Drawing; using Greenshot.Addons.Interfaces.Drawing; -#endregion - namespace Greenshot.Addon.LegacyEditor.Memento { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Memento/DrawableContainerBoundsChangeMemento.cs b/src/Greenshot.Addon.LegacyEditor/Memento/DrawableContainerBoundsChangeMemento.cs index eb576873d..cbeadc60c 100644 --- a/src/Greenshot.Addon.LegacyEditor/Memento/DrawableContainerBoundsChangeMemento.cs +++ b/src/Greenshot.Addon.LegacyEditor/Memento/DrawableContainerBoundsChangeMemento.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Collections.Generic; using System.Drawing; using Dapplo.Windows.Common.Structs; @@ -30,8 +24,6 @@ using Greenshot.Addon.LegacyEditor.Drawing; using Greenshot.Addons.Core; using Greenshot.Addons.Interfaces.Drawing; -#endregion - namespace Greenshot.Addon.LegacyEditor.Memento { /// diff --git a/src/Greenshot.Addon.LegacyEditor/Memento/IMemento.cs b/src/Greenshot.Addon.LegacyEditor/Memento/IMemento.cs deleted file mode 100644 index 5e3588e20..000000000 --- a/src/Greenshot.Addon.LegacyEditor/Memento/IMemento.cs +++ /dev/null @@ -1,43 +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 . - */ -using System; - -namespace Greenshot.Memento { - /// - /// Description of IMemento. - /// - public interface IMemento : IDisposable { - /// - /// Restores target to the state memorized by this memento. - /// - /// - /// A memento of the state before restoring - /// - IMemento Restore(); - - /// - /// Try to merge the current memento with another, preventing loads of items on the stack - /// - /// The memento to try to merge with - /// - bool Merge(IMemento other); - } -} diff --git a/src/Greenshot.Addon.LegacyEditor/Memento/SurfaceBackgroundChangeMemento.cs b/src/Greenshot.Addon.LegacyEditor/Memento/SurfaceBackgroundChangeMemento.cs index 90f82fbc4..3a667c08c 100644 --- a/src/Greenshot.Addon.LegacyEditor/Memento/SurfaceBackgroundChangeMemento.cs +++ b/src/Greenshot.Addon.LegacyEditor/Memento/SurfaceBackgroundChangeMemento.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,16 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - -using System.Drawing; using System.Drawing.Drawing2D; using Greenshot.Addon.LegacyEditor.Drawing; using Greenshot.Addons.Interfaces.Drawing; - -#endregion +using Greenshot.Gfx; namespace Greenshot.Addon.LegacyEditor.Memento { @@ -37,7 +29,7 @@ namespace Greenshot.Addon.LegacyEditor.Memento /// public sealed class SurfaceBackgroundChangeMemento : IMemento { - private Bitmap _bitmap; + private IBitmapWithNativeSupport _bitmap; private Matrix _matrix; private Surface _surface; diff --git a/src/Greenshot.Addon.LegacyEditor/Memento/TextChangeMemento.cs b/src/Greenshot.Addon.LegacyEditor/Memento/TextChangeMemento.cs index b13f832e8..752bf9994 100644 --- a/src/Greenshot.Addon.LegacyEditor/Memento/TextChangeMemento.cs +++ b/src/Greenshot.Addon.LegacyEditor/Memento/TextChangeMemento.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using Greenshot.Addon.LegacyEditor.Drawing; using Greenshot.Addons.Interfaces.Drawing; -#endregion - namespace Greenshot.Addon.LegacyEditor.Memento { /// diff --git a/src/Greenshot.Addon.LegacyEditor/ViewModels/EditorConfigViewModel.cs b/src/Greenshot.Addon.LegacyEditor/ViewModels/EditorConfigViewModel.cs index 90bec2cab..138698f1b 100644 --- a/src/Greenshot.Addon.LegacyEditor/ViewModels/EditorConfigViewModel.cs +++ b/src/Greenshot.Addon.LegacyEditor/ViewModels/EditorConfigViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Reactive.Disposables; using Dapplo.CaliburnMicro.Configuration; using Dapplo.CaliburnMicro.Extensions; diff --git a/src/Greenshot.Addon.Lutim/Configuration/ILutimLanguage.cs b/src/Greenshot.Addon.Lutim/Configuration/ILutimLanguage.cs index 6c4275296..c8a2440cd 100644 --- a/src/Greenshot.Addon.Lutim/Configuration/ILutimLanguage.cs +++ b/src/Greenshot.Addon.Lutim/Configuration/ILutimLanguage.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,12 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.ComponentModel; using Dapplo.Config.Language; -namespace Greenshot.Addon.Lutim +namespace Greenshot.Addon.Lutim.Configuration { [Language("Lutim")] public interface ILutimLanguage : ILanguage, INotifyPropertyChanged diff --git a/src/Greenshot.Addon.Lutim/Configuration/Impl/LutimConfigurationImpl.cs b/src/Greenshot.Addon.Lutim/Configuration/Impl/LutimConfigurationImpl.cs index cd0481f3c..0f88f2674 100644 --- a/src/Greenshot.Addon.Lutim/Configuration/Impl/LutimConfigurationImpl.cs +++ b/src/Greenshot.Addon.Lutim/Configuration/Impl/LutimConfigurationImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Collections.Generic; using Dapplo.Config.Ini; using Greenshot.Addon.Lutim.Entities; @@ -30,8 +26,6 @@ namespace Greenshot.Addon.Lutim.Configuration.Impl { internal class LutimConfigurationImpl : IniSectionBase, ILutimConfiguration { - #region Implementation of IFileConfiguration - public string OutputFilePath { get; set; } public bool OutputFileAllowOverwrite { get; set; } public string OutputFileFilenamePattern { get; set; } @@ -45,21 +39,11 @@ namespace Greenshot.Addon.Lutim.Configuration.Impl public string OptimizePNGCommand { get; set; } public string OptimizePNGCommandArguments { get; set; } - #endregion - - #region Implementation of IDestinationFileConfiguration - public bool UseOwnSettings { get; set; } - #endregion - - #region Implementation of ILutimConfiguration - public string LutimUrl { get; set; } public bool CopyLinkToClipboard { get; set; } public IDictionary LutimUploadHistory { get; set; } public IDictionary RuntimeLutimHistory { get; set; } - - #endregion } } diff --git a/src/Greenshot.Addon.Lutim/Configuration/Impl/LutimLanguageImpl.cs b/src/Greenshot.Addon.Lutim/Configuration/Impl/LutimLanguageImpl.cs index 59887426f..dfc0bb729 100644 --- a/src/Greenshot.Addon.Lutim/Configuration/Impl/LutimLanguageImpl.cs +++ b/src/Greenshot.Addon.Lutim/Configuration/Impl/LutimLanguageImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Diagnostics.CodeAnalysis; using Dapplo.Config.Language; @@ -33,8 +29,6 @@ namespace Greenshot.Addon.Lutim.Configuration.Impl #pragma warning disable CS1591 public class LutimLanguageImpl : LanguageBase, ILutimLanguage { - #region Implementation of ILutimLanguage - public string Cancel { get; } public string ClearQuestion { get; } public string CommunicationWait { get; } @@ -52,7 +46,5 @@ namespace Greenshot.Addon.Lutim.Configuration.Impl public string UploadSuccess { get; } public string UsePageLink { get; } public string AnonymousAccess { get; } - - #endregion } } diff --git a/src/Greenshot.Addon.Lutim/Greenshot.Addon.Lutim.csproj b/src/Greenshot.Addon.Lutim/Greenshot.Addon.Lutim.csproj index 8100713a8..a6a59029a 100644 --- a/src/Greenshot.Addon.Lutim/Greenshot.Addon.Lutim.csproj +++ b/src/Greenshot.Addon.Lutim/Greenshot.Addon.Lutim.csproj @@ -1,4 +1,4 @@ - + Greenshot.Addon.Lutim @@ -50,7 +50,7 @@ - + all diff --git a/src/Greenshot.Addon.Lutim/LutimAddonModule.cs b/src/Greenshot.Addon.Lutim/LutimAddonModule.cs index 3e7e483bb..65c127081 100644 --- a/src/Greenshot.Addon.Lutim/LutimAddonModule.cs +++ b/src/Greenshot.Addon.Lutim/LutimAddonModule.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Autofac; using Dapplo.Addons; using Dapplo.CaliburnMicro.Configuration; diff --git a/src/Greenshot.Addon.Lutim/LutimDestination.cs b/src/Greenshot.Addon.Lutim/LutimDestination.cs index dfbcb0668..04202227a 100644 --- a/src/Greenshot.Addon.Lutim/LutimDestination.cs +++ b/src/Greenshot.Addon.Lutim/LutimDestination.cs @@ -20,7 +20,6 @@ */ using System; -using System.Drawing; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; @@ -73,7 +72,7 @@ namespace Greenshot.Addon.Lutim { public override string Description => _lutimLanguage.UploadMenuItem; - public override Bitmap DisplayIcon { + public override IBitmapWithNativeSupport DisplayIcon { get { // TODO: Optimize this by caching using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType().Assembly, "Lutim.png")) diff --git a/src/Greenshot.Addon.Lutim/ViewModels/LutimConfigViewModel.cs b/src/Greenshot.Addon.Lutim/ViewModels/LutimConfigViewModel.cs index c047d4c16..985f56cb7 100644 --- a/src/Greenshot.Addon.Lutim/ViewModels/LutimConfigViewModel.cs +++ b/src/Greenshot.Addon.Lutim/ViewModels/LutimConfigViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Reactive.Disposables; using Dapplo.CaliburnMicro.Configuration; using Dapplo.CaliburnMicro.Extensions; diff --git a/src/Greenshot.Addon.Lutim/ViewModels/LutimHistoryViewModel.cs b/src/Greenshot.Addon.Lutim/ViewModels/LutimHistoryViewModel.cs index f1f0038da..935fb41c7 100644 --- a/src/Greenshot.Addon.Lutim/ViewModels/LutimHistoryViewModel.cs +++ b/src/Greenshot.Addon.Lutim/ViewModels/LutimHistoryViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/Greenshot.Addon.OCR/Configuration/IOcrConfiguration.cs b/src/Greenshot.Addon.OCR/Configuration/IOcrConfiguration.cs index 352f95e5d..13b6682cc 100644 --- a/src/Greenshot.Addon.OCR/Configuration/IOcrConfiguration.cs +++ b/src/Greenshot.Addon.OCR/Configuration/IOcrConfiguration.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,16 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using System.Diagnostics.CodeAnalysis; using Dapplo.Config.Ini; -#endregion - namespace Greenshot.Addon.OCR.Configuration { /// diff --git a/src/Greenshot.Addon.OCR/Configuration/Impl/OcrConfigurationImpl.cs b/src/Greenshot.Addon.OCR/Configuration/Impl/OcrConfigurationImpl.cs index c37107396..66f739ba9 100644 --- a/src/Greenshot.Addon.OCR/Configuration/Impl/OcrConfigurationImpl.cs +++ b/src/Greenshot.Addon.OCR/Configuration/Impl/OcrConfigurationImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,20 +17,14 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Dapplo.Config.Ini; namespace Greenshot.Addon.OCR.Configuration.Impl { internal class OcrConfigurationImpl : IniSectionBase, IOcrConfiguration { - #region Implementation of IOcrConfiguration - public string Language { get; set; } public bool Orientimage { get; set; } public bool StraightenImage { get; set; } - - #endregion } } diff --git a/src/Greenshot.Addon.OCR/Configuration/Impl/OcrLanguageImpl.cs b/src/Greenshot.Addon.OCR/Configuration/Impl/OcrLanguageImpl.cs index b3f90b33d..2eac0c649 100644 --- a/src/Greenshot.Addon.OCR/Configuration/Impl/OcrLanguageImpl.cs +++ b/src/Greenshot.Addon.OCR/Configuration/Impl/OcrLanguageImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Diagnostics.CodeAnalysis; using Dapplo.Config.Language; @@ -33,12 +29,8 @@ namespace Greenshot.Addon.OCR.Configuration.Impl [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] public class OcrLanguageImpl : LanguageBase, IOcrLanguage { - #region Implementation of IOcrLanguage - public string Language { get; } public string OrientImage { get; } public string StraightenImage { get; } - - #endregion } } diff --git a/src/Greenshot.Addon.OCR/Greenshot.Addon.OCR.csproj b/src/Greenshot.Addon.OCR/Greenshot.Addon.OCR.csproj index 11965a1c0..b2455eb89 100644 --- a/src/Greenshot.Addon.OCR/Greenshot.Addon.OCR.csproj +++ b/src/Greenshot.Addon.OCR/Greenshot.Addon.OCR.csproj @@ -1,4 +1,4 @@ - + Greenshot.Addon.OCR @@ -40,7 +40,7 @@ - + all runtime; build; native; contentfiles; analyzers diff --git a/src/Greenshot.Addon.OCR/OCRDestination.cs b/src/Greenshot.Addon.OCR/OCRDestination.cs index 9efa32a2d..ae53498af 100644 --- a/src/Greenshot.Addon.OCR/OCRDestination.cs +++ b/src/Greenshot.Addon.OCR/OCRDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,13 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Diagnostics; -using System.Drawing; using System.IO; using System.Reflection; using System.Windows.Forms; @@ -37,10 +30,9 @@ using Greenshot.Addons.Core; using Greenshot.Addons.Interfaces; using Greenshot.Addons.Interfaces.Plugin; using Greenshot.Core.Enums; +using Greenshot.Gfx; using Greenshot.Gfx.Effects; -#endregion - namespace Greenshot.Addon.OCR { /// @@ -79,7 +71,7 @@ namespace Greenshot.Addon.OCR public override string Description => "OCR"; - public override Bitmap GetDisplayIcon(double dpi) + public override IBitmapWithNativeSupport GetDisplayIcon(double dpi) { var exePath = PluginUtils.GetExePath("MSPVIEW.EXE"); if (exePath != null && File.Exists(exePath)) diff --git a/src/Greenshot.Addon.OCR/OcrAddonModule.cs b/src/Greenshot.Addon.OCR/OcrAddonModule.cs index f8559fc68..fc4e127d6 100644 --- a/src/Greenshot.Addon.OCR/OcrAddonModule.cs +++ b/src/Greenshot.Addon.OCR/OcrAddonModule.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Diagnostics; using System.IO; using Autofac; diff --git a/src/Greenshot.Addon.OCR/SettingsForm.Designer.cs b/src/Greenshot.Addon.OCR/SettingsForm.Designer.cs index 148acc9c6..8164c7bba 100644 --- a/src/Greenshot.Addon.OCR/SettingsForm.Designer.cs +++ b/src/Greenshot.Addon.OCR/SettingsForm.Designer.cs @@ -110,7 +110,7 @@ namespace Greenshot.Addon.OCR this.buttonOK.Size = new System.Drawing.Size(104, 23); this.buttonOK.TabIndex = 4; this.buttonOK.UseVisualStyleBackColor = true; - this.buttonOK.Click += new System.EventHandler(this.ButtonOKClick); + this.buttonOK.Click += new System.EventHandler(this.ButtonOkClick); // // buttonCancel // diff --git a/src/Greenshot.Addon.OCR/SettingsForm.cs b/src/Greenshot.Addon.OCR/SettingsForm.cs index f2b6bf18e..6e945a4f8 100644 --- a/src/Greenshot.Addon.OCR/SettingsForm.cs +++ b/src/Greenshot.Addon.OCR/SettingsForm.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,16 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using Greenshot.Addon.OCR.Configuration; using Greenshot.Addons.Controls; -#endregion - namespace Greenshot.Addon.OCR { /// @@ -36,14 +28,14 @@ namespace Greenshot.Addon.OCR /// public partial class SettingsForm : GreenshotForm { - private readonly IOcrConfiguration config; + private readonly IOcrConfiguration _config; public SettingsForm(string[] languages, IOcrLanguage ocrLanguage, IOcrConfiguration config) : base(ocrLanguage) { // // The InitializeComponent() call is required for Windows Forms designer support. // - this.config = config; + _config = config; InitializeComponent(); AcceptButton = buttonOK; CancelButton = buttonCancel; @@ -69,12 +61,12 @@ namespace Greenshot.Addon.OCR } } - private void ButtonOKClick(object sender, EventArgs e) + private void ButtonOkClick(object sender, EventArgs e) { var selectedString = (string) comboBox_languages.SelectedItem; if (selectedString != null) { - config.Language = selectedString.ToUpper(); + _config.Language = selectedString.ToUpper(); } } } diff --git a/src/Greenshot.Addon.OcrCommand/COMWrapper.cs b/src/Greenshot.Addon.OcrCommand/COMWrapper.cs index 67f9c14db..214221025 100644 --- a/src/Greenshot.Addon.OcrCommand/COMWrapper.cs +++ b/src/Greenshot.Addon.OcrCommand/COMWrapper.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Diagnostics; using System.Reflection; @@ -31,8 +25,6 @@ using System.Runtime.Remoting; using System.Runtime.Remoting.Messaging; using System.Runtime.Remoting.Proxies; -#endregion - namespace Greenshot.Addon.OcrCommand { /// @@ -314,9 +306,7 @@ namespace Greenshot.Addon.OcrCommand return new ReturnMessage(returnValue, outArgs, outArgsCount, callMessage.LogicalCallContext, callMessage); } - #region Private Data - - /// + /// /// Holds reference to the actual COM object which is wrapped by this proxy /// private readonly object _comObject; @@ -331,11 +321,7 @@ namespace Greenshot.Addon.OcrCommand /// private readonly Type _interceptType; - #endregion - - #region Construction - - /// + /// /// Gets a COM object and returns the transparent proxy which intercepts all calls to the object /// /// Interface which defines the method and properties to intercept @@ -510,11 +496,7 @@ namespace Greenshot.Addon.OcrCommand _interceptType = type; } - #endregion - - #region Clean up - - /// + /// /// If dispose() is not called, we need to make /// sure that the COM object is still cleaned up. /// @@ -560,11 +542,7 @@ namespace Greenshot.Addon.OcrCommand } } - #endregion - - #region Object methods - - /// + /// /// Returns a string representing the wrapped object. /// /// @@ -637,7 +615,5 @@ namespace Greenshot.Addon.OcrCommand return byRefType; } - - #endregion - } + } } \ No newline at end of file diff --git a/src/Greenshot.Addon.OcrCommand/ComProgIdAttribute.cs b/src/Greenshot.Addon.OcrCommand/ComProgIdAttribute.cs index b49b17fad..05fc8675d 100644 --- a/src/Greenshot.Addon.OcrCommand/ComProgIdAttribute.cs +++ b/src/Greenshot.Addon.OcrCommand/ComProgIdAttribute.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; -#endregion - namespace Greenshot.Addon.OcrCommand { /// diff --git a/src/Greenshot.Addon.OcrCommand/Modi/CompressionLevel.cs b/src/Greenshot.Addon.OcrCommand/Modi/CompressionLevel.cs index 21ac98c25..b422130f8 100644 --- a/src/Greenshot.Addon.OcrCommand/Modi/CompressionLevel.cs +++ b/src/Greenshot.Addon.OcrCommand/Modi/CompressionLevel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addon.OcrCommand.Modi { public enum CompressionLevel diff --git a/src/Greenshot.Addon.OcrCommand/Modi/FileFormat.cs b/src/Greenshot.Addon.OcrCommand/Modi/FileFormat.cs index 164097f5a..729d0b24d 100644 --- a/src/Greenshot.Addon.OcrCommand/Modi/FileFormat.cs +++ b/src/Greenshot.Addon.OcrCommand/Modi/FileFormat.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addon.OcrCommand.Modi { public enum FileFormat diff --git a/src/Greenshot.Addon.OcrCommand/Modi/ICommon.cs b/src/Greenshot.Addon.OcrCommand/Modi/ICommon.cs index 53bd0e5ac..848a9f247 100644 --- a/src/Greenshot.Addon.OcrCommand/Modi/ICommon.cs +++ b/src/Greenshot.Addon.OcrCommand/Modi/ICommon.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; -#endregion - namespace Greenshot.Addon.OcrCommand.Modi { /// diff --git a/src/Greenshot.Addon.OcrCommand/Modi/IDispatch.cs b/src/Greenshot.Addon.OcrCommand/Modi/IDispatch.cs index 9da6b2ce4..e8b91c2b7 100644 --- a/src/Greenshot.Addon.OcrCommand/Modi/IDispatch.cs +++ b/src/Greenshot.Addon.OcrCommand/Modi/IDispatch.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,16 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Runtime.InteropServices; using System.Runtime.InteropServices.CustomMarshalers; -#endregion - namespace Greenshot.Addon.OcrCommand.Modi { [ComImport] diff --git a/src/Greenshot.Addon.OcrCommand/Modi/IDocument.cs b/src/Greenshot.Addon.OcrCommand/Modi/IDocument.cs index d2f1114e4..1440f7615 100644 --- a/src/Greenshot.Addon.OcrCommand/Modi/IDocument.cs +++ b/src/Greenshot.Addon.OcrCommand/Modi/IDocument.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,12 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - -#endregion - namespace Greenshot.Addon.OcrCommand.Modi { /// diff --git a/src/Greenshot.Addon.OcrCommand/Modi/IImage.cs b/src/Greenshot.Addon.OcrCommand/Modi/IImage.cs index e90c1d538..6ddb1feb5 100644 --- a/src/Greenshot.Addon.OcrCommand/Modi/IImage.cs +++ b/src/Greenshot.Addon.OcrCommand/Modi/IImage.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addon.OcrCommand.Modi { /// diff --git a/src/Greenshot.Addon.OcrCommand/Modi/IImages.cs b/src/Greenshot.Addon.OcrCommand/Modi/IImages.cs index 2fd2f7491..16e425779 100644 --- a/src/Greenshot.Addon.OcrCommand/Modi/IImages.cs +++ b/src/Greenshot.Addon.OcrCommand/Modi/IImages.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Collections; -#endregion - namespace Greenshot.Addon.OcrCommand.Modi { /// diff --git a/src/Greenshot.Addon.OcrCommand/Modi/ILayout.cs b/src/Greenshot.Addon.OcrCommand/Modi/ILayout.cs index c0c095061..7b36bc989 100644 --- a/src/Greenshot.Addon.OcrCommand/Modi/ILayout.cs +++ b/src/Greenshot.Addon.OcrCommand/Modi/ILayout.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addon.OcrCommand.Modi { /// diff --git a/src/Greenshot.Addon.OcrCommand/Modi/IMiRect.cs b/src/Greenshot.Addon.OcrCommand/Modi/IMiRect.cs index 6d6909ffd..26544e805 100644 --- a/src/Greenshot.Addon.OcrCommand/Modi/IMiRect.cs +++ b/src/Greenshot.Addon.OcrCommand/Modi/IMiRect.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addon.OcrCommand.Modi { /// diff --git a/src/Greenshot.Addon.OcrCommand/Modi/IMiRects.cs b/src/Greenshot.Addon.OcrCommand/Modi/IMiRects.cs index 9a6c01e29..e43884c11 100644 --- a/src/Greenshot.Addon.OcrCommand/Modi/IMiRects.cs +++ b/src/Greenshot.Addon.OcrCommand/Modi/IMiRects.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Collections; -#endregion - namespace Greenshot.Addon.OcrCommand.Modi { /// diff --git a/src/Greenshot.Addon.OcrCommand/Modi/IWord.cs b/src/Greenshot.Addon.OcrCommand/Modi/IWord.cs index 2b64df57f..14c4e6d31 100644 --- a/src/Greenshot.Addon.OcrCommand/Modi/IWord.cs +++ b/src/Greenshot.Addon.OcrCommand/Modi/IWord.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addon.OcrCommand.Modi { /// diff --git a/src/Greenshot.Addon.OcrCommand/Modi/IWords.cs b/src/Greenshot.Addon.OcrCommand/Modi/IWords.cs index 9e3e64735..96fa0a75c 100644 --- a/src/Greenshot.Addon.OcrCommand/Modi/IWords.cs +++ b/src/Greenshot.Addon.OcrCommand/Modi/IWords.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Collections; -#endregion - namespace Greenshot.Addon.OcrCommand.Modi { /// diff --git a/src/Greenshot.Addon.OcrCommand/Modi/ModiLanguage.cs b/src/Greenshot.Addon.OcrCommand/Modi/ModiLanguage.cs index 7a6f3198d..666fffa07 100644 --- a/src/Greenshot.Addon.OcrCommand/Modi/ModiLanguage.cs +++ b/src/Greenshot.Addon.OcrCommand/Modi/ModiLanguage.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addon.OcrCommand.Modi { public enum ModiLanguage diff --git a/src/Greenshot.Addon.OcrCommand/Program.cs b/src/Greenshot.Addon.OcrCommand/Program.cs index cfb36ad77..c42ea7735 100644 --- a/src/Greenshot.Addon.OcrCommand/Program.cs +++ b/src/Greenshot.Addon.OcrCommand/Program.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.IO; @@ -30,7 +24,6 @@ using Greenshot.Addon.OcrCommand.Modi; #if DEBUG using System.Diagnostics; #endif -#endregion namespace Greenshot.Addon.OcrCommand { diff --git a/src/Greenshot.Addon.Office/Configuration/IOfficeConfiguration.cs b/src/Greenshot.Addon.Office/Configuration/IOfficeConfiguration.cs index 48391b1e5..29f3922da 100644 --- a/src/Greenshot.Addon.Office/Configuration/IOfficeConfiguration.cs +++ b/src/Greenshot.Addon.Office/Configuration/IOfficeConfiguration.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,17 +17,11 @@ // You should have received a copy of the GNU General License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using Dapplo.Config.Ini; using Greenshot.Addon.Office.OfficeInterop; using Microsoft.Office.Interop.PowerPoint; -#endregion - namespace Greenshot.Addon.Office.Configuration { /// diff --git a/src/Greenshot.Addon.Office/Configuration/Impl/OfficeConfigurationImpl.cs b/src/Greenshot.Addon.Office/Configuration/Impl/OfficeConfigurationImpl.cs index e8c1fd02b..90cc364f8 100644 --- a/src/Greenshot.Addon.Office/Configuration/Impl/OfficeConfigurationImpl.cs +++ b/src/Greenshot.Addon.Office/Configuration/Impl/OfficeConfigurationImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General License // along with this program. If not, see . -#endregion - using Dapplo.Config.Ini; using Greenshot.Addon.Office.OfficeInterop; using Microsoft.Office.Interop.PowerPoint; @@ -33,8 +29,6 @@ namespace Greenshot.Addon.Office.Configuration.Impl #pragma warning disable CS1591 internal class OfficeConfigurationImpl : IniSectionBase, IOfficeConfiguration { - #region Implementation of IOfficeConfiguration - public EmailFormat OutlookEmailFormat { get; set; } public string EmailSubjectPattern { get; set; } public string EmailTo { get; set; } @@ -44,7 +38,5 @@ namespace Greenshot.Addon.Office.Configuration.Impl public bool WordLockAspectRatio { get; set; } public bool PowerpointLockAspectRatio { get; set; } public PpSlideLayout PowerpointSlideLayout { get; set; } - - #endregion } } diff --git a/src/Greenshot.Addon.Office/Configuration/Impl/OfficeLanguageImpl.cs b/src/Greenshot.Addon.Office/Configuration/Impl/OfficeLanguageImpl.cs index 0039d2200..a26197369 100644 --- a/src/Greenshot.Addon.Office/Configuration/Impl/OfficeLanguageImpl.cs +++ b/src/Greenshot.Addon.Office/Configuration/Impl/OfficeLanguageImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Diagnostics.CodeAnalysis; using Dapplo.Config.Language; @@ -33,8 +29,6 @@ namespace Greenshot.Addon.Office.Configuration.Impl [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] public class OfficeLanguageImpl : LanguageBase, IOfficeLanguage { - #region Implementation of IOfficeLanguage - public string SettingsTitle { get; } public string WordLockaspect { get; } public string OutlookAllowmeetings { get; } @@ -46,7 +40,5 @@ namespace Greenshot.Addon.Office.Configuration.Impl public string OutlookEmailBcc { get; } public string PowerpointSlideLayout { get; } public string PowerpointLockaspect { get; } - - #endregion } } diff --git a/src/Greenshot.Addon.Office/Destinations/ExcelDestination.cs b/src/Greenshot.Addon.Office/Destinations/ExcelDestination.cs index 61f18bb42..ab14ce4f0 100644 --- a/src/Greenshot.Addon.Office/Destinations/ExcelDestination.cs +++ b/src/Greenshot.Addon.Office/Destinations/ExcelDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,12 +17,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Collections.Generic; -using System.Drawing; using System.IO; using System.Text.RegularExpressions; using Greenshot.Addon.Office.OfficeExport; @@ -33,8 +26,7 @@ using Greenshot.Addons.Components; using Greenshot.Addons.Core; using Greenshot.Addons.Interfaces; using Greenshot.Addons.Interfaces.Plugin; - -#endregion +using Greenshot.Gfx; namespace Greenshot.Addon.Office.Destinations { @@ -96,7 +88,7 @@ namespace Greenshot.Addon.Office.Destinations public override bool IsActive => base.IsActive && _exePath != null; /// - public override Bitmap GetDisplayIcon(double dpi) + public override IBitmapWithNativeSupport GetDisplayIcon(double dpi) { return PluginUtils.GetCachedExeIcon(_exePath, !string.IsNullOrEmpty(_workbookName) ? IconWorkbook : IconApplication, dpi > 100); } diff --git a/src/Greenshot.Addon.Office/Destinations/OneNoteDestination.cs b/src/Greenshot.Addon.Office/Destinations/OneNoteDestination.cs index b3b29c1b7..cc4ba6595 100644 --- a/src/Greenshot.Addon.Office/Destinations/OneNoteDestination.cs +++ b/src/Greenshot.Addon.Office/Destinations/OneNoteDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,13 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; -using System.Drawing; using System.IO; using System.Linq; using System.Runtime.InteropServices; @@ -36,8 +29,7 @@ using Greenshot.Addons; using Greenshot.Addons.Components; using Greenshot.Addons.Core; using Greenshot.Addons.Interfaces; - -#endregion +using Greenshot.Gfx; namespace Greenshot.Addon.Office.Destinations { @@ -113,7 +105,7 @@ namespace Greenshot.Addon.Office.Destinations public override bool IsActive => base.IsActive && _exePath != null; /// - public override Bitmap GetDisplayIcon(double dpi) + public override IBitmapWithNativeSupport GetDisplayIcon(double dpi) { return PluginUtils.GetCachedExeIcon(_exePath, IconApplication, dpi > 100); } diff --git a/src/Greenshot.Addon.Office/Destinations/OutlookDestination.cs b/src/Greenshot.Addon.Office/Destinations/OutlookDestination.cs index ddb9261cc..3ab2fa5c4 100644 --- a/src/Greenshot.Addon.Office/Destinations/OutlookDestination.cs +++ b/src/Greenshot.Addon.Office/Destinations/OutlookDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,12 +17,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Collections.Generic; -using System.Drawing; using System.IO; using System.Text.RegularExpressions; using System.Windows.Forms; @@ -37,10 +30,9 @@ using Greenshot.Addons.Core; using Greenshot.Addons.Interfaces; using Greenshot.Addons.Interfaces.Plugin; using Greenshot.Addons.Resources; +using Greenshot.Gfx; using Microsoft.Office.Interop.Outlook; -#endregion - namespace Greenshot.Addon.Office.Destinations { /// @@ -56,7 +48,7 @@ namespace Greenshot.Addon.Office.Destinations private readonly IOfficeConfiguration _officeConfiguration; private readonly ExportNotification _exportNotification; - private static readonly Bitmap MailIcon = GreenshotResources.Instance.GetBitmap("Email.Image"); + private static readonly IBitmapWithNativeSupport MailIcon = GreenshotResources.Instance.GetBitmap("Email.Image"); private readonly string _exePath; private readonly bool _isActiveFlag; private readonly string _outlookInspectorCaption; @@ -130,7 +122,7 @@ namespace Greenshot.Addon.Office.Destinations public override Keys EditorShortcutKeys => Keys.Control | Keys.E; /// - public override Bitmap GetDisplayIcon(double dpi) + public override IBitmapWithNativeSupport GetDisplayIcon(double dpi) { if (_outlookInspectorCaption == null) { diff --git a/src/Greenshot.Addon.Office/Destinations/PowerpointDestination.cs b/src/Greenshot.Addon.Office/Destinations/PowerpointDestination.cs index acb256a12..42e3de98a 100644 --- a/src/Greenshot.Addon.Office/Destinations/PowerpointDestination.cs +++ b/src/Greenshot.Addon.Office/Destinations/PowerpointDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Collections.Generic; using System.Drawing; using System.IO; @@ -35,8 +29,7 @@ using Greenshot.Addons.Components; using Greenshot.Addons.Core; using Greenshot.Addons.Interfaces; using Greenshot.Addons.Interfaces.Plugin; - -#endregion +using Greenshot.Gfx; namespace Greenshot.Addon.Office.Destinations { @@ -117,7 +110,7 @@ namespace Greenshot.Addon.Office.Destinations public override bool IsActive => base.IsActive && _exePath != null; /// - public override Bitmap GetDisplayIcon(double dpi) + public override IBitmapWithNativeSupport GetDisplayIcon(double dpi) { if (!string.IsNullOrEmpty(_presentationName)) { diff --git a/src/Greenshot.Addon.Office/Destinations/WordDestination.cs b/src/Greenshot.Addon.Office/Destinations/WordDestination.cs index 253e0e496..778f7df9d 100644 --- a/src/Greenshot.Addon.Office/Destinations/WordDestination.cs +++ b/src/Greenshot.Addon.Office/Destinations/WordDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,13 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; -using System.Drawing; using System.IO; using System.Linq; using System.Text.RegularExpressions; @@ -37,8 +30,7 @@ using Greenshot.Addons.Components; using Greenshot.Addons.Core; using Greenshot.Addons.Interfaces; using Greenshot.Addons.Interfaces.Plugin; - -#endregion +using Greenshot.Gfx; namespace Greenshot.Addon.Office.Destinations { @@ -108,7 +100,7 @@ namespace Greenshot.Addon.Office.Destinations public override bool IsActive => base.IsActive && _exePath != null; /// - public override Bitmap GetDisplayIcon(double dpi) + public override IBitmapWithNativeSupport GetDisplayIcon(double dpi) { return PluginUtils.GetCachedExeIcon(_exePath, !string.IsNullOrEmpty(_documentCaption) ? IconDocument : IconApplication, dpi > 100); } diff --git a/src/Greenshot.Addon.Office/Greenshot.Addon.Office.csproj b/src/Greenshot.Addon.Office/Greenshot.Addon.Office.csproj index c5bc70853..f75477886 100644 --- a/src/Greenshot.Addon.Office/Greenshot.Addon.Office.csproj +++ b/src/Greenshot.Addon.Office/Greenshot.Addon.Office.csproj @@ -1,4 +1,4 @@ - + Greenshot.Addon.Office @@ -40,7 +40,7 @@ - + diff --git a/src/Greenshot.Addon.Office/OfficeAddonModule.cs b/src/Greenshot.Addon.Office/OfficeAddonModule.cs index c39376d2e..aa2127870 100644 --- a/src/Greenshot.Addon.Office/OfficeAddonModule.cs +++ b/src/Greenshot.Addon.Office/OfficeAddonModule.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Autofac; using Dapplo.Addons; using Dapplo.CaliburnMicro.Configuration; diff --git a/src/Greenshot.Addon.Office/OfficeExport/Entities/OneNoteNotebook.cs b/src/Greenshot.Addon.Office/OfficeExport/Entities/OneNoteNotebook.cs index 13c450d0b..9155e269f 100644 --- a/src/Greenshot.Addon.Office/OfficeExport/Entities/OneNoteNotebook.cs +++ b/src/Greenshot.Addon.Office/OfficeExport/Entities/OneNoteNotebook.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,13 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - - -#endregion - namespace Greenshot.Addon.Office.OfficeExport.Entities { /// diff --git a/src/Greenshot.Addon.Office/OfficeExport/Entities/OneNotePage.cs b/src/Greenshot.Addon.Office/OfficeExport/Entities/OneNotePage.cs index 794835774..fbf169343 100644 --- a/src/Greenshot.Addon.Office/OfficeExport/Entities/OneNotePage.cs +++ b/src/Greenshot.Addon.Office/OfficeExport/Entities/OneNotePage.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,13 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - - -#endregion - namespace Greenshot.Addon.Office.OfficeExport.Entities { /// diff --git a/src/Greenshot.Addon.Office/OfficeExport/Entities/OneNoteSection.cs b/src/Greenshot.Addon.Office/OfficeExport/Entities/OneNoteSection.cs index 3c64cef73..fbee1f222 100644 --- a/src/Greenshot.Addon.Office/OfficeExport/Entities/OneNoteSection.cs +++ b/src/Greenshot.Addon.Office/OfficeExport/Entities/OneNoteSection.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,13 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - - -#endregion - namespace Greenshot.Addon.Office.OfficeExport.Entities { /// diff --git a/src/Greenshot.Addon.Office/OfficeExport/ExcelExporter.cs b/src/Greenshot.Addon.Office/OfficeExport/ExcelExporter.cs index 15798b2e2..928309c08 100644 --- a/src/Greenshot.Addon.Office/OfficeExport/ExcelExporter.cs +++ b/src/Greenshot.Addon.Office/OfficeExport/ExcelExporter.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Drawing; @@ -34,8 +28,6 @@ using Microsoft.Office.Core; using Microsoft.Office.Interop.Excel; using Version = System.Version; -#endregion - namespace Greenshot.Addon.Office.OfficeExport { /// diff --git a/src/Greenshot.Addon.Office/OfficeExport/OneNoteExporter.cs b/src/Greenshot.Addon.Office/OfficeExport/OneNoteExporter.cs index 9f6a82189..bbdf1459f 100644 --- a/src/Greenshot.Addon.Office/OfficeExport/OneNoteExporter.cs +++ b/src/Greenshot.Addon.Office/OfficeExport/OneNoteExporter.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.IO; @@ -37,8 +31,6 @@ using Greenshot.Addons.Interfaces.Plugin; using Greenshot.Core.Enums; using Microsoft.Office.Interop.OneNote; -#endregion - namespace Greenshot.Addon.Office.OfficeExport { /// diff --git a/src/Greenshot.Addon.Office/OfficeExport/OutlookEmailExporter.cs b/src/Greenshot.Addon.Office/OfficeExport/OutlookEmailExporter.cs index ac721e577..1922d265c 100644 --- a/src/Greenshot.Addon.Office/OfficeExport/OutlookEmailExporter.cs +++ b/src/Greenshot.Addon.Office/OfficeExport/OutlookEmailExporter.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.IO; @@ -39,8 +33,6 @@ using Application = Microsoft.Office.Interop.Outlook.Application; using Exception = System.Exception; using Version = System.Version; -#endregion - namespace Greenshot.Addon.Office.OfficeExport { /// diff --git a/src/Greenshot.Addon.Office/OfficeExport/PowerpointExporter.cs b/src/Greenshot.Addon.Office/OfficeExport/PowerpointExporter.cs index 84afa8a34..aab20d66c 100644 --- a/src/Greenshot.Addon.Office/OfficeExport/PowerpointExporter.cs +++ b/src/Greenshot.Addon.Office/OfficeExport/PowerpointExporter.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Drawing; @@ -34,8 +28,6 @@ using Microsoft.Office.Core; using Microsoft.Office.Interop.PowerPoint; using Shape = Microsoft.Office.Interop.PowerPoint.Shape; -#endregion - namespace Greenshot.Addon.Office.OfficeExport { /// diff --git a/src/Greenshot.Addon.Office/OfficeExport/WordExporter.cs b/src/Greenshot.Addon.Office/OfficeExport/WordExporter.cs index 8e633d15f..c200fabf2 100644 --- a/src/Greenshot.Addon.Office/OfficeExport/WordExporter.cs +++ b/src/Greenshot.Addon.Office/OfficeExport/WordExporter.cs @@ -17,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#region Usings - using System; using System.Collections.Generic; using Dapplo.Log; @@ -29,8 +27,6 @@ using Microsoft.Office.Core; using Microsoft.Office.Interop.Word; using Version = System.Version; -#endregion - namespace Greenshot.Addon.Office.OfficeExport { /// diff --git a/src/Greenshot.Addon.Office/OfficeInterop/EmailFormat.cs b/src/Greenshot.Addon.Office/OfficeInterop/EmailFormat.cs index a8a716d0b..8a60b6519 100644 --- a/src/Greenshot.Addon.Office/OfficeInterop/EmailFormat.cs +++ b/src/Greenshot.Addon.Office/OfficeInterop/EmailFormat.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addon.Office.OfficeInterop { /// diff --git a/src/Greenshot.Addon.Office/OfficeInterop/OfficeVersions.cs b/src/Greenshot.Addon.Office/OfficeInterop/OfficeVersions.cs index 5f199efe2..b870a0535 100644 --- a/src/Greenshot.Addon.Office/OfficeInterop/OfficeVersions.cs +++ b/src/Greenshot.Addon.Office/OfficeInterop/OfficeVersions.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addon.Office.OfficeInterop { /// diff --git a/src/Greenshot.Addon.Office/ViewModels/OfficeConfigViewModel.cs b/src/Greenshot.Addon.Office/ViewModels/OfficeConfigViewModel.cs index 792dc6f19..a249fde37 100644 --- a/src/Greenshot.Addon.Office/ViewModels/OfficeConfigViewModel.cs +++ b/src/Greenshot.Addon.Office/ViewModels/OfficeConfigViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Collections.Generic; using System.Reactive.Disposables; using Dapplo.CaliburnMicro.Configuration; diff --git a/src/Greenshot.Addon.OneDrive/Configuration/IOneDriveConfiguration.cs b/src/Greenshot.Addon.OneDrive/Configuration/IOneDriveConfiguration.cs index d729dd396..83508c41b 100644 --- a/src/Greenshot.Addon.OneDrive/Configuration/IOneDriveConfiguration.cs +++ b/src/Greenshot.Addon.OneDrive/Configuration/IOneDriveConfiguration.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,18 +17,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using System.Runtime.Serialization; using Dapplo.Config.Ini; using Dapplo.HttpExtensions.OAuth; using Greenshot.Addons.Core; -#endregion - namespace Greenshot.Addon.OneDrive.Configuration { [IniSection("OneDrive")] diff --git a/src/Greenshot.Addon.OneDrive/Configuration/IOneDriveLanguage.cs b/src/Greenshot.Addon.OneDrive/Configuration/IOneDriveLanguage.cs index 629025ae9..cced78aa4 100644 --- a/src/Greenshot.Addon.OneDrive/Configuration/IOneDriveLanguage.cs +++ b/src/Greenshot.Addon.OneDrive/Configuration/IOneDriveLanguage.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,21 +17,15 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using Dapplo.Config.Language; -#endregion - #pragma warning disable 1591 namespace Greenshot.Addon.OneDrive.Configuration { - /// - /// This interface contains all the translations for the OneDrive addon + /// + /// This interface contains all the translations for the OneDrive addon /// [Language("OneDrive")] public interface IOneDriveLanguage : ILanguage, INotifyPropertyChanged @@ -54,6 +46,6 @@ namespace Greenshot.Addon.OneDrive.Configuration string ResetCredentialsButton { get; } } -} - +} + #pragma warning restore 1591 \ No newline at end of file diff --git a/src/Greenshot.Addon.OneDrive/Configuration/Impl/OneDriveConfigurationImpl.cs b/src/Greenshot.Addon.OneDrive/Configuration/Impl/OneDriveConfigurationImpl.cs index 6a09a13b8..29c8a4aef 100644 --- a/src/Greenshot.Addon.OneDrive/Configuration/Impl/OneDriveConfigurationImpl.cs +++ b/src/Greenshot.Addon.OneDrive/Configuration/Impl/OneDriveConfigurationImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.ComponentModel; using Dapplo.Config.Ini; @@ -31,8 +27,6 @@ namespace Greenshot.Addon.OneDrive.Configuration.Impl { internal class OneDriveConfigurationImpl : IniSectionBase, IOneDriveConfiguration { - #region Implementation of IFileConfiguration - public string OutputFilePath { get; set; } public bool OutputFileAllowOverwrite { get; set; } public string OutputFileFilenamePattern { get; set; } @@ -46,16 +40,8 @@ namespace Greenshot.Addon.OneDrive.Configuration.Impl public string OptimizePNGCommand { get; set; } public string OptimizePNGCommandArguments { get; set; } - #endregion - - #region Implementation of IDestinationFileConfiguration - public bool UseOwnSettings { get; set; } - #endregion - - #region Implementation of IOAuth2Token - [TypeConverter(typeof(StringEncryptionTypeConverter))] public string OAuth2AccessToken { get; set; } @@ -64,14 +50,8 @@ namespace Greenshot.Addon.OneDrive.Configuration.Impl [TypeConverter(typeof(StringEncryptionTypeConverter))] public string OAuth2RefreshToken { get; set; } - #endregion - - #region Implementation of IOneDriveConfiguration - public bool AfterUploadLinkToClipBoard { get; set; } public OneDriveLinkType LinkType { get; set; } public string ClientId { get; set; } - - #endregion } } diff --git a/src/Greenshot.Addon.OneDrive/Configuration/Impl/OneDriveLanguageImpl.cs b/src/Greenshot.Addon.OneDrive/Configuration/Impl/OneDriveLanguageImpl.cs index 66a24d894..f37111aba 100644 --- a/src/Greenshot.Addon.OneDrive/Configuration/Impl/OneDriveLanguageImpl.cs +++ b/src/Greenshot.Addon.OneDrive/Configuration/Impl/OneDriveLanguageImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Diagnostics.CodeAnalysis; using Dapplo.Config.Language; @@ -33,8 +29,6 @@ namespace Greenshot.Addon.OneDrive.Configuration.Impl #pragma warning disable CS1591 public class OneDriveLanguageImpl : LanguageBase, IOneDriveLanguage { - #region Implementation of IOneDriveLanguage - public string CommunicationWait { get; } public string LabelUploadFormat { get; } public string LabelLinkType { get; } @@ -43,7 +37,5 @@ namespace Greenshot.Addon.OneDrive.Configuration.Impl public string UploadMenuItem { get; } public string UsePageLink { get; } public string ResetCredentialsButton { get; } - - #endregion } } diff --git a/src/Greenshot.Addon.OneDrive/Entities/OneDriveGetLinkRequest.cs b/src/Greenshot.Addon.OneDrive/Entities/OneDriveGetLinkRequest.cs index 60e12f9f6..8091e1912 100644 --- a/src/Greenshot.Addon.OneDrive/Entities/OneDriveGetLinkRequest.cs +++ b/src/Greenshot.Addon.OneDrive/Entities/OneDriveGetLinkRequest.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,25 +17,23 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Newtonsoft.Json; namespace Greenshot.Addon.OneDrive.Entities { - /// - /// The request to get a link + /// + /// The request to get a link /// public class OneDriveGetLinkRequest { - /// - /// The type of the link which is requested + /// + /// The type of the link which is requested /// [JsonProperty("type")] public string Type; - /// - /// Scope of the link + /// + /// Scope of the link /// [JsonProperty("scope")] public string Scope; diff --git a/src/Greenshot.Addon.OneDrive/Entities/OneDriveGetLinkResponse.cs b/src/Greenshot.Addon.OneDrive/Entities/OneDriveGetLinkResponse.cs index e6841ccbe..3b196786b 100644 --- a/src/Greenshot.Addon.OneDrive/Entities/OneDriveGetLinkResponse.cs +++ b/src/Greenshot.Addon.OneDrive/Entities/OneDriveGetLinkResponse.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,25 +17,23 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Newtonsoft.Json; namespace Greenshot.Addon.OneDrive.Entities { - /// - /// This is the response for the "get link" API + /// + /// This is the response for the "get link" API /// public class OneDriveGetLinkResponse { - /// - /// The ID for the response + /// + /// The ID for the response /// [JsonProperty("id")] public string Id; - /// - /// The property for the actual link + /// + /// The property for the actual link /// [JsonProperty("link")] public OneDriveGetLinkResponseLink Link; diff --git a/src/Greenshot.Addon.OneDrive/Entities/OneDriveGetLinkResponseLink.cs b/src/Greenshot.Addon.OneDrive/Entities/OneDriveGetLinkResponseLink.cs index a08a647ea..fa9f59e29 100644 --- a/src/Greenshot.Addon.OneDrive/Entities/OneDriveGetLinkResponseLink.cs +++ b/src/Greenshot.Addon.OneDrive/Entities/OneDriveGetLinkResponseLink.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Newtonsoft.Json; namespace Greenshot.Addon.OneDrive.Entities diff --git a/src/Greenshot.Addon.OneDrive/Entities/OneDriveUploadResponse.cs b/src/Greenshot.Addon.OneDrive/Entities/OneDriveUploadResponse.cs index e52c4fa5b..e1345b502 100644 --- a/src/Greenshot.Addon.OneDrive/Entities/OneDriveUploadResponse.cs +++ b/src/Greenshot.Addon.OneDrive/Entities/OneDriveUploadResponse.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,25 +17,23 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Newtonsoft.Json; namespace Greenshot.Addon.OneDrive.Entities { - /// - /// The response for the upload, only what we need is defined here + /// + /// The response for the upload, only what we need is defined here /// public class OneDriveUploadResponse { - /// - /// Id of the response + /// + /// Id of the response /// [JsonProperty("id")] public string Id; - /// - /// The url + /// + /// The url /// [JsonProperty("webUrl")] public string WebUrl; diff --git a/src/Greenshot.Addon.OneDrive/Greenshot.Addon.OneDrive.csproj b/src/Greenshot.Addon.OneDrive/Greenshot.Addon.OneDrive.csproj index 6f03bf637..a9d85013d 100644 --- a/src/Greenshot.Addon.OneDrive/Greenshot.Addon.OneDrive.csproj +++ b/src/Greenshot.Addon.OneDrive/Greenshot.Addon.OneDrive.csproj @@ -1,4 +1,4 @@ - + Greenshot.Addon.OneDrive @@ -50,7 +50,7 @@ - + all diff --git a/src/Greenshot.Addon.OneDrive/OneDriveAddonModule.cs b/src/Greenshot.Addon.OneDrive/OneDriveAddonModule.cs index 734202c9b..b6b77342d 100644 --- a/src/Greenshot.Addon.OneDrive/OneDriveAddonModule.cs +++ b/src/Greenshot.Addon.OneDrive/OneDriveAddonModule.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Autofac; using Dapplo.Addons; using Dapplo.CaliburnMicro.Configuration; diff --git a/src/Greenshot.Addon.OneDrive/OneDriveDestination.cs b/src/Greenshot.Addon.OneDrive/OneDriveDestination.cs index dfa9da5e1..e64d9e94f 100644 --- a/src/Greenshot.Addon.OneDrive/OneDriveDestination.cs +++ b/src/Greenshot.Addon.OneDrive/OneDriveDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,13 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; -using System.Drawing; using System.IO; using System.Net.Http; using System.Threading; @@ -49,8 +42,6 @@ using Greenshot.Addons.Extensions; using Greenshot.Addons.Interfaces; using Greenshot.Gfx; -#endregion - namespace Greenshot.Addon.OneDrive { /// @@ -117,7 +108,7 @@ namespace Greenshot.Addon.OneDrive public override string Description => _oneDriveLanguage.UploadMenuItem; - public override Bitmap DisplayIcon + public override IBitmapWithNativeSupport DisplayIcon { get { diff --git a/src/Greenshot.Addon.OneDrive/OneDriveLinkType.cs b/src/Greenshot.Addon.OneDrive/OneDriveLinkType.cs index 215bca6b3..4d71dfd4b 100644 --- a/src/Greenshot.Addon.OneDrive/OneDriveLinkType.cs +++ b/src/Greenshot.Addon.OneDrive/OneDriveLinkType.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addon.OneDrive { public enum OneDriveLinkType diff --git a/src/Greenshot.Addon.OneDrive/ViewModels/OneDriveConfigViewModel.cs b/src/Greenshot.Addon.OneDrive/ViewModels/OneDriveConfigViewModel.cs index c0ee54642..906b97b7b 100644 --- a/src/Greenshot.Addon.OneDrive/ViewModels/OneDriveConfigViewModel.cs +++ b/src/Greenshot.Addon.OneDrive/ViewModels/OneDriveConfigViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Collections.Generic; using System.Reactive.Disposables; using Dapplo.CaliburnMicro.Configuration; @@ -42,33 +38,33 @@ namespace Greenshot.Addon.OneDrive.ViewModels /// private CompositeDisposable _disposables; - /// - /// Used in the view to change the configuration + /// + /// Used in the view to change the configuration /// public IOneDriveConfiguration OneDriveConfiguration { get; } - /// - /// Used in the view for the translations + /// + /// Used in the view for the translations /// - public IOneDriveLanguage OneDriveLanguage { get; } - - /// - /// Used in the view for the translations + public IOneDriveLanguage OneDriveLanguage { get; } + + /// + /// Used in the view for the translations /// public IGreenshotLanguage GreenshotLanguage { get; } - /// - /// Used in the view to change the file configuration + /// + /// Used in the view to change the file configuration /// public FileConfigPartViewModel FileConfigPartViewModel { get; } - /// - /// Constructor used for dependency injection - /// - /// IOneDriveConfiguration - /// IOneDriveLanguage - /// IGreenshotLanguage - /// + /// + /// Constructor used for dependency injection + /// + /// IOneDriveConfiguration + /// IOneDriveLanguage + /// IGreenshotLanguage + /// FileConfigPartViewModel public OneDriveConfigViewModel( IOneDriveConfiguration oneDriveConfiguration, IOneDriveLanguage oneDriveLanguage, @@ -124,8 +120,8 @@ namespace Greenshot.Addon.OneDrive.ViewModels public bool CanResetCredentials => OneDriveConfiguration.HasToken(); - /// - /// Used to reset/clear the OAuth credentials + /// + /// Used to reset/clear the OAuth credentials /// public void ResetCredentials() { diff --git a/src/Greenshot.Addon.Photobucket/Configuration/IPhotobucketConfiguration.cs b/src/Greenshot.Addon.Photobucket/Configuration/IPhotobucketConfiguration.cs index c34adaa80..e9d7ccf06 100644 --- a/src/Greenshot.Addon.Photobucket/Configuration/IPhotobucketConfiguration.cs +++ b/src/Greenshot.Addon.Photobucket/Configuration/IPhotobucketConfiguration.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using System.Runtime.Serialization; using Dapplo.Config.Ini; @@ -30,8 +24,6 @@ using Dapplo.Config.Ini.Converters; using Dapplo.HttpExtensions.OAuth; using Greenshot.Addons.Core; -#endregion - namespace Greenshot.Addon.Photobucket.Configuration { /// diff --git a/src/Greenshot.Addon.Photobucket/Configuration/IPhotobucketLanguage.cs b/src/Greenshot.Addon.Photobucket/Configuration/IPhotobucketLanguage.cs index 3a3eb9b8b..da933785e 100644 --- a/src/Greenshot.Addon.Photobucket/Configuration/IPhotobucketLanguage.cs +++ b/src/Greenshot.Addon.Photobucket/Configuration/IPhotobucketLanguage.cs @@ -17,13 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#region Usings - using System.ComponentModel; using Dapplo.Config.Language; -#endregion - namespace Greenshot.Addon.Photobucket.Configuration { [Language("Photobucket")] diff --git a/src/Greenshot.Addon.Photobucket/Configuration/Impl/PhotobucketConfigurationImpl.cs b/src/Greenshot.Addon.Photobucket/Configuration/Impl/PhotobucketConfigurationImpl.cs index ffe5a28cb..b341e07a6 100644 --- a/src/Greenshot.Addon.Photobucket/Configuration/Impl/PhotobucketConfigurationImpl.cs +++ b/src/Greenshot.Addon.Photobucket/Configuration/Impl/PhotobucketConfigurationImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.ComponentModel; using Dapplo.Config.Ini; using Dapplo.Config.Ini.Converters; @@ -30,8 +26,6 @@ namespace Greenshot.Addon.Photobucket.Configuration.Impl { internal class PhotobucketConfigurationImpl : IniSectionBase, IPhotobucketConfiguration { - #region Implementation of IFileConfiguration - public string OutputFilePath { get; set; } public bool OutputFileAllowOverwrite { get; set; } public string OutputFileFilenamePattern { get; set; } @@ -45,16 +39,8 @@ namespace Greenshot.Addon.Photobucket.Configuration.Impl public string OptimizePNGCommand { get; set; } public string OptimizePNGCommandArguments { get; set; } - #endregion - - #region Implementation of IDestinationFileConfiguration - public bool UseOwnSettings { get; set; } - #endregion - - #region Implementation of IOAuth1Token - [TypeConverter(typeof(StringEncryptionTypeConverter))] public string OAuthToken { get; set; } @@ -64,10 +50,6 @@ namespace Greenshot.Addon.Photobucket.Configuration.Impl [TypeConverter(typeof(StringEncryptionTypeConverter))] public string OAuthTokenVerifier { get; set; } - #endregion - - #region Implementation of IPhotobucketConfiguration - public bool UsePageLink { get; set; } public string SubDomain { get; set; } public string Username { get; set; } @@ -75,7 +57,5 @@ namespace Greenshot.Addon.Photobucket.Configuration.Impl public int Credits { get; set; } public string ClientId { get; set; } public string ClientSecret { get; set; } - - #endregion } } diff --git a/src/Greenshot.Addon.Photobucket/Configuration/Impl/PhotobucketLanguageImpl.cs b/src/Greenshot.Addon.Photobucket/Configuration/Impl/PhotobucketLanguageImpl.cs index c145ef19d..d0338552a 100644 --- a/src/Greenshot.Addon.Photobucket/Configuration/Impl/PhotobucketLanguageImpl.cs +++ b/src/Greenshot.Addon.Photobucket/Configuration/Impl/PhotobucketLanguageImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Diagnostics.CodeAnalysis; using Dapplo.Config.Language; @@ -33,8 +29,6 @@ namespace Greenshot.Addon.Photobucket.Configuration.Impl [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] public class PhotobucketLanguageImpl : LanguageBase, IPhotobucketLanguage { - #region Implementation of IPhotobucketLanguage - public string CommunicationWait { get; } public string Configure { get; } public string LabelClear { get; } @@ -44,7 +38,5 @@ namespace Greenshot.Addon.Photobucket.Configuration.Impl public string UploadMenuItem { get; } public string UploadSuccess { get; } public string UsePageLink { get; } - - #endregion } } diff --git a/src/Greenshot.Addon.Photobucket/Greenshot.Addon.Photobucket.csproj b/src/Greenshot.Addon.Photobucket/Greenshot.Addon.Photobucket.csproj index e03fbe464..6a4e6d1d7 100644 --- a/src/Greenshot.Addon.Photobucket/Greenshot.Addon.Photobucket.csproj +++ b/src/Greenshot.Addon.Photobucket/Greenshot.Addon.Photobucket.csproj @@ -1,4 +1,4 @@ - + Greenshot.Addon.Photobucket @@ -49,7 +49,7 @@ - + all runtime; build; native; contentfiles; analyzers diff --git a/src/Greenshot.Addon.Photobucket/PhotobucketAddonModule.cs b/src/Greenshot.Addon.Photobucket/PhotobucketAddonModule.cs index e79619b5d..c27cee903 100644 --- a/src/Greenshot.Addon.Photobucket/PhotobucketAddonModule.cs +++ b/src/Greenshot.Addon.Photobucket/PhotobucketAddonModule.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Autofac; using Dapplo.Addons; using Dapplo.CaliburnMicro.Configuration; diff --git a/src/Greenshot.Addon.Photobucket/PhotobucketDestination.cs b/src/Greenshot.Addon.Photobucket/PhotobucketDestination.cs index 507857e52..a34d67396 100644 --- a/src/Greenshot.Addon.Photobucket/PhotobucketDestination.cs +++ b/src/Greenshot.Addon.Photobucket/PhotobucketDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,13 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; -using System.Drawing; using System.IO; using System.Net.Http; using System.Net.Http.Headers; @@ -45,8 +38,6 @@ using Greenshot.Addons.Extensions; using Greenshot.Addons.Interfaces; using Greenshot.Gfx; -#endregion - namespace Greenshot.Addon.Photobucket { /// @@ -168,7 +159,7 @@ namespace Greenshot.Addon.Photobucket } } - public override Bitmap DisplayIcon + public override IBitmapWithNativeSupport DisplayIcon { get { diff --git a/src/Greenshot.Addon.Photobucket/PhotobucketInfo.cs b/src/Greenshot.Addon.Photobucket/PhotobucketInfo.cs index 439547719..8d6906577 100644 --- a/src/Greenshot.Addon.Photobucket/PhotobucketInfo.cs +++ b/src/Greenshot.Addon.Photobucket/PhotobucketInfo.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,16 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Xml; using Dapplo.Log; -#endregion - namespace Greenshot.Addon.Photobucket { /// diff --git a/src/Greenshot.Addon.Photobucket/ViewModels/PhotobucketConfigViewModel.cs b/src/Greenshot.Addon.Photobucket/ViewModels/PhotobucketConfigViewModel.cs index 5ffcad8f5..ccf7569c2 100644 --- a/src/Greenshot.Addon.Photobucket/ViewModels/PhotobucketConfigViewModel.cs +++ b/src/Greenshot.Addon.Photobucket/ViewModels/PhotobucketConfigViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Reactive.Disposables; using Dapplo.CaliburnMicro.Configuration; using Dapplo.CaliburnMicro.Extensions; diff --git a/src/Greenshot.Addon.Tfs/Configuration/ITfsConfiguration.cs b/src/Greenshot.Addon.Tfs/Configuration/ITfsConfiguration.cs index 5a32ff1b3..fc3d8ecd3 100644 --- a/src/Greenshot.Addon.Tfs/Configuration/ITfsConfiguration.cs +++ b/src/Greenshot.Addon.Tfs/Configuration/ITfsConfiguration.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,19 +17,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.ComponentModel; using Dapplo.Config.Ini; using Dapplo.Config.Ini.Converters; using Greenshot.Addons.Core; -#endregion - -namespace Greenshot.Addon.Tfs +namespace Greenshot.Addon.Tfs.Configuration { [IniSection("Tfs")] [Description("Greenshot Tfs Addon configuration")] diff --git a/src/Greenshot.Addon.Tfs/Configuration/ITfsLanguage.cs b/src/Greenshot.Addon.Tfs/Configuration/ITfsLanguage.cs index df724c5bf..8c0693797 100644 --- a/src/Greenshot.Addon.Tfs/Configuration/ITfsLanguage.cs +++ b/src/Greenshot.Addon.Tfs/Configuration/ITfsLanguage.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using Dapplo.Config.Language; -#endregion - namespace Greenshot.Addon.Tfs { [Language("Tfs")] diff --git a/src/Greenshot.Addon.Tfs/Configuration/Impl/TfsConfigurationImpl.cs b/src/Greenshot.Addon.Tfs/Configuration/Impl/TfsConfigurationImpl.cs index 82611e9f3..b59931509 100644 --- a/src/Greenshot.Addon.Tfs/Configuration/Impl/TfsConfigurationImpl.cs +++ b/src/Greenshot.Addon.Tfs/Configuration/Impl/TfsConfigurationImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using Dapplo.Config.Ini; using Greenshot.Core.Enums; @@ -29,8 +25,6 @@ namespace Greenshot.Addon.Tfs.Configuration.Impl { internal class TfsConfigurationImpl : IniSectionBase, ITfsConfiguration { - #region Implementation of IFileConfiguration - public string OutputFilePath { get; set; } public bool OutputFileAllowOverwrite { get; set; } public string OutputFileFilenamePattern { get; set; } @@ -44,20 +38,10 @@ namespace Greenshot.Addon.Tfs.Configuration.Impl public string OptimizePNGCommand { get; set; } public string OptimizePNGCommandArguments { get; set; } - #endregion - - #region Implementation of IDestinationFileConfiguration - public bool UseOwnSettings { get; set; } - #endregion - - #region Implementation of ITfsConfiguration - public bool AfterUploadLinkToClipBoard { get; set; } public Uri TfsUri { get; set; } public string ApiKey { get; set; } - - #endregion } } diff --git a/src/Greenshot.Addon.Tfs/Configuration/Impl/TfsLanguageImpl.cs b/src/Greenshot.Addon.Tfs/Configuration/Impl/TfsLanguageImpl.cs index 6ed612ed9..1e254828c 100644 --- a/src/Greenshot.Addon.Tfs/Configuration/Impl/TfsLanguageImpl.cs +++ b/src/Greenshot.Addon.Tfs/Configuration/Impl/TfsLanguageImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Diagnostics.CodeAnalysis; using Dapplo.Config.Language; @@ -33,8 +29,6 @@ namespace Greenshot.Addon.Tfs.Configuration.Impl #pragma warning disable CS1591 public class TfsLanguageImpl : LanguageBase, ITfsLanguage { - #region Implementation of ITfsLanguage - public string CommunicationWait { get; } public string LabelUrl { get; } public string LabelApiKey { get; } @@ -42,7 +36,5 @@ namespace Greenshot.Addon.Tfs.Configuration.Impl public string UploadFailure { get; } public string UploadMenuItem { get; } public string UsePageLink { get; } - - #endregion } } diff --git a/src/Greenshot.Addon.Tfs/Entities/Attributes.cs b/src/Greenshot.Addon.Tfs/Entities/Attributes.cs index 3238f63f5..3fd8cce0f 100644 --- a/src/Greenshot.Addon.Tfs/Entities/Attributes.cs +++ b/src/Greenshot.Addon.Tfs/Entities/Attributes.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Newtonsoft.Json; namespace Greenshot.Addon.Tfs.Entities diff --git a/src/Greenshot.Addon.Tfs/Entities/Item.cs b/src/Greenshot.Addon.Tfs/Entities/Item.cs index f931b9c12..a9ef1315e 100644 --- a/src/Greenshot.Addon.Tfs/Entities/Item.cs +++ b/src/Greenshot.Addon.Tfs/Entities/Item.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using Newtonsoft.Json; diff --git a/src/Greenshot.Addon.Tfs/Entities/Operation.cs b/src/Greenshot.Addon.Tfs/Entities/Operation.cs index 4a4de97c4..e9d44c7c6 100644 --- a/src/Greenshot.Addon.Tfs/Entities/Operation.cs +++ b/src/Greenshot.Addon.Tfs/Entities/Operation.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Newtonsoft.Json; namespace Greenshot.Addon.Tfs.Entities diff --git a/src/Greenshot.Addon.Tfs/Entities/Value.cs b/src/Greenshot.Addon.Tfs/Entities/Value.cs index e541bb75c..56af20a69 100644 --- a/src/Greenshot.Addon.Tfs/Entities/Value.cs +++ b/src/Greenshot.Addon.Tfs/Entities/Value.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using Newtonsoft.Json; diff --git a/src/Greenshot.Addon.Tfs/Entities/WorkItemFields.cs b/src/Greenshot.Addon.Tfs/Entities/WorkItemFields.cs index d1a276658..44ee06454 100644 --- a/src/Greenshot.Addon.Tfs/Entities/WorkItemFields.cs +++ b/src/Greenshot.Addon.Tfs/Entities/WorkItemFields.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Newtonsoft.Json; namespace Greenshot.Addon.Tfs.Entities diff --git a/src/Greenshot.Addon.Tfs/Entities/WorkItemList.cs b/src/Greenshot.Addon.Tfs/Entities/WorkItemList.cs index ea99559dd..7310d33c5 100644 --- a/src/Greenshot.Addon.Tfs/Entities/WorkItemList.cs +++ b/src/Greenshot.Addon.Tfs/Entities/WorkItemList.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Collections.Generic; using Newtonsoft.Json; diff --git a/src/Greenshot.Addon.Tfs/Entities/WorkItemQueryResult.cs b/src/Greenshot.Addon.Tfs/Entities/WorkItemQueryResult.cs index eaad31eb9..d04542359 100644 --- a/src/Greenshot.Addon.Tfs/Entities/WorkItemQueryResult.cs +++ b/src/Greenshot.Addon.Tfs/Entities/WorkItemQueryResult.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Collections.Generic; using Newtonsoft.Json; diff --git a/src/Greenshot.Addon.Tfs/Entities/Workitem.cs b/src/Greenshot.Addon.Tfs/Entities/Workitem.cs index 62437aff5..8ef675f8c 100644 --- a/src/Greenshot.Addon.Tfs/Entities/Workitem.cs +++ b/src/Greenshot.Addon.Tfs/Entities/Workitem.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using Newtonsoft.Json; diff --git a/src/Greenshot.Addon.Tfs/Greenshot.Addon.Tfs.csproj b/src/Greenshot.Addon.Tfs/Greenshot.Addon.Tfs.csproj index 1942d4750..5536a1071 100644 --- a/src/Greenshot.Addon.Tfs/Greenshot.Addon.Tfs.csproj +++ b/src/Greenshot.Addon.Tfs/Greenshot.Addon.Tfs.csproj @@ -1,4 +1,4 @@ - + Greenshot.Addon.Tfs @@ -50,7 +50,7 @@ - + all diff --git a/src/Greenshot.Addon.Tfs/TfsAddonModule.cs b/src/Greenshot.Addon.Tfs/TfsAddonModule.cs index 52b8d3413..b53aedbd0 100644 --- a/src/Greenshot.Addon.Tfs/TfsAddonModule.cs +++ b/src/Greenshot.Addon.Tfs/TfsAddonModule.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,13 +17,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Autofac; using Dapplo.Addons; using Dapplo.CaliburnMicro.Configuration; using Dapplo.Config.Ini; using Dapplo.Config.Language; +using Greenshot.Addon.Tfs.Configuration; using Greenshot.Addon.Tfs.Configuration.Impl; using Greenshot.Addon.Tfs.ViewModels; using Greenshot.Addons.Components; diff --git a/src/Greenshot.Addon.Tfs/TfsClient.cs b/src/Greenshot.Addon.Tfs/TfsClient.cs index 9554d46b1..382e404ef 100644 --- a/src/Greenshot.Addon.Tfs/TfsClient.cs +++ b/src/Greenshot.Addon.Tfs/TfsClient.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Collections.Generic; using System.IO; @@ -31,6 +27,7 @@ using Dapplo.HttpExtensions; using Dapplo.HttpExtensions.ContentConverter; using Dapplo.HttpExtensions.Factory; using Dapplo.HttpExtensions.JsonNet; +using Greenshot.Addon.Tfs.Configuration; using Greenshot.Addon.Tfs.Entities; using Greenshot.Addons.Core; using Greenshot.Addons.Extensions; diff --git a/src/Greenshot.Addon.Tfs/TfsDestination.cs b/src/Greenshot.Addon.Tfs/TfsDestination.cs index 7749fae36..ba9cbdc51 100644 --- a/src/Greenshot.Addon.Tfs/TfsDestination.cs +++ b/src/Greenshot.Addon.Tfs/TfsDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Drawing; @@ -33,6 +27,7 @@ using Autofac.Features.OwnedInstances; using Dapplo.Addons; using Dapplo.Log; using Dapplo.Windows.Clipboard; +using Greenshot.Addon.Tfs.Configuration; using Greenshot.Addon.Tfs.Entities; using Greenshot.Addons; using Greenshot.Addons.Components; @@ -42,8 +37,6 @@ using Greenshot.Addons.Extensions; using Greenshot.Addons.Interfaces; using Greenshot.Gfx; -#endregion - namespace Greenshot.Addon.Tfs { /// @@ -137,7 +130,7 @@ namespace Greenshot.Addon.Tfs } } - public override Bitmap DisplayIcon + public override IBitmapWithNativeSupport DisplayIcon { get { diff --git a/src/Greenshot.Addon.Tfs/ViewModels/TfsConfigViewModel.cs b/src/Greenshot.Addon.Tfs/ViewModels/TfsConfigViewModel.cs index 5513af396..9423228d3 100644 --- a/src/Greenshot.Addon.Tfs/ViewModels/TfsConfigViewModel.cs +++ b/src/Greenshot.Addon.Tfs/ViewModels/TfsConfigViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,11 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Reactive.Disposables; using Dapplo.CaliburnMicro.Configuration; using Dapplo.CaliburnMicro.Extensions; +using Greenshot.Addon.Tfs.Configuration; using Greenshot.Addons; using Greenshot.Addons.Core.Enums; using Greenshot.Addons.ViewModels; diff --git a/src/Greenshot.Addon.Win10/Greenshot.Addon.Win10.csproj b/src/Greenshot.Addon.Win10/Greenshot.Addon.Win10.csproj index e9d1b3c18..ca41b76ab 100644 --- a/src/Greenshot.Addon.Win10/Greenshot.Addon.Win10.csproj +++ b/src/Greenshot.Addon.Win10/Greenshot.Addon.Win10.csproj @@ -43,7 +43,7 @@ - + diff --git a/src/Greenshot.Addon.Win10/Native/WindowMessageInfo.cs b/src/Greenshot.Addon.Win10/Native/WindowMessageInfo.cs index 12688522b..9561d6060 100644 --- a/src/Greenshot.Addon.Win10/Native/WindowMessageInfo.cs +++ b/src/Greenshot.Addon.Win10/Native/WindowMessageInfo.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using Dapplo.Windows.Messages; diff --git a/src/Greenshot.Addon.Win10/Native/WindowMessageMonitor.cs b/src/Greenshot.Addon.Win10/Native/WindowMessageMonitor.cs index 3a809e9f7..f903cf554 100644 --- a/src/Greenshot.Addon.Win10/Native/WindowMessageMonitor.cs +++ b/src/Greenshot.Addon.Win10/Native/WindowMessageMonitor.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Reactive.Disposables; using System.Reactive.Linq; diff --git a/src/Greenshot.Addon.Win10/Win10AddonModule.cs b/src/Greenshot.Addon.Win10/Win10AddonModule.cs index 52c579500..dc8a81008 100644 --- a/src/Greenshot.Addon.Win10/Win10AddonModule.cs +++ b/src/Greenshot.Addon.Win10/Win10AddonModule.cs @@ -21,9 +21,9 @@ using Autofac; using Dapplo.Addons; -using Greenshot.Addons.Interfaces; using Dapplo.Windows.Common; using Greenshot.Addons.Components; +using Greenshot.Addons.Interfaces; namespace Greenshot.Addon.Win10 { diff --git a/src/Greenshot.Addon.Win10/Win10FormEnhancer.cs b/src/Greenshot.Addon.Win10/Win10FormEnhancer.cs index f4e25651d..6c051e7c2 100644 --- a/src/Greenshot.Addon.Win10/Win10FormEnhancer.cs +++ b/src/Greenshot.Addon.Win10/Win10FormEnhancer.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - #if !NETCOREAPP3_0 using System; @@ -33,10 +29,10 @@ namespace Greenshot.Addon.Win10 { public class Win10FormEnhancer : IFormEnhancer { - private WindowsXamlHost inkCanvasHost; - private WindowsXamlHost inkToolbarHost; - private Windows.UI.Xaml.Controls.InkCanvas inkCanvas; - private Windows.UI.Xaml.Controls.InkToolbar inkToolbar; + private WindowsXamlHost _inkCanvasHost; + private WindowsXamlHost _inkToolbarHost; + private Windows.UI.Xaml.Controls.InkCanvas _inkCanvas; + private Windows.UI.Xaml.Controls.InkToolbar _inkToolbar; public void InitializeComponent(Form target) { @@ -45,17 +41,17 @@ namespace Greenshot.Addon.Win10 return; } // InkCanvas - inkCanvasHost = new WindowsXamlHost + _inkCanvasHost = new WindowsXamlHost { InitialTypeName = "Windows.UI.Xaml.Controls.InkCanvas", Dock = DockStyle.Fill, BackColor = Color.Transparent, }; - inkCanvasHost.ChildChanged += InkCanvas_ChildChanged; + _inkCanvasHost.ChildChanged += InkCanvas_ChildChanged; // InkToolbar - inkToolbarHost = new WindowsXamlHost + _inkToolbarHost = new WindowsXamlHost { InitialTypeName = "Windows.UI.Xaml.Controls.InkToolbar", // Layout @@ -65,33 +61,33 @@ namespace Greenshot.Addon.Win10 Dock = DockStyle.Top, BackColor = Color.Transparent }; - inkToolbarHost.ChildChanged += InkToolbar_ChildChanged; + _inkToolbarHost.ChildChanged += InkToolbar_ChildChanged; // Add to Window - target.Controls.Add(inkToolbarHost); - target.Controls.Add(inkCanvasHost); + target.Controls.Add(_inkToolbarHost); + target.Controls.Add(_inkCanvasHost); } private void InkToolbar_ChildChanged(object sender, EventArgs e) { - inkToolbar = ((WindowsXamlHost)sender).Child as Windows.UI.Xaml.Controls.InkToolbar; + _inkToolbar = ((WindowsXamlHost)sender).Child as Windows.UI.Xaml.Controls.InkToolbar; InitializeUwpControls(); } private void InkCanvas_ChildChanged(object sender, EventArgs e) { - inkCanvas = ((WindowsXamlHost)sender).Child as Windows.UI.Xaml.Controls.InkCanvas; + _inkCanvas = ((WindowsXamlHost)sender).Child as Windows.UI.Xaml.Controls.InkCanvas; InitializeUwpControls(); } private void InitializeUwpControls() { - if (inkToolbar == null || inkCanvas == null) + if (_inkToolbar == null || _inkCanvas == null) { return; } - inkToolbar.TargetInkCanvas = inkCanvas; + _inkToolbar.TargetInkCanvas = _inkCanvas; } } } diff --git a/src/Greenshot.Addon.Win10/Win10OcrDestination.cs b/src/Greenshot.Addon.Win10/Win10OcrDestination.cs index 3df6140ab..c71c7f75c 100644 --- a/src/Greenshot.Addon.Win10/Win10OcrDestination.cs +++ b/src/Greenshot.Addon.Win10/Win10OcrDestination.cs @@ -20,7 +20,6 @@ */ using System; -using System.Drawing; using System.IO; using System.Threading.Tasks; using Windows.Graphics.Imaging; @@ -32,6 +31,7 @@ using Greenshot.Addons.Components; using Greenshot.Addons.Core; using Greenshot.Addons.Interfaces; using Greenshot.Addons.Interfaces.Plugin; +using Greenshot.Gfx; namespace Greenshot.Addon.Win10 { @@ -50,7 +50,7 @@ namespace Greenshot.Addon.Win10 /// /// Icon for the OCR function, the icon was found via: http://help4windows.com/windows_8_imageres_dll.shtml /// - public override Bitmap DisplayIcon=> PluginUtils.GetCachedExeIcon(FilenameHelper.FillCmdVariables(@"%windir%\system32\imageres.dll"), 97); + public override IBitmapWithNativeSupport DisplayIcon=> PluginUtils.GetCachedExeIcon(FilenameHelper.FillCmdVariables(@"%windir%\system32\imageres.dll"), 97); /// /// Constructor, this is only debug information diff --git a/src/Greenshot.Addon.Win10/Win10ShareDestination.cs b/src/Greenshot.Addon.Win10/Win10ShareDestination.cs index 1279a66b7..2ddbf0a41 100644 --- a/src/Greenshot.Addon.Win10/Win10ShareDestination.cs +++ b/src/Greenshot.Addon.Win10/Win10ShareDestination.cs @@ -20,7 +20,6 @@ */ using System; -using System.Drawing; using System.IO; using System.Linq; using System.Reactive.Linq; @@ -74,7 +73,7 @@ namespace Greenshot.Addon.Win10 /// /// Icon for the App-share, the icon was found via: http://help4windows.com/windows_8_shell32_dll.shtml /// - public override Bitmap DisplayIcon => PluginUtils.GetCachedExeIcon(FilenameHelper.FillCmdVariables(@"%windir%\system32\shell32.dll"), 238); + public override IBitmapWithNativeSupport DisplayIcon => PluginUtils.GetCachedExeIcon(FilenameHelper.FillCmdVariables(@"%windir%\system32\shell32.dll"), 238); private class ShareInfo { @@ -188,7 +187,7 @@ namespace Greenshot.Addon.Win10 // Create logo RandomAccessStreamReference logoRandomAccessStreamReference; - using (var logo = GreenshotResources.Instance.GetGreenshotIcon().ToBitmap()) + using (var logo = BitmapWrapper.FromBitmap(GreenshotResources.Instance.GetGreenshotIcon().ToBitmap())) using (var logoThumbnail = logo.CreateThumbnail(30, 30)) { ImageOutput.SaveToStream(logoThumbnail, null, logoStream, outputSettings); diff --git a/src/Greenshot.Addons/AddonsModule.cs b/src/Greenshot.Addons/AddonsModule.cs index dfefa23b0..c07455448 100644 --- a/src/Greenshot.Addons/AddonsModule.cs +++ b/src/Greenshot.Addons/AddonsModule.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Autofac; using Dapplo.Addons; using Dapplo.CaliburnMicro.Configuration; diff --git a/src/Greenshot.Addons/Animation/AnimationLeg.cs b/src/Greenshot.Addons/Animation/AnimationLeg.cs index 097c600ed..9eaa0d01f 100644 --- a/src/Greenshot.Addons/Animation/AnimationLeg.cs +++ b/src/Greenshot.Addons/Animation/AnimationLeg.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,12 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - -#endregion - namespace Greenshot.Addons.Animation { /// diff --git a/src/Greenshot.Addons/Animation/AnimatorBase.cs b/src/Greenshot.Addons/Animation/AnimatorBase.cs index 779a7ce76..935559629 100644 --- a/src/Greenshot.Addons/Animation/AnimatorBase.cs +++ b/src/Greenshot.Addons/Animation/AnimatorBase.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region using - using System.Collections.Generic; -#endregion - namespace Greenshot.Addons.Animation { /// diff --git a/src/Greenshot.Addons/Animation/ColorAnimator.cs b/src/Greenshot.Addons/Animation/ColorAnimator.cs index f72744570..89ed78f49 100644 --- a/src/Greenshot.Addons/Animation/ColorAnimator.cs +++ b/src/Greenshot.Addons/Animation/ColorAnimator.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region using - using System.Drawing; -#endregion - namespace Greenshot.Addons.Animation { /// diff --git a/src/Greenshot.Addons/Animation/EasePower.cs b/src/Greenshot.Addons/Animation/EasePower.cs index d13ab152f..a663ab148 100644 --- a/src/Greenshot.Addons/Animation/EasePower.cs +++ b/src/Greenshot.Addons/Animation/EasePower.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region using - using System; -#endregion - namespace Greenshot.Addons.Animation { /// diff --git a/src/Greenshot.Addons/Animation/EaseSine.cs b/src/Greenshot.Addons/Animation/EaseSine.cs index b220f48f6..bd63c78f5 100644 --- a/src/Greenshot.Addons/Animation/EaseSine.cs +++ b/src/Greenshot.Addons/Animation/EaseSine.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region using - using System; -#endregion - namespace Greenshot.Addons.Animation { /// diff --git a/src/Greenshot.Addons/Animation/Easing.cs b/src/Greenshot.Addons/Animation/Easing.cs index 4e4633116..249328204 100644 --- a/src/Greenshot.Addons/Animation/Easing.cs +++ b/src/Greenshot.Addons/Animation/Easing.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region using - using System; -#endregion - namespace Greenshot.Addons.Animation { /// diff --git a/src/Greenshot.Addons/Animation/EasingModes.cs b/src/Greenshot.Addons/Animation/EasingModes.cs index c7f61fd75..914afd591 100644 --- a/src/Greenshot.Addons/Animation/EasingModes.cs +++ b/src/Greenshot.Addons/Animation/EasingModes.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addons.Animation { /// diff --git a/src/Greenshot.Addons/Animation/EasingTypes.cs b/src/Greenshot.Addons/Animation/EasingTypes.cs index b1035f4ea..eb65d8970 100644 --- a/src/Greenshot.Addons/Animation/EasingTypes.cs +++ b/src/Greenshot.Addons/Animation/EasingTypes.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addons.Animation { /// diff --git a/src/Greenshot.Addons/Animation/IAnimator.cs b/src/Greenshot.Addons/Animation/IAnimator.cs index 5a5f374b7..f7f6169c8 100644 --- a/src/Greenshot.Addons/Animation/IAnimator.cs +++ b/src/Greenshot.Addons/Animation/IAnimator.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addons.Animation { /// diff --git a/src/Greenshot.Addons/Animation/IntAnimator.cs b/src/Greenshot.Addons/Animation/IntAnimator.cs index 4f843bc23..0a4087b30 100644 --- a/src/Greenshot.Addons/Animation/IntAnimator.cs +++ b/src/Greenshot.Addons/Animation/IntAnimator.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addons.Animation { /// diff --git a/src/Greenshot.Addons/Animation/PointAnimator.cs b/src/Greenshot.Addons/Animation/PointAnimator.cs index ef44d4f9a..f9572df2e 100644 --- a/src/Greenshot.Addons/Animation/PointAnimator.cs +++ b/src/Greenshot.Addons/Animation/PointAnimator.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region using - using Dapplo.Windows.Common.Structs; -#endregion - namespace Greenshot.Addons.Animation { /// diff --git a/src/Greenshot.Addons/Animation/RectangleAnimator.cs b/src/Greenshot.Addons/Animation/RectangleAnimator.cs index e3157964d..77670c37f 100644 --- a/src/Greenshot.Addons/Animation/RectangleAnimator.cs +++ b/src/Greenshot.Addons/Animation/RectangleAnimator.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region using - using Dapplo.Windows.Common.Structs; -#endregion - namespace Greenshot.Addons.Animation { /// diff --git a/src/Greenshot.Addons/Animation/SizeAnimator.cs b/src/Greenshot.Addons/Animation/SizeAnimator.cs index d89b61f7e..97d9303d3 100644 --- a/src/Greenshot.Addons/Animation/SizeAnimator.cs +++ b/src/Greenshot.Addons/Animation/SizeAnimator.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region using - using Dapplo.Windows.Common.Structs; -#endregion - namespace Greenshot.Addons.Animation { /// diff --git a/src/Greenshot.Addons/Components/DestinationAttribute.cs b/src/Greenshot.Addons/Components/DestinationAttribute.cs index 3fa4cc99c..e864b00c4 100644 --- a/src/Greenshot.Addons/Components/DestinationAttribute.cs +++ b/src/Greenshot.Addons/Components/DestinationAttribute.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.ComponentModel.Composition; diff --git a/src/Greenshot.Addons/Components/DestinationOrder.cs b/src/Greenshot.Addons/Components/DestinationOrder.cs index 795b10469..2d32bbf29 100644 --- a/src/Greenshot.Addons/Components/DestinationOrder.cs +++ b/src/Greenshot.Addons/Components/DestinationOrder.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addons.Components { public enum DestinationOrder diff --git a/src/Greenshot.Addons/Components/ExportNotification.cs b/src/Greenshot.Addons/Components/ExportNotification.cs index 2f87c4017..99596f205 100644 --- a/src/Greenshot.Addons/Components/ExportNotification.cs +++ b/src/Greenshot.Addons/Components/ExportNotification.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using Autofac.Features.OwnedInstances; using Caliburn.Micro; diff --git a/src/Greenshot.Addons/Components/IDestination.cs b/src/Greenshot.Addons/Components/IDestination.cs index ba1d303c1..3137b6120 100644 --- a/src/Greenshot.Addons/Components/IDestination.cs +++ b/src/Greenshot.Addons/Components/IDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,20 +17,14 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; -using System.Drawing; using System.Threading.Tasks; using System.Windows.Forms; using System.Windows.Media.Imaging; using Dapplo.Windows.Dpi; using Greenshot.Addons.Interfaces; - -#endregion +using Greenshot.Gfx; namespace Greenshot.Addons.Components { @@ -54,7 +46,7 @@ namespace Greenshot.Addons.Components /// /// Gets an icon for the destination /// - Bitmap DisplayIcon { get; } + IBitmapWithNativeSupport DisplayIcon { get; } /// /// Gets an icon for the destination @@ -64,7 +56,7 @@ namespace Greenshot.Addons.Components /// /// Gets an icon for the destination, optionally it's already scaled /// - Bitmap GetDisplayIcon(double dpi); + IBitmapWithNativeSupport GetDisplayIcon(double dpi); /// /// Returns if there is a displayIcon @@ -104,7 +96,7 @@ namespace Greenshot.Addons.Components /// Handler which is called when clicked /// BitmapScaleHandler can be used for scaling icons /// ToolStripMenuItem - ToolStripMenuItem GetMenuItem(bool addDynamics, ContextMenuStrip menu, EventHandler destinationClickHandler, BitmapScaleHandler bitmapScaleHandler); + ToolStripMenuItem GetMenuItem(bool addDynamics, ContextMenuStrip menu, EventHandler destinationClickHandler, BitmapScaleHandler bitmapScaleHandler); /// /// Gets the dynamic destinations diff --git a/src/Greenshot.Addons/Components/IDestinationProvider.cs b/src/Greenshot.Addons/Components/IDestinationProvider.cs index 4e2e3929d..1c9f3931d 100644 --- a/src/Greenshot.Addons/Components/IDestinationProvider.cs +++ b/src/Greenshot.Addons/Components/IDestinationProvider.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Collections.Generic; diff --git a/src/Greenshot.Addons/Components/WindowHandle.cs b/src/Greenshot.Addons/Components/WindowHandle.cs index 816bd5b55..46a125313 100644 --- a/src/Greenshot.Addons/Components/WindowHandle.cs +++ b/src/Greenshot.Addons/Components/WindowHandle.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; namespace Greenshot.Addons.Components diff --git a/src/Greenshot.Addons/Config/Impl/CoreConfigurationImpl.cs b/src/Greenshot.Addons/Config/Impl/CoreConfigurationImpl.cs index 7019ec044..ddc07b8ef 100644 --- a/src/Greenshot.Addons/Config/Impl/CoreConfigurationImpl.cs +++ b/src/Greenshot.Addons/Config/Impl/CoreConfigurationImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Collections.Generic; using System.Drawing; using System.Windows; using Dapplo.Config.Ini; -using Dapplo.Log; using Dapplo.Windows.Common.Structs; using Dapplo.Windows.User32.Structs; using Greenshot.Addons.Core; @@ -37,17 +32,11 @@ namespace Greenshot.Addons.Config.Impl { public class CoreConfigurationImpl : IniSectionBase, ICoreConfiguration { - #region Overrides of IniSectionBase - public override void AfterLoad() { CoreConfigurationExtensions.AfterLoad(this); } - #endregion - - #region Implementation of IFileConfiguration - public string OutputFilePath { get; set; } public bool OutputFileAllowOverwrite { get; set; } public string OutputFileFilenamePattern { get; set; } @@ -61,10 +50,6 @@ namespace Greenshot.Addons.Config.Impl public string OptimizePNGCommand { get; set; } public string OptimizePNGCommandArguments { get; set; } - #endregion - - #region Implementation of ICaptureConfiguration - public NativeSize Win10BorderCrop { get; set; } public bool CaptureMousepointer { get; set; } public bool CaptureWindowsInteractive { get; set; } @@ -78,10 +63,6 @@ namespace Greenshot.Addons.Config.Impl public bool WindowCaptureRemoveCorners { get; set; } public IList WindowCornerCutShape { get; set; } - #endregion - - #region Implementation of ICoreConfiguration - public string Language { get; set; } public string RegionHotkey { get; set; } public string WindowHotkey { get; set; } @@ -152,14 +133,8 @@ namespace Greenshot.Addons.Config.Impl public bool IsPortable { get; set; } public ISet Permissions { get; set; } - #endregion - - #region Implementation of IUiConfiguration - public WindowStartupLocation DefaultWindowStartupLocation { get; set; } public bool AreWindowLocationsStored { get; set; } public IDictionary WindowLocations { get; set; } - - #endregion } } diff --git a/src/Greenshot.Addons/Config/Impl/GreenshotLanguageImpl.cs b/src/Greenshot.Addons/Config/Impl/GreenshotLanguageImpl.cs index 19ebfaaba..1e678d6a3 100644 --- a/src/Greenshot.Addons/Config/Impl/GreenshotLanguageImpl.cs +++ b/src/Greenshot.Addons/Config/Impl/GreenshotLanguageImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Diagnostics.CodeAnalysis; using Dapplo.Config.Language; @@ -33,15 +29,9 @@ namespace Greenshot.Addons.Config.Impl #pragma warning disable CS1591 internal class GreenshotLanguageImpl : LanguageBase, IGreenshotLanguage { - #region Implementation of ICoreTranslations - public string Cancel { get; } public string Ok { get; } - #endregion - - #region Implementation of IGreenshotLanguage - public string None { get; } public string AboutBugs { get; } public string AboutDonations { get; } @@ -178,7 +168,5 @@ namespace Greenshot.Addons.Config.Impl public string CurrentVersion { get; } public string Expert { get; } public string DestinationExportFailed { get; } - - #endregion } } diff --git a/src/Greenshot.Addons/Config/Impl/HttpConfigurationImpl.cs b/src/Greenshot.Addons/Config/Impl/HttpConfigurationImpl.cs index bf1a2f62e..3173a5ea8 100644 --- a/src/Greenshot.Addons/Config/Impl/HttpConfigurationImpl.cs +++ b/src/Greenshot.Addons/Config/Impl/HttpConfigurationImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Net; using System.Net.Cache; diff --git a/src/Greenshot.Addons/Controls/AnimatingForm.cs b/src/Greenshot.Addons/Controls/AnimatingForm.cs index 3f007f65e..61598804c 100644 --- a/src/Greenshot.Addons/Controls/AnimatingForm.cs +++ b/src/Greenshot.Addons/Controls/AnimatingForm.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Windows.Forms; using Dapplo.Config.Language; @@ -32,8 +26,6 @@ using Dapplo.Windows.Gdi32.Enums; using Dapplo.Windows.Gdi32.SafeHandles; using Greenshot.Addons.Core; -#endregion - namespace Greenshot.Addons.Controls { /// diff --git a/src/Greenshot.Addons/Controls/BackgroundForm.cs b/src/Greenshot.Addons/Controls/BackgroundForm.cs index 78136800a..86c7c9e36 100644 --- a/src/Greenshot.Addons/Controls/BackgroundForm.cs +++ b/src/Greenshot.Addons/Controls/BackgroundForm.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,18 +17,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.Threading; using System.Windows.Forms; using Greenshot.Addons.Resources; -#endregion - namespace Greenshot.Addons.Controls { /// diff --git a/src/Greenshot.Addons/Controls/ContextMenuToolStripProfessionalRenderer.cs b/src/Greenshot.Addons/Controls/ContextMenuToolStripProfessionalRenderer.cs index 27df331fe..b7965fb60 100644 --- a/src/Greenshot.Addons/Controls/ContextMenuToolStripProfessionalRenderer.cs +++ b/src/Greenshot.Addons/Controls/ContextMenuToolStripProfessionalRenderer.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,19 +17,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Drawing; using System.Windows.Forms; using Dapplo.Windows.Common.Structs; -using Greenshot.Addons.Config.Impl; using Greenshot.Addons.Core; using Greenshot.Gfx; -#endregion - namespace Greenshot.Addons.Controls { /// @@ -46,7 +37,7 @@ namespace Greenshot.Addons.Controls _coreConfiguration = coreConfiguration; } - private Image _scaledCheckbox; + private IBitmapWithNativeSupport _scaledCheckbox; private bool _newImage; protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e) { @@ -56,12 +47,12 @@ namespace Greenshot.Addons.Controls { _scaledCheckbox?.Dispose(); } - var checkbox = ((Bitmap) e.Image); + var checkbox = BitmapWrapper.FromBitmap((Bitmap) e.Image); _scaledCheckbox = checkbox.ScaleIconForDisplaying(96); _newImage = !Equals(checkbox, _scaledCheckbox); } var old = e.ImageRectangle; - var clone = new ToolStripItemImageRenderEventArgs(e.Graphics, e.Item, _scaledCheckbox, new Rectangle(old.X, 0, old.Width, old.Height)); + var clone = new ToolStripItemImageRenderEventArgs(e.Graphics, e.Item, _scaledCheckbox.NativeBitmap, new Rectangle(old.X, 0, old.Width, old.Height)); base.OnRenderItemCheck(clone); } } diff --git a/src/Greenshot.Addons/Controls/FormWithoutActivation.cs b/src/Greenshot.Addons/Controls/FormWithoutActivation.cs index 0bd596174..82f0a835d 100644 --- a/src/Greenshot.Addons/Controls/FormWithoutActivation.cs +++ b/src/Greenshot.Addons/Controls/FormWithoutActivation.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Windows.Forms; -#endregion - namespace Greenshot.Addons.Controls { /// diff --git a/src/Greenshot.Addons/Controls/GreenshotButton.cs b/src/Greenshot.Addons/Controls/GreenshotButton.cs index 1fcddaaa6..63aeb2520 100644 --- a/src/Greenshot.Addons/Controls/GreenshotButton.cs +++ b/src/Greenshot.Addons/Controls/GreenshotButton.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using System.Windows.Forms; -#endregion - namespace Greenshot.Addons.Controls { public class GreenshotButton : Button, IGreenshotLanguageBindable diff --git a/src/Greenshot.Addons/Controls/GreenshotCheckBox.cs b/src/Greenshot.Addons/Controls/GreenshotCheckBox.cs index 77bb32312..b0c9b35b5 100644 --- a/src/Greenshot.Addons/Controls/GreenshotCheckBox.cs +++ b/src/Greenshot.Addons/Controls/GreenshotCheckBox.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using System.Windows.Forms; -#endregion - namespace Greenshot.Addons.Controls { /// diff --git a/src/Greenshot.Addons/Controls/GreenshotColumnSorter.cs b/src/Greenshot.Addons/Controls/GreenshotColumnSorter.cs index 7079b2838..9f945f02e 100644 --- a/src/Greenshot.Addons/Controls/GreenshotColumnSorter.cs +++ b/src/Greenshot.Addons/Controls/GreenshotColumnSorter.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Collections; using System.Windows.Forms; -#endregion - namespace Greenshot.Addons.Controls { /// diff --git a/src/Greenshot.Addons/Controls/GreenshotComboBox.cs b/src/Greenshot.Addons/Controls/GreenshotComboBox.cs index e95b1e014..d33b2575a 100644 --- a/src/Greenshot.Addons/Controls/GreenshotComboBox.cs +++ b/src/Greenshot.Addons/Controls/GreenshotComboBox.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,18 +17,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.ComponentModel; using System.Linq; using System.Windows.Forms; using Dapplo.Config.Language; -#endregion - namespace Greenshot.Addons.Controls { public class GreenshotComboBox : ComboBox, IGreenshotConfigBindable diff --git a/src/Greenshot.Addons/Controls/GreenshotForm.cs b/src/Greenshot.Addons/Controls/GreenshotForm.cs index bbd51375f..3bf4f4fe2 100644 --- a/src/Greenshot.Addons/Controls/GreenshotForm.cs +++ b/src/Greenshot.Addons/Controls/GreenshotForm.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.ComponentModel; @@ -40,8 +34,6 @@ using Dapplo.Windows.Dpi.Forms; using Greenshot.Addons.Resources; using Greenshot.Gfx; -#endregion - namespace Greenshot.Addons.Controls { /// @@ -53,7 +45,7 @@ namespace Greenshot.Addons.Controls private static readonly IDictionary ReflectionCache = new Dictionary(); private readonly ILanguage _language; - protected readonly BitmapScaleHandler ScaleHandler; + protected readonly BitmapScaleHandler ScaleHandler; #if DEBUG public GreenshotForm() @@ -68,7 +60,7 @@ namespace Greenshot.Addons.Controls { _language = language; // Add the Dapplo.Windows DPI change handler - ScaleHandler = BitmapScaleHandler.Create(FormDpiHandler, (imageName, dpi) => GreenshotResources.Instance.GetBitmap(imageName, GetType()), (bitmap, dpi) => bitmap.ScaleIconForDisplaying(dpi)); + ScaleHandler = BitmapScaleHandler.Create(FormDpiHandler, (imageName, dpi) => GreenshotResources.Instance.GetBitmap(imageName, GetType()), (bitmap, dpi) => bitmap.ScaleIconForDisplaying(dpi)); } protected bool ManualLanguageApply { get; set; } diff --git a/src/Greenshot.Addons/Controls/GreenshotGroupBox.cs b/src/Greenshot.Addons/Controls/GreenshotGroupBox.cs index a7b0a8671..55388e9b6 100644 --- a/src/Greenshot.Addons/Controls/GreenshotGroupBox.cs +++ b/src/Greenshot.Addons/Controls/GreenshotGroupBox.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using System.Windows.Forms; -#endregion - namespace Greenshot.Addons.Controls { public class GreenshotGroupBox : GroupBox, IGreenshotLanguageBindable diff --git a/src/Greenshot.Addons/Controls/GreenshotLabel.cs b/src/Greenshot.Addons/Controls/GreenshotLabel.cs index b31139f05..117d96ea1 100644 --- a/src/Greenshot.Addons/Controls/GreenshotLabel.cs +++ b/src/Greenshot.Addons/Controls/GreenshotLabel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using System.Windows.Forms; -#endregion - namespace Greenshot.Addons.Controls { public class GreenshotLabel : Label, IGreenshotLanguageBindable diff --git a/src/Greenshot.Addons/Controls/GreenshotRadioButton.cs b/src/Greenshot.Addons/Controls/GreenshotRadioButton.cs index 51814a22a..acaf0010b 100644 --- a/src/Greenshot.Addons/Controls/GreenshotRadioButton.cs +++ b/src/Greenshot.Addons/Controls/GreenshotRadioButton.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using System.Windows.Forms; -#endregion - namespace Greenshot.Addons.Controls { /// diff --git a/src/Greenshot.Addons/Controls/GreenshotTextBox.cs b/src/Greenshot.Addons/Controls/GreenshotTextBox.cs index a58d3f928..e0da34814 100644 --- a/src/Greenshot.Addons/Controls/GreenshotTextBox.cs +++ b/src/Greenshot.Addons/Controls/GreenshotTextBox.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using System.Windows.Forms; -#endregion - namespace Greenshot.Addons.Controls { public class GreenshotTextBox : TextBox, IGreenshotConfigBindable diff --git a/src/Greenshot.Addons/Controls/GreenshotToolDropDownButton.cs b/src/Greenshot.Addons/Controls/GreenshotToolDropDownButton.cs index 6899b4c5f..62b97f478 100644 --- a/src/Greenshot.Addons/Controls/GreenshotToolDropDownButton.cs +++ b/src/Greenshot.Addons/Controls/GreenshotToolDropDownButton.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using System.Windows.Forms; -#endregion - namespace Greenshot.Addons.Controls { public class GreenshotToolStripDropDownButton : ToolStripDropDownButton, IGreenshotLanguageBindable diff --git a/src/Greenshot.Addons/Controls/GreenshotToolStripButton.cs b/src/Greenshot.Addons/Controls/GreenshotToolStripButton.cs index fe2528ac9..89e93e750 100644 --- a/src/Greenshot.Addons/Controls/GreenshotToolStripButton.cs +++ b/src/Greenshot.Addons/Controls/GreenshotToolStripButton.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using System.Windows.Forms; -#endregion - namespace Greenshot.Addons.Controls { public class GreenshotToolStripButton : ToolStripButton, IGreenshotLanguageBindable diff --git a/src/Greenshot.Addons/Controls/GreenshotToolStripLabel.cs b/src/Greenshot.Addons/Controls/GreenshotToolStripLabel.cs index 7574f906c..cfcf254c0 100644 --- a/src/Greenshot.Addons/Controls/GreenshotToolStripLabel.cs +++ b/src/Greenshot.Addons/Controls/GreenshotToolStripLabel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using System.Windows.Forms; -#endregion - namespace Greenshot.Addons.Controls { public class GreenshotToolStripLabel : ToolStripLabel, IGreenshotLanguageBindable diff --git a/src/Greenshot.Addons/Controls/GreenshotToolStripMenuItem.cs b/src/Greenshot.Addons/Controls/GreenshotToolStripMenuItem.cs index 09229c6cf..b8574b0de 100644 --- a/src/Greenshot.Addons/Controls/GreenshotToolStripMenuItem.cs +++ b/src/Greenshot.Addons/Controls/GreenshotToolStripMenuItem.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using System.Windows.Forms; -#endregion - namespace Greenshot.Addons.Controls { public class GreenshotToolStripMenuItem : ToolStripMenuItem, IGreenshotLanguageBindable diff --git a/src/Greenshot.Addons/Controls/HotkeyControl.cs b/src/Greenshot.Addons/Controls/HotkeyControl.cs index f3bd5190c..20f44ce9a 100644 --- a/src/Greenshot.Addons/Controls/HotkeyControl.cs +++ b/src/Greenshot.Addons/Controls/HotkeyControl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; @@ -34,8 +28,6 @@ using Dapplo.Windows.Common; using Greenshot.Addons.Core; using Greenshot.Addons.Interfaces.Plugin; -#endregion - namespace Greenshot.Addons.Controls { /// diff --git a/src/Greenshot.Addons/Controls/IGreenshotConfigBindable.cs b/src/Greenshot.Addons/Controls/IGreenshotConfigBindable.cs index efdeb01f8..03d3fb7fa 100644 --- a/src/Greenshot.Addons/Controls/IGreenshotConfigBindable.cs +++ b/src/Greenshot.Addons/Controls/IGreenshotConfigBindable.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addons.Controls { public interface IGreenshotConfigBindable diff --git a/src/Greenshot.Addons/Controls/IGreenshotLanguageBindable.cs b/src/Greenshot.Addons/Controls/IGreenshotLanguageBindable.cs index 6904a0ea0..768837711 100644 --- a/src/Greenshot.Addons/Controls/IGreenshotLanguageBindable.cs +++ b/src/Greenshot.Addons/Controls/IGreenshotLanguageBindable.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addons.Controls { /// diff --git a/src/Greenshot.Addons/Controls/InvertedBooleanConverter.cs b/src/Greenshot.Addons/Controls/InvertedBooleanConverter.cs index bc45d5a97..555e55d96 100644 --- a/src/Greenshot.Addons/Controls/InvertedBooleanConverter.cs +++ b/src/Greenshot.Addons/Controls/InvertedBooleanConverter.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Globalization; using System.Windows.Data; diff --git a/src/Greenshot.Addons/Controls/MovableShowColorForm.cs b/src/Greenshot.Addons/Controls/MovableShowColorForm.cs index 240130566..b955997fc 100644 --- a/src/Greenshot.Addons/Controls/MovableShowColorForm.cs +++ b/src/Greenshot.Addons/Controls/MovableShowColorForm.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,18 +17,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.Windows.Forms; using Dapplo.Windows.Gdi32; using Dapplo.Windows.Gdi32.SafeHandles; -#endregion - namespace Greenshot.Addons.Controls { /// diff --git a/src/Greenshot.Addons/Controls/PleaseWaitForm.cs b/src/Greenshot.Addons/Controls/PleaseWaitForm.cs index f4227ad0a..84602d01c 100644 --- a/src/Greenshot.Addons/Controls/PleaseWaitForm.cs +++ b/src/Greenshot.Addons/Controls/PleaseWaitForm.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Threading; using System.Threading.Tasks; @@ -30,8 +24,6 @@ using System.Windows.Forms; using Dapplo.Log; using Greenshot.Addons.Resources; -#endregion - namespace Greenshot.Addons.Controls { /// diff --git a/src/Greenshot.Addons/Controls/QualityDialog.cs b/src/Greenshot.Addons/Controls/QualityDialog.cs index e5365ec77..1a52382ac 100644 --- a/src/Greenshot.Addons/Controls/QualityDialog.cs +++ b/src/Greenshot.Addons/Controls/QualityDialog.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,17 +17,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using Greenshot.Addons.Core; using Greenshot.Addons.Interfaces.Plugin; using Greenshot.Core.Enums; -#endregion - namespace Greenshot.Addons.Controls { /// @@ -53,9 +45,9 @@ namespace Greenshot.Addons.Controls checkBox_reduceColors.Checked = Settings.ReduceColors; trackBarJpegQuality.Enabled = OutputFormats.jpg.Equals(outputSettings.Format); - trackBarJpegQuality.Value = Settings.JPGQuality; + trackBarJpegQuality.Value = Settings.JpgQuality; textBoxJpegQuality.Enabled = OutputFormats.jpg.Equals(outputSettings.Format); - textBoxJpegQuality.Text = Settings.JPGQuality.ToString(); + textBoxJpegQuality.Text = Settings.JpgQuality.ToString(); ToFront = true; } @@ -63,14 +55,14 @@ namespace Greenshot.Addons.Controls private void Button_okClick(object sender, EventArgs e) { - Settings.JPGQuality = trackBarJpegQuality.Value; + Settings.JpgQuality = trackBarJpegQuality.Value; Settings.ReduceColors = checkBox_reduceColors.Checked; if (!checkbox_dontaskagain.Checked) { return; } - _coreConfiguration.OutputFileJpegQuality = Settings.JPGQuality; + _coreConfiguration.OutputFileJpegQuality = Settings.JpgQuality; _coreConfiguration.OutputFilePromptQuality = false; _coreConfiguration.OutputFileReduceColors = Settings.ReduceColors; } diff --git a/src/Greenshot.Addons/Controls/ResourceImageManager.cs b/src/Greenshot.Addons/Controls/ResourceImageManager.cs index 04fb9ea29..cebe20395 100644 --- a/src/Greenshot.Addons/Controls/ResourceImageManager.cs +++ b/src/Greenshot.Addons/Controls/ResourceImageManager.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,11 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Collections.Generic; -using System.Drawing; using System.Linq; using Greenshot.Addons.Resources; using Greenshot.Gfx; @@ -36,7 +31,7 @@ namespace Greenshot.Addons.Controls public class ResourceImageManager : IDisposable { private readonly Type _resourceType; - private readonly IList _images = new List(); + private readonly List _images = new List(); public ResourceImageManager(Type resourceType) { _resourceType = resourceType; @@ -47,7 +42,7 @@ namespace Greenshot.Addons.Controls /// /// string with the name /// Bitmap - public Bitmap GetIcon(string imageName) + public IBitmapWithNativeSupport GetIcon(string imageName) { var bitmap = GreenshotResources.Instance.GetBitmap(imageName, _resourceType); var result = bitmap.ScaleIconForDisplaying(96); diff --git a/src/Greenshot.Addons/Controls/SaveImageFileDialog.cs b/src/Greenshot.Addons/Controls/SaveImageFileDialog.cs index a7a34a887..4e3743393 100644 --- a/src/Greenshot.Addons/Controls/SaveImageFileDialog.cs +++ b/src/Greenshot.Addons/Controls/SaveImageFileDialog.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,21 +17,14 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.IO; using System.Windows.Forms; using Dapplo.Log; -using Greenshot.Addons.Config.Impl; using Greenshot.Addons.Core; using Greenshot.Addons.Interfaces; using Greenshot.Core.Enums; -#endregion - namespace Greenshot.Addons.Controls { /// diff --git a/src/Greenshot.Addons/Controls/ThumbnailForm.cs b/src/Greenshot.Addons/Controls/ThumbnailForm.cs index 919ff55d2..491b368e3 100644 --- a/src/Greenshot.Addons/Controls/ThumbnailForm.cs +++ b/src/Greenshot.Addons/Controls/ThumbnailForm.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.Windows.Forms; @@ -33,12 +27,9 @@ using Dapplo.Windows.DesktopWindowsManager; using Dapplo.Windows.DesktopWindowsManager.Structs; using Dapplo.Windows.User32; using Dapplo.Windows.User32.Enums; -using Greenshot.Addons.Config.Impl; using Greenshot.Addons.Core; using Greenshot.Core.Enums; -#endregion - namespace Greenshot.Addons.Controls { /// diff --git a/src/Greenshot.Addons/Core/AbstractDestination.cs b/src/Greenshot.Addons/Core/AbstractDestination.cs index 476477bfb..bce7a91cd 100644 --- a/src/Greenshot.Addons/Core/AbstractDestination.cs +++ b/src/Greenshot.Addons/Core/AbstractDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,13 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; -using System.Drawing; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -44,8 +37,6 @@ using Greenshot.Addons.Interfaces; using Greenshot.Addons.Resources; using Greenshot.Gfx; -#endregion - namespace Greenshot.Addons.Core { /// @@ -74,12 +65,12 @@ namespace Greenshot.Addons.Core public abstract string Description { get; } /// - public virtual Bitmap DisplayIcon { get; set; } + public virtual IBitmapWithNativeSupport DisplayIcon { get; set; } /// - public virtual BitmapSource DisplayIconWpf => DisplayIcon?.ToBitmapSource() ?? GetDisplayIcon(DpiHandler.DefaultScreenDpi).ToBitmapSource(); + public virtual BitmapSource DisplayIconWpf => DisplayIcon?.NativeBitmap.ToBitmapSource() ?? GetDisplayIcon(DpiHandler.DefaultScreenDpi).NativeBitmap.ToBitmapSource(); - public virtual Bitmap GetDisplayIcon(double dpi) + public virtual IBitmapWithNativeSupport GetDisplayIcon(double dpi) { return DisplayIcon; } @@ -160,7 +151,7 @@ namespace Greenshot.Addons.Core /// EventHandler /// BitmapScaleHandler /// ToolStripMenuItem - public virtual ToolStripMenuItem GetMenuItem(bool addDynamics, ContextMenuStrip menu, EventHandler destinationClickHandler, BitmapScaleHandler bitmapScaleHandler) + public virtual ToolStripMenuItem GetMenuItem(bool addDynamics, ContextMenuStrip menu, EventHandler destinationClickHandler, BitmapScaleHandler bitmapScaleHandler) { var basisMenuItem = new ToolStripMenuItem(Description) { @@ -168,7 +159,7 @@ namespace Greenshot.Addons.Core Text = Description }; - bitmapScaleHandler.AddTarget(basisMenuItem, this); + bitmapScaleHandler.AddTarget(basisMenuItem, this, bitmap => bitmap?.NativeBitmap); AddTagEvents(basisMenuItem, menu, Description); basisMenuItem.Click -= destinationClickHandler; @@ -217,7 +208,7 @@ namespace Greenshot.Addons.Core { Tag = subDestination, }; - bitmapScaleHandler.AddTarget(destinationMenuItem, subDestination); + bitmapScaleHandler.AddTarget(destinationMenuItem, subDestination, bitmap => bitmap.NativeBitmap); destinationMenuItem.Click += destinationClickHandler; AddTagEvents(destinationMenuItem, menu, subDestination.Description); @@ -290,7 +281,8 @@ namespace Greenshot.Addons.Core TopLevel = true }; var dpiHandler = menu.AttachDpiHandler(); - var bitmapScaleHandler = BitmapScaleHandler.Create( + // TODO: Check + var bitmapScaleHandler = BitmapScaleHandler.Create( dpiHandler, (destination, dpi) => destination.GetDisplayIcon(dpi), (bitmap, d) => bitmap.ScaleIconForDisplaying(d)); @@ -392,7 +384,7 @@ namespace Greenshot.Addons.Core menu.Items.Add(new ToolStripSeparator()); var closeItem = new ToolStripMenuItem(GreenshotLanguage.ContextmenuExit) { - Image = GreenshotResources.Instance.GetBitmap("Close.Image") + Image = GreenshotResources.Instance.GetBitmap("Close.Image").NativeBitmap }; closeItem.Click += (sender, args) => { diff --git a/src/Greenshot.Addons/Core/AbstractProcessor.cs b/src/Greenshot.Addons/Core/AbstractProcessor.cs index c84b4726d..72276e17b 100644 --- a/src/Greenshot.Addons/Core/AbstractProcessor.cs +++ b/src/Greenshot.Addons/Core/AbstractProcessor.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using Greenshot.Addons.Interfaces; -#endregion - namespace Greenshot.Addons.Core { /// diff --git a/src/Greenshot.Addons/Core/BinaryStructHelper.cs b/src/Greenshot.Addons/Core/BinaryStructHelper.cs index 8ce01a970..d8e45e679 100644 --- a/src/Greenshot.Addons/Core/BinaryStructHelper.cs +++ b/src/Greenshot.Addons/Core/BinaryStructHelper.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Runtime.InteropServices; -#endregion - namespace Greenshot.Addons.Core { /// diff --git a/src/Greenshot.Addons/Core/Cache.cs b/src/Greenshot.Addons/Core/Cache.cs index ab264b3b8..88b067165 100644 --- a/src/Greenshot.Addons/Core/Cache.cs +++ b/src/Greenshot.Addons/Core/Cache.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,18 +17,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Linq; using System.Timers; using Dapplo.Log; -#endregion - namespace Greenshot.Addons.Core { /// diff --git a/src/Greenshot.Addons/Core/Capture.cs b/src/Greenshot.Addons/Core/Capture.cs index 3c173f318..a0566a384 100644 --- a/src/Greenshot.Addons/Core/Capture.cs +++ b/src/Greenshot.Addons/Core/Capture.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.Drawing.Imaging; @@ -33,8 +27,6 @@ using Dapplo.Windows.User32; using Greenshot.Addons.Interfaces; using Greenshot.Gfx; -#endregion - namespace Greenshot.Addons.Core { /// @@ -51,7 +43,7 @@ namespace Greenshot.Addons.Core private NativePoint _cursorLocation = NativePoint.Empty; - private Bitmap _bitmap; + private IBitmapWithNativeSupport _bitmap; private NativeRect _screenBounds; @@ -69,7 +61,7 @@ namespace Greenshot.Addons.Core /// Note: the supplied bitmap can be disposed immediately or when constructor is called. /// /// Bitmap - public Capture(Bitmap newBitmap) : this() + public Capture(IBitmapWithNativeSupport newBitmap) : this() { Bitmap = newBitmap; } @@ -93,7 +85,7 @@ namespace Greenshot.Addons.Core /// /// Get/Set the Bitmap /// - public Bitmap Bitmap + public IBitmapWithNativeSupport Bitmap { get => _bitmap; set @@ -109,7 +101,8 @@ namespace Greenshot.Addons.Core try { // Default Bitmap PixelFormat is Format32bppArgb - _bitmap = new Bitmap(value); + // TODO: fix conversion + _bitmap = BitmapWrapper.FromBitmap(new Bitmap(value.NativeBitmap)); } finally { diff --git a/src/Greenshot.Addons/Core/CaptureDetails.cs b/src/Greenshot.Addons/Core/CaptureDetails.cs index b272cc2ad..b9d7f4141 100644 --- a/src/Greenshot.Addons/Core/CaptureDetails.cs +++ b/src/Greenshot.Addons/Core/CaptureDetails.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,17 +17,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using Greenshot.Addons.Components; using Greenshot.Addons.Interfaces; -#endregion - namespace Greenshot.Addons.Core { /// diff --git a/src/Greenshot.Addons/Core/CaptureHandler.cs b/src/Greenshot.Addons/Core/CaptureHandler.cs index a3b8777ee..398b65473 100644 --- a/src/Greenshot.Addons/Core/CaptureHandler.cs +++ b/src/Greenshot.Addons/Core/CaptureHandler.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - -using System.Drawing; using Dapplo.Windows.Common.Structs; - -#endregion +using Greenshot.Gfx; namespace Greenshot.Addons.Core { @@ -35,7 +27,7 @@ namespace Greenshot.Addons.Core /// /// /// Captured Bitmap - public delegate Bitmap CaptureScreenRectangleHandler(NativeRect captureBounds); + public delegate IBitmapWithNativeSupport CaptureScreenRectangleHandler(NativeRect captureBounds); /// /// This is a hack to experiment with different screen capture routines diff --git a/src/Greenshot.Addons/Core/ClipboardHelper.cs b/src/Greenshot.Addons/Core/ClipboardHelper.cs index 3f593d3c2..cb6b64808 100644 --- a/src/Greenshot.Addons/Core/ClipboardHelper.cs +++ b/src/Greenshot.Addons/Core/ClipboardHelper.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Diagnostics; @@ -40,15 +34,12 @@ using Dapplo.Windows.Common.Structs; using Dapplo.Windows.Gdi32.Enums; using Dapplo.Windows.Gdi32.Structs; using Dapplo.Windows.User32; -using Greenshot.Addons.Config.Impl; using Greenshot.Addons.Core.Enums; using Greenshot.Addons.Interfaces; using Greenshot.Addons.Interfaces.Plugin; using Greenshot.Core.Enums; using Greenshot.Gfx; -#endregion - namespace Greenshot.Addons.Core { /// @@ -357,7 +348,7 @@ EndSelection:<<<<<<<4 /// Wrapper for Clipboard.GetBitmap, Created for Bug #3432313 /// /// Bitmap if there is an bitmap on the clipboard - public static Bitmap GetBitmap() + public static IBitmapWithNativeSupport GetBitmap() { var clipboardData = GetDataObject(); // Return the first image @@ -370,7 +361,7 @@ EndSelection:<<<<<<<4 /// /// /// IEnumerable of Bitmap - public static IEnumerable GetBitmaps(IDataObject dataObject) + public static IEnumerable GetBitmaps(IDataObject dataObject) { // Get single image, this takes the "best" match var singleImage = GetBitmap(dataObject); @@ -384,7 +375,7 @@ EndSelection:<<<<<<<4 // check if files are supplied foreach (var imageFile in GetImageFilenames(dataObject)) { - Bitmap returnBitmap = null; + IBitmapWithNativeSupport returnBitmap = null; try { returnBitmap = BitmapHelper.LoadBitmap(imageFile); @@ -408,9 +399,9 @@ EndSelection:<<<<<<<4 /// /// /// Bitmap or null - private static Bitmap GetBitmap(IDataObject dataObject) + private static IBitmapWithNativeSupport GetBitmap(IDataObject dataObject) { - Bitmap returnBitmap = null; + IBitmapWithNativeSupport returnBitmap = null; if (dataObject == null) { return null; @@ -464,14 +455,14 @@ EndSelection:<<<<<<<4 /// string with the format /// IDataObject /// Bitmap or null - private static Bitmap GetBitmapForFormat(string format, IDataObject dataObject) + private static IBitmapWithNativeSupport GetBitmapForFormat(string format, IDataObject dataObject) { var clipboardObject = GetFromDataObject(dataObject, format); var imageStream = clipboardObject as MemoryStream; if (!IsValidStream(imageStream)) { // TODO: add "HTML Format" support here... - return clipboardObject as Bitmap; + return BitmapWrapper.FromBitmap(clipboardObject as Bitmap); } if (CoreConfiguration.EnableSpecialDIBClipboardReader) { @@ -513,12 +504,14 @@ EndSelection:<<<<<<<4 { var handle = GCHandle.Alloc(dibBuffer, GCHandleType.Pinned); gcHandle = GCHandle.ToIntPtr(handle); + // TODO: Should be easier return + BitmapWrapper.FromBitmap( new Bitmap(infoHeader.Width, infoHeader.Height, -(int) (infoHeader.SizeImage / infoHeader.Height), infoHeader.BitCount == 32 ? PixelFormat.Format32bppArgb : PixelFormat.Format24bppRgb, new IntPtr(handle.AddrOfPinnedObject().ToInt32() + infoHeader.OffsetToPixels + (infoHeader.Height - 1) * (int) (infoHeader.SizeImage / infoHeader.Height)) - ); + )); } catch (Exception ex) { @@ -647,7 +640,7 @@ EndSelection:<<<<<<<4 MemoryStream dibStream = null; MemoryStream dibV5Stream = null; MemoryStream pngStream = null; - Bitmap bitmapToSave = null; + IBitmapWithNativeSupport bitmapToSave = null; var disposeImage = false; try { @@ -774,7 +767,7 @@ EndSelection:<<<<<<<4 // Check if Bitmap is wanted if (CoreConfiguration.ClipboardFormats.Contains(ClipboardFormats.BITMAP)) { - dataObject.SetImage(bitmapToSave); + dataObject.SetImage(bitmapToSave.NativeBitmap); // Place the DataObject to the clipboard SetDataObject(dataObject, true); } @@ -801,11 +794,11 @@ EndSelection:<<<<<<<4 /// /// Bitmap /// byte[] - private static byte[] BitmapToByteArray(Bitmap bitmap) + private static byte[] BitmapToByteArray(IBitmapWithNativeSupport bitmap) { // Lock the bitmap's bits. var rect = new NativeRect(0, 0, bitmap.Width, bitmap.Height); - var bmpData = bitmap.LockBits(rect, ImageLockMode.ReadOnly, bitmap.PixelFormat); + var bmpData = bitmap.NativeBitmap.LockBits(rect, ImageLockMode.ReadOnly, bitmap.PixelFormat); var absStride = Math.Abs(bmpData.Stride); var bytes = absStride * bitmap.Height; @@ -820,7 +813,7 @@ EndSelection:<<<<<<<4 } // Unlock the bits. - bitmap.UnlockBits(bmpData); + bitmap.NativeBitmap.UnlockBits(bmpData); return rgbValues; } diff --git a/src/Greenshot.Addons/Core/CoreConfigurationExtensions.cs b/src/Greenshot.Addons/Core/CoreConfigurationExtensions.cs index 1316980a0..8d2d1ca85 100644 --- a/src/Greenshot.Addons/Core/CoreConfigurationExtensions.cs +++ b/src/Greenshot.Addons/Core/CoreConfigurationExtensions.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.IO; @@ -31,8 +25,6 @@ using System.Reflection; using Dapplo.Log; using Greenshot.Addons.Core.Enums; -#endregion - namespace Greenshot.Addons.Core { /// diff --git a/src/Greenshot.Addons/Core/Credentials/CredFlags.cs b/src/Greenshot.Addons/Core/Credentials/CredFlags.cs index c9af7665a..14ba43b97 100644 --- a/src/Greenshot.Addons/Core/Credentials/CredFlags.cs +++ b/src/Greenshot.Addons/Core/Credentials/CredFlags.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; -#endregion - namespace Greenshot.Addons.Core.Credentials { /// diff --git a/src/Greenshot.Addons/Core/Credentials/CredUIReturnCodes.cs b/src/Greenshot.Addons/Core/Credentials/CredUIReturnCodes.cs index 96da48fed..52e8470de 100644 --- a/src/Greenshot.Addons/Core/Credentials/CredUIReturnCodes.cs +++ b/src/Greenshot.Addons/Core/Credentials/CredUIReturnCodes.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addons.Core.Credentials { /// http://www.pinvoke.net/default.aspx/Enums.CredUIReturnCodes diff --git a/src/Greenshot.Addons/Core/Credentials/CredUiInfo.cs b/src/Greenshot.Addons/Core/Credentials/CredUiInfo.cs index aa91f07d2..b5b3bae38 100644 --- a/src/Greenshot.Addons/Core/Credentials/CredUiInfo.cs +++ b/src/Greenshot.Addons/Core/Credentials/CredUiInfo.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Runtime.InteropServices; -#endregion - namespace Greenshot.Addons.Core.Credentials { /// diff --git a/src/Greenshot.Addons/Core/Credentials/CredentialsDialog.cs b/src/Greenshot.Addons/Core/Credentials/CredentialsDialog.cs index 0b4c3d449..25126beb5 100644 --- a/src/Greenshot.Addons/Core/Credentials/CredentialsDialog.cs +++ b/src/Greenshot.Addons/Core/Credentials/CredentialsDialog.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.Runtime.InteropServices; @@ -31,8 +25,6 @@ using System.Threading; using System.Windows.Forms; using Dapplo.Windows.Common; -#endregion - namespace Greenshot.Addons.Core.Credentials { /// diff --git a/src/Greenshot.Addons/Core/DisplayKeyAttribute.cs b/src/Greenshot.Addons/Core/DisplayKeyAttribute.cs index e2d75e400..b6754fd82 100644 --- a/src/Greenshot.Addons/Core/DisplayKeyAttribute.cs +++ b/src/Greenshot.Addons/Core/DisplayKeyAttribute.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; -#endregion - namespace Greenshot.Addons.Core { [AttributeUsage(AttributeTargets.Field)] diff --git a/src/Greenshot.Addons/Core/DotNetScreenCapture.cs b/src/Greenshot.Addons/Core/DotNetScreenCapture.cs index b25a7c9b7..cdb945b2f 100644 --- a/src/Greenshot.Addons/Core/DotNetScreenCapture.cs +++ b/src/Greenshot.Addons/Core/DotNetScreenCapture.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,24 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; -using System.Runtime.InteropServices; -using System.Windows; -using System.Windows.Interop; -using System.Windows.Media.Imaging; using Dapplo.Windows.Common.Structs; -using Dapplo.Windows.Gdi32; -using Dapplo.Windows.Gdi32.Enums; -using Dapplo.Windows.Gdi32.SafeHandles; -using Dapplo.Windows.Gdi32.Structs; -using Dapplo.Windows.User32; - -#endregion namespace Greenshot.Addons.Core { diff --git a/src/Greenshot.Addons/Core/EmailConfigHelper.cs b/src/Greenshot.Addons/Core/EmailConfigHelper.cs index d0cbdcf9e..06864d3e2 100644 --- a/src/Greenshot.Addons/Core/EmailConfigHelper.cs +++ b/src/Greenshot.Addons/Core/EmailConfigHelper.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.IO; using Microsoft.Win32; -#endregion - namespace Greenshot.Addons.Core { /// diff --git a/src/Greenshot.Addons/Core/EnumExtensions.cs b/src/Greenshot.Addons/Core/EnumExtensions.cs index f900ec2c8..70cf47c6b 100644 --- a/src/Greenshot.Addons/Core/EnumExtensions.cs +++ b/src/Greenshot.Addons/Core/EnumExtensions.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; -#endregion - namespace Greenshot.Addons.Core { public static class EnumerationExtensions diff --git a/src/Greenshot.Addons/Core/Enums/BuildStates.cs b/src/Greenshot.Addons/Core/Enums/BuildStates.cs index 80c2561da..1bee647b4 100644 --- a/src/Greenshot.Addons/Core/Enums/BuildStates.cs +++ b/src/Greenshot.Addons/Core/Enums/BuildStates.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addons.Core.Enums { public enum BuildStates diff --git a/src/Greenshot.Addons/Core/Enums/ClickActions.cs b/src/Greenshot.Addons/Core/Enums/ClickActions.cs index 93642c9eb..f37477c1f 100644 --- a/src/Greenshot.Addons/Core/Enums/ClickActions.cs +++ b/src/Greenshot.Addons/Core/Enums/ClickActions.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addons.Core.Enums { public enum ClickActions diff --git a/src/Greenshot.Addons/Core/Enums/ClipboardFormats.cs b/src/Greenshot.Addons/Core/Enums/ClipboardFormats.cs index 7523a3b71..7b3f3f08f 100644 --- a/src/Greenshot.Addons/Core/Enums/ClipboardFormats.cs +++ b/src/Greenshot.Addons/Core/Enums/ClipboardFormats.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addons.Core.Enums { public enum ClipboardFormats diff --git a/src/Greenshot.Addons/Core/Enums/ConfigIds.cs b/src/Greenshot.Addons/Core/Enums/ConfigIds.cs index 29fb5175e..1b88063df 100644 --- a/src/Greenshot.Addons/Core/Enums/ConfigIds.cs +++ b/src/Greenshot.Addons/Core/Enums/ConfigIds.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addons.Core.Enums { public enum ConfigIds diff --git a/src/Greenshot.Addons/Core/EventDelay.cs b/src/Greenshot.Addons/Core/EventDelay.cs index c353c1b53..fa301ded1 100644 --- a/src/Greenshot.Addons/Core/EventDelay.cs +++ b/src/Greenshot.Addons/Core/EventDelay.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; -#endregion - namespace Greenshot.Addons.Core { public class EventDelay diff --git a/src/Greenshot.Addons/Core/ExplorerHelper.cs b/src/Greenshot.Addons/Core/ExplorerHelper.cs index 8fea0c4cd..a0f1fc4ff 100644 --- a/src/Greenshot.Addons/Core/ExplorerHelper.cs +++ b/src/Greenshot.Addons/Core/ExplorerHelper.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,16 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Diagnostics; using System.IO; -#endregion - namespace Greenshot.Addons.Core { /// diff --git a/src/Greenshot.Addons/Core/ExtensionAttribute.cs b/src/Greenshot.Addons/Core/ExtensionAttribute.cs index bfc9d20d2..8c522b5d6 100644 --- a/src/Greenshot.Addons/Core/ExtensionAttribute.cs +++ b/src/Greenshot.Addons/Core/ExtensionAttribute.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; -#endregion - namespace Greenshot.Addons.Core { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)] diff --git a/src/Greenshot.Addons/Core/FilenameHelper.cs b/src/Greenshot.Addons/Core/FilenameHelper.cs index b6a55ae6f..40085ec15 100644 --- a/src/Greenshot.Addons/Core/FilenameHelper.cs +++ b/src/Greenshot.Addons/Core/FilenameHelper.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections; using System.Collections.Generic; @@ -30,12 +24,9 @@ using System.IO; using System.Text.RegularExpressions; using System.Windows.Forms; using Dapplo.Log; -using Greenshot.Addons.Config.Impl; using Greenshot.Addons.Interfaces; using Greenshot.Core.Enums; -#endregion - namespace Greenshot.Addons.Core { public static class FilenameHelper diff --git a/src/Greenshot.Addons/Core/GdiScreenCapture.cs b/src/Greenshot.Addons/Core/GdiScreenCapture.cs index 58a8106c3..537cdfca2 100644 --- a/src/Greenshot.Addons/Core/GdiScreenCapture.cs +++ b/src/Greenshot.Addons/Core/GdiScreenCapture.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,13 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; -using System.Runtime.InteropServices; using System.Windows; using System.Windows.Interop; using System.Windows.Media.Imaging; @@ -36,8 +29,6 @@ using Dapplo.Windows.Gdi32.SafeHandles; using Dapplo.Windows.Gdi32.Structs; using Dapplo.Windows.User32; -#endregion - namespace Greenshot.Addons.Core { /// diff --git a/src/Greenshot.Addons/Core/ICoreConfiguration.cs b/src/Greenshot.Addons/Core/ICoreConfiguration.cs index febdc5f7e..030f45cbe 100644 --- a/src/Greenshot.Addons/Core/ICoreConfiguration.cs +++ b/src/Greenshot.Addons/Core/ICoreConfiguration.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.ComponentModel; @@ -33,8 +27,6 @@ using Dapplo.Windows.Common.Structs; using Greenshot.Addons.Core.Enums; using Greenshot.Core.Configuration; -#endregion - namespace Greenshot.Addons.Core { /// diff --git a/src/Greenshot.Addons/Core/IDestinationFileConfiguration.cs b/src/Greenshot.Addons/Core/IDestinationFileConfiguration.cs index 39127e82d..8a7c5c45c 100644 --- a/src/Greenshot.Addons/Core/IDestinationFileConfiguration.cs +++ b/src/Greenshot.Addons/Core/IDestinationFileConfiguration.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; -#endregion - namespace Greenshot.Addons.Core { /// diff --git a/src/Greenshot.Addons/Core/IFileConfiguration.cs b/src/Greenshot.Addons/Core/IFileConfiguration.cs index 6b8d0ecb8..ac67d4477 100644 --- a/src/Greenshot.Addons/Core/IFileConfiguration.cs +++ b/src/Greenshot.Addons/Core/IFileConfiguration.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using Greenshot.Core.Enums; -#endregion - namespace Greenshot.Addons.Core { /// diff --git a/src/Greenshot.Addons/Core/IHttpConfiguration.cs b/src/Greenshot.Addons/Core/IHttpConfiguration.cs index dfb804751..b13c7256f 100644 --- a/src/Greenshot.Addons/Core/IHttpConfiguration.cs +++ b/src/Greenshot.Addons/Core/IHttpConfiguration.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,16 +17,10 @@ // You should have received a copy of the GNU General License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using Dapplo.Config.Ini; using Dapplo.HttpExtensions; -#endregion - namespace Greenshot.Addons.Core { /// diff --git a/src/Greenshot.Addons/Core/ImageOutput.cs b/src/Greenshot.Addons/Core/ImageOutput.cs index 360fb4383..1605bfd7d 100644 --- a/src/Greenshot.Addons/Core/ImageOutput.cs +++ b/src/Greenshot.Addons/Core/ImageOutput.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Diagnostics; @@ -38,7 +32,6 @@ using System.Windows.Forms; using Dapplo.Log; using Dapplo.Windows.Clipboard; using Dapplo.Windows.Common; -using Greenshot.Addons.Config.Impl; using Greenshot.Addons.Controls; using Greenshot.Addons.Interfaces; using Greenshot.Addons.Interfaces.Plugin; @@ -47,8 +40,6 @@ using Greenshot.Gfx; using Greenshot.Gfx.Quantizer; using Encoder = System.Drawing.Imaging.Encoder; -#endregion - namespace Greenshot.Addons.Core { /// @@ -126,9 +117,7 @@ namespace Greenshot.Addons.Core return propertyItem; } - #region save-as - - /// + /// /// Save with showing a dialog /// /// @@ -167,9 +156,7 @@ namespace Greenshot.Addons.Core return returnValue; } - #endregion - - /// + /// /// Create a tmpfile which has the name like in the configured pattern. /// Used e.g. by the email export /// @@ -298,15 +285,13 @@ namespace Greenshot.Addons.Core File.Delete(path); } - #region Icon - - /// + /// /// Write the images to the stream as icon /// Every image is resized to 256x256 (but the content maintains the aspect ratio) /// /// Stream to write to /// List of images - public static void WriteIcon(Stream stream, IList bitmaps) + public static void WriteIcon(Stream stream, IList bitmaps) { var binaryWriter = new BinaryWriter(stream); // @@ -337,7 +322,7 @@ namespace Greenshot.Addons.Core { using (var clonedImage = bitmap.CloneBitmap(PixelFormat.Format32bppArgb)) { - clonedImage.Save(imageStream, ImageFormat.Png); + clonedImage.NativeBitmap.Save(imageStream, ImageFormat.Png); imageSizes.Add(new Size(size, size)); } } @@ -348,7 +333,7 @@ namespace Greenshot.Addons.Core { using (var resizedImage = clonedImage.Resize(true, true, Color.Empty, size, size, null)) { - resizedImage.Save(imageStream, ImageFormat.Png); + resizedImage.NativeBitmap.Save(imageStream, ImageFormat.Png); imageSizes.Add(resizedImage.Size); } } @@ -391,10 +376,8 @@ namespace Greenshot.Addons.Core } } - #endregion - - /// + /// /// Load a Greenshot surface from a stream /// /// Stream @@ -439,8 +422,6 @@ namespace Greenshot.Addons.Core return returnSurface; } - #region save - /// /// Saves ISurface to stream with specified output settings /// @@ -467,7 +448,7 @@ namespace Greenshot.Addons.Core /// surface for the elements, needed if the greenshot format is used /// Stream to save to /// SurfaceOutputSettings - public static void SaveToStream(Bitmap bitmapToSave, ISurface surface, Stream stream, SurfaceOutputSettings outputSettings) + public static void SaveToStream(IBitmapWithNativeSupport bitmapToSave, ISurface surface, Stream stream, SurfaceOutputSettings outputSettings) { var useMemoryStream = false; MemoryStream memoryStream = null; @@ -528,20 +509,20 @@ namespace Greenshot.Addons.Core { var parameters = new EncoderParameters(1) { - Param = {[0] = new EncoderParameter(Encoder.Quality, outputSettings.JPGQuality)} + Param = {[0] = new EncoderParameter(Encoder.Quality, outputSettings.JpgQuality)} }; // Removing transparency if it's not supported in the output if (Image.IsAlphaPixelFormat(bitmapToSave.PixelFormat)) { var nonAlphaImage = bitmapToSave.CloneBitmap(PixelFormat.Format24bppRgb); AddTag(nonAlphaImage); - nonAlphaImage.Save(targetStream, imageCodec, parameters); + nonAlphaImage.NativeBitmap.Save(targetStream, imageCodec, parameters); nonAlphaImage.Dispose(); } else { AddTag(bitmapToSave); - bitmapToSave.Save(targetStream, imageCodec, parameters); + bitmapToSave.NativeBitmap.Save(targetStream, imageCodec, parameters); } foundEncoder = true; break; @@ -555,7 +536,7 @@ namespace Greenshot.Addons.Core else if (Equals(imageFormat, ImageFormat.Icon)) { // FEATURE-916: Added Icon support - IList bitmaps = new List + IList bitmaps = new List { bitmapToSave }; @@ -579,7 +560,7 @@ namespace Greenshot.Addons.Core } if (!processed) { - bitmapToSave.Save(targetStream, imageFormat); + bitmapToSave.NativeBitmap.Save(targetStream, imageFormat); } if (needsDispose) { @@ -623,7 +604,7 @@ namespace Greenshot.Addons.Core /// Image to pass to the external process /// stream to write the processed image to /// - private static bool ProcessPngImageExternally(Image imageToProcess, Stream targetStream) + private static bool ProcessPngImageExternally(IBitmapWithNativeSupport imageToProcess, Stream targetStream) { if (string.IsNullOrEmpty(CoreConfiguration.OptimizePNGCommand)) { @@ -640,7 +621,7 @@ namespace Greenshot.Addons.Core using (var tmpStream = File.Create(tmpFileName)) { Log.Debug().WriteLine("Writing png to tmp file: {0}", tmpFileName); - imageToProcess.Save(tmpStream, ImageFormat.Png); + imageToProcess.NativeBitmap.Save(tmpStream, ImageFormat.Png); if (Log.IsDebugEnabled()) { Log.Debug().WriteLine("File size before processing {0}", new FileInfo(tmpFileName).Length); @@ -703,7 +684,7 @@ namespace Greenshot.Addons.Core /// /// /// true if the image must be disposed - public static bool CreateBitmapFromSurface(ISurface surface, SurfaceOutputSettings outputSettings, out Bitmap bitmapToSave) + public static bool CreateBitmapFromSurface(ISurface surface, SurfaceOutputSettings outputSettings, out IBitmapWithNativeSupport bitmapToSave) { var disposeImage = false; @@ -724,7 +705,7 @@ namespace Greenshot.Addons.Core { return disposeImage; } - Bitmap tmpBitmap; + IBitmapWithNativeSupport tmpBitmap; if (outputSettings.Effects != null && outputSettings.Effects.Count > 0) { // apply effects, if there are any @@ -788,22 +769,24 @@ namespace Greenshot.Addons.Core /// Add the greenshot property! /// /// - private static void AddTag(Image imageToSave) + private static void AddTag(IBitmapWithNativeSupport imageToSave) { // Create meta-data var softwareUsedPropertyItem = CreatePropertyItem(PROPERTY_TAG_SOFTWARE_USED, "Greenshot"); - if (softwareUsedPropertyItem != null) - { - try - { - imageToSave.SetPropertyItem(softwareUsedPropertyItem); - } - catch (Exception) - { - Log.Warn().WriteLine("Couldn't set property {0}", softwareUsedPropertyItem.Id); - } - } - } + if (softwareUsedPropertyItem == null) + { + return; + } + + try + { + imageToSave.NativeBitmap.SetPropertyItem(softwareUsedPropertyItem); + } + catch (Exception) + { + Log.Warn().WriteLine("Couldn't set property {0}", softwareUsedPropertyItem.Id); + } + } /// /// Load a Greenshot surface @@ -894,7 +877,5 @@ namespace Greenshot.Addons.Core } return format; } - - #endregion - } + } } \ No newline at end of file diff --git a/src/Greenshot.Addons/Core/InteropWindowCaptureExtensions.cs b/src/Greenshot.Addons/Core/InteropWindowCaptureExtensions.cs index 28b628715..c57f907fb 100644 --- a/src/Greenshot.Addons/Core/InteropWindowCaptureExtensions.cs +++ b/src/Greenshot.Addons/Core/InteropWindowCaptureExtensions.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Diagnostics; using System.Drawing; @@ -40,14 +34,11 @@ using Dapplo.Windows.Gdi32; using Dapplo.Windows.Icons; using Dapplo.Windows.Kernel32; using Dapplo.Windows.User32.Enums; -using Greenshot.Addons.Config.Impl; using Greenshot.Addons.Interfaces; using Greenshot.Core.Enums; using Greenshot.Gfx; using Greenshot.Gfx.FastBitmap; -#endregion - namespace Greenshot.Addons.Core { /// @@ -79,14 +70,14 @@ namespace Greenshot.Addons.Core /// /// IInteropWindow /// true to use the large icon - public static Image GetDisplayIcon(this IInteropWindow interopWindow, bool useLargeIcon = true) + public static IBitmapWithNativeSupport GetDisplayIcon(this IInteropWindow interopWindow, bool useLargeIcon = true) { try { var appIcon = interopWindow.GetIcon(useLargeIcon); if (appIcon != null) { - return appIcon; + return BitmapWrapper.FromBitmap(appIcon); } } catch (Exception ex) @@ -110,7 +101,7 @@ namespace Greenshot.Addons.Core /// InteropWindow /// true to use the client bounds /// Bitmap - public static Bitmap CaptureFromScreen(this IInteropWindow interopWindow, bool clientBounds = false) + public static IBitmapWithNativeSupport CaptureFromScreen(this IInteropWindow interopWindow, bool clientBounds = false) { var bounds = clientBounds ? interopWindow.GetInfo().ClientBounds: interopWindow.GetInfo().Bounds; return WindowCapture.CaptureRectangle(bounds); @@ -139,9 +130,9 @@ namespace Greenshot.Addons.Core /// As GDI+ draws it, it will be without Aero borders! /// TODO: If there is a parent, this could be removed with SetParent, and set back afterwards. /// - public static Bitmap PrintWindow(this IInteropWindow nativeWindow) + public static IBitmapWithNativeSupport PrintWindow(this IInteropWindow nativeWindow) { - var returnBitmap = nativeWindow.PrintWindow(); + var returnBitmap = BitmapWrapper.FromBitmap(nativeWindow.PrintWindow()); if (nativeWindow.HasParent || !nativeWindow.IsMaximized()) { return returnBitmap; @@ -286,7 +277,7 @@ namespace Greenshot.Addons.Core captureRectangle = captureRectangle.Intersect(capture.ScreenBounds); // Destination bitmap for the capture - Bitmap capturedBitmap = null; + IBitmapWithNativeSupport capturedBitmap = null; // Check if we make a transparent capture if (windowCaptureMode == WindowCaptureModes.AeroTransparent) { @@ -368,8 +359,8 @@ namespace Greenshot.Addons.Core // Remove corners if (!Image.IsAlphaPixelFormat(capturedBitmap.PixelFormat)) { - Log.Debug().WriteLine("Changing pixelformat to Alpha for the RemoveCorners"); - var tmpBitmap = capturedBitmap.CloneBitmap(PixelFormat.Format32bppArgb) as Bitmap; + Log.Debug().WriteLine("Changing pixel format to Alpha for the RemoveCorners"); + var tmpBitmap = capturedBitmap.CloneBitmap(PixelFormat.Format32bppArgb); capturedBitmap.Dispose(); capturedBitmap = tmpBitmap; } @@ -407,7 +398,7 @@ namespace Greenshot.Addons.Core /// Helper method to remove the corners from a DMW capture /// /// The bitmap to remove the corners from. - private static void RemoveCorners(Bitmap image) + private static void RemoveCorners(IBitmapWithNativeSupport image) { using (var fastBitmap = FastBitmapFactory.Create(image)) { @@ -432,7 +423,7 @@ namespace Greenshot.Addons.Core /// Bitmap with the black image /// Bitmap with the black image /// Bitmap with transparency - private static Bitmap ApplyTransparency(Bitmap blackBitmap, Bitmap whiteBitmap) + private static IBitmapWithNativeSupport ApplyTransparency(IBitmapWithNativeSupport blackBitmap, IBitmapWithNativeSupport whiteBitmap) { using (var targetBuffer = FastBitmapFactory.CreateEmpty(blackBitmap.Size, PixelFormat.Format32bppArgb, Color.Transparent)) { diff --git a/src/Greenshot.Addons/Core/InteropWindowExtensions.cs b/src/Greenshot.Addons/Core/InteropWindowExtensions.cs index 410314c26..0d8eece3e 100644 --- a/src/Greenshot.Addons/Core/InteropWindowExtensions.cs +++ b/src/Greenshot.Addons/Core/InteropWindowExtensions.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,16 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using Dapplo.Windows.Common.Extensions; using Dapplo.Windows.Common.Structs; using Dapplo.Windows.Desktop; -#endregion - namespace Greenshot.Addons.Core { /// diff --git a/src/Greenshot.Addons/Core/ObjectExtensions.cs b/src/Greenshot.Addons/Core/ObjectExtensions.cs index 542b517b6..b64db33de 100644 --- a/src/Greenshot.Addons/Core/ObjectExtensions.cs +++ b/src/Greenshot.Addons/Core/ObjectExtensions.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.IO; @@ -30,8 +24,6 @@ using System.Reflection; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; -#endregion - namespace Greenshot.Addons.Core { /// diff --git a/src/Greenshot.Addons/Core/PluginUtils.cs b/src/Greenshot.Addons/Core/PluginUtils.cs index 5695bf6b1..1ee8df0e1 100644 --- a/src/Greenshot.Addons/Core/PluginUtils.cs +++ b/src/Greenshot.Addons/Core/PluginUtils.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.ComponentModel; @@ -32,12 +26,10 @@ using System.Windows.Forms; using Dapplo.Log; using Dapplo.Windows.Icons; using Dapplo.Windows.Icons.Enums; -using Greenshot.Addons.Config.Impl; using Greenshot.Addons.Interfaces.Forms; +using Greenshot.Gfx; using Microsoft.Win32; -#endregion - namespace Greenshot.Addons.Core { /// @@ -48,7 +40,7 @@ namespace Greenshot.Addons.Core private const string PathKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\"; private static readonly LogSource Log = new LogSource(); private static bool _isHooked = false; - private static readonly Dictionary ExeIconCache = new Dictionary(); + private static readonly Dictionary ExeIconCache = new Dictionary(); private static ICoreConfiguration coreConfiguration; /// @@ -79,7 +71,7 @@ namespace Greenshot.Addons.Core return; } - var cachedImages = new List(); + var cachedImages = new List(); lock (ExeIconCache) { foreach (var key in ExeIconCache.Keys) @@ -136,10 +128,10 @@ namespace Greenshot.Addons.Core /// index of the icon /// true to use the large icon /// Bitmap with the icon or null if something happended. you are responsible for copying this icon - public static Bitmap GetCachedExeIcon(string path, int index, bool useLargeIcon = true) + public static IBitmapWithNativeSupport GetCachedExeIcon(string path, int index, bool useLargeIcon = true) { string cacheKey = $"{path}:{index}"; - Bitmap returnValue; + IBitmapWithNativeSupport returnValue; lock (ExeIconCache) { if (ExeIconCache.TryGetValue(cacheKey, out returnValue)) @@ -169,7 +161,7 @@ namespace Greenshot.Addons.Core /// index of the icon /// true to use the large icon, if available /// Bitmap with the icon or null if something happended - private static Bitmap GetExeIcon(string path, int index, bool useLargeIcon = true) + private static IBitmapWithNativeSupport GetExeIcon(string path, int index, bool useLargeIcon = true) { if (!File.Exists(path)) { @@ -180,9 +172,9 @@ namespace Greenshot.Addons.Core var appIcon = IconHelper.ExtractAssociatedIcon(path, index, useLargeIcon); if (appIcon != null) { - return appIcon; + return BitmapWrapper.FromBitmap(appIcon); } - return Shell32.GetFileExtensionIcon(path, useLargeIcon ? IconSize.Large : IconSize.Small, false); + return BitmapWrapper.FromBitmap(Shell32.GetFileExtensionIcon(path, useLargeIcon ? IconSize.Large : IconSize.Small, false)); } catch (Exception exIcon) { diff --git a/src/Greenshot.Addons/Core/StringExtensions.cs b/src/Greenshot.Addons/Core/StringExtensions.cs index 23c876291..109082e3b 100644 --- a/src/Greenshot.Addons/Core/StringExtensions.cs +++ b/src/Greenshot.Addons/Core/StringExtensions.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,18 +17,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.IO; using System.Text.RegularExpressions; using Dapplo.Log; -#endregion - namespace Greenshot.Addons.Core { public static class StringExtensions diff --git a/src/Greenshot.Addons/Core/WindowCapture.cs b/src/Greenshot.Addons/Core/WindowCapture.cs index cdacb70fb..f748b00ae 100644 --- a/src/Greenshot.Addons/Core/WindowCapture.cs +++ b/src/Greenshot.Addons/Core/WindowCapture.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,15 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Diagnostics; using System.Drawing; -using System.Drawing.Imaging; using System.Runtime.InteropServices; using System.Windows.Forms; using Dapplo.Log; @@ -42,11 +35,9 @@ using Dapplo.Windows.Icons; using Dapplo.Windows.User32; using Dapplo.Windows.User32.Enums; using Dapplo.Windows.User32.Structs; -using Greenshot.Addons.Config.Impl; using Greenshot.Addons.Interfaces; using Greenshot.Gfx; - -#endregion +using Greenshot.Gfx.Structs; namespace Greenshot.Addons.Core { @@ -240,7 +231,7 @@ namespace Greenshot.Addons.Core { capture = new Capture(); } - Bitmap capturedBitmap = null; + IBitmapWithNativeSupport capturedBitmap = null; // If the CaptureHandler has a handle use this, otherwise use the CaptureRectangle here if (CaptureHandler.CaptureScreenRectangle != null) { @@ -285,9 +276,8 @@ namespace Greenshot.Addons.Core /// /// NativeRect with the bounds to capture /// Bitmap which is captured from the screen at the location specified by the captureBounds - public static Bitmap CaptureRectangle(NativeRect captureBounds) + public static IBitmapWithNativeSupport CaptureRectangle(NativeRect captureBounds) { - Bitmap returnBitmap = null; if (captureBounds.Height <= 0 || captureBounds.Width <= 0) { Log.Warn().WriteLine("Nothing to capture, ignoring!"); @@ -356,7 +346,7 @@ namespace Greenshot.Addons.Core } // get a .NET image object for it - // A suggestion for the "A generic error occurred in GDI+." E_FAIL/0×80004005 error is to re-try... + // A suggestion for the "A generic error occurred in GDI+." E_FAIL/0�80004005 error is to re-try... var success = false; ExternalException exception = null; for (var i = 0; i < 3; i++) @@ -393,10 +383,10 @@ namespace Greenshot.Addons.Core using (var tmpBitmap = Image.FromHbitmap(safeDibSectionHandle.DangerousGetHandle())) { // Create a new bitmap which has a transparent background - returnBitmap = BitmapFactory.CreateEmpty(tmpBitmap.Width, tmpBitmap.Height, PixelFormat.Format32bppArgb, Color.Transparent, tmpBitmap.HorizontalResolution, - tmpBitmap.VerticalResolution); + var returnBitmap = new UnmanagedBitmap(tmpBitmap.Width, tmpBitmap.Height, tmpBitmap.HorizontalResolution, tmpBitmap.VerticalResolution); + returnBitmap.Span.Fill(Color.Transparent.FromColorWithAlpha()); // Content will be copied here - using (var graphics = Graphics.FromImage(returnBitmap)) + using (var graphics = Graphics.FromImage(returnBitmap.NativeBitmap)) { // For all screens copy the content to the new bitmap foreach (var screen in Screen.AllScreens) @@ -407,13 +397,16 @@ namespace Greenshot.Addons.Core graphics.DrawImage(tmpBitmap, screenBounds, screenBounds.X, screenBounds.Y, screenBounds.Width, screenBounds.Height, GraphicsUnit.Pixel); } } + + return returnBitmap; } } else { // All screens, which are inside the capture, are of equal size // assign image to Capture, the image will be disposed there.. - returnBitmap = Image.FromHbitmap(safeDibSectionHandle.DangerousGetHandle()); + // TODO: Optimize? + return BitmapWrapper.FromBitmap(Image.FromHbitmap(safeDibSectionHandle.DangerousGetHandle())); } // We got through the capture without exception success = true; @@ -436,7 +429,8 @@ namespace Greenshot.Addons.Core } } } - return returnBitmap; + + return null; } } } \ No newline at end of file diff --git a/src/Greenshot.Addons/Core/WmInputLangChangeRequestFilter.cs b/src/Greenshot.Addons/Core/WmInputLangChangeRequestFilter.cs index 43db5e536..010b9bb1f 100644 --- a/src/Greenshot.Addons/Core/WmInputLangChangeRequestFilter.cs +++ b/src/Greenshot.Addons/Core/WmInputLangChangeRequestFilter.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,16 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Windows.Forms; using Dapplo.Log; using Dapplo.Windows.Messages; -#endregion - namespace Greenshot.Addons.Core { /// diff --git a/src/Greenshot.Addons/Extensions/ClipboardBitmapExtensions.cs b/src/Greenshot.Addons/Extensions/ClipboardBitmapExtensions.cs index 5dcf85e67..16366ebdf 100644 --- a/src/Greenshot.Addons/Extensions/ClipboardBitmapExtensions.cs +++ b/src/Greenshot.Addons/Extensions/ClipboardBitmapExtensions.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Drawing; using System.Drawing.Imaging; @@ -88,7 +84,7 @@ namespace Greenshot.Addons.Extensions /// /// /// Bitmap or null - public static Bitmap GetAsDeviceIndependendBitmap(this IClipboardAccessToken clipboardAccessToken) + public static IBitmapWithNativeSupport GetAsDeviceIndependendBitmap(this IClipboardAccessToken clipboardAccessToken) { var formats = clipboardAccessToken.AvailableFormats().ToList(); if (!formats.Contains(StandardClipboardFormats.Bitmap.AsString())) @@ -128,7 +124,7 @@ namespace Greenshot.Addons.Extensions /// /// IClipboardAccessToken /// Bitmap or null - public static Bitmap GetAsFormat17(this IClipboardAccessToken clipboardAccessToken) + public static IBitmapWithNativeSupport GetAsFormat17(this IClipboardAccessToken clipboardAccessToken) { var formats = clipboardAccessToken.AvailableFormats().ToList(); if (!formats.Contains("Format17")) @@ -151,11 +147,13 @@ namespace Greenshot.Addons.Extensions var handle = GCHandle.Alloc(format17Bytes, GCHandleType.Pinned); gcHandle = GCHandle.ToIntPtr(handle); return - new Bitmap(infoHeader.Width, infoHeader.Height, - -(int)(infoHeader.SizeImage / infoHeader.Height), - infoHeader.BitCount == 32 ? PixelFormat.Format32bppArgb : PixelFormat.Format24bppRgb, - new IntPtr(handle.AddrOfPinnedObject().ToInt32() + infoHeader.OffsetToPixels + (infoHeader.Height - 1) * (int)(infoHeader.SizeImage / infoHeader.Height)) - ); + BitmapWrapper.FromBitmap( + new Bitmap(infoHeader.Width, infoHeader.Height, + -(int) (infoHeader.SizeImage / infoHeader.Height), + infoHeader.BitCount == 32 ? PixelFormat.Format32bppArgb : PixelFormat.Format24bppRgb, + new IntPtr(handle.AddrOfPinnedObject().ToInt32() + infoHeader.OffsetToPixels + + (infoHeader.Height - 1) * (int) (infoHeader.SizeImage / infoHeader.Height)) + )); } catch (Exception ex) { @@ -238,13 +236,13 @@ namespace Greenshot.Addons.Extensions /// Helper method so get the bitmap bytes /// See: http://stackoverflow.com/a/6570155 /// - /// Bitmap + /// IBitmapWithNativeSupport /// byte[] - private static byte[] BitmapToByteArray(Bitmap bitmap) + private static byte[] BitmapToByteArray(IBitmapWithNativeSupport bitmap) { // Lock the bitmap's bits. var rect = new NativeRect(0, 0, bitmap.Width, bitmap.Height); - var bmpData = bitmap.LockBits(rect, ImageLockMode.ReadOnly, bitmap.PixelFormat); + var bmpData = bitmap.NativeBitmap.LockBits(rect, ImageLockMode.ReadOnly, bitmap.PixelFormat); var absStride = Math.Abs(bmpData.Stride); var bytes = absStride * bitmap.Height; @@ -259,7 +257,7 @@ namespace Greenshot.Addons.Extensions } // Unlock the bits. - bitmap.UnlockBits(bmpData); + bitmap.NativeBitmap.UnlockBits(bmpData); return rgbValues; } diff --git a/src/Greenshot.Addons/Extensions/ClipboardHtmlExtensions.cs b/src/Greenshot.Addons/Extensions/ClipboardHtmlExtensions.cs index f74bb9bdb..1e70561a2 100644 --- a/src/Greenshot.Addons/Extensions/ClipboardHtmlExtensions.cs +++ b/src/Greenshot.Addons/Extensions/ClipboardHtmlExtensions.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.IO; using System.Text; diff --git a/src/Greenshot.Addons/Extensions/DestinationExtensions.cs b/src/Greenshot.Addons/Extensions/DestinationExtensions.cs index a280c0657..355f55748 100644 --- a/src/Greenshot.Addons/Extensions/DestinationExtensions.cs +++ b/src/Greenshot.Addons/Extensions/DestinationExtensions.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Collections.Generic; using System.Linq; diff --git a/src/Greenshot.Addons/Extensions/LanguageExtensions.cs b/src/Greenshot.Addons/Extensions/LanguageExtensions.cs index bbbbc7f99..22945e366 100644 --- a/src/Greenshot.Addons/Extensions/LanguageExtensions.cs +++ b/src/Greenshot.Addons/Extensions/LanguageExtensions.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Collections.Generic; using System.Linq; diff --git a/src/Greenshot.Addons/Extensions/ProcessorExtensions.cs b/src/Greenshot.Addons/Extensions/ProcessorExtensions.cs index 3521195a6..715be35b3 100644 --- a/src/Greenshot.Addons/Extensions/ProcessorExtensions.cs +++ b/src/Greenshot.Addons/Extensions/ProcessorExtensions.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Collections.Generic; using System.Linq; using Greenshot.Addons.Interfaces; diff --git a/src/Greenshot.Addons/Greenshot.Addons.csproj b/src/Greenshot.Addons/Greenshot.Addons.csproj index 224497432..59e513742 100644 --- a/src/Greenshot.Addons/Greenshot.Addons.csproj +++ b/src/Greenshot.Addons/Greenshot.Addons.csproj @@ -1,4 +1,4 @@ - + net472;netcoreapp3.0 @@ -62,10 +62,13 @@ 0.9.18 - 0.8.17 + 0.8.18 + + + 0.8.18 - 0.8.17 + 0.8.18 all diff --git a/src/Greenshot.Addons/IGreenshotLanguage.cs b/src/Greenshot.Addons/IGreenshotLanguage.cs index 25d9001c2..e6ccaa059 100644 --- a/src/Greenshot.Addons/IGreenshotLanguage.cs +++ b/src/Greenshot.Addons/IGreenshotLanguage.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; using Dapplo.Config.Language; -#endregion - namespace Greenshot.Addons { [Language("Core")] diff --git a/src/Greenshot.Addons/Interfaces/CaptureMode.cs b/src/Greenshot.Addons/Interfaces/CaptureMode.cs index 89d001cba..d2bfb440a 100644 --- a/src/Greenshot.Addons/Interfaces/CaptureMode.cs +++ b/src/Greenshot.Addons/Interfaces/CaptureMode.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addons.Interfaces { /// diff --git a/src/Greenshot.Addons/Interfaces/Drawing/Adorners/IAdorner.cs b/src/Greenshot.Addons/Interfaces/Drawing/Adorners/IAdorner.cs index a0087ad05..19baeb120 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/Adorners/IAdorner.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/Adorners/IAdorner.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,16 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Drawing.Drawing2D; using System.Windows.Forms; using Dapplo.Windows.Common.Structs; -#endregion - namespace Greenshot.Addons.Interfaces.Drawing.Adorners { public interface IAdorner diff --git a/src/Greenshot.Addons/Interfaces/Drawing/EditStatus.cs b/src/Greenshot.Addons/Interfaces/Drawing/EditStatus.cs index 465c17595..ed6402274 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/EditStatus.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/EditStatus.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addons.Interfaces.Drawing { public enum EditStatus diff --git a/src/Greenshot.Addons/Interfaces/Drawing/FieldChangedEventArgs.cs b/src/Greenshot.Addons/Interfaces/Drawing/FieldChangedEventArgs.cs index 1e64e81b2..4c55a0d36 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/FieldChangedEventArgs.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/FieldChangedEventArgs.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; -#endregion - namespace Greenshot.Addons.Interfaces.Drawing { /// diff --git a/src/Greenshot.Addons/Interfaces/Drawing/FieldChangedEventHandler.cs b/src/Greenshot.Addons/Interfaces/Drawing/FieldChangedEventHandler.cs index 948e7f180..ded14845a 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/FieldChangedEventHandler.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/FieldChangedEventHandler.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addons.Interfaces.Drawing { /// diff --git a/src/Greenshot.Addons/Interfaces/Drawing/FieldFlag.cs b/src/Greenshot.Addons/Interfaces/Drawing/FieldFlag.cs index f6eb7ca58..2b4070589 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/FieldFlag.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/FieldFlag.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; -#endregion - namespace Greenshot.Addons.Interfaces.Drawing { [Flags] diff --git a/src/Greenshot.Addons/Interfaces/Drawing/IBitmapContainer.cs b/src/Greenshot.Addons/Interfaces/Drawing/IBitmapContainer.cs index 85dc259bd..9d9587d59 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/IBitmapContainer.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/IBitmapContainer.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,13 +17,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - -using System.Drawing; - -#endregion +using Greenshot.Gfx; namespace Greenshot.Addons.Interfaces.Drawing { @@ -34,7 +26,7 @@ namespace Greenshot.Addons.Interfaces.Drawing /// public interface IBitmapContainer : IDrawableContainer { - Bitmap Bitmap { get; set; } + IBitmapWithNativeSupport Bitmap { get; set; } void Load(string filename); } diff --git a/src/Greenshot.Addons/Interfaces/Drawing/ICursorContainer.cs b/src/Greenshot.Addons/Interfaces/Drawing/ICursorContainer.cs index 479fb5f0d..32e98929f 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/ICursorContainer.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/ICursorContainer.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Windows.Forms; -#endregion - namespace Greenshot.Addons.Interfaces.Drawing { public interface ICursorContainer : IDrawableContainer diff --git a/src/Greenshot.Addons/Interfaces/Drawing/IDrawableContainer.cs b/src/Greenshot.Addons/Interfaces/Drawing/IDrawableContainer.cs index 4a91336e4..096a344a8 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/IDrawableContainer.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/IDrawableContainer.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.ComponentModel; @@ -32,8 +26,6 @@ using System.Windows.Forms; using Dapplo.Windows.Common.Structs; using Greenshot.Addons.Interfaces.Drawing.Adorners; -#endregion - namespace Greenshot.Addons.Interfaces.Drawing { public interface IDrawableContainer : INotifyPropertyChanged, IDisposable @@ -58,7 +50,7 @@ namespace Greenshot.Addons.Interfaces.Drawing NativeRect DrawingBounds { get; } - bool hasFilters { get; } + bool HasFilters { get; } EditStatus Status { get; set; } diff --git a/src/Greenshot.Addons/Interfaces/Drawing/IDrawableContainerList.cs b/src/Greenshot.Addons/Interfaces/Drawing/IDrawableContainerList.cs index fc84bf54f..572bf09b9 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/IDrawableContainerList.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/IDrawableContainerList.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,18 +17,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms; using Dapplo.Windows.Common.Structs; - -#endregion +using Greenshot.Gfx; namespace Greenshot.Addons.Interfaces.Drawing { @@ -52,7 +45,7 @@ namespace Greenshot.Addons.Interfaces.Drawing void OnDoubleClick(); bool HasIntersectingFilters(NativeRect clipRectangle); bool IntersectsWith(NativeRect clipRectangle); - void Draw(Graphics g, Bitmap bitmap, RenderMode renderMode, NativeRect clipRectangle); + void Draw(Graphics g, IBitmapWithNativeSupport bitmap, RenderMode renderMode, NativeRect clipRectangle); void Invalidate(); void PullElementsToTop(IDrawableContainerList elements); bool CanPushDown(IDrawableContainerList elements); diff --git a/src/Greenshot.Addons/Interfaces/Drawing/IField.cs b/src/Greenshot.Addons/Interfaces/Drawing/IField.cs index 542df02aa..f6f11a915 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/IField.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/IField.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; -#endregion - namespace Greenshot.Addons.Interfaces.Drawing { /// diff --git a/src/Greenshot.Addons/Interfaces/Drawing/IFieldHolderWithChildren.cs b/src/Greenshot.Addons/Interfaces/Drawing/IFieldHolderWithChildren.cs index bee2522d5..02a8ff169 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/IFieldHolderWithChildren.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/IFieldHolderWithChildren.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addons.Interfaces.Drawing { /// diff --git a/src/Greenshot.Addons/Interfaces/Drawing/IFieldType.cs b/src/Greenshot.Addons/Interfaces/Drawing/IFieldType.cs index bc8be2308..55a6f8311 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/IFieldType.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/IFieldType.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; namespace Greenshot.Addons.Interfaces.Drawing diff --git a/src/Greenshot.Addons/Interfaces/Drawing/IFieldholder.cs b/src/Greenshot.Addons/Interfaces/Drawing/IFieldholder.cs index b93d3c222..046dcc966 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/IFieldholder.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/IFieldholder.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Collections.Generic; -#endregion - namespace Greenshot.Addons.Interfaces.Drawing { /// diff --git a/src/Greenshot.Addons/Interfaces/Drawing/IIconContainer.cs b/src/Greenshot.Addons/Interfaces/Drawing/IIconContainer.cs index 332c223dd..69c38d06e 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/IIconContainer.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/IIconContainer.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Drawing; -#endregion - namespace Greenshot.Addons.Interfaces.Drawing { public interface IIconContainer : IDrawableContainer diff --git a/src/Greenshot.Addons/Interfaces/Drawing/IMemento.cs b/src/Greenshot.Addons/Interfaces/Drawing/IMemento.cs index 754c9de34..d3dd2c610 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/IMemento.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/IMemento.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; -#endregion - namespace Greenshot.Addons.Interfaces.Drawing { /// diff --git a/src/Greenshot.Addons/Interfaces/Drawing/IMetafileContainer.cs b/src/Greenshot.Addons/Interfaces/Drawing/IMetafileContainer.cs index 10701d12a..456c2a068 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/IMetafileContainer.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/IMetafileContainer.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Drawing.Imaging; -#endregion - namespace Greenshot.Addons.Interfaces.Drawing { public interface IMetafileContainer : IDrawableContainer diff --git a/src/Greenshot.Addons/Interfaces/Drawing/ITextContainer.cs b/src/Greenshot.Addons/Interfaces/Drawing/ITextContainer.cs index ad8a14298..94ca526dd 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/ITextContainer.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/ITextContainer.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addons.Interfaces.Drawing { public interface ITextContainer : IDrawableContainer diff --git a/src/Greenshot.Addons/Interfaces/Drawing/RenderMode.cs b/src/Greenshot.Addons/Interfaces/Drawing/RenderMode.cs index de811c6df..3e9fffaf7 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/RenderMode.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/RenderMode.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addons.Interfaces.Drawing { /// diff --git a/src/Greenshot.Addons/Interfaces/DrawingModes.cs b/src/Greenshot.Addons/Interfaces/DrawingModes.cs index 0f7156dc9..6b97e5fbf 100644 --- a/src/Greenshot.Addons/Interfaces/DrawingModes.cs +++ b/src/Greenshot.Addons/Interfaces/DrawingModes.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addons.Interfaces { public enum DrawingModes diff --git a/src/Greenshot.Addons/Interfaces/ExportInformation.cs b/src/Greenshot.Addons/Interfaces/ExportInformation.cs index 876d990a7..c2b862710 100644 --- a/src/Greenshot.Addons/Interfaces/ExportInformation.cs +++ b/src/Greenshot.Addons/Interfaces/ExportInformation.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addons.Interfaces { public class ExportInformation diff --git a/src/Greenshot.Addons/Interfaces/Forms/IImageEditor.cs b/src/Greenshot.Addons/Interfaces/Forms/IImageEditor.cs index 6ddcaf203..78444535c 100644 --- a/src/Greenshot.Addons/Interfaces/Forms/IImageEditor.cs +++ b/src/Greenshot.Addons/Interfaces/Forms/IImageEditor.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - -using System.Drawing; using System.Windows.Forms; - -#endregion +using Greenshot.Gfx; namespace Greenshot.Addons.Interfaces.Forms { @@ -52,8 +44,8 @@ namespace Greenshot.Addons.Interfaces.Forms /// This is actually a wrapper which calls Surface.GetBitmapForExport(). /// Don't forget to call image.Dispose() when finished!!! /// - /// Bitmap - Image GetImageForExport(); + /// IBitmapWithNativeSupport + IBitmapWithNativeSupport GetImageForExport(); /// /// Get the ToolStripMenuItem where plugins can place their Menu entrys diff --git a/src/Greenshot.Addons/Interfaces/ICapture.cs b/src/Greenshot.Addons/Interfaces/ICapture.cs index 947dcf119..888ae8833 100644 --- a/src/Greenshot.Addons/Interfaces/ICapture.cs +++ b/src/Greenshot.Addons/Interfaces/ICapture.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,15 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using Dapplo.Windows.Common.Structs; - -#endregion +using Greenshot.Gfx; namespace Greenshot.Addons.Interfaces { @@ -40,7 +33,7 @@ namespace Greenshot.Addons.Interfaces ICaptureDetails CaptureDetails { get; set; } // The captured Image - Bitmap Bitmap { get; set; } + IBitmapWithNativeSupport Bitmap { get; set; } NativeRect ScreenBounds { get; set; } diff --git a/src/Greenshot.Addons/Interfaces/ICaptureDetails.cs b/src/Greenshot.Addons/Interfaces/ICaptureDetails.cs index a327e5a05..de9286376 100644 --- a/src/Greenshot.Addons/Interfaces/ICaptureDetails.cs +++ b/src/Greenshot.Addons/Interfaces/ICaptureDetails.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,16 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using Greenshot.Addons.Components; -#endregion - namespace Greenshot.Addons.Interfaces { //, Video }; diff --git a/src/Greenshot.Addons/Interfaces/IGreenshotContract.cs b/src/Greenshot.Addons/Interfaces/IGreenshotContract.cs index 745487308..c9a507b42 100644 --- a/src/Greenshot.Addons/Interfaces/IGreenshotContract.cs +++ b/src/Greenshot.Addons/Interfaces/IGreenshotContract.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - #if !NETCOREAPP3_0 using System.ServiceModel; diff --git a/src/Greenshot.Addons/Interfaces/IProcessor.cs b/src/Greenshot.Addons/Interfaces/IProcessor.cs index 37d8cfb57..d42c899db 100644 --- a/src/Greenshot.Addons/Interfaces/IProcessor.cs +++ b/src/Greenshot.Addons/Interfaces/IProcessor.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; -#endregion - namespace Greenshot.Addons.Interfaces { /// diff --git a/src/Greenshot.Addons/Interfaces/ISurface.cs b/src/Greenshot.Addons/Interfaces/ISurface.cs index e8454735a..c6943be1a 100644 --- a/src/Greenshot.Addons/Interfaces/ISurface.cs +++ b/src/Greenshot.Addons/Interfaces/ISurface.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,19 +17,14 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.IO; using System.Windows.Forms; using Greenshot.Addons.Interfaces.Drawing; +using Greenshot.Gfx; using Greenshot.Gfx.Effects; -#endregion - namespace Greenshot.Addons.Interfaces { /// @@ -47,7 +40,7 @@ namespace Greenshot.Addons.Interfaces /// /// Unique ID of the Surface /// - Guid ID { get; set; } + Guid Id { get; set; } IDrawableContainerList Elements { get; } @@ -59,7 +52,7 @@ namespace Greenshot.Addons.Interfaces /// The setter will clone the passed bitmap and dispose it when the Surface is disposed /// This means that the supplied image needs to be disposed by the calling code (if needed!) /// - Bitmap Screenshot { get; set; } + IBitmapWithNativeSupport Screenshot { get; set; } bool HasSelectedElements { get; } @@ -85,7 +78,7 @@ namespace Greenshot.Addons.Interfaces /// Don't forget to call image.Dispose() when finished!!! /// /// Bitmap - Bitmap GetBitmapForExport(); + IBitmapWithNativeSupport GetBitmapForExport(); /// /// Add a TextContainer, at the given location, to the Surface. @@ -105,7 +98,7 @@ namespace Greenshot.Addons.Interfaces ITextContainer AddTextContainer(string text, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment, FontFamily family, float size, bool italic, bool bold, bool shadow, int borderSize, Color color, Color fillColor); - IBitmapContainer AddImageContainer(Bitmap bitmap, int x, int y); + IBitmapContainer AddImageContainer(IBitmapWithNativeSupport bitmap, int x, int y); ICursorContainer AddCursorContainer(Cursor cursor, int x, int y); IIconContainer AddIconContainer(Icon icon, int x, int y); IBitmapContainer AddImageContainer(string filename, int x, int y); @@ -179,10 +172,10 @@ namespace Greenshot.Addons.Interfaces void SetCapture(ICapture capture); /// - /// Use the supplied bitmape in the surface + /// Use the supplied bitmap in the surface /// - /// Bitmap + /// IBitmapWithNativeSupport /// specify if the current bitmap must be disposed - void SetBitmap(Bitmap bitmap, bool dispose = false); + void SetBitmap(IBitmapWithNativeSupport bitmap, bool dispose = false); } } \ No newline at end of file diff --git a/src/Greenshot.Addons/Interfaces/Plugin/HotKeyHandler.cs b/src/Greenshot.Addons/Interfaces/Plugin/HotKeyHandler.cs index 58710c79d..b5f2353ad 100644 --- a/src/Greenshot.Addons/Interfaces/Plugin/HotKeyHandler.cs +++ b/src/Greenshot.Addons/Interfaces/Plugin/HotKeyHandler.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addons.Interfaces.Plugin { public delegate void HotKeyHandler(); diff --git a/src/Greenshot.Addons/Interfaces/Plugin/SurfaceOutputSettings.cs b/src/Greenshot.Addons/Interfaces/Plugin/SurfaceOutputSettings.cs index ef312d4f2..e1e3edf80 100644 --- a/src/Greenshot.Addons/Interfaces/Plugin/SurfaceOutputSettings.cs +++ b/src/Greenshot.Addons/Interfaces/Plugin/SurfaceOutputSettings.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,18 +17,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Collections.Generic; -using Greenshot.Addons.Config.Impl; using Greenshot.Addons.Core; using Greenshot.Core.Enums; using Greenshot.Gfx.Effects; -#endregion - namespace Greenshot.Addons.Interfaces.Plugin { /// @@ -49,7 +40,7 @@ namespace Greenshot.Addons.Interfaces.Plugin { _disableReduceColors = false; Format = fileConfiguration?.OutputFileFormat ?? OutputFormats.png; - JPGQuality = fileConfiguration?.OutputFileJpegQuality ?? 80; + JpgQuality = fileConfiguration?.OutputFileJpegQuality ?? 80; ReduceColors = fileConfiguration?.OutputFileReduceColors ?? false; } @@ -60,7 +51,7 @@ namespace Greenshot.Addons.Interfaces.Plugin public SurfaceOutputSettings(IFileConfiguration fileConfiguration, OutputFormats format, int quality) : this(fileConfiguration, format) { - JPGQuality = quality; + JpgQuality = quality; } public SurfaceOutputSettings(IFileConfiguration fileConfiguration, OutputFormats format, int quality, bool reduceColors) : this(fileConfiguration, format, quality) @@ -70,7 +61,7 @@ namespace Greenshot.Addons.Interfaces.Plugin public OutputFormats Format { get; set; } - public int JPGQuality { get; set; } + public int JpgQuality { get; set; } public bool SaveBackgroundOnly { get; set; } diff --git a/src/Greenshot.Addons/Interfaces/SurfaceDrawingModeEventArgs.cs b/src/Greenshot.Addons/Interfaces/SurfaceDrawingModeEventArgs.cs index 2f823ba81..f7aa56eb8 100644 --- a/src/Greenshot.Addons/Interfaces/SurfaceDrawingModeEventArgs.cs +++ b/src/Greenshot.Addons/Interfaces/SurfaceDrawingModeEventArgs.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; -#endregion - namespace Greenshot.Addons.Interfaces { public class SurfaceDrawingModeEventArgs : EventArgs diff --git a/src/Greenshot.Addons/Interfaces/SurfaceDrawingModeEventHandler.cs b/src/Greenshot.Addons/Interfaces/SurfaceDrawingModeEventHandler.cs index 2e77a3205..40665a0d4 100644 --- a/src/Greenshot.Addons/Interfaces/SurfaceDrawingModeEventHandler.cs +++ b/src/Greenshot.Addons/Interfaces/SurfaceDrawingModeEventHandler.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addons.Interfaces { public delegate void SurfaceDrawingModeEventHandler(object sender, SurfaceDrawingModeEventArgs e); diff --git a/src/Greenshot.Addons/Interfaces/SurfaceElementEventArgs.cs b/src/Greenshot.Addons/Interfaces/SurfaceElementEventArgs.cs index 24f82bc67..ed0a64c28 100644 --- a/src/Greenshot.Addons/Interfaces/SurfaceElementEventArgs.cs +++ b/src/Greenshot.Addons/Interfaces/SurfaceElementEventArgs.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using Greenshot.Addons.Interfaces.Drawing; -#endregion - namespace Greenshot.Addons.Interfaces { public class SurfaceElementEventArgs : EventArgs diff --git a/src/Greenshot.Addons/Interfaces/SurfaceElementEventHandler.cs b/src/Greenshot.Addons/Interfaces/SurfaceElementEventHandler.cs index 4f44d4ebb..57afa9e3e 100644 --- a/src/Greenshot.Addons/Interfaces/SurfaceElementEventHandler.cs +++ b/src/Greenshot.Addons/Interfaces/SurfaceElementEventHandler.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addons.Interfaces { public delegate void SurfaceElementEventHandler(object sender, SurfaceElementEventArgs e); diff --git a/src/Greenshot.Addons/Interfaces/SurfaceMessageEventArgs.cs b/src/Greenshot.Addons/Interfaces/SurfaceMessageEventArgs.cs index 8d47c9c2f..73993e7d5 100644 --- a/src/Greenshot.Addons/Interfaces/SurfaceMessageEventArgs.cs +++ b/src/Greenshot.Addons/Interfaces/SurfaceMessageEventArgs.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; -#endregion - namespace Greenshot.Addons.Interfaces { public class SurfaceMessageEventArgs : EventArgs diff --git a/src/Greenshot.Addons/Interfaces/SurfaceMessageEventHandler.cs b/src/Greenshot.Addons/Interfaces/SurfaceMessageEventHandler.cs index e597604a2..8dfeaca73 100644 --- a/src/Greenshot.Addons/Interfaces/SurfaceMessageEventHandler.cs +++ b/src/Greenshot.Addons/Interfaces/SurfaceMessageEventHandler.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addons.Interfaces { public delegate void SurfaceMessageEventHandler(object sender, SurfaceMessageEventArgs e); diff --git a/src/Greenshot.Addons/Interfaces/SurfaceMessageTyp.cs b/src/Greenshot.Addons/Interfaces/SurfaceMessageTyp.cs index e1ac51f00..31ca7eae8 100644 --- a/src/Greenshot.Addons/Interfaces/SurfaceMessageTyp.cs +++ b/src/Greenshot.Addons/Interfaces/SurfaceMessageTyp.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addons.Interfaces { public enum SurfaceMessageTyp diff --git a/src/Greenshot.Addons/Interfaces/SurfaceSizeChangeEventHandler.cs b/src/Greenshot.Addons/Interfaces/SurfaceSizeChangeEventHandler.cs index efc663fd3..c217065d3 100644 --- a/src/Greenshot.Addons/Interfaces/SurfaceSizeChangeEventHandler.cs +++ b/src/Greenshot.Addons/Interfaces/SurfaceSizeChangeEventHandler.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; -#endregion - namespace Greenshot.Addons.Interfaces { public delegate void SurfaceSizeChangeEventHandler(object sender, EventArgs e); diff --git a/src/Greenshot.Addons/Interfaces/VerticalAlignment.cs b/src/Greenshot.Addons/Interfaces/VerticalAlignment.cs index 754b2dccb..550ee6003 100644 --- a/src/Greenshot.Addons/Interfaces/VerticalAlignment.cs +++ b/src/Greenshot.Addons/Interfaces/VerticalAlignment.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Addons.Interfaces { /// diff --git a/src/Greenshot.Addons/Interop/IServiceProvider.cs b/src/Greenshot.Addons/Interop/IServiceProvider.cs index ccbe2e00a..d19412c94 100644 --- a/src/Greenshot.Addons/Interop/IServiceProvider.cs +++ b/src/Greenshot.Addons/Interop/IServiceProvider.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Runtime.InteropServices; -#endregion - namespace Greenshot.Addons.Interop { /// diff --git a/src/Greenshot.Addons/Resources/GreenshotResources.cs b/src/Greenshot.Addons/Resources/GreenshotResources.cs index b33ae26e4..ca2873249 100644 --- a/src/Greenshot.Addons/Resources/GreenshotResources.cs +++ b/src/Greenshot.Addons/Resources/GreenshotResources.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.IO; @@ -31,8 +25,6 @@ using Dapplo.Addons; using Dapplo.Windows.Icons; using Greenshot.Gfx; -#endregion - namespace Greenshot.Addons.Resources { /// @@ -88,8 +80,8 @@ namespace Greenshot.Addons.Resources /// /// Get the Greenshot logo as a Bitmap /// - /// Bitmap - public Bitmap GetGreenshotImage() + /// IBitmapWithNativeSupport + public IBitmapWithNativeSupport GetGreenshotImage() { return GetBitmap("Greenshot.Image.png", GetType()); } @@ -99,8 +91,8 @@ namespace Greenshot.Addons.Resources /// /// string /// Type - /// Bitmap - public Bitmap GetBitmap(string name, Type type = null) + /// IBitmapWithNativeSupport + public IBitmapWithNativeSupport GetBitmap(string name, Type type = null) { if (name.EndsWith(".Image")) { diff --git a/src/Greenshot.Addons/ViewModels/ExportNotificationViewModel.cs b/src/Greenshot.Addons/ViewModels/ExportNotificationViewModel.cs index 7a75e756d..43b74c7ac 100644 --- a/src/Greenshot.Addons/ViewModels/ExportNotificationViewModel.cs +++ b/src/Greenshot.Addons/ViewModels/ExportNotificationViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Diagnostics; using System.Windows.Media; @@ -60,7 +56,7 @@ namespace Greenshot.Addons.ViewModels using (var bitmap = exportedSurface.GetBitmapForExport()) { - ExportBitmapSource = bitmap.ToBitmapSource(); + ExportBitmapSource = bitmap.NativeBitmap.ToBitmapSource(); } } diff --git a/src/Greenshot.Addons/ViewModels/FileConfigPartViewModel.cs b/src/Greenshot.Addons/ViewModels/FileConfigPartViewModel.cs index d6ddaed52..54b5b685f 100644 --- a/src/Greenshot.Addons/ViewModels/FileConfigPartViewModel.cs +++ b/src/Greenshot.Addons/ViewModels/FileConfigPartViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Collections.Generic; using System.Windows; using Caliburn.Micro; diff --git a/src/Greenshot.Addons/ViewModels/UploadViewModel.cs b/src/Greenshot.Addons/ViewModels/UploadViewModel.cs index c00d3c594..b742eac75 100644 --- a/src/Greenshot.Addons/ViewModels/UploadViewModel.cs +++ b/src/Greenshot.Addons/ViewModels/UploadViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Reactive.Disposables; using Caliburn.Micro; using Dapplo.CaliburnMicro.Extensions; diff --git a/src/Greenshot.Addons/Views/UploadView.xaml b/src/Greenshot.Addons/Views/UploadView.xaml index edcb9e4b7..9fd338bf0 100644 --- a/src/Greenshot.Addons/Views/UploadView.xaml +++ b/src/Greenshot.Addons/Views/UploadView.xaml @@ -3,7 +3,6 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:local="clr-namespace:Greenshot.Addons.Views" xmlns:viewModels="clr-namespace:Greenshot.Addons.ViewModels" mc:Ignorable="d" Height="100" Width="500" d:DataContext="{d:DesignInstance viewModels:UploadViewModel,IsDesignTimeCreatable=False}" diff --git a/src/Greenshot.Core/Capture.cs b/src/Greenshot.Core/Capture.cs index 2043fdffd..ed23b1113 100644 --- a/src/Greenshot.Core/Capture.cs +++ b/src/Greenshot.Core/Capture.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Collections.Generic; using System.Linq; diff --git a/src/Greenshot.Core/CaptureElement.cs b/src/Greenshot.Core/CaptureElement.cs index fda4b0cb1..1347d640e 100644 --- a/src/Greenshot.Core/CaptureElement.cs +++ b/src/Greenshot.Core/CaptureElement.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Collections.Generic; using System.Drawing; diff --git a/src/Greenshot.Core/CaptureFlow.cs b/src/Greenshot.Core/CaptureFlow.cs index 42d3df2be..d951deefd 100644 --- a/src/Greenshot.Core/CaptureFlow.cs +++ b/src/Greenshot.Core/CaptureFlow.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; diff --git a/src/Greenshot.Core/Enums/CaptureElementType.cs b/src/Greenshot.Core/Enums/CaptureElementType.cs index 7ede3334b..8358872f7 100644 --- a/src/Greenshot.Core/Enums/CaptureElementType.cs +++ b/src/Greenshot.Core/Enums/CaptureElementType.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Core.Enums { /// diff --git a/src/Greenshot.Core/Enums/OutputFormats.cs b/src/Greenshot.Core/Enums/OutputFormats.cs index c5b339659..c2f9aff2a 100644 --- a/src/Greenshot.Core/Enums/OutputFormats.cs +++ b/src/Greenshot.Core/Enums/OutputFormats.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Core.Enums { public enum OutputFormats diff --git a/src/Greenshot.Core/Enums/ScreenCaptureMode.cs b/src/Greenshot.Core/Enums/ScreenCaptureMode.cs index 2e3eff37a..24c48cbd5 100644 --- a/src/Greenshot.Core/Enums/ScreenCaptureMode.cs +++ b/src/Greenshot.Core/Enums/ScreenCaptureMode.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Core.Enums { public enum ScreenCaptureMode diff --git a/src/Greenshot.Core/Enums/WindowCaptureModes.cs b/src/Greenshot.Core/Enums/WindowCaptureModes.cs index f77c54637..04fb44128 100644 --- a/src/Greenshot.Core/Enums/WindowCaptureModes.cs +++ b/src/Greenshot.Core/Enums/WindowCaptureModes.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Core.Enums { public enum WindowCaptureModes diff --git a/src/Greenshot.Core/Extensions/BitmapSourceExtensions.cs b/src/Greenshot.Core/Extensions/BitmapSourceExtensions.cs index 7a4af3688..0f8b6d13b 100644 --- a/src/Greenshot.Core/Extensions/BitmapSourceExtensions.cs +++ b/src/Greenshot.Core/Extensions/BitmapSourceExtensions.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.IO; using System.Windows.Media.Imaging; diff --git a/src/Greenshot.Core/Extensions/InteropWindowCaptureExtensions.cs b/src/Greenshot.Core/Extensions/InteropWindowCaptureExtensions.cs index 671430caf..ada8194c1 100644 --- a/src/Greenshot.Core/Extensions/InteropWindowCaptureExtensions.cs +++ b/src/Greenshot.Core/Extensions/InteropWindowCaptureExtensions.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Diagnostics; using System.Drawing; @@ -44,11 +38,9 @@ using Greenshot.Core.Configuration; using Greenshot.Core.Enums; using Greenshot.Core.Interfaces; using Greenshot.Core.Sources; -using Greenshot.Core.Structs; +using Greenshot.Gfx.Structs; using Color = System.Drawing.Color; -#endregion - namespace Greenshot.Core.Extensions { /// diff --git a/src/Greenshot.Core/Greenshot.Core.csproj b/src/Greenshot.Core/Greenshot.Core.csproj index 0385185ae..e6f93f574 100644 --- a/src/Greenshot.Core/Greenshot.Core.csproj +++ b/src/Greenshot.Core/Greenshot.Core.csproj @@ -1,4 +1,4 @@ - + net472;netcoreapp3.0 @@ -29,7 +29,7 @@ - 0.8.17 + 0.8.18 diff --git a/src/Greenshot.Core/Interfaces/ICapture.cs b/src/Greenshot.Core/Interfaces/ICapture.cs index bcaa230ae..fc7c9ddb5 100644 --- a/src/Greenshot.Core/Interfaces/ICapture.cs +++ b/src/Greenshot.Core/Interfaces/ICapture.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Collections.Generic; using Dapplo.Windows.Common.Structs; diff --git a/src/Greenshot.Core/Interfaces/ICaptureElement.cs b/src/Greenshot.Core/Interfaces/ICaptureElement.cs index 3095d3437..1351a16a4 100644 --- a/src/Greenshot.Core/Interfaces/ICaptureElement.cs +++ b/src/Greenshot.Core/Interfaces/ICaptureElement.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Collections.Generic; using Dapplo.Windows.Common.Structs; diff --git a/src/Greenshot.Core/Interfaces/IDestination.cs b/src/Greenshot.Core/Interfaces/IDestination.cs index 868e6f85b..48bc30075 100644 --- a/src/Greenshot.Core/Interfaces/IDestination.cs +++ b/src/Greenshot.Core/Interfaces/IDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Threading; using System.Threading.Tasks; diff --git a/src/Greenshot.Core/Interfaces/IProcessor.cs b/src/Greenshot.Core/Interfaces/IProcessor.cs index b5eea06a6..535a20cee 100644 --- a/src/Greenshot.Core/Interfaces/IProcessor.cs +++ b/src/Greenshot.Core/Interfaces/IProcessor.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Threading; using System.Threading.Tasks; diff --git a/src/Greenshot.Core/Interfaces/ISource.cs b/src/Greenshot.Core/Interfaces/ISource.cs index f18d1e367..29e3a3345 100644 --- a/src/Greenshot.Core/Interfaces/ISource.cs +++ b/src/Greenshot.Core/Interfaces/ISource.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Threading; using System.Threading.Tasks; diff --git a/src/Greenshot.Core/Interfaces/ITemplate.cs b/src/Greenshot.Core/Interfaces/ITemplate.cs index 9385d36a4..12085c799 100644 --- a/src/Greenshot.Core/Interfaces/ITemplate.cs +++ b/src/Greenshot.Core/Interfaces/ITemplate.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Windows; namespace Greenshot.Core.Interfaces diff --git a/src/Greenshot.Core/Sources/DwmWindowSource.cs b/src/Greenshot.Core/Sources/DwmWindowSource.cs index afd7baf61..bdfe38eab 100644 --- a/src/Greenshot.Core/Sources/DwmWindowSource.cs +++ b/src/Greenshot.Core/Sources/DwmWindowSource.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Threading; using System.Threading.Tasks; diff --git a/src/Greenshot.Core/Sources/MouseSource.cs b/src/Greenshot.Core/Sources/MouseSource.cs index 5f8d106b5..1c9180cec 100644 --- a/src/Greenshot.Core/Sources/MouseSource.cs +++ b/src/Greenshot.Core/Sources/MouseSource.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Threading; using System.Threading.Tasks; using System.Windows.Media.Imaging; diff --git a/src/Greenshot.Core/Sources/ScreenSource.cs b/src/Greenshot.Core/Sources/ScreenSource.cs index 1ee9eefd1..e885e5563 100644 --- a/src/Greenshot.Core/Sources/ScreenSource.cs +++ b/src/Greenshot.Core/Sources/ScreenSource.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Collections.Generic; using System.Drawing; diff --git a/src/Greenshot.Core/Structs/Bgra32.cs b/src/Greenshot.Core/Structs/Bgra32.cs deleted file mode 100644 index 03c434760..000000000 --- a/src/Greenshot.Core/Structs/Bgra32.cs +++ /dev/null @@ -1,33 +0,0 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool -// Copyright (C) 2007-2018 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 . - -#endregion - -namespace Greenshot.Core.Structs -{ - public struct Bgra32 - { - public byte B; - public byte G; - public byte R; - public byte A; - } -} diff --git a/src/Greenshot.Core/Templates/CroppedTemplate.cs b/src/Greenshot.Core/Templates/CroppedTemplate.cs index 6813d3281..36a1dc607 100644 --- a/src/Greenshot.Core/Templates/CroppedTemplate.cs +++ b/src/Greenshot.Core/Templates/CroppedTemplate.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Windows; using System.Windows.Controls; using System.Windows.Media; diff --git a/src/Greenshot.Core/Templates/SimpleTemplate.cs b/src/Greenshot.Core/Templates/SimpleTemplate.cs index 4e850dc1f..ce8710594 100644 --- a/src/Greenshot.Core/Templates/SimpleTemplate.cs +++ b/src/Greenshot.Core/Templates/SimpleTemplate.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Windows; using System.Windows.Controls; diff --git a/src/Greenshot.Gfx/BitmapFactory.cs b/src/Greenshot.Gfx/BitmapFactory.cs index e80ab3d9e..cbf66529a 100644 --- a/src/Greenshot.Gfx/BitmapFactory.cs +++ b/src/Greenshot.Gfx/BitmapFactory.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Drawing; using System.Drawing.Imaging; @@ -42,7 +38,7 @@ namespace Greenshot.Gfx /// the source bitmap as the specifications for the new bitmap /// The color to fill with, or Color.Empty to take the default depending on the pixel format /// Bitmap - public static Bitmap CreateEmptyLike(this Image sourceImage, Color? backgroundColor = null) + public static IBitmapWithNativeSupport CreateEmptyLike(this IBitmapWithNativeSupport sourceImage, Color? backgroundColor = null) { var pixelFormat = sourceImage.PixelFormat; if (backgroundColor.HasValue && backgroundColor.Value.A < 255) @@ -51,7 +47,7 @@ namespace Greenshot.Gfx } return CreateEmpty(sourceImage.Width, sourceImage.Height, pixelFormat, backgroundColor, sourceImage.HorizontalResolution, sourceImage.VerticalResolution); } - + /// /// A generic way to create an empty image /// @@ -62,14 +58,14 @@ namespace Greenshot.Gfx /// float /// float /// Bitmap - public static Bitmap CreateEmpty(int width, int height, PixelFormat format = PixelFormat.Format32bppArgb, Color? backgroundColor = null, float horizontalResolution = 96f, float verticalResolution = 96f) + public static IBitmapWithNativeSupport CreateEmpty(int width, int height, PixelFormat format = PixelFormat.Format32bppArgb, Color? backgroundColor = null, float horizontalResolution = 96f, float verticalResolution = 96f) { // Create a new "clean" image var newImage = new Bitmap(width, height, format); newImage.SetResolution(horizontalResolution, verticalResolution); if (format == PixelFormat.Format8bppIndexed) { - return newImage; + return BitmapWrapper.FromBitmap(newImage); } using (var graphics = Graphics.FromImage(newImage)) { @@ -87,7 +83,7 @@ namespace Greenshot.Gfx graphics.Clear(Color.White); } } - return newImage; + return BitmapWrapper.FromBitmap(newImage); } /// @@ -104,7 +100,27 @@ namespace Greenshot.Gfx /// PixelFormat is not supported) /// /// Bitmap - public static Bitmap CloneBitmap(this Bitmap sourceBitmap, PixelFormat targetFormat = PixelFormat.DontCare, NativeRect? sourceRectangle = null) + public static IBitmapWithNativeSupport CloneBitmap(this Bitmap sourceBitmap, PixelFormat targetFormat = PixelFormat.DontCare, NativeRect? sourceRectangle = null) + { + // TODO: Remove this at a later time + return BitmapWrapper.FromBitmap(sourceBitmap).CloneBitmap(targetFormat, sourceRectangle); + } + + /// + /// Clone a bitmap, taking some rules into account: + /// 1) When sourceRect is the whole bitmap there is a GDI+ bug in Clone + /// Clone will than return the same PixelFormat as the source + /// a quick workaround is using new Bitmap which uses a default of Format32bppArgb + /// 2) When going from a transparent to a non transparent bitmap, we draw the background white! + /// + /// Source bitmap to clone + /// NativeRect to copy from the source, use NativeRect.Empty for all + /// + /// Target Format, use PixelFormat.DontCare if you want the original (or a default if the source + /// PixelFormat is not supported) + /// + /// Bitmap + public static IBitmapWithNativeSupport CloneBitmap(this IBitmapWithNativeSupport sourceBitmap, PixelFormat targetFormat = PixelFormat.DontCare, NativeRect? sourceRectangle = null) { Bitmap newImage; var sourceRect = sourceRectangle ?? NativeRect.Empty; @@ -165,23 +181,23 @@ namespace Greenshot.Gfx // decide fastest copy method if (isAreaEqual) { - graphics.DrawImageUnscaled(sourceBitmap, 0, 0); + graphics.DrawImageUnscaled(sourceBitmap.NativeBitmap, 0, 0); } else { - graphics.DrawImage(sourceBitmap, 0, 0, sourceRect, GraphicsUnit.Pixel); + graphics.DrawImage(sourceBitmap.NativeBitmap, 0, 0, sourceRect, GraphicsUnit.Pixel); } } } else { // Let GDI+ decide how to convert, need to test what is quicker... - newImage = sourceBitmap.Clone(sourceRect, targetFormat); + newImage = sourceBitmap.NativeBitmap.Clone(sourceRect, targetFormat); // Make sure both images have the same resolution newImage.SetResolution(sourceBitmap.HorizontalResolution, sourceBitmap.VerticalResolution); } // Clone property items (EXIF information etc) - foreach (var propertyItem in sourceBitmap.PropertyItems) + foreach (var propertyItem in sourceBitmap.NativeBitmap.PropertyItems) { try { @@ -192,7 +208,8 @@ namespace Greenshot.Gfx Log.Warn().WriteLine(ex, "Problem cloning a propertyItem."); } } - return newImage; + + return BitmapWrapper.FromBitmap(newImage); } } diff --git a/src/Greenshot.Gfx/BitmapHelper.cs b/src/Greenshot.Gfx/BitmapHelper.cs index 3aa4f5e69..4b2409bc7 100644 --- a/src/Greenshot.Gfx/BitmapHelper.cs +++ b/src/Greenshot.Gfx/BitmapHelper.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Drawing; @@ -36,9 +30,9 @@ using Dapplo.Windows.Common.Extensions; using Dapplo.Windows.Common.Structs; using Dapplo.Windows.Dpi; using Greenshot.Gfx.Effects; +using Greenshot.Gfx.Extensions; using Greenshot.Gfx.FastBitmap; - -#endregion +using Greenshot.Gfx.Structs; namespace Greenshot.Gfx { @@ -53,7 +47,7 @@ namespace Greenshot.Gfx /// /// A function which usage image.fromstream /// - public static readonly Func FromStreamReader = (stream, s) => + public static readonly Func FromStreamReader = (stream, s) => { using (var tmpImage = Image.FromStream(stream, true, true)) { @@ -82,7 +76,7 @@ namespace Greenshot.Gfx stream.Position = 0; try { - return SvgBitmap.FromStream(stream).Bitmap; + return SvgBitmap.FromStream(stream); } catch (Exception ex) { @@ -131,7 +125,7 @@ namespace Greenshot.Gfx }; } - public static IDictionary> StreamConverters { get; } = new Dictionary>(StringComparer.OrdinalIgnoreCase); + public static IDictionary> StreamConverters { get; } = new Dictionary>(StringComparer.OrdinalIgnoreCase); /// /// Make sure the image is orientated correctly @@ -198,7 +192,7 @@ namespace Greenshot.Gfx /// int /// int /// - public static Bitmap CreateThumbnail(this Image image, int thumbWidth, int thumbHeight, int maxWidth = -1, int maxHeight = -1) + public static IBitmapWithNativeSupport CreateThumbnail(this IBitmapWithNativeSupport image, int thumbWidth, int thumbHeight, int maxWidth = -1, int maxHeight = -1) { var srcWidth = image.Width; var srcHeight = image.Height; @@ -221,15 +215,15 @@ namespace Greenshot.Gfx thumbWidth = (int) (thumbHeight * (srcWidth / (float) srcHeight)); } - var bmp = new Bitmap(thumbWidth, thumbHeight); - using (var graphics = Graphics.FromImage(bmp)) + IBitmapWithNativeSupport bmp = new UnmanagedBitmap(thumbWidth, thumbHeight, image.HorizontalResolution, image.VerticalResolution); + using (var graphics = Graphics.FromImage(bmp.NativeBitmap)) { graphics.SmoothingMode = SmoothingMode.HighQuality; graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; graphics.CompositingQuality = CompositingQuality.HighQuality; graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; var rectDestination = new NativeRect(0, 0, thumbWidth, thumbHeight); - graphics.DrawImage(image, rectDestination, 0, 0, srcWidth, srcHeight, GraphicsUnit.Pixel); + graphics.DrawImage(image.NativeBitmap, rectDestination, 0, 0, srcWidth, srcHeight, GraphicsUnit.Pixel); } return bmp; } @@ -239,7 +233,7 @@ namespace Greenshot.Gfx /// /// Bitmap to crop /// NativeRect with bitmap coordinates, will be "intersected" to the bitmap - public static bool Crop(ref Bitmap bitmap, ref NativeRect cropRectangle) + public static bool Crop(ref IBitmapWithNativeSupport bitmap, ref NativeRect cropRectangle) { if (bitmap.Width * bitmap.Height > 0) { @@ -347,7 +341,7 @@ namespace Greenshot.Gfx /// /// /// NativeRect - public static NativeRect FindAutoCropRectangle(this Image image, int cropDifference) + public static NativeRect FindAutoCropRectangle(this IBitmapWithNativeSupport image, int cropDifference) { var cropRectangle = NativeRect.Empty; var checkPoints = new List @@ -361,7 +355,7 @@ namespace Greenshot.Gfx // Bottom Left // Top Right // Bottom Right - using (var fastBitmap = FastBitmapFactory.Create((Bitmap) image)) + using (var fastBitmap = FastBitmapFactory.Create(image)) { // find biggest area foreach (var checkPoint in checkPoints) @@ -381,7 +375,7 @@ namespace Greenshot.Gfx /// /// /// - public static Bitmap LoadBitmap(string filename) + public static IBitmapWithNativeSupport LoadBitmap(string filename) { if (string.IsNullOrEmpty(filename)) { @@ -391,7 +385,7 @@ namespace Greenshot.Gfx { return null; } - Bitmap fileBitmap; + IBitmapWithNativeSupport fileBitmap; Log.Info().WriteLine("Loading image from file {0}", filename); // Fixed lock problem Bug #3431881 using (Stream imageFileStream = File.OpenRead(filename)) @@ -412,11 +406,11 @@ namespace Greenshot.Gfx /// /// Stream with the icon information /// Bitmap with the Vista Icon (256x256) - private static Bitmap ExtractVistaIcon(this Stream iconStream) + private static IBitmapWithNativeSupport ExtractVistaIcon(this Stream iconStream) { const int sizeIconDir = 6; const int sizeIconDirEntry = 16; - Bitmap bmpPngExtracted = null; + IBitmapWithNativeSupport bmpPngExtracted = null; try { var srcBuf = new byte[iconStream.Length]; @@ -436,7 +430,7 @@ namespace Greenshot.Gfx { destStream.Write(srcBuf, iImageOffset, iImageSize); destStream.Seek(0, SeekOrigin.Begin); - bmpPngExtracted = new Bitmap(destStream); // This is PNG! :) + bmpPngExtracted = BitmapWrapper.FromBitmap(new Bitmap(destStream)); // This is PNG! :) } break; } @@ -455,7 +449,7 @@ namespace Greenshot.Gfx /// IEffect /// Matrix /// Bitmap - public static Bitmap ApplyEffect(this Bitmap sourceBitmap, IEffect effect, Matrix matrix) + public static IBitmapWithNativeSupport ApplyEffect(this IBitmapWithNativeSupport sourceBitmap, IEffect effect, Matrix matrix) { var effects = new List {effect}; return sourceBitmap.ApplyEffects(effects, matrix); @@ -468,7 +462,7 @@ namespace Greenshot.Gfx /// List of IEffect /// Matrix /// Bitmap - public static Bitmap ApplyEffects(this Bitmap sourceBitmap, IEnumerable effects, Matrix matrix) + public static IBitmapWithNativeSupport ApplyEffects(this IBitmapWithNativeSupport sourceBitmap, IEnumerable effects, Matrix matrix) { var currentImage = sourceBitmap; var disposeImage = false; @@ -527,7 +521,7 @@ namespace Greenshot.Gfx /// location /// /// Bitmap with the shadow, is bigger than the sourceBitmap!! - public static Bitmap CreateShadow(this Image sourceBitmap, float darkness, int shadowSize, NativePoint shadowOffset, Matrix matrix, PixelFormat targetPixelformat) + public static IBitmapWithNativeSupport CreateShadow(this IBitmapWithNativeSupport sourceBitmap, float darkness, int shadowSize, NativePoint shadowOffset, Matrix matrix, PixelFormat targetPixelformat) { var offset = shadowOffset.Offset(shadowSize - 1, shadowSize - 1); matrix.Translate(offset.X, offset.Y, MatrixOrder.Append); @@ -549,7 +543,7 @@ namespace Greenshot.Gfx }; var shadowRectangle = new NativeRect(new NativePoint(shadowSize, shadowSize), sourceBitmap.Size); - ApplyColorMatrix((Bitmap) sourceBitmap, NativeRect.Empty, returnImage, shadowRectangle, maskMatrix); + ApplyColorMatrix(sourceBitmap, NativeRect.Empty, returnImage, shadowRectangle, maskMatrix); // blur "shadow", apply to whole new image @@ -557,15 +551,15 @@ namespace Greenshot.Gfx returnImage.ApplyBoxBlur(shadowSize); // Draw the original image over the shadow - using (var graphics = Graphics.FromImage(returnImage)) + using (var graphics = Graphics.FromImage(sourceBitmap.NativeBitmap)) { // Make sure we draw with the best quality! graphics.SmoothingMode = SmoothingMode.HighQuality; graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; graphics.CompositingQuality = CompositingQuality.HighQuality; graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; - // draw original with a TextureBrush so we have nice antialiasing! - using (Brush textureBrush = new TextureBrush(sourceBitmap, WrapMode.Clamp)) + // draw original with a TextureBrush so we have nice anti-aliasing! + using (Brush textureBrush = new TextureBrush(sourceBitmap.NativeBitmap, WrapMode.Clamp)) { // We need to do a translate-transform otherwise the image is wrapped graphics.TranslateTransform(offset.X, offset.Y); @@ -580,7 +574,7 @@ namespace Greenshot.Gfx /// /// Image to apply matrix to /// ColorMatrix to apply - public static void ApplyColorMatrix(this Bitmap source, ColorMatrix colorMatrix) + public static void ApplyColorMatrix(this IBitmapWithNativeSupport source, ColorMatrix colorMatrix) { source.ApplyColorMatrix(NativeRect.Empty, source, NativeRect.Empty, colorMatrix); } @@ -593,13 +587,13 @@ namespace Greenshot.Gfx /// NativeRect to copy to /// Image to copy to /// ColorMatrix to apply - public static void ApplyColorMatrix(this Bitmap source, NativeRect sourceRect, Bitmap dest, NativeRect destRect, ColorMatrix colorMatrix) + public static void ApplyColorMatrix(this IBitmapWithNativeSupport source, NativeRect sourceRect, IBitmapWithNativeSupport dest, NativeRect destRect, ColorMatrix colorMatrix) { using (var imageAttributes = new ImageAttributes()) { imageAttributes.ClearColorMatrix(); imageAttributes.SetColorMatrix(colorMatrix); - source.ApplyImageAttributes(sourceRect, dest, destRect, imageAttributes); + source.ApplyImageAttributes(sourceRect, dest, destRect, imageAttributes); } } @@ -608,9 +602,9 @@ namespace Greenshot.Gfx /// /// Image to apply matrix to /// ImageAttributes to apply - public static void ApplyColorMatrix(this Bitmap source, ImageAttributes imageAttributes) + public static void ApplyColorMatrix(this IBitmapWithNativeSupport source, ImageAttributes imageAttributes) { - source.ApplyImageAttributes(NativeRect.Empty, source, NativeRect.Empty, imageAttributes); + source.ApplyImageAttributes(NativeRect.Empty, source, NativeRect.Empty, imageAttributes); } /// @@ -621,7 +615,7 @@ namespace Greenshot.Gfx /// NativeRect to copy to /// Image to copy to /// ImageAttributes to apply - public static void ApplyImageAttributes(this Bitmap source, NativeRect sourceRect, Bitmap dest, NativeRect destRect, ImageAttributes imageAttributes) + public static void ApplyImageAttributes(this IBitmapWithNativeSupport source, NativeRect sourceRect, IBitmapWithNativeSupport dest, NativeRect destRect, ImageAttributes imageAttributes) { if (sourceRect == NativeRect.Empty) { @@ -635,7 +629,7 @@ namespace Greenshot.Gfx { destRect = new NativeRect(0, 0, dest.Width, dest.Height); } - using (var graphics = Graphics.FromImage(dest)) + using (var graphics = Graphics.FromImage(dest.NativeBitmap)) { // Make sure we draw with the best quality! graphics.SmoothingMode = SmoothingMode.HighQuality; @@ -644,7 +638,7 @@ namespace Greenshot.Gfx graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; graphics.CompositingMode = CompositingMode.SourceCopy; - graphics.DrawImage(source, destRect, sourceRect.X, sourceRect.Y, sourceRect.Width, sourceRect.Height, GraphicsUnit.Pixel, imageAttributes); + graphics.DrawImage(source.NativeBitmap, destRect, sourceRect.X, sourceRect.Y, sourceRect.Width, sourceRect.Height, GraphicsUnit.Pixel, imageAttributes); } } @@ -653,7 +647,7 @@ namespace Greenshot.Gfx /// /// bitmap to check /// bool if we support it - public static bool IsPixelFormatSupported(this Image image) + public static bool IsPixelFormatSupported(this IBitmapWithNativeSupport image) { return image.PixelFormat.IsPixelFormatSupported(); } @@ -678,10 +672,10 @@ namespace Greenshot.Gfx /// Image /// RotateFlipType /// Image - public static Bitmap ApplyRotateFlip(this Bitmap sourceBitmap, RotateFlipType rotateFlipType) + public static IBitmapWithNativeSupport ApplyRotateFlip(this IBitmapWithNativeSupport sourceBitmap, RotateFlipType rotateFlipType) { var returnImage = sourceBitmap.CloneBitmap(); - returnImage.RotateFlip(rotateFlipType); + returnImage.NativeBitmap.RotateFlip(rotateFlipType); return returnImage; } @@ -692,7 +686,7 @@ namespace Greenshot.Gfx /// Image /// 1-99 to make smaller, use 101 and more to make the picture bigger /// Bitmap - public static Bitmap ScaleByPercent(this Image sourceImage, int percent) + public static IBitmapWithNativeSupport ScaleByPercent(this IBitmapWithNativeSupport sourceImage, int percent) { var nPercent = (float) percent / 100; @@ -702,10 +696,10 @@ namespace Greenshot.Gfx var destHeight = (int) (sourceHeight * nPercent); var scaledBitmap = BitmapFactory.CreateEmpty(destWidth, destHeight, sourceImage.PixelFormat, Color.Empty, sourceImage.HorizontalResolution, sourceImage.VerticalResolution); - using (var graphics = Graphics.FromImage(scaledBitmap)) + using (var graphics = Graphics.FromImage(scaledBitmap.NativeBitmap)) { graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; - graphics.DrawImage(sourceImage, new NativeRect(0, 0, destWidth, destHeight), new NativeRect(0, 0, sourceWidth, sourceHeight), GraphicsUnit.Pixel); + graphics.DrawImage(sourceImage.NativeBitmap, new NativeRect(0, 0, destWidth, destHeight), new NativeRect(0, 0, sourceWidth, sourceHeight), GraphicsUnit.Pixel); } return scaledBitmap; } @@ -721,14 +715,14 @@ namespace Greenshot.Gfx /// int /// Matrix /// a new bitmap with the source copied on it - public static Bitmap ResizeCanvas(this Image sourceImage, Color backgroundColor, int left, int right, int top, int bottom, Matrix matrix) + public static IBitmapWithNativeSupport ResizeCanvas(this IBitmapWithNativeSupport sourceImage, Color backgroundColor, int left, int right, int top, int bottom, Matrix matrix) { matrix.Translate(left, top, MatrixOrder.Append); var newBitmap = BitmapFactory.CreateEmpty(sourceImage.Width + left + right, sourceImage.Height + top + bottom, sourceImage.PixelFormat, backgroundColor, sourceImage.HorizontalResolution, sourceImage.VerticalResolution); - using (var graphics = Graphics.FromImage(newBitmap)) + using (var graphics = Graphics.FromImage(newBitmap.NativeBitmap)) { - graphics.DrawImageUnscaled(sourceImage, left, top); + graphics.DrawImageUnscaled(sourceImage.NativeBitmap, left, top); } return newBitmap; } @@ -743,7 +737,7 @@ namespace Greenshot.Gfx /// Matrix /// InterpolationMode /// Image - public static Bitmap Resize(this Image sourceImage, bool maintainAspectRatio, int newWidth, int newHeight, Matrix matrix = null, InterpolationMode interpolationMode = InterpolationMode.HighQualityBicubic) + public static IBitmapWithNativeSupport Resize(this IBitmapWithNativeSupport sourceImage, bool maintainAspectRatio, int newWidth, int newHeight, Matrix matrix = null, InterpolationMode interpolationMode = InterpolationMode.HighQualityBicubic) { return Resize(sourceImage, maintainAspectRatio, false, Color.Empty, newWidth, newHeight, matrix, interpolationMode); } @@ -760,7 +754,7 @@ namespace Greenshot.Gfx /// Matrix /// InterpolationMode /// a new bitmap with the specified size, the source-Image scaled to fit with aspect ratio locked - public static Bitmap Resize(this Image sourceImage, bool maintainAspectRatio, bool canvasUseNewSize, Color backgroundColor, int newWidth, int newHeight, Matrix matrix, InterpolationMode interpolationMode = InterpolationMode.HighQualityBicubic) + public static IBitmapWithNativeSupport Resize(this IBitmapWithNativeSupport sourceImage, bool maintainAspectRatio, bool canvasUseNewSize, Color backgroundColor, int newWidth, int newHeight, Matrix matrix, InterpolationMode interpolationMode = InterpolationMode.HighQualityBicubic) { var destX = 0; var destY = 0; @@ -797,7 +791,7 @@ namespace Greenshot.Gfx { newHeight = destHeight; } - Bitmap newBitmap; + IBitmapWithNativeSupport newBitmap; if (maintainAspectRatio && canvasUseNewSize) { newBitmap = BitmapFactory.CreateEmpty(newWidth, newHeight, sourceImage.PixelFormat, backgroundColor, sourceImage.HorizontalResolution, sourceImage.VerticalResolution); @@ -809,7 +803,7 @@ namespace Greenshot.Gfx matrix?.Scale((float) destWidth / sourceImage.Width, (float) destHeight / sourceImage.Height, MatrixOrder.Append); } - using (var graphics = Graphics.FromImage(newBitmap)) + using (var graphics = Graphics.FromImage(newBitmap.NativeBitmap)) { graphics.CompositingQuality = CompositingQuality.HighQuality; graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; @@ -818,7 +812,7 @@ namespace Greenshot.Gfx using (var wrapMode = new ImageAttributes()) { wrapMode.SetWrapMode(WrapMode.TileFlipXY); - graphics.DrawImage(sourceImage, new NativeRect(destX, destY, destWidth, destHeight), 0, 0, sourceImage.Width, sourceImage.Height, GraphicsUnit.Pixel, wrapMode); + graphics.DrawImage(sourceImage.NativeBitmap, new NativeRect(destX, destY, destWidth, destHeight), 0, 0, sourceImage.Width, sourceImage.Height, GraphicsUnit.Pixel, wrapMode); } } return newBitmap; @@ -831,7 +825,7 @@ namespace Greenshot.Gfx /// Color to count /// true if Alpha needs to be checked /// int with the number of pixels which have colorToCount - public static int CountColor(this Image sourceImage, Color colorToCount, bool includeAlpha = true) + public static int CountColor(this IBitmapWithNativeSupport sourceImage, Color colorToCount, bool includeAlpha = true) { var lockObject = new object(); var colors = 0; @@ -840,7 +834,7 @@ namespace Greenshot.Gfx { toCount = toCount & 0xffffff; } - using (var bb = FastBitmapFactory.Create((Bitmap)sourceImage)) + using (var bb = FastBitmapFactory.Create(sourceImage)) { Parallel.For(0, bb.Height, () => 0, (y, state, initialColorCount) => { @@ -876,7 +870,7 @@ namespace Greenshot.Gfx /// Stream /// /// Image - public static Bitmap FromStream(Stream stream, string extension = null) + public static IBitmapWithNativeSupport FromStream(Stream stream, string extension = null) { if (stream == null) { @@ -895,7 +889,7 @@ namespace Greenshot.Gfx stream = memoryStream; } - Bitmap returnBitmap = null; + IBitmapWithNativeSupport returnBitmap = null; if (StreamConverters.TryGetValue(extension ?? "", out var converter)) { returnBitmap = converter(stream, extension); @@ -917,7 +911,7 @@ namespace Greenshot.Gfx /// double with the dpi value /// the base size of the icon, default is 16 /// Bitmap - public static Bitmap ScaleIconForDisplaying(this Bitmap original, uint dpi, int baseSize = 16) + public static IBitmapWithNativeSupport ScaleIconForDisplaying(this IBitmapWithNativeSupport original, uint dpi, int baseSize = 16) { if (original == null) { @@ -933,6 +927,7 @@ namespace Greenshot.Gfx return original; } + if (width == original.Width * 2) { return original.Scale2X(); @@ -957,7 +952,7 @@ namespace Greenshot.Gfx /// Bitmap /// Bitmap /// bool true if they are equal - public static bool IsEqualTo(this Bitmap bitmap1, Bitmap bitmap2) + public static bool IsEqualTo(this IBitmapWithNativeSupport bitmap1, IBitmapWithNativeSupport bitmap2) { if (bitmap1.Width != bitmap2.Width || bitmap1.Height != bitmap2.Height) { diff --git a/src/Greenshot.Gfx/BitmapWrapper.cs b/src/Greenshot.Gfx/BitmapWrapper.cs index bbff887db..5d991a0a6 100644 --- a/src/Greenshot.Gfx/BitmapWrapper.cs +++ b/src/Greenshot.Gfx/BitmapWrapper.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,92 +17,57 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Drawing; using System.Drawing.Imaging; -#endregion - namespace Greenshot.Gfx { /// - /// Wrap an Bitmap, make it resizeable + /// Wrap an Bitmap /// - public class BitmapWrapper : IBitmap + public class BitmapWrapper : IBitmapWithNativeSupport { - // Underlying image, is used to generate a resized version of it when needed + // Underlying image private readonly Bitmap _bitmap; - private Bitmap _bitmapClone; public BitmapWrapper(Bitmap bitmap) { // Make sure the orientation is set correctly so Greenshot can process the image correctly bitmap.Orientate(); _bitmap = bitmap; - Width = _bitmap.Width; - Height = _bitmap.Height; } public void Dispose() { _bitmap.Dispose(); - _bitmapClone?.Dispose(); } - /// - /// Height of the image, can be set to change - /// - public int Height { get; set; } + /// + public int Height => _bitmap.Height; - /// - /// Width of the image, can be set to change. - /// - public int Width { get; set; } + /// + public int Width => _bitmap.Width; - /// - /// Size of the image - /// - public Size Size => new Size(Width, Height); + /// + public PixelFormat PixelFormat => _bitmap.PixelFormat; - /// - /// Pixelformat of the underlying image - /// - public PixelFormat PixelFormat => Bitmap.PixelFormat; + /// + public float HorizontalResolution => _bitmap.HorizontalResolution; - public float HorizontalResolution => Bitmap.HorizontalResolution; - public float VerticalResolution => Bitmap.VerticalResolution; + /// + public float VerticalResolution => _bitmap.VerticalResolution; - public Bitmap Bitmap - { - get - { - if (_bitmapClone == null) - { - if (_bitmap.Height == Height && _bitmap.Width == Width) - { - return _bitmap; - } - } - if (_bitmapClone?.Height == Height && _bitmapClone?.Width == Width) - { - return _bitmapClone; - } - // Calculate new image clone - _bitmapClone?.Dispose(); - _bitmapClone = _bitmap.Resize(false, Width, Height); - return _bitmapClone; - } - } + /// + public Bitmap NativeBitmap => _bitmap; - /// + public Size Size => new Size(Width, Height); + + /// /// Factory method /// /// Image /// IBitmap - public static IBitmap FromImage(Bitmap bitmap) + public static IBitmapWithNativeSupport FromBitmap(Bitmap bitmap) { return bitmap == null ? null : new BitmapWrapper(bitmap); } diff --git a/src/Greenshot.Gfx/BoxBlur.cs b/src/Greenshot.Gfx/BoxBlur.cs index 35c330ae7..21184b1e5 100644 --- a/src/Greenshot.Gfx/BoxBlur.cs +++ b/src/Greenshot.Gfx/BoxBlur.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,9 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -using System.Drawing; using System.Runtime.CompilerServices; using System.Threading.Tasks; using Greenshot.Gfx.FastBitmap; @@ -38,7 +33,7 @@ namespace Greenshot.Gfx /// /// Bitmap to blur /// Must be ODD, if not +1 is used - public static void ApplyBoxBlur(this Bitmap destinationBitmap, int range) + public static void ApplyBoxBlur(this IBitmapWithNativeSupport destinationBitmap, int range) { // We only need one fastbitmap as we use it as source and target (the reading is done for one line H/V, writing after "parsing" one line H/V) using (var fastBitmap = FastBitmapFactory.Create(destinationBitmap)) diff --git a/src/Greenshot.Gfx/BoxBlurUnmanaged.cs b/src/Greenshot.Gfx/BoxBlurUnmanaged.cs index d65efe073..ac989c268 100644 --- a/src/Greenshot.Gfx/BoxBlurUnmanaged.cs +++ b/src/Greenshot.Gfx/BoxBlurUnmanaged.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Threading.Tasks; using Greenshot.Gfx.Structs; diff --git a/src/Greenshot.Gfx/Effects/AdjustEffect.cs b/src/Greenshot.Gfx/Effects/AdjustEffect.cs index 4d15b40a3..c9adc2625 100644 --- a/src/Greenshot.Gfx/Effects/AdjustEffect.cs +++ b/src/Greenshot.Gfx/Effects/AdjustEffect.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,17 +17,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using Dapplo.Windows.Common.Structs; -#endregion - namespace Greenshot.Gfx.Effects { /// @@ -43,7 +35,7 @@ namespace Greenshot.Gfx.Effects public float Gamma { get; set; } = 1f; - public Bitmap Apply(Bitmap sourceBitmap, Matrix matrix) + public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix) { return Adjust(sourceBitmap, Brightness, Contrast, Gamma); } @@ -57,7 +49,7 @@ namespace Greenshot.Gfx.Effects /// /// /// Bitmap with grayscale - public static Bitmap Adjust(Bitmap sourceBitmap, float brightness, float contrast, float gamma) + public static IBitmapWithNativeSupport Adjust(IBitmapWithNativeSupport sourceBitmap, float brightness, float contrast, float gamma) { //create a blank bitmap the same size as original // If using 8bpp than the following exception comes: A Graphics object cannot be created from an image that has an indexed pixel format. diff --git a/src/Greenshot.Gfx/Effects/BlurEffect.cs b/src/Greenshot.Gfx/Effects/BlurEffect.cs index 97eb3574a..6f9e08634 100644 --- a/src/Greenshot.Gfx/Effects/BlurEffect.cs +++ b/src/Greenshot.Gfx/Effects/BlurEffect.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,17 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; -using System.Drawing; using System.Drawing.Drawing2D; using Greenshot.Gfx.FastBitmap; -#endregion - namespace Greenshot.Gfx.Effects { /// @@ -40,7 +31,7 @@ namespace Greenshot.Gfx.Effects { public int Range { get; set; } = 3; - public virtual Bitmap Apply(Bitmap sourceBitmap, Matrix matrix) + public virtual IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix) { var result = FastBitmapFactory.CreateCloneOf(sourceBitmap); result.ApplyBoxBlur(Range); diff --git a/src/Greenshot.Gfx/Effects/BorderEffect.cs b/src/Greenshot.Gfx/Effects/BorderEffect.cs index a89e53d31..86a891e57 100644 --- a/src/Greenshot.Gfx/Effects/BorderEffect.cs +++ b/src/Greenshot.Gfx/Effects/BorderEffect.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,17 +17,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using Dapplo.Windows.Common.Structs; -#endregion - namespace Greenshot.Gfx.Effects { /// @@ -41,7 +33,7 @@ namespace Greenshot.Gfx.Effects public int Width { get; set; } = 2; - public Bitmap Apply(Bitmap sourceBitmap, Matrix matrix) + public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix) { return CreateBorder(sourceBitmap, Width, Color, sourceBitmap.PixelFormat, matrix); } @@ -58,7 +50,7 @@ namespace Greenshot.Gfx.Effects /// location /// /// Bitmap with the shadow, is bigger than the sourceBitmap!! - public static Bitmap CreateBorder(Bitmap sourceBitmap, int borderSize, Color borderColor, PixelFormat targetPixelformat, Matrix matrix) + public static IBitmapWithNativeSupport CreateBorder(IBitmapWithNativeSupport sourceBitmap, int borderSize, Color borderColor, PixelFormat targetPixelformat, Matrix matrix) { // "return" the shifted offset, so the caller can e.g. move elements var offset = new NativePoint(borderSize, borderSize); @@ -67,7 +59,7 @@ namespace Greenshot.Gfx.Effects // Create a new "clean" image var newImage = BitmapFactory.CreateEmpty(sourceBitmap.Width + borderSize * 2, sourceBitmap.Height + borderSize * 2, targetPixelformat, Color.Empty, sourceBitmap.HorizontalResolution, sourceBitmap.VerticalResolution); - using (var graphics = Graphics.FromImage(newImage)) + using (var graphics = Graphics.FromImage(newImage.NativeBitmap)) { // Make sure we draw with the best quality! graphics.SmoothingMode = SmoothingMode.HighQuality; @@ -85,8 +77,8 @@ namespace Greenshot.Gfx.Effects graphics.DrawPath(pen, path); } } - // draw original with a TextureBrush so we have nice antialiasing! - using (Brush textureBrush = new TextureBrush(sourceBitmap, WrapMode.Clamp)) + // draw original with a TextureBrush so we have nice anti-aliasing! + using (Brush textureBrush = new TextureBrush(sourceBitmap.NativeBitmap, WrapMode.Clamp)) { // We need to do a translate-tranform otherwise the image is wrapped graphics.TranslateTransform(offset.X, offset.Y); diff --git a/src/Greenshot.Gfx/Effects/DropShadowEffect.cs b/src/Greenshot.Gfx/Effects/DropShadowEffect.cs index 3de75c395..93c98c22f 100644 --- a/src/Greenshot.Gfx/Effects/DropShadowEffect.cs +++ b/src/Greenshot.Gfx/Effects/DropShadowEffect.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,18 +17,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; -using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using Dapplo.Windows.Common.Structs; -#endregion - namespace Greenshot.Gfx.Effects { /// @@ -60,7 +51,7 @@ namespace Greenshot.Gfx.Effects /// Bitmap /// Matrix /// Bitmap - public virtual Bitmap Apply(Bitmap sourceBitmap, Matrix matrix) + public virtual IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix) { return sourceBitmap.CreateShadow(Darkness, ShadowSize, ShadowOffset, matrix, PixelFormat.Format32bppArgb); } diff --git a/src/Greenshot.Gfx/Effects/EffectConverter.cs b/src/Greenshot.Gfx/Effects/EffectConverter.cs index 19c6a8a02..9434f2508 100644 --- a/src/Greenshot.Gfx/Effects/EffectConverter.cs +++ b/src/Greenshot.Gfx/Effects/EffectConverter.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.ComponentModel; using System.Globalization; @@ -30,8 +24,6 @@ using System.Text; using Dapplo.Windows.Common.Extensions; using Dapplo.Windows.Common.Structs; -#endregion - namespace Greenshot.Gfx.Effects { /// diff --git a/src/Greenshot.Gfx/Effects/GrayscaleEffect.cs b/src/Greenshot.Gfx/Effects/GrayscaleEffect.cs index 93d1c9f33..fd750a434 100644 --- a/src/Greenshot.Gfx/Effects/GrayscaleEffect.cs +++ b/src/Greenshot.Gfx/Effects/GrayscaleEffect.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,16 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - -using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; -#endregion - namespace Greenshot.Gfx.Effects { /// @@ -42,7 +33,7 @@ namespace Greenshot.Gfx.Effects /// Bitmap /// Matrix /// Bitmap - public Bitmap Apply(Bitmap sourceBitmap, Matrix matrix) + public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix) { return CreateGrayscale(sourceBitmap); } @@ -52,7 +43,7 @@ namespace Greenshot.Gfx.Effects /// /// Original bitmap /// Bitmap with grayscale - public static Bitmap CreateGrayscale(Bitmap sourceBitmap) + public static IBitmapWithNativeSupport CreateGrayscale(IBitmapWithNativeSupport sourceBitmap) { var clone = sourceBitmap.CloneBitmap(); var grayscaleMatrix = new ColorMatrix(new[] diff --git a/src/Greenshot.Gfx/Effects/IEffect.cs b/src/Greenshot.Gfx/Effects/IEffect.cs index b6133ca42..9e9c840b2 100644 --- a/src/Greenshot.Gfx/Effects/IEffect.cs +++ b/src/Greenshot.Gfx/Effects/IEffect.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - -using System.Drawing; using System.Drawing.Drawing2D; -#endregion - namespace Greenshot.Gfx.Effects { /// @@ -45,6 +36,6 @@ namespace Greenshot.Gfx.Effects /// location of elements on a canvas /// /// new image with applied effect - Bitmap Apply(Bitmap sourceBitmap, Matrix matrix); + IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix); } } \ No newline at end of file diff --git a/src/Greenshot.Gfx/Effects/InvertEffect.cs b/src/Greenshot.Gfx/Effects/InvertEffect.cs index 959241ed0..ea6a4b9ae 100644 --- a/src/Greenshot.Gfx/Effects/InvertEffect.cs +++ b/src/Greenshot.Gfx/Effects/InvertEffect.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,16 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - -using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; -#endregion - namespace Greenshot.Gfx.Effects { /// @@ -36,7 +27,7 @@ namespace Greenshot.Gfx.Effects /// public class InvertEffect : IEffect { - public Bitmap Apply(Bitmap sourceBitmap, Matrix matrix) + public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix) { return CreateNegative(sourceBitmap); } @@ -46,7 +37,7 @@ namespace Greenshot.Gfx.Effects /// /// Bitmap to create a negative off /// Negative bitmap - public static Bitmap CreateNegative(Bitmap sourceBitmap) + public static IBitmapWithNativeSupport CreateNegative(IBitmapWithNativeSupport sourceBitmap) { var clone = sourceBitmap.CloneBitmap(); var invertMatrix = new ColorMatrix(new[] diff --git a/src/Greenshot.Gfx/Effects/MonochromeEffect.cs b/src/Greenshot.Gfx/Effects/MonochromeEffect.cs index 57a7819ef..2511392e4 100644 --- a/src/Greenshot.Gfx/Effects/MonochromeEffect.cs +++ b/src/Greenshot.Gfx/Effects/MonochromeEffect.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,17 +17,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Drawing; using System.Drawing.Drawing2D; using System.Threading.Tasks; using Greenshot.Gfx.FastBitmap; -#endregion - namespace Greenshot.Gfx.Effects { /// @@ -45,7 +37,7 @@ namespace Greenshot.Gfx.Effects _threshold = threshold; } - public Bitmap Apply(Bitmap sourceBitmap, Matrix matrix) + public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix) { return CreateMonochrome(sourceBitmap, _threshold); } @@ -56,7 +48,7 @@ namespace Greenshot.Gfx.Effects /// Bitmap to create a b/w of /// Threshold for monochrome filter (0 - 255), lower value means less black /// b/w bitmap - public static Bitmap CreateMonochrome(Bitmap sourceBitmap, byte threshold) + public static IBitmapWithNativeSupport CreateMonochrome(IBitmapWithNativeSupport sourceBitmap, byte threshold) { using (var fastBitmap = FastBitmapFactory.CreateCloneOf(sourceBitmap, sourceBitmap.PixelFormat)) { diff --git a/src/Greenshot.Gfx/Effects/ReduceColorsEffect.cs b/src/Greenshot.Gfx/Effects/ReduceColorsEffect.cs index 2fb0489ac..194ca0520 100644 --- a/src/Greenshot.Gfx/Effects/ReduceColorsEffect.cs +++ b/src/Greenshot.Gfx/Effects/ReduceColorsEffect.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,18 +17,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; -using System.Drawing; using System.Drawing.Drawing2D; using Dapplo.Log; using Greenshot.Gfx.Quantizer; -#endregion - namespace Greenshot.Gfx.Effects { /// @@ -42,7 +33,7 @@ namespace Greenshot.Gfx.Effects public int Colors { get; set; } = 256; - public Bitmap Apply(Bitmap sourceBitmap, Matrix matrix) + public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix) { using (var quantizer = new WuQuantizer(sourceBitmap)) { diff --git a/src/Greenshot.Gfx/Effects/ResizeCanvasEffect.cs b/src/Greenshot.Gfx/Effects/ResizeCanvasEffect.cs index 8cfce75e8..d8e6faa23 100644 --- a/src/Greenshot.Gfx/Effects/ResizeCanvasEffect.cs +++ b/src/Greenshot.Gfx/Effects/ResizeCanvasEffect.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Drawing; using System.Drawing.Drawing2D; -#endregion - namespace Greenshot.Gfx.Effects { /// @@ -54,7 +46,7 @@ namespace Greenshot.Gfx.Effects public Color BackgroundColor { get; set; } - public Bitmap Apply(Bitmap sourceBitmap, Matrix matrix) + public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix) { return BitmapHelper.ResizeCanvas(sourceBitmap, BackgroundColor, Left, Right, Top, Bottom, matrix); } diff --git a/src/Greenshot.Gfx/Effects/ResizeEffect.cs b/src/Greenshot.Gfx/Effects/ResizeEffect.cs index fe2b8c04a..74b8b1a67 100644 --- a/src/Greenshot.Gfx/Effects/ResizeEffect.cs +++ b/src/Greenshot.Gfx/Effects/ResizeEffect.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - -using System.Drawing; using System.Drawing.Drawing2D; -#endregion - namespace Greenshot.Gfx.Effects { /// @@ -48,7 +39,7 @@ namespace Greenshot.Gfx.Effects public bool MaintainAspectRatio { get; set; } - public Bitmap Apply(Bitmap sourceBitmap, Matrix matrix) + public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix) { return sourceBitmap.Resize(MaintainAspectRatio, Width, Height, matrix); } diff --git a/src/Greenshot.Gfx/Effects/RotateEffect.cs b/src/Greenshot.Gfx/Effects/RotateEffect.cs index dd723f26c..aa93a34c8 100644 --- a/src/Greenshot.Gfx/Effects/RotateEffect.cs +++ b/src/Greenshot.Gfx/Effects/RotateEffect.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,16 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.Drawing.Drawing2D; -#endregion - namespace Greenshot.Gfx.Effects { /// @@ -43,7 +35,7 @@ namespace Greenshot.Gfx.Effects public int Angle { get; set; } - public Bitmap Apply(Bitmap sourceBitmap, Matrix matrix) + public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix) { RotateFlipType flipType; if (Angle == 90) diff --git a/src/Greenshot.Gfx/Effects/Scale2xEffect.cs b/src/Greenshot.Gfx/Effects/Scale2xEffect.cs index 679ca0771..a2dc783b8 100644 --- a/src/Greenshot.Gfx/Effects/Scale2xEffect.cs +++ b/src/Greenshot.Gfx/Effects/Scale2xEffect.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.ComponentModel; -using System.Drawing; using System.Drawing.Drawing2D; - -#endregion +using Greenshot.Gfx.Extensions; namespace Greenshot.Gfx.Effects { @@ -37,7 +29,7 @@ namespace Greenshot.Gfx.Effects [TypeConverter(typeof(EffectConverter))] public sealed class Scale2xEffect : IEffect { - public Bitmap Apply(Bitmap sourceBitmap, Matrix matrix) + public IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix) { matrix?.Scale(2, 2, MatrixOrder.Append); diff --git a/src/Greenshot.Gfx/Effects/TornEdgeEffect.cs b/src/Greenshot.Gfx/Effects/TornEdgeEffect.cs index 8ddaec2ee..dcc96e263 100644 --- a/src/Greenshot.Gfx/Effects/TornEdgeEffect.cs +++ b/src/Greenshot.Gfx/Effects/TornEdgeEffect.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.ComponentModel; @@ -31,8 +25,6 @@ using System.Drawing.Drawing2D; using System.Drawing.Imaging; using Dapplo.Windows.Common.Structs; -#endregion - namespace Greenshot.Gfx.Effects { /// @@ -51,7 +43,7 @@ namespace Greenshot.Gfx.Effects public bool GenerateShadow { get; set; } = true; - public override Bitmap Apply(Bitmap sourceBitmap, Matrix matrix) + public override IBitmapWithNativeSupport Apply(IBitmapWithNativeSupport sourceBitmap, Matrix matrix) { var tmpTornImage = CreateTornEdge(sourceBitmap, ToothHeight, HorizontalToothRange, VerticalToothRange, Edges); if (!GenerateShadow) @@ -91,7 +83,7 @@ namespace Greenshot.Gfx.Effects /// 0=top,1=right,2=bottom,3=left /// /// Changed bitmap - public static Bitmap CreateTornEdge(Bitmap sourceBitmap, int toothHeight, int horizontalToothRange, int verticalToothRange, bool[] edges) + public static IBitmapWithNativeSupport CreateTornEdge(IBitmapWithNativeSupport sourceBitmap, int toothHeight, int horizontalToothRange, int verticalToothRange, bool[] edges) { var returnBitmap = BitmapFactory.CreateEmpty(sourceBitmap.Width, sourceBitmap.Height, PixelFormat.Format32bppArgb, Color.Empty, sourceBitmap.HorizontalResolution, sourceBitmap.VerticalResolution); using (var path = new GraphicsPath()) @@ -186,13 +178,13 @@ namespace Greenshot.Gfx.Effects path.CloseFigure(); // Draw the created figure with the original image by using a TextureBrush so we have anti-aliasing - using (var graphics = Graphics.FromImage(returnBitmap)) + using (var graphics = Graphics.FromImage(returnBitmap.NativeBitmap)) { graphics.SmoothingMode = SmoothingMode.HighQuality; graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; graphics.CompositingQuality = CompositingQuality.HighQuality; graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; - using (Brush brush = new TextureBrush(sourceBitmap)) + using (Brush brush = new TextureBrush(sourceBitmap.NativeBitmap)) { // Important note: If the target wouldn't be at 0,0 we need to translate-transform!! graphics.FillPath(brush, path); diff --git a/src/Greenshot.Gfx/ExifOrientations.cs b/src/Greenshot.Gfx/ExifOrientations.cs index 52548ad21..78b1d478a 100644 --- a/src/Greenshot.Gfx/ExifOrientations.cs +++ b/src/Greenshot.Gfx/ExifOrientations.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Gfx { internal enum ExifOrientations : byte diff --git a/src/Greenshot.Gfx/Extensions/BitmapExtensions.cs b/src/Greenshot.Gfx/Extensions/BitmapExtensions.cs new file mode 100644 index 000000000..9a907fdd1 --- /dev/null +++ b/src/Greenshot.Gfx/Extensions/BitmapExtensions.cs @@ -0,0 +1,68 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2019 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Greenshot +// +// Greenshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Greenshot 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 Lesser General Public License for more details. +// +// You should have a copy of the GNU Lesser General Public License +// along with Greenshot. If not, see . +// + +using Greenshot.Gfx.Structs; + +namespace Greenshot.Gfx.Extensions +{ + /// + /// + /// + public static class BitmapExtensions + { + /// + /// Scale 2x + /// + /// IBitmapWithNativeSupport + /// IBitmapWithNativeSupport + public static IBitmapWithNativeSupport Scale2X(this IBitmapWithNativeSupport bitmap) + { + switch (bitmap) + { + case UnmanagedBitmap unmanagedBitmap: + return unmanagedBitmap.Scale2X(); + case UnmanagedBitmap unmanagedBitmap: + return unmanagedBitmap.Scale2X(); + } + + return ScaleX.Scale2X(bitmap); + } + + /// + /// Scale3x + /// + /// IBitmapWithNativeSupport + /// IBitmapWithNativeSupport + public static IBitmapWithNativeSupport Scale3X(this IBitmapWithNativeSupport bitmap) + { + switch (bitmap) + { + case UnmanagedBitmap unmanagedBitmap: + return unmanagedBitmap.Scale3X(); + case UnmanagedBitmap unmanagedBitmap: + return unmanagedBitmap.Scale3X(); + } + + return ScaleX.Scale3X(bitmap); + } + } +} \ No newline at end of file diff --git a/src/Greenshot.Gfx/Extensions/WriteableBitmapExtensions.cs b/src/Greenshot.Gfx/Extensions/WriteableBitmapExtensions.cs index 70db996c0..d2470be8c 100644 --- a/src/Greenshot.Gfx/Extensions/WriteableBitmapExtensions.cs +++ b/src/Greenshot.Gfx/Extensions/WriteableBitmapExtensions.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Windows; using System.Windows.Media.Imaging; using Dapplo.Windows.Common.Structs; diff --git a/src/Greenshot.Gfx/FastBitmap/Fast24RgbBitmap.cs b/src/Greenshot.Gfx/FastBitmap/Fast24RgbBitmap.cs index 028063497..48acafaf5 100644 --- a/src/Greenshot.Gfx/FastBitmap/Fast24RgbBitmap.cs +++ b/src/Greenshot.Gfx/FastBitmap/Fast24RgbBitmap.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Drawing; using Dapplo.Windows.Common.Structs; -#endregion - namespace Greenshot.Gfx.FastBitmap { /// @@ -35,7 +27,7 @@ namespace Greenshot.Gfx.FastBitmap /// public unsafe class Fast24RgbBitmap : FastBitmapBase { - public Fast24RgbBitmap(Bitmap source, NativeRect? area = null) : base(source, area) + public Fast24RgbBitmap(IBitmapWithNativeSupport source, NativeRect? area = null) : base(source, area) { } diff --git a/src/Greenshot.Gfx/FastBitmap/Fast32ArgbBitmap.cs b/src/Greenshot.Gfx/FastBitmap/Fast32ArgbBitmap.cs index 0ae0d5441..8c5cbb313 100644 --- a/src/Greenshot.Gfx/FastBitmap/Fast32ArgbBitmap.cs +++ b/src/Greenshot.Gfx/FastBitmap/Fast32ArgbBitmap.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Drawing; using Dapplo.Windows.Common.Structs; -#endregion - namespace Greenshot.Gfx.FastBitmap { /// @@ -35,7 +27,7 @@ namespace Greenshot.Gfx.FastBitmap /// public unsafe class Fast32ArgbBitmap : FastBitmapBase, IFastBitmapWithBlend { - public Fast32ArgbBitmap(Bitmap source, NativeRect? area = null) : base(source, area) + public Fast32ArgbBitmap(IBitmapWithNativeSupport source, NativeRect? area = null) : base(source, area) { BackgroundBlendColor = Color.White; } diff --git a/src/Greenshot.Gfx/FastBitmap/Fast32RgbBitmap.cs b/src/Greenshot.Gfx/FastBitmap/Fast32RgbBitmap.cs index 65608bca7..a329b6de2 100644 --- a/src/Greenshot.Gfx/FastBitmap/Fast32RgbBitmap.cs +++ b/src/Greenshot.Gfx/FastBitmap/Fast32RgbBitmap.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Drawing; using Dapplo.Windows.Common.Structs; -#endregion - namespace Greenshot.Gfx.FastBitmap { /// @@ -35,7 +27,7 @@ namespace Greenshot.Gfx.FastBitmap /// public unsafe class Fast32RgbBitmap : FastBitmapBase { - public Fast32RgbBitmap(Bitmap source, NativeRect? area = null) : base(source, area) + public Fast32RgbBitmap(IBitmapWithNativeSupport source, NativeRect? area = null) : base(source, area) { } diff --git a/src/Greenshot.Gfx/FastBitmap/FastBitmapBase.cs b/src/Greenshot.Gfx/FastBitmap/FastBitmapBase.cs index c98962a89..44c222bf3 100644 --- a/src/Greenshot.Gfx/FastBitmap/FastBitmapBase.cs +++ b/src/Greenshot.Gfx/FastBitmap/FastBitmapBase.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,18 +17,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.Drawing.Imaging; using Dapplo.Windows.Common.Extensions; using Dapplo.Windows.Common.Structs; -#endregion - namespace Greenshot.Gfx.FastBitmap { /// @@ -55,7 +47,7 @@ namespace Greenshot.Gfx.FastBitmap /// /// The bitmap for which the FastBitmap is creating access /// - protected Bitmap Bitmap; + protected IBitmapWithNativeSupport Bitmap; protected bool BitsLocked; @@ -68,7 +60,7 @@ namespace Greenshot.Gfx.FastBitmap /// /// Bitmap /// NativeRect - protected FastBitmapBase(Bitmap bitmap, NativeRect? area = null) + protected FastBitmapBase(IBitmapWithNativeSupport bitmap, NativeRect? area = null) { Bitmap = bitmap; var bitmapArea = new NativeRect(NativePoint.Empty, bitmap.Size); @@ -76,7 +68,7 @@ namespace Greenshot.Gfx.FastBitmap // As the lock takes care that only the specified area is made available we need to calculate the offset Left = Area.Left; Top = Area.Top; - // Default cliping is done to the area without invert + // Default clipping is done to the area without invert Clip = Area; InvertClip = false; // Always lock, so we don't need to do this ourselves @@ -94,7 +86,7 @@ namespace Greenshot.Gfx.FastBitmap public void SetResolution(float horizontal, float vertical) { - Bitmap.SetResolution(horizontal, vertical); + Bitmap.NativeBitmap.SetResolution(horizontal, vertical); } /// @@ -165,7 +157,7 @@ namespace Greenshot.Gfx.FastBitmap /// /// Returns the underlying bitmap, unlocks it and prevents that it will be disposed /// - public Bitmap UnlockAndReturnBitmap() + public IBitmapWithNativeSupport UnlockAndReturnBitmap() { if (BitsLocked) { @@ -196,7 +188,7 @@ namespace Greenshot.Gfx.FastBitmap { return; } - BmData = Bitmap.LockBits(Area, ImageLockMode.ReadWrite, Bitmap.PixelFormat); + BmData = Bitmap.NativeBitmap.LockBits(Area, ImageLockMode.ReadWrite, Bitmap.PixelFormat); BitsLocked = true; var scan0 = BmData.Scan0; @@ -213,7 +205,7 @@ namespace Greenshot.Gfx.FastBitmap { return; } - Bitmap.UnlockBits(BmData); + Bitmap.NativeBitmap.UnlockBits(BmData); BitsLocked = false; } @@ -242,7 +234,7 @@ namespace Greenshot.Gfx.FastBitmap Unlock(); } - graphics.DrawImage(Bitmap, destinationRect, Area, GraphicsUnit.Pixel); + graphics.DrawImage(Bitmap.NativeBitmap, destinationRect, Area, GraphicsUnit.Pixel); } /// @@ -340,8 +332,6 @@ namespace Greenshot.Gfx.FastBitmap return hash.CalculatedHash; } - #region IFastBitmapWithClip - /// /// Test if the bitmap containt the specified coordinates /// @@ -485,10 +475,6 @@ namespace Greenshot.Gfx.FastBitmap SetColorAt(x, y, color, colorIndex); } - #endregion - - #region IFastBitmapWithOffset - /// /// returns true if x & y are inside the FastBitmap /// @@ -554,7 +540,5 @@ namespace Greenshot.Gfx.FastBitmap y -= ((IFastBitmapWithOffset) this).Top; SetColorAt(x, y, ref color); } - - #endregion - } + } } \ No newline at end of file diff --git a/src/Greenshot.Gfx/FastBitmap/FastBitmapFactory.cs b/src/Greenshot.Gfx/FastBitmap/FastBitmapFactory.cs index 546dd7d91..76e1aef83 100644 --- a/src/Greenshot.Gfx/FastBitmap/FastBitmapFactory.cs +++ b/src/Greenshot.Gfx/FastBitmap/FastBitmapFactory.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,17 +17,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.Drawing.Imaging; using Dapplo.Windows.Common.Structs; -#endregion - namespace Greenshot.Gfx.FastBitmap { /// @@ -44,7 +36,7 @@ namespace Greenshot.Gfx.FastBitmap /// Bitmap to access /// NativeRect which specifies the area to have access to, can be NativeRect.Empty for the whole image /// IFastBitmap - public static IFastBitmap Create(Bitmap source, NativeRect? area = null) + public static IFastBitmap Create(IBitmapWithNativeSupport source, NativeRect? area = null) { switch (source.PixelFormat) { @@ -69,7 +61,7 @@ namespace Greenshot.Gfx.FastBitmap /// Pixelformat of the cloned bitmap /// Area of the bitmap to access, can be NativeRect.Empty for the whole /// IFastBitmap - public static IFastBitmap CreateCloneOf(Bitmap source, PixelFormat pixelFormat = PixelFormat.DontCare, NativeRect? area = null) + public static IFastBitmap CreateCloneOf(IBitmapWithNativeSupport source, PixelFormat pixelFormat = PixelFormat.DontCare, NativeRect? area = null) { var destination = source.CloneBitmap(pixelFormat, area); if (!(Create(destination) is FastBitmapBase fastBitmap)) diff --git a/src/Greenshot.Gfx/FastBitmap/FastChunkyBitmap.cs b/src/Greenshot.Gfx/FastBitmap/FastChunkyBitmap.cs index 507881d71..deb503cd1 100644 --- a/src/Greenshot.Gfx/FastBitmap/FastChunkyBitmap.cs +++ b/src/Greenshot.Gfx/FastBitmap/FastChunkyBitmap.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,17 +17,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Drawing; using Dapplo.Windows.Common.Structs; -#endregion - namespace Greenshot.Gfx.FastBitmap { /// @@ -41,9 +33,9 @@ namespace Greenshot.Gfx.FastBitmap // Used for indexed images private readonly Color[] _colorEntries; - public FastChunkyBitmap(Bitmap source, NativeRect? area = null) : base(source, area) + public FastChunkyBitmap(IBitmapWithNativeSupport source, NativeRect? area = null) : base(source, area) { - _colorEntries = Bitmap.Palette.Entries; + _colorEntries = Bitmap.NativeBitmap.Palette.Entries; } /// diff --git a/src/Greenshot.Gfx/FastBitmap/IFastBitmap.cs b/src/Greenshot.Gfx/FastBitmap/IFastBitmap.cs index 337dd60b3..31f6168c7 100644 --- a/src/Greenshot.Gfx/FastBitmap/IFastBitmap.cs +++ b/src/Greenshot.Gfx/FastBitmap/IFastBitmap.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,16 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using Dapplo.Windows.Common.Structs; -#endregion - namespace Greenshot.Gfx.FastBitmap { /// @@ -164,7 +156,7 @@ namespace Greenshot.Gfx.FastBitmap /// Unlock the bitmap and get the underlying bitmap in one call /// /// - Bitmap UnlockAndReturnBitmap(); + IBitmapWithNativeSupport UnlockAndReturnBitmap(); /// /// Draw the stored bitmap to the destionation bitmap at the supplied point diff --git a/src/Greenshot.Gfx/FastBitmap/IFastBitmapWithBlend.cs b/src/Greenshot.Gfx/FastBitmap/IFastBitmapWithBlend.cs index 2a4eafdd1..0262772d8 100644 --- a/src/Greenshot.Gfx/FastBitmap/IFastBitmapWithBlend.cs +++ b/src/Greenshot.Gfx/FastBitmap/IFastBitmapWithBlend.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Drawing; -#endregion - namespace Greenshot.Gfx.FastBitmap { /// diff --git a/src/Greenshot.Gfx/FastBitmap/IFastBitmapWithClip.cs b/src/Greenshot.Gfx/FastBitmap/IFastBitmapWithClip.cs index 7c1e7387b..7fe8e3cce 100644 --- a/src/Greenshot.Gfx/FastBitmap/IFastBitmapWithClip.cs +++ b/src/Greenshot.Gfx/FastBitmap/IFastBitmapWithClip.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Drawing; using Dapplo.Windows.Common.Structs; -#endregion - namespace Greenshot.Gfx.FastBitmap { /// diff --git a/src/Greenshot.Gfx/FastBitmap/IFastBitmapWithOffset.cs b/src/Greenshot.Gfx/FastBitmap/IFastBitmapWithOffset.cs index a3e812c23..5da25d535 100644 --- a/src/Greenshot.Gfx/FastBitmap/IFastBitmapWithOffset.cs +++ b/src/Greenshot.Gfx/FastBitmap/IFastBitmapWithOffset.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Drawing; -#endregion - namespace Greenshot.Gfx.FastBitmap { /// diff --git a/src/Greenshot.Gfx/Greenshot.Gfx.csproj b/src/Greenshot.Gfx/Greenshot.Gfx.csproj index 46cb9abd4..561371feb 100644 --- a/src/Greenshot.Gfx/Greenshot.Gfx.csproj +++ b/src/Greenshot.Gfx/Greenshot.Gfx.csproj @@ -1,8 +1,9 @@ - + net472;netcoreapp3.0 true + 8 @@ -31,9 +32,11 @@ 1.2.21 - 2.4.2 + + 4.5.2 + diff --git a/src/Greenshot.Gfx/IBitmap.cs b/src/Greenshot.Gfx/IBitmap.cs index c70821430..78e11c4ac 100644 --- a/src/Greenshot.Gfx/IBitmap.cs +++ b/src/Greenshot.Gfx/IBitmap.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,40 +17,29 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.Drawing.Imaging; -#endregion - namespace Greenshot.Gfx { /// - /// The image interface, this abstracts a bitmap + /// A new interface for handling bitmaps /// public interface IBitmap : IDisposable { /// /// Height of the image, can be set to change /// - int Height { get; set; } + int Height { get; } /// /// Width of the image, can be set to change. /// - int Width { get; set; } + int Width { get; } - /// - /// Size of the image - /// - Size Size { get; } - - /// - /// Pixelformat of the underlying image + /// + /// PixelFormat of the underlying image /// PixelFormat PixelFormat { get; } @@ -66,9 +53,21 @@ namespace Greenshot.Gfx /// float HorizontalResolution { get; } - /// - /// Unterlying image, or an on demand rendered version with different attributes as the original - /// - Bitmap Bitmap { get; } - } + } + + /// + /// This adds native bitmap support to IBitmap + /// + public interface IBitmapWithNativeSupport : IBitmap + { + /// + /// Underlying image, or an on demand rendered version with different attributes as the original + /// + Bitmap NativeBitmap { get; } + + /// + /// Return the Size + /// + Size Size { get; } + } } \ No newline at end of file diff --git a/src/Greenshot.Gfx/Legacy/GeometryHelper.cs b/src/Greenshot.Gfx/Legacy/GeometryHelper.cs index 37613d9b1..8006942f5 100644 --- a/src/Greenshot.Gfx/Legacy/GeometryHelper.cs +++ b/src/Greenshot.Gfx/Legacy/GeometryHelper.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; -#endregion - namespace Greenshot.Gfx.Legacy { /// diff --git a/src/Greenshot.Gfx/Legacy/Positions.cs b/src/Greenshot.Gfx/Legacy/Positions.cs index 3f082b811..93eb1f533 100644 --- a/src/Greenshot.Gfx/Legacy/Positions.cs +++ b/src/Greenshot.Gfx/Legacy/Positions.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - namespace Greenshot.Gfx.Legacy { /// diff --git a/src/Greenshot.Gfx/Legacy/RoundedRectangle.cs b/src/Greenshot.Gfx/Legacy/RoundedRectangle.cs index 38b560976..e00ba1f41 100644 --- a/src/Greenshot.Gfx/Legacy/RoundedRectangle.cs +++ b/src/Greenshot.Gfx/Legacy/RoundedRectangle.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,16 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing.Drawing2D; using Dapplo.Windows.Common.Structs; -#endregion - namespace Greenshot.Gfx.Legacy { /// diff --git a/src/Greenshot.Gfx/Legacy/ScaleHelper.cs b/src/Greenshot.Gfx/Legacy/ScaleHelper.cs index ddb9caf05..4221b3d3b 100644 --- a/src/Greenshot.Gfx/Legacy/ScaleHelper.cs +++ b/src/Greenshot.Gfx/Legacy/ScaleHelper.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,18 +17,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.Windows.Forms; using Dapplo.Windows.Common.Extensions; using Dapplo.Windows.Common.Structs; -#endregion - namespace Greenshot.Gfx.Legacy { /// diff --git a/src/Greenshot.Gfx/Murmur3.cs b/src/Greenshot.Gfx/Murmur3.cs index fb1085e5d..5938586bb 100644 --- a/src/Greenshot.Gfx/Murmur3.cs +++ b/src/Greenshot.Gfx/Murmur3.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Runtime.CompilerServices; using System.Security.Cryptography; diff --git a/src/Greenshot.Gfx/Quantizer/WuColorCube.cs b/src/Greenshot.Gfx/Quantizer/WuColorCube.cs index 6a3e59287..a9342b4d8 100644 --- a/src/Greenshot.Gfx/Quantizer/WuColorCube.cs +++ b/src/Greenshot.Gfx/Quantizer/WuColorCube.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,12 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - -#endregion - namespace Greenshot.Gfx.Quantizer { internal class WuColorCube diff --git a/src/Greenshot.Gfx/Quantizer/WuQuantizer.cs b/src/Greenshot.Gfx/Quantizer/WuQuantizer.cs index 102894d32..0aa9a1cfe 100644 --- a/src/Greenshot.Gfx/Quantizer/WuQuantizer.cs +++ b/src/Greenshot.Gfx/Quantizer/WuQuantizer.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections; using System.Collections.Generic; @@ -31,8 +25,6 @@ using System.Drawing.Imaging; using Dapplo.Log; using Greenshot.Gfx.FastBitmap; -#endregion - namespace Greenshot.Gfx.Quantizer { /// @@ -57,19 +49,19 @@ namespace Greenshot.Gfx.Quantizer private readonly long[,,] _momentsBlue; private readonly long[,,] _momentsGreen; private readonly long[,,] _momentsRed; - private readonly Bitmap _sourceBitmap; + private readonly IBitmapWithNativeSupport _sourceBitmap; private readonly long[,,] _weights; private int[] _blues; private int[] _greens; private int[] _reds; - private Bitmap _resultBitmap; + private IBitmapWithNativeSupport _resultBitmap; private int[] _sums; private byte[] _tag; - public WuQuantizer(Bitmap sourceBitmap) + public WuQuantizer(IBitmapWithNativeSupport sourceBitmap) { _sourceBitmap = sourceBitmap; // Make sure the color count variables are reset @@ -188,7 +180,7 @@ namespace Greenshot.Gfx.Quantizer /// Reindex the 24/32 BPP (A)RGB image to a 8BPP /// /// Bitmap - public Bitmap SimpleReindex() + public IBitmapWithNativeSupport SimpleReindex() { var colors = new List(); var lookup = new Dictionary(); @@ -231,7 +223,7 @@ namespace Greenshot.Gfx.Quantizer } // generates palette - var imagePalette = _resultBitmap.Palette; + var imagePalette = _resultBitmap.NativeBitmap.Palette; var entries = imagePalette.Entries; for (var paletteIndex = 0; paletteIndex < 256; paletteIndex++) { @@ -244,7 +236,7 @@ namespace Greenshot.Gfx.Quantizer entries[paletteIndex] = Color.Black; } } - _resultBitmap.Palette = imagePalette; + _resultBitmap.NativeBitmap.Palette = imagePalette; // Make sure the bitmap is not disposed, as we return it. var tmpBitmap = _resultBitmap; @@ -255,7 +247,7 @@ namespace Greenshot.Gfx.Quantizer /// /// Get the image /// - public Bitmap GetQuantizedImage(int allowedColorCount = 256) + public IBitmapWithNativeSupport GetQuantizedImage(int allowedColorCount = 256) { if (allowedColorCount > 256) { @@ -414,7 +406,7 @@ namespace Greenshot.Gfx.Quantizer // generates palette - var imagePalette = _resultBitmap.Palette; + var imagePalette = _resultBitmap.NativeBitmap.Palette; var entries = imagePalette.Entries; for (var paletteIndex = 0; paletteIndex < allowedColorCount; paletteIndex++) { @@ -427,7 +419,7 @@ namespace Greenshot.Gfx.Quantizer entries[paletteIndex] = Color.FromArgb(255, _reds[paletteIndex], _greens[paletteIndex], _blues[paletteIndex]); } - _resultBitmap.Palette = imagePalette; + _resultBitmap.NativeBitmap.Palette = imagePalette; // Make sure the bitmap is not disposed, as we return it. var tmpBitmap = _resultBitmap; diff --git a/src/Greenshot.Gfx/ScaleX.cs b/src/Greenshot.Gfx/ScaleX.cs index d04f6d41f..8912d2d73 100644 --- a/src/Greenshot.Gfx/ScaleX.cs +++ b/src/Greenshot.Gfx/ScaleX.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Diagnostics.CodeAnalysis; using System.Drawing; using System.Runtime.CompilerServices; @@ -35,7 +31,7 @@ namespace Greenshot.Gfx /// Use "Scale2x" algorithm to produce bitmap from the original. /// /// Bitmap to scale 2x - public static Bitmap Scale2X(this Bitmap original) + public static IBitmapWithNativeSupport Scale2X(IBitmapWithNativeSupport original) { using (var source = (IFastBitmapWithClip)FastBitmapFactory.Create(original)) using (var destination = (IFastBitmapWithClip)FastBitmapFactory.CreateEmpty(new Size(original.Width << 1, original.Height << 1), original.PixelFormat)) @@ -94,7 +90,7 @@ namespace Greenshot.Gfx /// /// Bitmap to scale 3x [SuppressMessage("ReSharper", "AccessToDisposedClosure")] - public static Bitmap Scale3X(this Bitmap original) + public static IBitmapWithNativeSupport Scale3X(IBitmapWithNativeSupport original) { using (var source = (IFastBitmapWithClip)FastBitmapFactory.Create(original)) using (var destination = (IFastBitmapWithClip)FastBitmapFactory.CreateEmpty(new Size(original.Width * 3, original.Height * 3), original.PixelFormat)) diff --git a/src/Greenshot.Gfx/ScaleXUnmanaged.cs b/src/Greenshot.Gfx/ScaleXUnmanaged.cs index 75387b996..079299c87 100644 --- a/src/Greenshot.Gfx/ScaleXUnmanaged.cs +++ b/src/Greenshot.Gfx/ScaleXUnmanaged.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Runtime.InteropServices; diff --git a/src/Greenshot.Gfx/ScaleXUnmanagedReference.cs b/src/Greenshot.Gfx/ScaleXUnmanagedReference.cs index fba10f7a4..5a1f2d7ae 100644 --- a/src/Greenshot.Gfx/ScaleXUnmanagedReference.cs +++ b/src/Greenshot.Gfx/ScaleXUnmanagedReference.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Runtime.InteropServices; diff --git a/src/Greenshot.Gfx/Stitching/BitmapStitcher.cs b/src/Greenshot.Gfx/Stitching/BitmapStitcher.cs index c3a281f5b..db6480ece 100644 --- a/src/Greenshot.Gfx/Stitching/BitmapStitcher.cs +++ b/src/Greenshot.Gfx/Stitching/BitmapStitcher.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Collections.Generic; using System.Drawing; @@ -57,7 +53,7 @@ namespace Greenshot.Gfx.Stitching /// /// Bitmap /// BitmapStitcher for fluent calling - public BitmapStitcher AddBitmap(Bitmap bitmap) + public BitmapStitcher AddBitmap(IBitmapWithNativeSupport bitmap) { if (!_resultPixelFormat.HasValue) { @@ -72,7 +68,7 @@ namespace Greenshot.Gfx.Stitching /// Create the resulting bitmap, this needs to be disposed /// /// Bitmap - public Bitmap Result() + public IBitmapWithNativeSupport Result() { if (RemoveHeader) { @@ -94,7 +90,7 @@ namespace Greenshot.Gfx.Stitching if (Trim) { - // Remove from the last to first, untill something is left + // Remove from the last to first, until something is left foreach (var stitchInfo in _stitchInfos.Reverse()) { if (stitchInfo.Trim().SourceRect.Height > 0) @@ -112,13 +108,13 @@ namespace Greenshot.Gfx.Stitching previous = stitchInfo; } - // Calculate the total hight of the result bitmap + // Calculate the total height of the result bitmap var totalHeight = _stitchInfos.Sum(info => info.SourceRect.Height); // Create the resulting bitmap var resultBitmap = BitmapFactory.CreateEmpty(_stitchInfos[0].SourceRect.Width, totalHeight, _resultPixelFormat ?? PixelFormat.Format32bppArgb); // Now stitch the captures together by copying them onto the result bitmap - using (var graphics = Graphics.FromImage(resultBitmap)) + using (var graphics = Graphics.FromImage(resultBitmap.NativeBitmap)) { var currentPosition = 0; foreach (var stitchInfo in _stitchInfos) diff --git a/src/Greenshot.Gfx/Stitching/StitchInfo.cs b/src/Greenshot.Gfx/Stitching/StitchInfo.cs index 5199cb9c6..10874a05d 100644 --- a/src/Greenshot.Gfx/Stitching/StitchInfo.cs +++ b/src/Greenshot.Gfx/Stitching/StitchInfo.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Collections.Generic; using System.Drawing; @@ -36,7 +32,7 @@ namespace Greenshot.Gfx.Stitching /// public class StitchInfo : IDisposable { - private readonly Bitmap _bitmap; + private readonly IBitmapWithNativeSupport _bitmap; private readonly IList _hashes; private NativeRect _sourceRect; @@ -45,7 +41,7 @@ namespace Greenshot.Gfx.Stitching /// Create stitching information for this bitmap /// /// Bitmap - public StitchInfo(Bitmap bitmap) + public StitchInfo(IBitmapWithNativeSupport bitmap) { _bitmap = bitmap; using (var fastBitmap = FastBitmapFactory.Create(bitmap)) @@ -188,7 +184,7 @@ namespace Greenshot.Gfx.Stitching /// int public void DrawTo(Graphics graphics, int y) { - graphics.DrawImage(_bitmap, new Rectangle(0, y, _sourceRect.Width, _sourceRect.Height), _sourceRect, GraphicsUnit.Pixel); + graphics.DrawImage(_bitmap.NativeBitmap, new Rectangle(0, y, _sourceRect.Width, _sourceRect.Height), _sourceRect, GraphicsUnit.Pixel); } } } diff --git a/src/Greenshot.Gfx/Structs/Bgr32.cs b/src/Greenshot.Gfx/Structs/Bgr32.cs index 48b8ed77f..f958c9f02 100644 --- a/src/Greenshot.Gfx/Structs/Bgr32.cs +++ b/src/Greenshot.Gfx/Structs/Bgr32.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Runtime.InteropServices; @@ -49,10 +45,14 @@ namespace Greenshot.Gfx.Structs /// public byte Unused; - /// + /// + /// Equal + /// public static bool operator ==(Bgr32 left, Bgr32 right) => Equals(left, right); - /// + /// + /// Not Equal + /// public static bool operator !=(Bgr32 left, Bgr32 right) => !Equals(left, right); /// diff --git a/src/Greenshot.Gfx/Structs/Bgra32.cs b/src/Greenshot.Gfx/Structs/Bgra32.cs index 5e6e6f74b..47a8026cb 100644 --- a/src/Greenshot.Gfx/Structs/Bgra32.cs +++ b/src/Greenshot.Gfx/Structs/Bgra32.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Runtime.InteropServices; @@ -52,10 +48,14 @@ namespace Greenshot.Gfx.Structs /// public byte A; - /// + /// + /// Equal + /// public static bool operator ==(Bgra32 left, Bgra32 right) => Equals(left, right); - /// + /// + /// Not equal + /// public static bool operator !=(Bgra32 left, Bgra32 right) => !Equals(left, right); /// diff --git a/src/Greenshot.Gfx/Structs/PixelExtensions.cs b/src/Greenshot.Gfx/Structs/PixelExtensions.cs new file mode 100644 index 000000000..21c0ba2a7 --- /dev/null +++ b/src/Greenshot.Gfx/Structs/PixelExtensions.cs @@ -0,0 +1,49 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2019 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Greenshot +// +// Greenshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Greenshot 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 Lesser General Public License for more details. +// +// You should have a copy of the GNU Lesser General Public License +// along with Greenshot. If not, see . +// + +using System.Drawing; + +namespace Greenshot.Gfx.Structs +{ + public static class PixelExtensions + { + public static Bgra32 FromColorWithAlpha(this Color color) + { + return new Bgra32 + { + A = color.A, + R = color.R, + G = color.G, + B = color.B, + }; + } + public static Bgr32 FromColor(this Color color) + { + return new Bgr32 + { + R = color.R, + G = color.G, + B = color.B, + }; + } + } +} \ No newline at end of file diff --git a/src/Greenshot.Gfx/SvgBitmap.cs b/src/Greenshot.Gfx/SvgBitmap.cs index 2308fa58d..f9d9930ce 100644 --- a/src/Greenshot.Gfx/SvgBitmap.cs +++ b/src/Greenshot.Gfx/SvgBitmap.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,52 +17,69 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Drawing; using System.Drawing.Imaging; using System.IO; using Svg; -#endregion namespace Greenshot.Gfx { /// /// Create an image look like of the SVG /// - public class SvgBitmap : IBitmap + public class SvgBitmap : IBitmapWithNativeSupport { private readonly SvgDocument _svgDocument; private Bitmap _imageClone; - /// - /// Default constructor - /// - /// - public SvgBitmap(Stream stream) + /// + /// Stream + /// int + /// int + public SvgBitmap(Stream stream, int? width = null, int? height = null) : this(SvgDocument.Open(stream), width, height) { - _svgDocument = SvgDocument.Open(stream); - if ((int) _svgDocument.ViewBox.Height == 0) - { - Height = (int)_svgDocument.Height; + } + + /// + /// Default constructor + /// + /// SvgDocument + /// int + /// int + public SvgBitmap(SvgDocument svgDocument, int? width = null, int? height = null) + { + _svgDocument = svgDocument; + if ((int) _svgDocument.ViewBox.Height == 0) + { + Height = (int)_svgDocument.Height; } - else - { - Height = (int)_svgDocument.ViewBox.Height; + else + { + Height = (int)_svgDocument.ViewBox.Height; } - if ((int)_svgDocument.ViewBox.Width == 0) - { - Width = (int)_svgDocument.Width; - } - else - { - Width = (int)_svgDocument.ViewBox.Width; - } - } + if ((int)_svgDocument.ViewBox.Width == 0) + { + Width = (int)_svgDocument.Width; + } + else + { + Width = (int)_svgDocument.ViewBox.Width; + } + + if (width.HasValue) + { + Width = width.Value; + } + if (height.HasValue) + { + Height = height.Value; + } + + // Generate the native bitmap + GenerateNativeBitmap(); + } /// /// Height of the image, can be set to change @@ -77,43 +92,46 @@ namespace Greenshot.Gfx public int Width { get; set; } /// - /// Size of the image + /// PixelFormat of the underlying image /// - public Size Size => new Size(Width, Height); - - /// - /// Pixelformat of the underlying image - /// - public PixelFormat PixelFormat => Bitmap.PixelFormat; + public PixelFormat PixelFormat => _imageClone.PixelFormat; /// /// Horizontal resolution of the underlying image /// - public float HorizontalResolution => Bitmap.HorizontalResolution; + public float HorizontalResolution => _imageClone.HorizontalResolution; /// /// Vertical resolution of the underlying image /// - public float VerticalResolution => Bitmap.VerticalResolution; + public float VerticalResolution => _imageClone.VerticalResolution; - /// - /// Unterlying image, or an on demand rendered version with different attributes as the original - /// - public Bitmap Bitmap + /// + /// Underlying image, or an on demand rendered version with different attributes as the original + /// + public Bitmap NativeBitmap => GenerateNativeBitmap(); + + private Bitmap GenerateNativeBitmap() { - get - { - if (_imageClone?.Height == Height && _imageClone?.Width == Width) - { - return _imageClone; - } - // Calculate new image clone - _imageClone?.Dispose(); - _imageClone = BitmapFactory.CreateEmpty(Width, Height, PixelFormat.Format32bppArgb, Color.Transparent, 96, 96); - _svgDocument.Draw(_imageClone); - return _imageClone; - } - } + if (_imageClone?.Height == Height && _imageClone?.Width == Width) + { + return _imageClone; + } + + // Calculate new image clone + _imageClone?.Dispose(); + var emptyBitmap = BitmapFactory.CreateEmpty(Width, Height, PixelFormat.Format32bppArgb, Color.Transparent, 96, 96); + _imageClone = emptyBitmap.NativeBitmap; + _svgDocument.Draw(_imageClone); + return _imageClone; + } + + public Size Size => new Size(Width, Height); + + public void DisposeNativeBitmap(Bitmap nativeBitmap) + { + // do nothing, we need this + } /// /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. @@ -123,14 +141,16 @@ namespace Greenshot.Gfx _imageClone?.Dispose(); } - /// - /// Factory to create via a stream - /// - /// Stream - /// IBitmap - public static IBitmap FromStream(Stream stream) + /// + /// Factory to create via a stream + /// + /// Stream + /// int optional + /// int optional + /// IBitmap + public static IBitmapWithNativeSupport FromStream(Stream stream, int? width = null, int? height = null) { - return new SvgBitmap(stream); + return new SvgBitmap(stream, width, height); } } } \ No newline at end of file diff --git a/src/Greenshot.Gfx/UnmanagedBitmap.cs b/src/Greenshot.Gfx/UnmanagedBitmap.cs index 7e1c7143a..9b391044b 100644 --- a/src/Greenshot.Gfx/UnmanagedBitmap.cs +++ b/src/Greenshot.Gfx/UnmanagedBitmap.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Drawing; using System.Drawing.Imaging; @@ -31,13 +27,16 @@ using Greenshot.Gfx.Structs; namespace Greenshot.Gfx { /// - /// A bitmap wraper with memory from Marshal.AllocHGlobal + /// A bitmap wrapper with memory from Marshal.AllocHGlobal /// /// struct for the pixel information - public class UnmanagedBitmap : IDisposable where TPixelLayout : unmanaged + public class UnmanagedBitmap : IBitmapWithNativeSupport where TPixelLayout : unmanaged { + private readonly float _horizontalPixelsPerInch; + private readonly float _verticalPixelsPerInch; private readonly int _stride; private IntPtr _hGlobal; + private Bitmap _nativeBitmap; /// /// Width of the bitmap @@ -54,8 +53,12 @@ namespace Greenshot.Gfx /// /// int /// int - public UnmanagedBitmap(int width, int height) + /// float + /// float + public UnmanagedBitmap(int width, int height, float horizontalPixelsPerInch = 0.96f, float verticalPixelsPerInch = 0.96f) { + _horizontalPixelsPerInch = horizontalPixelsPerInch; + _verticalPixelsPerInch = verticalPixelsPerInch; var bytesPerPixel = Marshal.SizeOf(); Width = width; Height = height; @@ -98,37 +101,58 @@ namespace Greenshot.Gfx } } + /// + public PixelFormat PixelFormat + { + get + { + PixelFormat format; + TPixelLayout empty = default; + switch (empty) + { + case Bgr24 _: + format = PixelFormat.Format24bppRgb; + break; + case Bgra32 _: + format = PixelFormat.Format32bppArgb; + break; + case Bgr32 _: + format = PixelFormat.Format32bppRgb; + break; + default: + throw new NotSupportedException("Unknown pixel format"); + } + + return format; + } + } + + /// + public float VerticalResolution => _verticalPixelsPerInch; + + /// + public float HorizontalResolution => _horizontalPixelsPerInch; + /// /// Convert this to a real bitmap /// /// Bitmap - public Bitmap AsBitmap() + public Bitmap NativeBitmap { - PixelFormat format; - TPixelLayout empty = default; - switch (empty) + get { - case Bgr24 _: - format = PixelFormat.Format24bppRgb; - break; - case Bgra32 _: - format = PixelFormat.Format32bppArgb; - break; - case Bgr32 _: - format = PixelFormat.Format32bppRgb; - break; - default: - throw new NotSupportedException("Unknown pixel format"); + return _nativeBitmap ??= new Bitmap(Width, Height, _stride, PixelFormat, _hGlobal); } - return new Bitmap(Width, Height, _stride, format, _hGlobal); } - #region Implementation of IDisposable + public Size Size => new Size(Width, Height); + /// /// The actual dispose /// public void Dispose() { + _nativeBitmap?.Dispose(); if (_hGlobal == IntPtr.Zero) { return; @@ -137,7 +161,5 @@ namespace Greenshot.Gfx _hGlobal = IntPtr.Zero; GC.RemoveMemoryPressure(Height * _stride); } - - #endregion } } diff --git a/src/Greenshot.PerformanceTests/CapturePerformance.cs b/src/Greenshot.PerformanceTests/CapturePerformance.cs index 433d600cb..af5cf8bda 100644 --- a/src/Greenshot.PerformanceTests/CapturePerformance.cs +++ b/src/Greenshot.PerformanceTests/CapturePerformance.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.IO; using BenchmarkDotNet.Attributes; diff --git a/src/Greenshot.PerformanceTests/GfxPerformance.cs b/src/Greenshot.PerformanceTests/GfxPerformance.cs index 403dc5ff9..d732a7a07 100644 --- a/src/Greenshot.PerformanceTests/GfxPerformance.cs +++ b/src/Greenshot.PerformanceTests/GfxPerformance.cs @@ -15,26 +15,23 @@ namespace Greenshot.PerformanceTests public class GfxPerformance { private UnmanagedBitmap _unmanagedTestBitmap; - private Bitmap _testBitmap; [GlobalSetup] public void CreateTestImage() { _unmanagedTestBitmap = new UnmanagedBitmap(400, 400); _unmanagedTestBitmap.Span.Fill(new Bgr32 { B = 255, G = 255, R = 255, Unused = 0}); - using (var bitmap = _unmanagedTestBitmap.AsBitmap()) + using (var bitmap = _unmanagedTestBitmap.NativeBitmap) using (var graphics = Graphics.FromImage(bitmap)) using (var pen = new SolidBrush(Color.Blue)) { graphics.FillRectangle(pen, new Rectangle(30, 30, 340, 340)); } - _testBitmap = _unmanagedTestBitmap.AsBitmap(); } [GlobalCleanup] public void Dispose() { - _testBitmap.Dispose(); _unmanagedTestBitmap.Dispose(); } @@ -47,7 +44,7 @@ namespace Greenshot.PerformanceTests { using (var bitmap = BitmapFactory.CreateEmpty(400, 400, pixelFormat, Color.White)) { - using (var graphics = Graphics.FromImage(bitmap)) + using (var graphics = Graphics.FromImage(bitmap.NativeBitmap)) using (var pen = new SolidBrush(Color.Blue)) { graphics.FillRectangle(pen, new Rectangle(30, 30, 340, 340)); @@ -55,7 +52,7 @@ namespace Greenshot.PerformanceTests var quantizer = new WuQuantizer(bitmap); using (var quantizedImage = quantizer.GetQuantizedImage()) { - quantizedImage.Save(@"quantized.png", ImageFormat.Png); + quantizedImage.NativeBitmap.Save(@"quantized.png", ImageFormat.Png); } } } @@ -65,7 +62,7 @@ namespace Greenshot.PerformanceTests { using (var bitmap = BitmapFactory.CreateEmpty(400, 400, PixelFormat.Format32bppRgb, Color.White)) { - using (var graphics = Graphics.FromImage(bitmap)) + using (var graphics = Graphics.FromImage(bitmap.NativeBitmap)) using (var pen = new SolidBrush(Color.Blue)) { graphics.FillRectangle(pen, new Rectangle(30, 30, 340, 340)); @@ -80,7 +77,7 @@ namespace Greenshot.PerformanceTests using (var unmanagedBitmap = new UnmanagedBitmap(400, 400)) { unmanagedBitmap.Span.Fill(new Bgr32 { B = 255, G = 255, R = 255 }); - using (var bitmap = unmanagedBitmap.AsBitmap()) + using (var bitmap = unmanagedBitmap.NativeBitmap) using (var graphics = Graphics.FromImage(bitmap)) using (var pen = new SolidBrush(Color.Blue)) { @@ -97,28 +94,28 @@ namespace Greenshot.PerformanceTests { using (var bitmap = BitmapFactory.CreateEmpty(400, 400, PixelFormat.Format32bppRgb, Color.White)) { - using (var graphics = Graphics.FromImage(bitmap)) + using (var graphics = Graphics.FromImage(bitmap.NativeBitmap)) using (var pen = new SolidBrush(Color.Blue)) { graphics.FillRectangle(pen, new Rectangle(30, 30, 340, 340)); } - bitmap.ApplyOldBoxBlur(10); + BoxBlurOld.ApplyOldBoxBlur(bitmap, 10); } } - [Benchmark] + //[Benchmark] public void Scale2x_FastBitmap() { - _testBitmap.Scale2X().Dispose(); + ScaleX.Scale2X(_unmanagedTestBitmap).Dispose(); } - [Benchmark] + //[Benchmark] public void Scale2x_Unmanaged() { _unmanagedTestBitmap.Scale2X().Dispose(); } - [Benchmark] + //[Benchmark] public void Scale2x_Unmanaged_Reference() { _unmanagedTestBitmap.Scale2XReference().Dispose(); @@ -127,7 +124,7 @@ namespace Greenshot.PerformanceTests [Benchmark] public void Scale3x_FastBitmap() { - _testBitmap.Scale3X().Dispose(); + ScaleX.Scale3X(_unmanagedTestBitmap).Dispose(); } [Benchmark] @@ -135,5 +132,11 @@ namespace Greenshot.PerformanceTests { _unmanagedTestBitmap.Scale3X().Dispose(); } + + [Benchmark] + public void Scale3x_Unmanaged_Reference() + { + _unmanagedTestBitmap.Scale3XReference().Dispose(); + } } } diff --git a/src/Greenshot.PerformanceTests/GfxPerformanceShort.cs b/src/Greenshot.PerformanceTests/GfxPerformanceShort.cs index 25fe0f8ef..e84dd7eb4 100644 --- a/src/Greenshot.PerformanceTests/GfxPerformanceShort.cs +++ b/src/Greenshot.PerformanceTests/GfxPerformanceShort.cs @@ -19,7 +19,7 @@ namespace Greenshot.PerformanceTests { using (var bitmap = BitmapFactory.CreateEmpty(400, 400, pixelFormat, Color.White)) { - using (var graphics = Graphics.FromImage(bitmap)) + using (var graphics = Graphics.FromImage(bitmap.NativeBitmap)) using (var pen = new SolidBrush(Color.Blue)) { graphics.FillRectangle(pen, new Rectangle(30, 30, 340, 340)); diff --git a/src/Greenshot.PerformanceTests/Greenshot.PerformanceTests.csproj b/src/Greenshot.PerformanceTests/Greenshot.PerformanceTests.csproj index fad4b963d..27934dcf2 100644 --- a/src/Greenshot.PerformanceTests/Greenshot.PerformanceTests.csproj +++ b/src/Greenshot.PerformanceTests/Greenshot.PerformanceTests.csproj @@ -1,4 +1,4 @@ - + Greenshot.PerformanceTests @@ -75,7 +75,6 @@ - diff --git a/src/Greenshot.PerformanceTests/Program.cs b/src/Greenshot.PerformanceTests/Program.cs index 6f028942b..cc17d23d7 100644 --- a/src/Greenshot.PerformanceTests/Program.cs +++ b/src/Greenshot.PerformanceTests/Program.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using BenchmarkDotNet.Running; diff --git a/src/Greenshot.Tests/BlurTests.cs b/src/Greenshot.Tests/BlurTests.cs index baf9d8c34..2b0d0f450 100644 --- a/src/Greenshot.Tests/BlurTests.cs +++ b/src/Greenshot.Tests/BlurTests.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Drawing; using System.Drawing.Imaging; using Greenshot.Gfx; @@ -44,20 +40,20 @@ namespace Greenshot.Tests using (var bitmapNew = BitmapFactory.CreateEmpty(400, 400, pixelFormat, Color.White)) using (var bitmapOld = BitmapFactory.CreateEmpty(400, 400, pixelFormat, Color.White)) { - using (var graphics = Graphics.FromImage(bitmapNew)) + using (var graphics = Graphics.FromImage(bitmapNew.NativeBitmap)) using (var pen = new SolidBrush(Color.Blue)) { graphics.FillRectangle(pen, new Rectangle(30, 30, 340, 340)); bitmapNew.ApplyBoxBlur(10); } - using (var graphics = Graphics.FromImage(bitmapOld)) + using (var graphics = Graphics.FromImage(bitmapOld.NativeBitmap)) using (var pen = new SolidBrush(Color.Blue)) { graphics.FillRectangle(pen, new Rectangle(30, 30, 340, 340)); - bitmapOld.ApplyOldBoxBlur(10); + BoxBlurOld.ApplyOldBoxBlur(bitmapOld, 10); } - bitmapOld.Save(@"old.png", ImageFormat.Png); - bitmapNew.Save(@"new.png", ImageFormat.Png); + bitmapOld.NativeBitmap.Save(@"old.png", ImageFormat.Png); + bitmapNew.NativeBitmap.Save(@"new.png", ImageFormat.Png); Assert.True(bitmapOld.IsEqualTo(bitmapNew), "New blur doesn't compare to old."); } @@ -70,16 +66,16 @@ namespace Greenshot.Tests using (var bitmapNew = new UnmanagedBitmap(400, 400)) using (var bitmapOld = BitmapFactory.CreateEmpty(400, 400, PixelFormat.Format32bppRgb, Color.White)) { - using (var graphics = Graphics.FromImage(bitmapOld)) + using (var graphics = Graphics.FromImage(bitmapOld.NativeBitmap)) using (var pen = new SolidBrush(Color.Blue)) { graphics.FillRectangle(pen, new Rectangle(30, 30, 340, 340)); - bitmapOld.ApplyOldBoxBlur(10); + BoxBlurOld.ApplyOldBoxBlur(bitmapOld, 10); } - bitmapOld.Save(@"old.png", ImageFormat.Png); + bitmapOld.NativeBitmap.Save(@"old.png", ImageFormat.Png); bitmapNew.Span.Fill(new Bgr32 { B = 255, G = 255, R = 255 }); - using (var bitmap = bitmapNew.AsBitmap()) + using (var bitmap = bitmapNew.NativeBitmap) using (var graphics = Graphics.FromImage(bitmap)) using (var pen = new SolidBrush(Color.Blue)) { @@ -88,7 +84,7 @@ namespace Greenshot.Tests bitmap.Save(@"new.png", ImageFormat.Png); } - Assert.True(bitmapOld.IsEqualTo(bitmapNew.AsBitmap()), "New blur doesn't compare to old."); + Assert.True(bitmapOld.IsEqualTo(bitmapNew), "New blur doesn't compare to old."); } } } diff --git a/src/Greenshot.Tests/CaptureTests.cs b/src/Greenshot.Tests/CaptureTests.cs index 0193c50fc..2f613dcb7 100644 --- a/src/Greenshot.Tests/CaptureTests.cs +++ b/src/Greenshot.Tests/CaptureTests.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,17 +17,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.IO; using System.Linq; -using System.Runtime.InteropServices; using System.Threading.Tasks; using System.Windows.Media.Imaging; using Dapplo.CaliburnMicro.Extensions; using Dapplo.Windows.Desktop; -using Dapplo.Windows.Icons; -using Dapplo.Windows.User32.Structs; using Greenshot.Addons.Config.Impl; using Greenshot.Addons.Core; using Greenshot.Core; diff --git a/src/Greenshot.Tests/CommandlineTests.cs b/src/Greenshot.Tests/CommandlineTests.cs index b63b49e77..6c02aaae3 100644 --- a/src/Greenshot.Tests/CommandlineTests.cs +++ b/src/Greenshot.Tests/CommandlineTests.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Linq; using CommandLine; diff --git a/src/Greenshot.Tests/Extensions/ByteArrayExtensions.cs b/src/Greenshot.Tests/Extensions/ByteArrayExtensions.cs index a55eae6ca..8be762f2a 100644 --- a/src/Greenshot.Tests/Extensions/ByteArrayExtensions.cs +++ b/src/Greenshot.Tests/Extensions/ByteArrayExtensions.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Runtime.CompilerServices; namespace Greenshot.Tests.Extensions diff --git a/src/Greenshot.Tests/FilterTests.cs b/src/Greenshot.Tests/FilterTests.cs index fb037554d..df178a71c 100644 --- a/src/Greenshot.Tests/FilterTests.cs +++ b/src/Greenshot.Tests/FilterTests.cs @@ -22,22 +22,22 @@ namespace Greenshot.Tests using (var bitmap1 = BitmapFactory.CreateEmpty(400, 400, PixelFormat.Format24bppRgb, Color.White)) using (var bitmap2 = BitmapFactory.CreateEmpty(400, 400, PixelFormat.Format24bppRgb, Color.White)) { - using (var graphics = Graphics.FromImage(bitmap1)) + using (var graphics = Graphics.FromImage(bitmap1.NativeBitmap)) using (var pen = new SolidBrush(Color.Blue)) { graphics.FillRectangle(pen, new Rectangle(30, 30, 340, 340)); } - bitmap1.Save("bitmap0.png", ImageFormat.Png); + bitmap1.NativeBitmap.Save("bitmap0.png", ImageFormat.Png); bitmap1.ApplyBoxBlur(10); - bitmap1.Save("bitmap1.png", ImageFormat.Png); + bitmap1.NativeBitmap.Save("bitmap1.png", ImageFormat.Png); - using (var graphics = Graphics.FromImage(bitmap2)) + using (var graphics = Graphics.FromImage(bitmap2.NativeBitmap)) using (var pen = new SolidBrush(Color.Blue)) { graphics.FillRectangle(pen, new Rectangle(30, 30, 340, 340)); } - bitmap2.ApplyOldBoxBlur(10); - bitmap2.Save("bitmap2.png", ImageFormat.Png); + BoxBlurOld.ApplyOldBoxBlur(bitmap2, 10); + bitmap2.NativeBitmap.Save("bitmap2.png", ImageFormat.Png); Assert.True(bitmap1.IsEqualTo(bitmap2)); } } diff --git a/src/Greenshot.Tests/Greenshot.Tests.csproj b/src/Greenshot.Tests/Greenshot.Tests.csproj index aacbe2222..f8f76a0f5 100644 --- a/src/Greenshot.Tests/Greenshot.Tests.csproj +++ b/src/Greenshot.Tests/Greenshot.Tests.csproj @@ -1,4 +1,4 @@ - + net472;netcoreapp3.0 @@ -72,7 +72,7 @@ - + runtime; build; native; contentfiles; analyzers all diff --git a/src/Greenshot.Tests/Implementation/BoxBlurOld.cs b/src/Greenshot.Tests/Implementation/BoxBlurOld.cs index ec7226d4a..5978155cc 100644 --- a/src/Greenshot.Tests/Implementation/BoxBlurOld.cs +++ b/src/Greenshot.Tests/Implementation/BoxBlurOld.cs @@ -1,5 +1,6 @@ using System; using System.Drawing; +using Greenshot.Gfx; using Greenshot.Gfx.FastBitmap; namespace Greenshot.Tests.Implementation @@ -14,7 +15,7 @@ namespace Greenshot.Tests.Implementation /// /// Bitmap to blur /// Must be ODD! - public static void ApplyOldBoxBlur(this Bitmap destinationBitmap, int range) + public static void ApplyOldBoxBlur(this IBitmapWithNativeSupport destinationBitmap, int range) { // We only need one fastbitmap as we use it as source and target (the reading is done for one line H/V, writing after "parsing" one line H/V) using (var fastBitmap = FastBitmapFactory.Create(destinationBitmap)) diff --git a/src/Greenshot.Tests/IniTests.cs b/src/Greenshot.Tests/IniTests.cs index 135ef00af..723440e62 100644 --- a/src/Greenshot.Tests/IniTests.cs +++ b/src/Greenshot.Tests/IniTests.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - /* * This only works when Greenshot.Addon.Dropbox can be loaded using Dapplo.Config.Ini.Converters; diff --git a/src/Greenshot.Tests/Murmur3Tests.cs b/src/Greenshot.Tests/Murmur3Tests.cs index 480670ad6..d5e6efc71 100644 --- a/src/Greenshot.Tests/Murmur3Tests.cs +++ b/src/Greenshot.Tests/Murmur3Tests.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Text; using Greenshot.Gfx; using Greenshot.Tests.Extensions; diff --git a/src/Greenshot.Tests/QuantizeTests.cs b/src/Greenshot.Tests/QuantizeTests.cs index 4795b8462..ee129c326 100644 --- a/src/Greenshot.Tests/QuantizeTests.cs +++ b/src/Greenshot.Tests/QuantizeTests.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Drawing; using System.Drawing.Imaging; using Greenshot.Gfx; @@ -39,7 +35,7 @@ namespace Greenshot.Tests { using (var bitmap = BitmapFactory.CreateEmpty(400, 400, PixelFormat.Format24bppRgb, Color.White)) { - using (var graphics = Graphics.FromImage(bitmap)) + using (var graphics = Graphics.FromImage(bitmap.NativeBitmap)) using (var pen = new SolidBrush(Color.Blue)) { graphics.FillRectangle(pen, new Rectangle(30, 30, 340, 340)); @@ -47,7 +43,7 @@ namespace Greenshot.Tests var quantizer = new WuQuantizer(bitmap); using (var quantizedImage = quantizer.GetQuantizedImage()) { - quantizedImage.Save(@"quantized.png", ImageFormat.Png); + quantizedImage.NativeBitmap.Save(@"quantized.png", ImageFormat.Png); } } } diff --git a/src/Greenshot.Tests/ScaleXTests.cs b/src/Greenshot.Tests/ScaleXTests.cs index 791e59782..682f3b601 100644 --- a/src/Greenshot.Tests/ScaleXTests.cs +++ b/src/Greenshot.Tests/ScaleXTests.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Drawing; using System.Drawing.Imaging; using Dapplo.Log; @@ -48,24 +44,23 @@ namespace Greenshot.Tests using (var bitmapNew = new UnmanagedBitmap(400, 400)) using (var bitmapOld = BitmapFactory.CreateEmpty(400, 400, PixelFormat.Format32bppRgb, Color.White)) { - using (var graphics = Graphics.FromImage(bitmapOld)) + using (var graphics = Graphics.FromImage(bitmapOld.NativeBitmap)) using (var pen = new SolidBrush(Color.Blue)) { graphics.FillRectangle(pen, new Rectangle(30, 30, 340, 340)); } bitmapNew.Span.Fill(new Bgr32 { B = 255, G = 255, R = 255, Unused = 0 }); - using (var bitmap = bitmapNew.AsBitmap()) + using (var bitmap = bitmapNew.NativeBitmap) using (var graphics = Graphics.FromImage(bitmap)) using (var pen = new SolidBrush(Color.Blue)) { graphics.FillRectangle(pen, new Rectangle(30, 30, 340, 340)); using (var scaledUnmanagedBitmap = bitmapNew.Scale2X()) - using (var scaledNewBitmap = scaledUnmanagedBitmap.AsBitmap()) - using (var scaledBitmap = bitmapOld.Scale2X()) + using (var scaledBitmap = ScaleX.Scale2X(bitmapOld)) { - scaledNewBitmap.Save(@"new2x.png", ImageFormat.Png); - scaledBitmap.Save(@"old2x.png", ImageFormat.Png); - Assert.True(scaledBitmap.IsEqualTo(scaledNewBitmap), "New Scale3X doesn't compare to old."); + scaledUnmanagedBitmap.NativeBitmap.Save(@"new2x.png", ImageFormat.Png); + scaledBitmap.NativeBitmap.Save(@"old2x.png", ImageFormat.Png); + Assert.True(scaledBitmap.IsEqualTo(scaledUnmanagedBitmap), "New Scale2X doesn't compare to old."); } } } @@ -77,24 +72,23 @@ namespace Greenshot.Tests using (var bitmapNew = new UnmanagedBitmap(400, 400)) using (var bitmapOld = BitmapFactory.CreateEmpty(400, 400, PixelFormat.Format32bppRgb, Color.White)) { - using (var graphics = Graphics.FromImage(bitmapOld)) + using (var graphics = Graphics.FromImage(bitmapOld.NativeBitmap)) using (var pen = new SolidBrush(Color.Blue)) { graphics.FillRectangle(pen, new Rectangle(30, 30, 340, 340)); } bitmapNew.Span.Fill(new Bgr32 { B = 255, G = 255, R = 255, Unused = 0 }); - using (var bitmap = bitmapNew.AsBitmap()) + using (var bitmap = bitmapNew.NativeBitmap) using (var graphics = Graphics.FromImage(bitmap)) using (var pen = new SolidBrush(Color.Blue)) { graphics.FillRectangle(pen, new Rectangle(30, 30, 340, 340)); using (var scaledUnmanagedBitmap = bitmapNew.Scale3X()) - using (var scaledNewBitmap = scaledUnmanagedBitmap.AsBitmap()) - using (var scaledBitmap = bitmapOld.Scale3X()) + using (var scaledBitmap = ScaleX.Scale2X(bitmapOld)) { - scaledNewBitmap.Save(@"new3x.png", ImageFormat.Png); - scaledBitmap.Save(@"old3x.png", ImageFormat.Png); - Assert.True(scaledBitmap.IsEqualTo(scaledNewBitmap), "New Scale3X doesn't compare to old."); + scaledUnmanagedBitmap.NativeBitmap.Save(@"new3x.png", ImageFormat.Png); + scaledBitmap.NativeBitmap.Save(@"old3x.png", ImageFormat.Png); + Assert.True(scaledBitmap.IsEqualTo(scaledUnmanagedBitmap), "New Scale3X doesn't compare to old."); } } } diff --git a/src/Greenshot.Tests/StitchTests.cs b/src/Greenshot.Tests/StitchTests.cs index 4797d27a1..e2816c2d8 100644 --- a/src/Greenshot.Tests/StitchTests.cs +++ b/src/Greenshot.Tests/StitchTests.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Drawing.Imaging; using Greenshot.Gfx; using Greenshot.Gfx.Stitching; @@ -44,7 +40,7 @@ namespace Greenshot.Tests using (var completedBitmap = bitmapStitcher.Result()) { - completedBitmap.Save("scroll.png", ImageFormat.Png); + completedBitmap.NativeBitmap.Save("scroll.png", ImageFormat.Png); } } } diff --git a/src/Greenshot.Tests/UpdateTests.cs b/src/Greenshot.Tests/UpdateTests.cs index 3e8ef09c3..ce8e755b4 100644 --- a/src/Greenshot.Tests/UpdateTests.cs +++ b/src/Greenshot.Tests/UpdateTests.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - #if !NETCOREAPP3_0 using System; using System.ServiceModel.Syndication; diff --git a/src/Greenshot/Components/AuthenticationProvider.cs b/src/Greenshot/Components/AuthenticationProvider.cs index 54f77ad86..d45ad8351 100644 --- a/src/Greenshot/Components/AuthenticationProvider.cs +++ b/src/Greenshot/Components/AuthenticationProvider.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General License // along with this program. If not, see . -#endregion - using System; using System.Collections.Generic; using System.Linq; diff --git a/src/Greenshot/Components/CommandlineParser.cs b/src/Greenshot/Components/CommandlineParser.cs index be13ecd2d..e42e23f16 100644 --- a/src/Greenshot/Components/CommandlineParser.cs +++ b/src/Greenshot/Components/CommandlineParser.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Collections.Generic; using System.Linq; diff --git a/src/Greenshot/Components/FormsStartup.cs b/src/Greenshot/Components/FormsStartup.cs index c33781ce9..f2990e37f 100644 --- a/src/Greenshot/Components/FormsStartup.cs +++ b/src/Greenshot/Components/FormsStartup.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Windows.Forms; using Dapplo.Addons; using Dapplo.Log; diff --git a/src/Greenshot/Components/GreenshotClient.cs b/src/Greenshot/Components/GreenshotClient.cs index d154a93de..0e70571eb 100644 --- a/src/Greenshot/Components/GreenshotClient.cs +++ b/src/Greenshot/Components/GreenshotClient.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - #if !NETCOREAPP3_0 using System.Collections.Generic; diff --git a/src/Greenshot/Components/GreenshotServer.cs b/src/Greenshot/Components/GreenshotServer.cs index 64c3f5e3f..6e809b7ca 100644 --- a/src/Greenshot/Components/GreenshotServer.cs +++ b/src/Greenshot/Components/GreenshotServer.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,12 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - #if !NETCOREAPP3_0 -#region Usings - using System; using System.IO; using System.Linq; @@ -43,8 +37,6 @@ using Greenshot.Forms; using Greenshot.Helpers; using Application = System.Windows.Application; -#endregion - namespace Greenshot.Components { /// @@ -106,8 +98,6 @@ namespace Greenshot.Components return Task.Factory.FromAsync((callback, stateObject) => _host.BeginClose(callback, stateObject), asyncResult => _host.EndClose(asyncResult), null); } -#region IGreenshotContract - /// public void Exit() { @@ -183,7 +173,6 @@ namespace Greenshot.Components break; } } -#endregion } } #endif \ No newline at end of file diff --git a/src/Greenshot/Components/HotkeyHandler.cs b/src/Greenshot/Components/HotkeyHandler.cs index c6fc90e43..6d10de242 100644 --- a/src/Greenshot/Components/HotkeyHandler.cs +++ b/src/Greenshot/Components/HotkeyHandler.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Linq; using Dapplo.CaliburnMicro.Extensions; diff --git a/src/Greenshot/Components/HotkeyService.cs b/src/Greenshot/Components/HotkeyService.cs index 8254a5eb4..7373d90f9 100644 --- a/src/Greenshot/Components/HotkeyService.cs +++ b/src/Greenshot/Components/HotkeyService.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Reactive.Linq; using Caliburn.Micro; diff --git a/src/Greenshot/Components/MainFormStartup.cs b/src/Greenshot/Components/MainFormStartup.cs index 682e9a493..41d95798f 100644 --- a/src/Greenshot/Components/MainFormStartup.cs +++ b/src/Greenshot/Components/MainFormStartup.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,9 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings using System; using System.Linq; using System.Windows.Forms; @@ -33,8 +28,6 @@ using Greenshot.Addons.Components; using Greenshot.Addons.Core; using Greenshot.Forms; -#endregion - namespace Greenshot.Components { /// diff --git a/src/Greenshot/Components/SoundHelper.cs b/src/Greenshot/Components/SoundHelper.cs index 6bcee30ea..29666406f 100644 --- a/src/Greenshot/Components/SoundHelper.cs +++ b/src/Greenshot/Components/SoundHelper.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.IO; using System.Runtime.InteropServices; @@ -34,8 +28,6 @@ using Dapplo.Windows.Multimedia.Enums; using Greenshot.Addons.Core; using Greenshot.Addons.Resources; -#endregion - namespace Greenshot.Components { /// diff --git a/src/Greenshot/Components/UpdateService.cs b/src/Greenshot/Components/UpdateService.cs index be929d027..f504ba62e 100644 --- a/src/Greenshot/Components/UpdateService.cs +++ b/src/Greenshot/Components/UpdateService.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Diagnostics; using System.Linq; @@ -39,8 +33,6 @@ using Dapplo.Log; using Greenshot.Addons.Core; using Greenshot.Ui.Notifications.ViewModels; -#endregion - namespace Greenshot.Components { /// diff --git a/src/Greenshot/Configuration/CommandlineCaptureOptions.cs b/src/Greenshot/Configuration/CommandlineCaptureOptions.cs index 71dd49e3f..6e666bf2f 100644 --- a/src/Greenshot/Configuration/CommandlineCaptureOptions.cs +++ b/src/Greenshot/Configuration/CommandlineCaptureOptions.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Collections.Generic; using CommandLine; diff --git a/src/Greenshot/Configuration/CommandlineOptions.cs b/src/Greenshot/Configuration/CommandlineOptions.cs index 2db9a3b09..cd8c41ca2 100644 --- a/src/Greenshot/Configuration/CommandlineOptions.cs +++ b/src/Greenshot/Configuration/CommandlineOptions.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Collections.Generic; using CommandLine; diff --git a/src/Greenshot/Configuration/IConfigTranslations.cs b/src/Greenshot/Configuration/IConfigTranslations.cs index 869b381cc..980a2fd6f 100644 --- a/src/Greenshot/Configuration/IConfigTranslations.cs +++ b/src/Greenshot/Configuration/IConfigTranslations.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.ComponentModel; using Dapplo.Config.Language; diff --git a/src/Greenshot/Configuration/IMetroConfiguration.cs b/src/Greenshot/Configuration/IMetroConfiguration.cs index b0652478c..a109594ae 100644 --- a/src/Greenshot/Configuration/IMetroConfiguration.cs +++ b/src/Greenshot/Configuration/IMetroConfiguration.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.ComponentModel; using Dapplo.CaliburnMicro.Metro.Configuration; using Dapplo.Config.Ini; diff --git a/src/Greenshot/Configuration/Impl/ConfigTranslationsImpl.cs b/src/Greenshot/Configuration/Impl/ConfigTranslationsImpl.cs index cad8fa563..bfd52f523 100644 --- a/src/Greenshot/Configuration/Impl/ConfigTranslationsImpl.cs +++ b/src/Greenshot/Configuration/Impl/ConfigTranslationsImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Diagnostics.CodeAnalysis; using Dapplo.Config.Language; diff --git a/src/Greenshot/Configuration/Impl/MetroConfigurationImpl.cs b/src/Greenshot/Configuration/Impl/MetroConfigurationImpl.cs index dfe253108..4bd46a231 100644 --- a/src/Greenshot/Configuration/Impl/MetroConfigurationImpl.cs +++ b/src/Greenshot/Configuration/Impl/MetroConfigurationImpl.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Dapplo.CaliburnMicro.Metro; using Dapplo.Config.Ini; @@ -36,8 +32,6 @@ namespace Greenshot.Configuration.Impl public string Theme { get; set; } public string ThemeColor { get; set; } - #region Overrides of IniSectionBase - public override void AfterLoad() { if (string.IsNullOrEmpty(Theme)) @@ -52,7 +46,5 @@ namespace Greenshot.Configuration.Impl base.AfterLoad(); } - - #endregion } } diff --git a/src/Greenshot/Destinations/ClipboardDestination.cs b/src/Greenshot/Destinations/ClipboardDestination.cs index 9378c4d14..d751ed13d 100644 --- a/src/Greenshot/Destinations/ClipboardDestination.cs +++ b/src/Greenshot/Destinations/ClipboardDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,12 +17,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; -using System.Drawing; using System.Windows.Forms; using Dapplo.Windows.Clipboard; using Greenshot.Addons; @@ -36,8 +29,7 @@ using Greenshot.Addons.Interfaces; using Greenshot.Addons.Interfaces.Plugin; using Greenshot.Addons.Resources; using Greenshot.Core.Enums; - -#endregion +using Greenshot.Gfx; namespace Greenshot.Destinations { @@ -62,7 +54,7 @@ namespace Greenshot.Destinations public override Keys EditorShortcutKeys => Keys.Control | Keys.Shift | Keys.C; - public override Bitmap DisplayIcon => GreenshotResources.Instance.GetBitmap("Clipboard.Image"); + public override IBitmapWithNativeSupport DisplayIcon => GreenshotResources.Instance.GetBitmap("Clipboard.Image"); protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { diff --git a/src/Greenshot/Destinations/EmailDestination.cs b/src/Greenshot/Destinations/EmailDestination.cs index 525255f18..fdbf3d28b 100644 --- a/src/Greenshot/Destinations/EmailDestination.cs +++ b/src/Greenshot/Destinations/EmailDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,22 +17,16 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; -using System.Drawing; using System.Windows.Forms; using Greenshot.Addons; using Greenshot.Addons.Components; using Greenshot.Addons.Core; using Greenshot.Addons.Interfaces; using Greenshot.Addons.Resources; +using Greenshot.Gfx; using Greenshot.Helpers.Mapi; -#endregion - namespace Greenshot.Destinations { /// @@ -44,7 +36,7 @@ namespace Greenshot.Destinations public class EmailDestination : AbstractDestination { private readonly ExportNotification _exportNotification; - private static readonly Bitmap MailIcon = GreenshotResources.Instance.GetBitmap("Email.Image"); + private static readonly IBitmapWithNativeSupport MailIcon = GreenshotResources.Instance.GetBitmap("Email.Image"); private static bool _isActiveFlag; private static string _mapiClient; @@ -108,7 +100,7 @@ namespace Greenshot.Destinations public override Keys EditorShortcutKeys => Keys.Control | Keys.E; - public override Bitmap DisplayIcon => MailIcon; + public override IBitmapWithNativeSupport DisplayIcon => MailIcon; protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { diff --git a/src/Greenshot/Destinations/FileDestination.cs b/src/Greenshot/Destinations/FileDestination.cs index 822136f9c..1598001ec 100644 --- a/src/Greenshot/Destinations/FileDestination.cs +++ b/src/Greenshot/Destinations/FileDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,12 +17,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; -using System.Drawing; using System.IO; using System.Windows.Forms; using Dapplo.Log; @@ -35,8 +28,7 @@ using Greenshot.Addons.Core; using Greenshot.Addons.Interfaces; using Greenshot.Addons.Interfaces.Plugin; using Greenshot.Addons.Resources; - -#endregion +using Greenshot.Gfx; namespace Greenshot.Destinations { @@ -61,7 +53,7 @@ namespace Greenshot.Destinations public override Keys EditorShortcutKeys => Keys.Control | Keys.S; - public override Bitmap DisplayIcon => GreenshotResources.Instance.GetBitmap("Save.Image"); + public override IBitmapWithNativeSupport DisplayIcon => GreenshotResources.Instance.GetBitmap("Save.Image"); protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { diff --git a/src/Greenshot/Destinations/FileWithDialogDestination.cs b/src/Greenshot/Destinations/FileWithDialogDestination.cs index fb3cd81a1..682b02d3c 100644 --- a/src/Greenshot/Destinations/FileWithDialogDestination.cs +++ b/src/Greenshot/Destinations/FileWithDialogDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,19 +17,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - -using System.Drawing; using System.Windows.Forms; using Greenshot.Addons; using Greenshot.Addons.Components; using Greenshot.Addons.Core; using Greenshot.Addons.Interfaces; using Greenshot.Addons.Resources; - -#endregion +using Greenshot.Gfx; namespace Greenshot.Destinations { @@ -58,7 +50,7 @@ namespace Greenshot.Destinations public override Keys EditorShortcutKeys => Keys.Control | Keys.Shift | Keys.S; - public override Bitmap DisplayIcon => GreenshotResources.Instance.GetBitmap("Save.Image"); + public override IBitmapWithNativeSupport DisplayIcon => GreenshotResources.Instance.GetBitmap("Save.Image"); protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { diff --git a/src/Greenshot/Destinations/PickerDestination.cs b/src/Greenshot/Destinations/PickerDestination.cs index 298deb2f9..c766c077a 100644 --- a/src/Greenshot/Destinations/PickerDestination.cs +++ b/src/Greenshot/Destinations/PickerDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Collections.Generic; using System.Linq; using Greenshot.Addons; @@ -30,8 +24,6 @@ using Greenshot.Addons.Components; using Greenshot.Addons.Core; using Greenshot.Addons.Interfaces; -#endregion - namespace Greenshot.Destinations { /// diff --git a/src/Greenshot/Destinations/PrinterDestination.cs b/src/Greenshot/Destinations/PrinterDestination.cs index e8eedf3eb..2ee95614f 100644 --- a/src/Greenshot/Destinations/PrinterDestination.cs +++ b/src/Greenshot/Destinations/PrinterDestination.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,13 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; -using System.Drawing; using System.Drawing.Printing; using System.Windows.Forms; using Autofac.Features.OwnedInstances; @@ -34,10 +27,9 @@ using Greenshot.Addons.Components; using Greenshot.Addons.Core; using Greenshot.Addons.Interfaces; using Greenshot.Addons.Resources; +using Greenshot.Gfx; using Greenshot.Helpers; -#endregion - namespace Greenshot.Destinations { /// @@ -87,7 +79,7 @@ namespace Greenshot.Destinations public override Keys EditorShortcutKeys => Keys.Control | Keys.P; - public override Bitmap DisplayIcon => GreenshotResources.Instance.GetBitmap("Printer.Image"); + public override IBitmapWithNativeSupport DisplayIcon => GreenshotResources.Instance.GetBitmap("Printer.Image"); public override bool IsDynamic => true; diff --git a/src/Greenshot/Forms/AboutForm.cs b/src/Greenshot/Forms/AboutForm.cs index eda85d816..3770fbc6f 100644 --- a/src/Greenshot/Forms/AboutForm.cs +++ b/src/Greenshot/Forms/AboutForm.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Diagnostics; @@ -41,8 +35,6 @@ using Greenshot.Addons.Controls; using Greenshot.Addons.Core; using Greenshot.Gfx; -#endregion - namespace Greenshot.Forms { /// @@ -124,7 +116,7 @@ namespace Greenshot.Forms private readonly IList _pixelColors = new List(); private readonly IList _pixels = new List(); private readonly Random _rand = new Random(); - private Bitmap _bitmap; + private IBitmapWithNativeSupport _bitmap; private int _colorIndex; private bool _hasAnimationsLeft; private int _scrollCount; @@ -156,7 +148,7 @@ namespace Greenshot.Forms // Use the self drawn image, first we create the background to be the backcolor (as we animate from this) _bitmap = BitmapFactory.CreateEmpty(90, 90, PixelFormat.Format24bppRgb, BackColor); - pictureBox1.Image = _bitmap; + pictureBox1.Image = _bitmap?.NativeBitmap; _dpiSubscription = FormDpiHandler.OnDpiChanged.Subscribe(info => { @@ -314,7 +306,7 @@ namespace Greenshot.Forms } // Draw the "G" - using (var graphics = Graphics.FromImage(_bitmap)) + using (var graphics = Graphics.FromImage(_bitmap.NativeBitmap)) { graphics.SmoothingMode = SmoothingMode.HighQuality; graphics.InterpolationMode = InterpolationMode.HighQualityBilinear; diff --git a/src/Greenshot/Forms/BugReportForm.cs b/src/Greenshot/Forms/BugReportForm.cs index 53e82284f..6421c25f1 100644 --- a/src/Greenshot/Forms/BugReportForm.cs +++ b/src/Greenshot/Forms/BugReportForm.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,18 +17,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Diagnostics; using System.Windows.Forms; using Greenshot.Addons; using Greenshot.Addons.Controls; -#endregion - namespace Greenshot.Forms { /// diff --git a/src/Greenshot/Forms/CaptureForm.cs b/src/Greenshot/Forms/CaptureForm.cs index 91db7c660..30e098d95 100644 --- a/src/Greenshot/Forms/CaptureForm.cs +++ b/src/Greenshot/Forms/CaptureForm.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Diagnostics; @@ -46,8 +40,6 @@ using Greenshot.Addons.Interfaces; using Greenshot.Addons.Resources; using Greenshot.Gfx.Legacy; -#endregion - namespace Greenshot.Forms { /// @@ -86,7 +78,7 @@ namespace Greenshot.Forms static CaptureForm() { var backgroundForTransparency = GreenshotResources.Instance.GetBitmap("Checkerboard.Image"); - BackgroundBrush = new TextureBrush(backgroundForTransparency, WrapMode.Tile); + BackgroundBrush = new TextureBrush(backgroundForTransparency.NativeBitmap, WrapMode.Tile); } /// @@ -205,8 +197,6 @@ namespace Greenshot.Forms Vertical } - #region key handling - /// /// Handle the key up event /// @@ -344,10 +334,6 @@ namespace Greenshot.Forms } } - #endregion - - #region events - /// /// The mousedown handler of the capture form /// @@ -820,12 +806,11 @@ namespace Greenshot.Forms if (!_isZoomerTransparent) { graphics.FillRectangle(BackgroundBrush, destinationRectangle); - graphics.DrawImage(_capture.Bitmap, destinationRectangle, sourceRectangle, GraphicsUnit.Pixel); + graphics.DrawImage(_capture.Bitmap.NativeBitmap, destinationRectangle, sourceRectangle, GraphicsUnit.Pixel); } else { - graphics.DrawImage(_capture.Bitmap, destinationRectangle, sourceRectangle.X, sourceRectangle.Y, sourceRectangle.Width, sourceRectangle.Height, GraphicsUnit.Pixel, - attributes); + graphics.DrawImage(_capture.Bitmap.NativeBitmap, destinationRectangle, sourceRectangle.X, sourceRectangle.Y, sourceRectangle.Width, sourceRectangle.Height, GraphicsUnit.Pixel, attributes); } } var alpha = (int) (255 * _coreConfiguration.ZoomerOpacity); @@ -895,7 +880,7 @@ namespace Greenshot.Forms { var graphics = e.Graphics; var clipRectangle = e.ClipRectangle; - graphics.DrawImageUnscaled(_capture.Bitmap, Point.Empty); + graphics.DrawImageUnscaled(_capture.Bitmap.NativeBitmap, Point.Empty); // Only draw Cursor if it's (partly) visible if (_capture.Cursor != null && _capture.CursorVisible && clipRectangle.IntersectsWith(new Rectangle(_capture.CursorLocation, _capture.Cursor.Size))) { @@ -1080,7 +1065,5 @@ namespace Greenshot.Forms var destinationRectangle = _zoomAnimator.Current.Offset(_cursorPos); DrawZoom(graphics, sourceRectangle, destinationRectangle); } - - #endregion } } \ No newline at end of file diff --git a/src/Greenshot/Forms/LanguageDialog.Designer.cs b/src/Greenshot/Forms/LanguageDialog.Designer.cs index 3af037d55..edbf5a28e 100644 --- a/src/Greenshot/Forms/LanguageDialog.Designer.cs +++ b/src/Greenshot/Forms/LanguageDialog.Designer.cs @@ -67,7 +67,7 @@ namespace Greenshot.Forms { this.btnOK.TabIndex = 1; this.btnOK.Text = "OK"; this.btnOK.UseVisualStyleBackColor = true; - this.btnOK.Click += new System.EventHandler(this.BtnOKClick); + this.btnOK.Click += new System.EventHandler(this.BtnOkClick); // // LanguageDialog // diff --git a/src/Greenshot/Forms/LanguageDialog.cs b/src/Greenshot/Forms/LanguageDialog.cs index dafc10658..919a369a0 100644 --- a/src/Greenshot/Forms/LanguageDialog.cs +++ b/src/Greenshot/Forms/LanguageDialog.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Linq; using System.Threading; @@ -31,8 +25,6 @@ using Dapplo.Config.Language; using Dapplo.Log; using Greenshot.Addons.Resources; -#endregion - namespace Greenshot.Forms { /// @@ -74,20 +66,15 @@ namespace Greenshot.Forms // Set datasource last to prevent problems // See: http://www.codeproject.com/KB/database/scomlistcontrolbinding.aspx?fid=111644 - comboBoxLanguage.DataSource = _languageContainer.AvailableLanguages; - - var currentLanguage = _languageContainer.CurrentLanguage; - - if (currentLanguage != null) - { - Log.Debug().WriteLine("Selecting {0}", currentLanguage); - comboBoxLanguage.SelectedValue = currentLanguage; - } - else - { - comboBoxLanguage.SelectedValue = Thread.CurrentThread.CurrentUICulture.Name; - } + comboBoxLanguage.DataSource = _languageContainer.AvailableLanguages.ToList(); + var preselectedLanguage = _languageContainer.CurrentLanguage ?? Thread.CurrentThread.CurrentUICulture.Name; + if (_languageContainer.AvailableLanguages.ContainsKey(preselectedLanguage)) + { + Log.Debug().WriteLine("Selecting {0}", preselectedLanguage); + comboBoxLanguage.SelectedValue = preselectedLanguage; + } + // Close again when there is only one language, this shows the form briefly! // But the use-case is not so interesting, only happens once, to invest a lot of time here. if (_languageContainer.AvailableLanguages.Count != 1) @@ -101,7 +88,7 @@ namespace Greenshot.Forms Close(); } - private void BtnOKClick(object sender, EventArgs e) + private void BtnOkClick(object sender, EventArgs e) { _properOkPressed = true; _ = _languageContainer.ChangeLanguageAsync(SelectedLanguage); diff --git a/src/Greenshot/Forms/MainForm.cs b/src/Greenshot/Forms/MainForm.cs index f81630e9a..36ceb9e6b 100644 --- a/src/Greenshot/Forms/MainForm.cs +++ b/src/Greenshot/Forms/MainForm.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.ComponentModel; @@ -64,8 +58,6 @@ using Dapplo.Windows.User32; using Greenshot.Addons.Resources; using Greenshot.Components; -#endregion - namespace Greenshot.Forms { /// @@ -80,6 +72,7 @@ namespace Greenshot.Forms private readonly InternetExplorerCaptureHelper _internetExplorerCaptureHelper; private readonly Func> _configViewModelFactory; private readonly Func> _aboutFormFactory; + private readonly Func _valueConverter = bitmap => bitmap?.NativeBitmap; // Timer for the double click test private readonly Timer _doubleClickTimer = new Timer(); @@ -400,24 +393,24 @@ namespace Greenshot.Forms notifyIcon.Icon = GreenshotResources.Instance.GetGreenshotIcon(); }); - var contextMenuResourceScaleHandler = BitmapScaleHandler.Create(ContextMenuDpiHandler, (imageName, dpi) => GreenshotResources.Instance.GetBitmap(imageName, GetType()), (bitmap, dpi) => bitmap.ScaleIconForDisplaying(dpi)); + var contextMenuResourceScaleHandler = BitmapScaleHandler.Create(ContextMenuDpiHandler, (imageName, dpi) => GreenshotResources.Instance.GetBitmap(imageName, GetType()), (bitmap, dpi) => bitmap.ScaleIconForDisplaying(dpi)); - contextMenuResourceScaleHandler.AddTarget(contextmenu_capturewindow, "contextmenu_capturewindow.Image"); - contextMenuResourceScaleHandler.AddTarget(contextmenu_capturearea, "contextmenu_capturearea.Image"); - contextMenuResourceScaleHandler.AddTarget(contextmenu_capturelastregion, "contextmenu_capturelastregion.Image"); - contextMenuResourceScaleHandler.AddTarget(contextmenu_capturefullscreen, "contextmenu_capturefullscreen.Image"); - contextMenuResourceScaleHandler.AddTarget(contextmenu_captureclipboard, "contextmenu_captureclipboard.Image"); - contextMenuResourceScaleHandler.AddTarget(contextmenu_openfile, "contextmenu_openfile.Image"); - contextMenuResourceScaleHandler.AddTarget(contextmenu_settings, "contextmenu_settings.Image"); - contextMenuResourceScaleHandler.AddTarget(contextmenu_help, "contextmenu_help.Image"); - contextMenuResourceScaleHandler.AddTarget(contextmenu_donate, "contextmenu_donate.Image"); - contextMenuResourceScaleHandler.AddTarget(contextmenu_exit, "contextmenu_exit.Image"); + contextMenuResourceScaleHandler.AddTarget(contextmenu_capturewindow, "contextmenu_capturewindow.Image", _valueConverter); + contextMenuResourceScaleHandler.AddTarget(contextmenu_capturearea, "contextmenu_capturearea.Image", _valueConverter); + contextMenuResourceScaleHandler.AddTarget(contextmenu_capturelastregion, "contextmenu_capturelastregion.Image", _valueConverter); + contextMenuResourceScaleHandler.AddTarget(contextmenu_capturefullscreen, "contextmenu_capturefullscreen.Image", _valueConverter); + contextMenuResourceScaleHandler.AddTarget(contextmenu_captureclipboard, "contextmenu_captureclipboard.Image", _valueConverter); + contextMenuResourceScaleHandler.AddTarget(contextmenu_openfile, "contextmenu_openfile.Image", _valueConverter); + contextMenuResourceScaleHandler.AddTarget(contextmenu_settings, "contextmenu_settings.Image", _valueConverter); + contextMenuResourceScaleHandler.AddTarget(contextmenu_help, "contextmenu_help.Image", _valueConverter); + contextMenuResourceScaleHandler.AddTarget(contextmenu_donate, "contextmenu_donate.Image", _valueConverter); + contextMenuResourceScaleHandler.AddTarget(contextmenu_exit, "contextmenu_exit.Image", _valueConverter); // this is special handling, for the icons which come from the executables - var exeBitmapScaleHandler = BitmapScaleHandler.Create(ContextMenuDpiHandler, + var exeBitmapScaleHandler = BitmapScaleHandler.Create(ContextMenuDpiHandler, (path, dpi) => PluginUtils.GetCachedExeIcon(path, 0, dpi >= 120), (bitmap, dpi) => bitmap.ScaleIconForDisplaying(dpi)); - exeBitmapScaleHandler.AddTarget(contextmenu_captureie, PluginUtils.GetExePath("iexplore.exe")); + exeBitmapScaleHandler.AddTarget(contextmenu_captureie, PluginUtils.GetExePath("iexplore.exe"), _valueConverter); // Add cleanup Application.ApplicationExit += (sender, args) => @@ -429,8 +422,6 @@ namespace Greenshot.Forms }; } -#region mainform events - private void MainFormFormClosing(object sender, FormClosingEventArgs e) { Log.Debug().WriteLine("Mainform closing, reason: {0}", e.CloseReason); @@ -444,10 +435,6 @@ namespace Greenshot.Forms ShowInTaskbar = false; } -#endregion - -#region key handlers - private void CaptureFile() { var openFileDialog = new OpenFileDialog @@ -473,10 +460,6 @@ namespace Greenshot.Forms } } -#endregion - -#region contextmenu - private void ContextMenuOpening(object sender, CancelEventArgs e) { using (var clipboardAccessToken = ClipboardNative.Access()) @@ -523,7 +506,7 @@ namespace Greenshot.Forms now.Month == 3 && now.Day > 13 && now.Day < 21) { // birthday - contextmenu_donate.Image = GreenshotResources.Instance.GetBitmap("contextmenu_present.Image", GetType()); + contextmenu_donate.Image = GreenshotResources.Instance.GetBitmap("contextmenu_present.Image", GetType()).NativeBitmap; } } @@ -566,7 +549,7 @@ namespace Greenshot.Forms } var captureIeTabItem = contextmenu_captureiefromlist.DropDownItems.Add(title); var index = counter.ContainsKey(tabData.Key) ? counter[tabData.Key] : 0; - captureIeTabItem.Image = tabData.Key.GetDisplayIcon(); + captureIeTabItem.Image = tabData.Key.GetDisplayIcon().NativeBitmap; captureIeTabItem.Tag = new KeyValuePair(tabData.Key, index++); captureIeTabItem.Click += Contextmenu_captureiefromlist_Click; contextmenu_captureiefromlist.DropDownItems.Add(captureIeTabItem); @@ -713,7 +696,7 @@ namespace Greenshot.Forms } var captureWindowItem = menuItem.DropDownItems.Add(title); captureWindowItem.Tag = window; - captureWindowItem.Image = window.GetDisplayIcon(ContextMenuDpiHandler.Dpi > DpiHandler.DefaultScreenDpi); + captureWindowItem.Image = window.GetDisplayIcon(ContextMenuDpiHandler.Dpi > DpiHandler.DefaultScreenDpi).NativeBitmap; captureWindowItem.Click += eventHandler; // Only show preview when enabled if (thumbnailPreview) @@ -1088,7 +1071,5 @@ namespace Greenshot.Forms // Rebuild the quick settings menu with the new settings. InitializeQuickSettingsMenu(); } - -#endregion } } \ No newline at end of file diff --git a/src/Greenshot/Forms/PrintOptionsDialog.cs b/src/Greenshot/Forms/PrintOptionsDialog.cs index 80f78bbf5..296a944c3 100644 --- a/src/Greenshot/Forms/PrintOptionsDialog.cs +++ b/src/Greenshot/Forms/PrintOptionsDialog.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,18 +17,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Windows.Forms; using Greenshot.Addons; using Greenshot.Addons.Controls; using Greenshot.Addons.Core; -#endregion - namespace Greenshot.Forms { /// diff --git a/src/Greenshot/Forms/ToolStripMenuSelectList.cs b/src/Greenshot/Forms/ToolStripMenuSelectList.cs index e89bf1d7f..eca40e0a5 100644 --- a/src/Greenshot/Forms/ToolStripMenuSelectList.cs +++ b/src/Greenshot/Forms/ToolStripMenuSelectList.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Drawing; @@ -31,8 +25,6 @@ using System.Windows.Forms; using Greenshot.Gfx; using Greenshot.Addons.Core; -#endregion - namespace Greenshot.Forms { /// @@ -52,7 +44,7 @@ namespace Greenshot.Forms if (_defaultImage == null || _defaultImage.Size != coreConfig.IconSize) { _defaultImage?.Dispose(); - _defaultImage = BitmapFactory.CreateEmpty(coreConfig.IconSize.Width, coreConfig.IconSize.Height, PixelFormat.Format32bppArgb, Color.Transparent); + _defaultImage = BitmapFactory.CreateEmpty(coreConfig.IconSize.Width, coreConfig.IconSize.Height, PixelFormat.Format32bppArgb, Color.Transparent).NativeBitmap; } Image = _defaultImage; } diff --git a/src/Greenshot/Greenshot.csproj b/src/Greenshot/Greenshot.csproj index f2693da73..168321381 100644 --- a/src/Greenshot/Greenshot.csproj +++ b/src/Greenshot/Greenshot.csproj @@ -90,9 +90,9 @@ - - - + + + all runtime; build; native; contentfiles; analyzers diff --git a/src/Greenshot/GreenshotAutofacModule.cs b/src/Greenshot/GreenshotAutofacModule.cs index 66ae3d2cb..d7c45b6e5 100644 --- a/src/Greenshot/GreenshotAutofacModule.cs +++ b/src/Greenshot/GreenshotAutofacModule.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Collections.Generic; using System.IO; using System.Linq; diff --git a/src/Greenshot/Help/HelpFileLoader.cs b/src/Greenshot/Help/HelpFileLoader.cs index b25d63e73..83ab03356 100644 --- a/src/Greenshot/Help/HelpFileLoader.cs +++ b/src/Greenshot/Help/HelpFileLoader.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,18 +17,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Diagnostics; using System.Net; using Dapplo.HttpExtensions; using Dapplo.Log; -#endregion - namespace Greenshot.Help { /// diff --git a/src/Greenshot/Helpers/CaptureHelper.cs b/src/Greenshot/Helpers/CaptureHelper.cs index 57e34a288..425cbdf7e 100644 --- a/src/Greenshot/Helpers/CaptureHelper.cs +++ b/src/Greenshot/Helpers/CaptureHelper.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Diagnostics; @@ -49,8 +43,6 @@ using Greenshot.Components; using Greenshot.Core.Enums; using Greenshot.Gfx; -#endregion - namespace Greenshot.Helpers { /// @@ -432,7 +424,7 @@ namespace Greenshot.Helpers } break; case CaptureMode.File: - Bitmap fileImage = null; + IBitmapWithNativeSupport fileImage = null; var filename = _capture.CaptureDetails.Filename; if (!string.IsNullOrEmpty(filename)) @@ -588,7 +580,7 @@ namespace Greenshot.Helpers // Make sure the resolution is set correctly! if (_capture.CaptureDetails != null) { - _capture.Bitmap?.SetResolution(_capture.CaptureDetails.DpiX, _capture.CaptureDetails.DpiY); + _capture.Bitmap?.NativeBitmap.SetResolution(_capture.CaptureDetails.DpiX, _capture.CaptureDetails.DpiY); // Generate a title if (_capture.CaptureDetails.Title == null) { @@ -1013,12 +1005,10 @@ namespace Greenshot.Helpers previouslyActiveWindow?.ToForegroundAsync(false); if (_capture.CaptureDetails != null) { - _capture.Bitmap?.SetResolution(_capture.CaptureDetails.DpiX, _capture.CaptureDetails.DpiY); + _capture.Bitmap?.NativeBitmap.SetResolution(_capture.CaptureDetails.DpiX, _capture.CaptureDetails.DpiY); } } - #region capture with feedback - private void CaptureWithFeedback() { // The following, to be precise the HideApp, causes the app to close as described in BUG-1620 @@ -1088,7 +1078,5 @@ namespace Greenshot.Helpers HandleCapture(); } } - - #endregion } } \ No newline at end of file diff --git a/src/Greenshot/Helpers/EnvironmentInfo.cs b/src/Greenshot/Helpers/EnvironmentInfo.cs index 6061e3ad2..5188f063c 100644 --- a/src/Greenshot/Helpers/EnvironmentInfo.cs +++ b/src/Greenshot/Helpers/EnvironmentInfo.cs @@ -1,5 +1,3 @@ -#region Greenshot GNU General Public License - // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.ComponentModel; using System.Linq; @@ -35,8 +29,6 @@ using Dapplo.Windows.Kernel32.Enums; using Dapplo.Windows.Kernel32.Structs; using Dapplo.Windows.User32; -#endregion - namespace Greenshot.Helpers { /// @@ -217,18 +209,12 @@ namespace Greenshot.Helpers /// public static class OsInfo { - #region BITS - - /// + /// /// Determines if the current application is 32 or 64-bit. /// public static int Bits => IntPtr.Size * 8; - #endregion BITS - - #region SERVICE PACK - - /// + /// /// Gets the service pack information of the operating system running on this computer. /// public static string ServicePack @@ -247,11 +233,7 @@ namespace Greenshot.Helpers } } - #endregion SERVICE PACK - - #region EDITION - - private static string _sEdition; + private static string _sEdition; /// /// Gets the edition of the operating system running on this computer. @@ -280,9 +262,7 @@ namespace Greenshot.Helpers var productType = osVersionInfo.ProductType; var suiteMask = osVersionInfo.SuiteMask; - #region VERSION 4 - - if (majorVersion == 4) + if (majorVersion == 4) { if (productType.HasFlag(WindowsProductTypes.VER_NT_WORKSTATION)) { @@ -294,11 +274,8 @@ namespace Greenshot.Helpers edition = suiteMask.HasFlag(WindowsSuites.Enterprise) ? "Enterprise Server" : "Standard Server"; } } - #endregion VERSION 4 - #region VERSION 5 - - else if (majorVersion == 5) + else if (majorVersion == 5) { if (productType.HasFlag(WindowsProductTypes.VER_NT_WORKSTATION)) { @@ -358,11 +335,8 @@ namespace Greenshot.Helpers } } } - #endregion VERSION 5 - #region VERSION 6 - - else if (majorVersion == 6) + else if (majorVersion == 6) { if (Kernel32Api.GetProductInfo(majorVersion, minorVersion, osVersionInfo.ServicePackMajor, osVersionInfo.ServicePackMinor, out var ed)) { @@ -376,18 +350,12 @@ namespace Greenshot.Helpers } } - #endregion VERSION 6 - - _sEdition = edition; + _sEdition = edition; return edition; } } - #endregion EDITION - - #region NAME - - private static string _name; + private static string _name; /// /// Gets the name of the operating system running on this computer. @@ -547,24 +515,12 @@ namespace Greenshot.Helpers } } - #endregion NAME - - #region VERSION - - #region BUILD - - /// + /// /// Gets the build version number of the operating system running on this computer. /// public static int BuildVersion => Environment.OSVersion.Version.Build; - #endregion BUILD - - #region FULL - - #region STRING - - /// + /// /// Gets the full version string of the operating system running on this computer. /// public static string VersionString @@ -576,11 +532,7 @@ namespace Greenshot.Helpers } } - #endregion STRING - - #region VERSION - - /// + /// /// Gets the full version of the operating system running on this computer. /// public static Version Version @@ -588,13 +540,7 @@ namespace Greenshot.Helpers get { return Environment.OSVersion.Version; } } - #endregion VERSION - - #endregion FULL - - #region MAJOR - - /// + /// /// Gets the major version number of the operating system running on this computer. /// public static int MajorVersion @@ -602,11 +548,7 @@ namespace Greenshot.Helpers get { return Environment.OSVersion.Version.Major; } } - #endregion MAJOR - - #region MINOR - - /// + /// /// Gets the minor version number of the operating system running on this computer. /// public static int MinorVersion @@ -614,20 +556,12 @@ namespace Greenshot.Helpers get { return Environment.OSVersion.Version.Minor; } } - #endregion MINOR - - #region REVISION - - /// + /// /// Gets the revision version number of the operating system running on this computer. /// public static int RevisionVersion { get { return Environment.OSVersion.Version.Revision; } } - - #endregion REVISION - - #endregion VERSION - } + } } \ No newline at end of file diff --git a/src/Greenshot/Helpers/Mapi/InteropRecipientCollection.cs b/src/Greenshot/Helpers/Mapi/InteropRecipientCollection.cs index 3a6eb5d63..35cfb2af7 100644 --- a/src/Greenshot/Helpers/Mapi/InteropRecipientCollection.cs +++ b/src/Greenshot/Helpers/Mapi/InteropRecipientCollection.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Runtime.InteropServices; -#endregion - namespace Greenshot.Helpers.Mapi { /// @@ -35,14 +27,8 @@ namespace Greenshot.Helpers.Mapi /// internal struct InteropRecipientCollection : IDisposable { - #region Member Variables - private int _count; - #endregion Member Variables - - #region Constructors - /// /// Default constructor for creating InteropRecipientCollection. /// @@ -73,16 +59,8 @@ namespace Greenshot.Helpers.Mapi } } - #endregion Costructors - - #region Public Properties - public IntPtr Handle { get; private set; } - #endregion Public Properties - - #region Public Methods - /// /// Disposes of resources. /// @@ -108,7 +86,5 @@ namespace Greenshot.Helpers.Mapi _count = 0; } } - - #endregion Public Methods } } \ No newline at end of file diff --git a/src/Greenshot/Helpers/Mapi/MapiFileDescriptor.cs b/src/Greenshot/Helpers/Mapi/MapiFileDescriptor.cs index 0e79a8806..5ef65dbcc 100644 --- a/src/Greenshot/Helpers/Mapi/MapiFileDescriptor.cs +++ b/src/Greenshot/Helpers/Mapi/MapiFileDescriptor.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Runtime.InteropServices; -#endregion - namespace Greenshot.Helpers.Mapi { [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] diff --git a/src/Greenshot/Helpers/Mapi/MapiHelperInterop.cs b/src/Greenshot/Helpers/Mapi/MapiHelperInterop.cs index e7fea46a1..2327dd86a 100644 --- a/src/Greenshot/Helpers/Mapi/MapiHelperInterop.cs +++ b/src/Greenshot/Helpers/Mapi/MapiHelperInterop.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Runtime.InteropServices; -#endregion - namespace Greenshot.Helpers.Mapi { /// @@ -35,9 +27,7 @@ namespace Greenshot.Helpers.Mapi /// internal class MapiHelperInterop { - #region Constructors - - /// + /// /// Private constructor. /// private MapiHelperInterop() @@ -45,9 +35,7 @@ namespace Greenshot.Helpers.Mapi // Intenationally blank } -#endregion Constructors - - [DllImport("MAPI32.DLL", SetLastError = true, CharSet = CharSet.Ansi)] + [DllImport("MAPI32.DLL", SetLastError = true, CharSet = CharSet.Ansi)] public static extern int MAPISendMail(IntPtr session, IntPtr hwnd, MapiMessage message, int flg, int rsv); } diff --git a/src/Greenshot/Helpers/Mapi/MapiMailMessage.cs b/src/Greenshot/Helpers/Mapi/MapiMailMessage.cs index 2b9ecd102..af546e4dc 100644 --- a/src/Greenshot/Helpers/Mapi/MapiMailMessage.cs +++ b/src/Greenshot/Helpers/Mapi/MapiMailMessage.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; @@ -35,8 +29,6 @@ using Greenshot.Addons.Core; using Greenshot.Addons.Interfaces; using Greenshot.Addons.Interfaces.Plugin; -#endregion - namespace Greenshot.Helpers.Mapi { /// @@ -56,13 +48,9 @@ namespace Greenshot.Helpers.Mapi /// internal static ICoreConfiguration CoreConfiguration { get; set; } - #region Member Variables - private readonly ManualResetEvent _manualResetEvent; - #endregion Member Variables - - /// + /// /// Helper Method for creating an Email with Attachment /// /// Path to file @@ -114,9 +102,7 @@ namespace Greenshot.Helpers.Mapi } } - #region Constructors - - /// + /// /// Creates a blank mail message. /// public MapiMailMessage() @@ -143,11 +129,7 @@ namespace Greenshot.Helpers.Mapi Body = body; } - #endregion Constructors - - #region Public Properties - - /// + /// /// Gets or sets the subject of this mail message. /// public string Subject { get; set; } @@ -167,11 +149,7 @@ namespace Greenshot.Helpers.Mapi /// public List Files { get; } - #endregion Public Properties - - #region Public Methods - - /// + /// /// Displays the mail message dialog asynchronously. /// public void ShowDialog() @@ -196,11 +174,7 @@ namespace Greenshot.Helpers.Mapi GC.SuppressFinalize(this); } - #endregion Public Methods - - #region Private Methods - - protected virtual void Dispose(bool disposing) + protected virtual void Dispose(bool disposing) { if (!disposing) { @@ -451,7 +425,5 @@ namespace Greenshot.Helpers.Mapi } return error; } - - #endregion Private Methods - } + } } \ No newline at end of file diff --git a/src/Greenshot/Helpers/Mapi/MapiMessage.cs b/src/Greenshot/Helpers/Mapi/MapiMessage.cs index b46a0d8a6..d6d4123d7 100644 --- a/src/Greenshot/Helpers/Mapi/MapiMessage.cs +++ b/src/Greenshot/Helpers/Mapi/MapiMessage.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Runtime.InteropServices; -#endregion - namespace Greenshot.Helpers.Mapi { [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] diff --git a/src/Greenshot/Helpers/Mapi/MapiRecipDesc.cs b/src/Greenshot/Helpers/Mapi/MapiRecipDesc.cs index ebae80e75..65996739e 100644 --- a/src/Greenshot/Helpers/Mapi/MapiRecipDesc.cs +++ b/src/Greenshot/Helpers/Mapi/MapiRecipDesc.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Runtime.InteropServices; -#endregion - namespace Greenshot.Helpers.Mapi { [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] diff --git a/src/Greenshot/Helpers/Mapi/Recipient.cs b/src/Greenshot/Helpers/Mapi/Recipient.cs index a5c24fce2..6c9a6cc6d 100644 --- a/src/Greenshot/Helpers/Mapi/Recipient.cs +++ b/src/Greenshot/Helpers/Mapi/Recipient.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,25 +17,14 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - - -#endregion - namespace Greenshot.Helpers.Mapi { - #region Public Recipient Class - /// /// Represents a Recipient for a MapiMailMessage. /// public class Recipient { - #region Internal Methods - - /// + /// /// Returns an interop representation of a recepient. /// /// @@ -60,11 +47,7 @@ namespace Greenshot.Helpers.Mapi return interop; } - #endregion Internal Methods - - #region Public Properties - - /// + /// /// The email address of this recipient. /// public string Address; @@ -79,11 +62,7 @@ namespace Greenshot.Helpers.Mapi /// public RecipientType RecipientType = RecipientType.To; - #endregion Public Properties - - #region Constructors - - /// + /// /// Creates a new recipient with the specified address. /// public Recipient(string address) @@ -118,9 +97,5 @@ namespace Greenshot.Helpers.Mapi DisplayName = displayName; RecipientType = recipientType; } - - #endregion Constructors - } - - #endregion Public RecipientCollection Class + } } \ No newline at end of file diff --git a/src/Greenshot/Helpers/Mapi/RecipientCollection.cs b/src/Greenshot/Helpers/Mapi/RecipientCollection.cs index 05d01781b..31946d933 100644 --- a/src/Greenshot/Helpers/Mapi/RecipientCollection.cs +++ b/src/Greenshot/Helpers/Mapi/RecipientCollection.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,14 +17,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System.Collections; -#endregion - namespace Greenshot.Helpers.Mapi { /// diff --git a/src/Greenshot/Helpers/Mapi/RecipientType.cs b/src/Greenshot/Helpers/Mapi/RecipientType.cs index e387afc9f..8a91d88f9 100644 --- a/src/Greenshot/Helpers/Mapi/RecipientType.cs +++ b/src/Greenshot/Helpers/Mapi/RecipientType.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,13 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - - -#endregion - namespace Greenshot.Helpers.Mapi { /// diff --git a/src/Greenshot/Helpers/PrintHelper.cs b/src/Greenshot/Helpers/PrintHelper.cs index 0b4126854..11b470331 100644 --- a/src/Greenshot/Helpers/PrintHelper.cs +++ b/src/Greenshot/Helpers/PrintHelper.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,10 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Drawing; using System.Drawing.Printing; @@ -40,8 +34,6 @@ using Greenshot.Core.Enums; using Greenshot.Gfx.Effects; using Greenshot.Gfx.Legacy; -#endregion - namespace Greenshot.Helpers { /// @@ -231,14 +223,14 @@ namespace Greenshot.Helpers pageRect.Height -= footerStringHeight; var gu = GraphicsUnit.Pixel; - var imageRect = bitmap.GetBounds(ref gu); + var imageRect = bitmap.NativeBitmap.GetBounds(ref gu); // rotate the image if it fits the page better if (_coreConfig.OutputPrintAllowRotate) { if (pageRect.Width > pageRect.Height && imageRect.Width < imageRect.Height || pageRect.Width < pageRect.Height && imageRect.Width > imageRect.Height) { - bitmap.RotateFlip(RotateFlipType.Rotate270FlipNone); - imageRect = bitmap.GetBounds(ref gu); + bitmap.NativeBitmap.RotateFlip(RotateFlipType.Rotate270FlipNone); + imageRect = bitmap.NativeBitmap.GetBounds(ref gu); if (alignment.Equals(ContentAlignment.TopLeft)) { alignment = ContentAlignment.TopRight; @@ -267,7 +259,7 @@ namespace Greenshot.Helpers e.Graphics.DrawString(footerString, f, Brushes.Black, pageRect.Width / 2 - footerStringWidth / 2, pageRect.Height); } } - e.Graphics.DrawImage(bitmap, printRect, imageRect, GraphicsUnit.Pixel); + e.Graphics.DrawImage(bitmap.NativeBitmap, printRect, imageRect, GraphicsUnit.Pixel); } finally { diff --git a/src/Greenshot/Helpers/ScrollingCapture.cs b/src/Greenshot/Helpers/ScrollingCapture.cs index f603c4363..115bad11b 100644 --- a/src/Greenshot/Helpers/ScrollingCapture.cs +++ b/src/Greenshot/Helpers/ScrollingCapture.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Drawing; using System.Reactive.Linq; @@ -34,6 +30,7 @@ using Dapplo.Windows.Input.Keyboard; using Dapplo.Windows.User32; using Dapplo.Windows.User32.Enums; using Greenshot.Addons.Core; +using Greenshot.Gfx; using Greenshot.Gfx.Stitching; namespace Greenshot.Helpers @@ -67,7 +64,7 @@ namespace Greenshot.Helpers /// Start the capture /// /// Bitmap - public Bitmap Capture() + public IBitmapWithNativeSupport Capture() { if (_windowScroller.NeedsFocus()) { @@ -119,7 +116,7 @@ namespace Greenshot.Helpers args.Handled = true; breakScroll = true; }); - Bitmap resultImage = null; + IBitmapWithNativeSupport resultImage = null; try { // A delay to make the window move diff --git a/src/Greenshot/Helpers/StartupHelper.cs b/src/Greenshot/Helpers/StartupHelper.cs index 752a27a88..07a353947 100644 --- a/src/Greenshot/Helpers/StartupHelper.cs +++ b/src/Greenshot/Helpers/StartupHelper.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,18 +17,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.IO; using System.Windows.Forms; using Dapplo.Log; using Microsoft.Win32; -#endregion - namespace Greenshot.Helpers { /// diff --git a/src/Greenshot/Helpers/WindowWrapper.cs b/src/Greenshot/Helpers/WindowWrapper.cs index ae2dceda4..e63e98d9d 100644 --- a/src/Greenshot/Helpers/WindowWrapper.cs +++ b/src/Greenshot/Helpers/WindowWrapper.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using System.Windows.Forms; -#endregion - namespace Greenshot.Helpers { public class WindowWrapper : IWin32Window diff --git a/src/Greenshot/Processors/TitleFixProcessor.cs b/src/Greenshot/Processors/TitleFixProcessor.cs index 1a6bd21ae..d0a80bdac 100644 --- a/src/Greenshot/Processors/TitleFixProcessor.cs +++ b/src/Greenshot/Processors/TitleFixProcessor.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,19 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - -using System.Collections.Generic; using System.Text.RegularExpressions; -using Dapplo.Log; -using Greenshot.Addons.Config.Impl; using Greenshot.Addons.Core; using Greenshot.Addons.Interfaces; -#endregion - namespace Greenshot.Processors { /// diff --git a/src/Greenshot/Startup.cs b/src/Greenshot/Startup.cs index d460130dc..765d58824 100644 --- a/src/Greenshot/Startup.cs +++ b/src/Greenshot/Startup.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Diagnostics; using System.Drawing; diff --git a/src/Greenshot/Ui/Configuration/AddonDestinationsConfigNode.cs b/src/Greenshot/Ui/Configuration/AddonDestinationsConfigNode.cs index 048800cf6..9dea57bcb 100644 --- a/src/Greenshot/Ui/Configuration/AddonDestinationsConfigNode.cs +++ b/src/Greenshot/Ui/Configuration/AddonDestinationsConfigNode.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Dapplo.CaliburnMicro.Configuration; using Dapplo.CaliburnMicro.Extensions; using Greenshot.Addons; diff --git a/src/Greenshot/Ui/Configuration/CaptureConfigNode.cs b/src/Greenshot/Ui/Configuration/CaptureConfigNode.cs index 20153a59c..857b118d7 100644 --- a/src/Greenshot/Ui/Configuration/CaptureConfigNode.cs +++ b/src/Greenshot/Ui/Configuration/CaptureConfigNode.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Dapplo.CaliburnMicro.Configuration; using Dapplo.CaliburnMicro.Extensions; using Greenshot.Addons; diff --git a/src/Greenshot/Ui/Configuration/InternalDestinationsConfigNode.cs b/src/Greenshot/Ui/Configuration/InternalDestinationsConfigNode.cs index ca6280f29..a8b08edaa 100644 --- a/src/Greenshot/Ui/Configuration/InternalDestinationsConfigNode.cs +++ b/src/Greenshot/Ui/Configuration/InternalDestinationsConfigNode.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using Dapplo.CaliburnMicro.Configuration; using Dapplo.CaliburnMicro.Extensions; using Greenshot.Addons; diff --git a/src/Greenshot/Ui/Configuration/ViewModels/CaptureConfigViewModel.cs b/src/Greenshot/Ui/Configuration/ViewModels/CaptureConfigViewModel.cs index 48d5fdc32..c94ce813c 100644 --- a/src/Greenshot/Ui/Configuration/ViewModels/CaptureConfigViewModel.cs +++ b/src/Greenshot/Ui/Configuration/ViewModels/CaptureConfigViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Collections.Generic; using System.Reactive.Disposables; using Dapplo.CaliburnMicro.Configuration; diff --git a/src/Greenshot/Ui/Configuration/ViewModels/ClipboardDestinationConfigViewModel.cs b/src/Greenshot/Ui/Configuration/ViewModels/ClipboardDestinationConfigViewModel.cs index 690ef116b..713127f97 100644 --- a/src/Greenshot/Ui/Configuration/ViewModels/ClipboardDestinationConfigViewModel.cs +++ b/src/Greenshot/Ui/Configuration/ViewModels/ClipboardDestinationConfigViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Collections.ObjectModel; using System.Linq; diff --git a/src/Greenshot/Ui/Configuration/ViewModels/ConfigViewModel.cs b/src/Greenshot/Ui/Configuration/ViewModels/ConfigViewModel.cs index d487d94c6..d93da4146 100644 --- a/src/Greenshot/Ui/Configuration/ViewModels/ConfigViewModel.cs +++ b/src/Greenshot/Ui/Configuration/ViewModels/ConfigViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,15 +17,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Collections.Generic; using System.Reactive.Disposables; using System.Windows; using System.Windows.Controls; using Autofac.Features.OwnedInstances; -using Caliburn.Micro; using Dapplo.CaliburnMicro; using Dapplo.CaliburnMicro.Configuration; using Dapplo.CaliburnMicro.Extensions; @@ -44,8 +39,6 @@ namespace Greenshot.Ui.Configuration.ViewModels /// public sealed class ConfigViewModel : Config, IHaveIcon { - private readonly IEventAggregator _eventAggregator; - /// /// Here all disposables are registered, so we can clean the up /// @@ -70,11 +63,9 @@ namespace Greenshot.Ui.Configuration.ViewModels IEnumerable> configScreens, IGreenshotLanguage greenshotLanguage, IConfigTranslations configTranslations, - IEventAggregator eventAggregator, Func> updateNotificationViewModelFactory ) { - _eventAggregator = eventAggregator; ConfigScreens = configScreens; GreenshotLanguage = greenshotLanguage; ConfigTranslations = configTranslations; diff --git a/src/Greenshot/Ui/Configuration/ViewModels/DestinationPickerConfigViewModel.cs b/src/Greenshot/Ui/Configuration/ViewModels/DestinationPickerConfigViewModel.cs index 1e06a1d25..01f62e8a5 100644 --- a/src/Greenshot/Ui/Configuration/ViewModels/DestinationPickerConfigViewModel.cs +++ b/src/Greenshot/Ui/Configuration/ViewModels/DestinationPickerConfigViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Collections.ObjectModel; using System.Linq; using System.Reactive.Disposables; diff --git a/src/Greenshot/Ui/Configuration/ViewModels/GeneralConfigViewModel.cs b/src/Greenshot/Ui/Configuration/ViewModels/GeneralConfigViewModel.cs index 163ffdc0b..b4da0d7d6 100644 --- a/src/Greenshot/Ui/Configuration/ViewModels/GeneralConfigViewModel.cs +++ b/src/Greenshot/Ui/Configuration/ViewModels/GeneralConfigViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Reactive.Disposables; using Dapplo.CaliburnMicro.Configuration; using Dapplo.CaliburnMicro.Extensions; diff --git a/src/Greenshot/Ui/Configuration/ViewModels/NetworkConfigViewModel.cs b/src/Greenshot/Ui/Configuration/ViewModels/NetworkConfigViewModel.cs index ca1c1f954..59308618f 100644 --- a/src/Greenshot/Ui/Configuration/ViewModels/NetworkConfigViewModel.cs +++ b/src/Greenshot/Ui/Configuration/ViewModels/NetworkConfigViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Reactive.Disposables; using System.Windows; using Dapplo.CaliburnMicro.Configuration; diff --git a/src/Greenshot/Ui/Configuration/ViewModels/OutputConfigViewModel.cs b/src/Greenshot/Ui/Configuration/ViewModels/OutputConfigViewModel.cs index 57f9a1fc1..84a41348f 100644 --- a/src/Greenshot/Ui/Configuration/ViewModels/OutputConfigViewModel.cs +++ b/src/Greenshot/Ui/Configuration/ViewModels/OutputConfigViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Reactive.Disposables; using Dapplo.CaliburnMicro.Configuration; using Dapplo.CaliburnMicro.Extensions; diff --git a/src/Greenshot/Ui/Configuration/ViewModels/PrintConfigViewModel.cs b/src/Greenshot/Ui/Configuration/ViewModels/PrintConfigViewModel.cs index 97957303f..b4f1d4dac 100644 --- a/src/Greenshot/Ui/Configuration/ViewModels/PrintConfigViewModel.cs +++ b/src/Greenshot/Ui/Configuration/ViewModels/PrintConfigViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System.Reactive.Disposables; using Dapplo.CaliburnMicro.Configuration; using Dapplo.CaliburnMicro.Extensions; diff --git a/src/Greenshot/Ui/Configuration/ViewModels/UiConfigViewModel.cs b/src/Greenshot/Ui/Configuration/ViewModels/UiConfigViewModel.cs index dbff7a912..c19532d0f 100644 --- a/src/Greenshot/Ui/Configuration/ViewModels/UiConfigViewModel.cs +++ b/src/Greenshot/Ui/Configuration/ViewModels/UiConfigViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/src/Greenshot/Ui/Misc/ViewModels/ErrorViewModel.cs b/src/Greenshot/Ui/Misc/ViewModels/ErrorViewModel.cs index 3946c52e3..51adbf759 100644 --- a/src/Greenshot/Ui/Misc/ViewModels/ErrorViewModel.cs +++ b/src/Greenshot/Ui/Misc/ViewModels/ErrorViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,17 +17,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using System; using Caliburn.Micro; using Dapplo.CaliburnMicro; using Greenshot.Addons; -#endregion - namespace Greenshot.Ui.Misc.ViewModels { /// diff --git a/src/Greenshot/Ui/Misc/ViewModels/SplashViewModel.cs b/src/Greenshot/Ui/Misc/ViewModels/SplashViewModel.cs index deb221f1a..ddfeda2ae 100644 --- a/src/Greenshot/Ui/Misc/ViewModels/SplashViewModel.cs +++ b/src/Greenshot/Ui/Misc/ViewModels/SplashViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,16 +17,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - -#region Usings - using Caliburn.Micro; using Dapplo.CaliburnMicro; using Greenshot.Forms; -#endregion - namespace Greenshot.Ui.Misc.ViewModels { public class SplashViewModel : Screen, IShell diff --git a/src/Greenshot/Ui/Notifications/ViewModels/UpdateNotificationViewModel.cs b/src/Greenshot/Ui/Notifications/ViewModels/UpdateNotificationViewModel.cs index 5b1c8d3e8..f51e382bd 100644 --- a/src/Greenshot/Ui/Notifications/ViewModels/UpdateNotificationViewModel.cs +++ b/src/Greenshot/Ui/Notifications/ViewModels/UpdateNotificationViewModel.cs @@ -1,6 +1,4 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -19,8 +17,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#endregion - using System; using System.Diagnostics; using System.Windows.Media;