From fc7faecaa569c73c6922aa741455844eaece7749 Mon Sep 17 00:00:00 2001 From: RKrom Date: Mon, 3 Nov 2014 14:25:14 +0100 Subject: [PATCH] FEATURE-757: Store the last region in the greenshot.ini so it's available after a restart. --- Greenshot/Configuration/RuntimeConfig.cs | 34 ------------------- Greenshot/Greenshot.csproj | 1 - Greenshot/Helpers/CaptureHelper.cs | 10 +++--- .../additional_files/readme.txt.template | 2 ++ GreenshotPlugin/Core/CoreConfiguration.cs | 7 ++++ 5 files changed, 14 insertions(+), 40 deletions(-) delete mode 100644 Greenshot/Configuration/RuntimeConfig.cs diff --git a/Greenshot/Configuration/RuntimeConfig.cs b/Greenshot/Configuration/RuntimeConfig.cs deleted file mode 100644 index 4d8330e94..000000000 --- a/Greenshot/Configuration/RuntimeConfig.cs +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Greenshot - a free and open source screenshot tool - * Copyright (C) 2007-2014 Thomas Braun, Jens Klingen, Robin Krom - * - * For more information see: http://getgreenshot.org/ - * The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/ - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 1 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using System.Drawing; - -namespace Greenshot.Configuration { - /// - /// Greenshot's runtime configuration - /// abstract, all properties are public and static - /// - public abstract class RuntimeConfig { - public static string[] SupportedLanguages = {"en-US","de-DE","nl-NL"}; - public static string BugTrackerUrl = "https://sourceforge.net/tracker/?func=postadd&group_id=191585&atid=937972&summary=%SUMMARY%&details=%DETAILS%"; - public static Rectangle LastCapturedRegion = Rectangle.Empty; - } -} diff --git a/Greenshot/Greenshot.csproj b/Greenshot/Greenshot.csproj index 31fe29a9e..b30be6f5e 100644 --- a/Greenshot/Greenshot.csproj +++ b/Greenshot/Greenshot.csproj @@ -32,7 +32,6 @@ - Component diff --git a/Greenshot/Helpers/CaptureHelper.cs b/Greenshot/Helpers/CaptureHelper.cs index e627b85af..6ed35a89a 100644 --- a/Greenshot/Helpers/CaptureHelper.cs +++ b/Greenshot/Helpers/CaptureHelper.cs @@ -403,8 +403,8 @@ namespace Greenshot.Helpers { } break; case CaptureMode.LastRegion: - if (!RuntimeConfig.LastCapturedRegion.IsEmpty) { - _capture = WindowCapture.CaptureRectangle(_capture, RuntimeConfig.LastCapturedRegion); + if (!conf.LastCapturedRegion.IsEmpty) { + _capture = WindowCapture.CaptureRectangle(_capture, conf.LastCapturedRegion); // TODO: Reactive / check if the elements code is activated //if (windowDetailsThread != null) { // windowDetailsThread.Join(); @@ -412,7 +412,7 @@ namespace Greenshot.Helpers { // Set capture title, fixing bug #3569703 foreach (WindowDetails window in WindowDetails.GetVisibleWindows()) { - Point estimatedLocation = new Point(RuntimeConfig.LastCapturedRegion.X + (RuntimeConfig.LastCapturedRegion.Width / 2), RuntimeConfig.LastCapturedRegion.Y + (RuntimeConfig.LastCapturedRegion.Height / 2)); + Point estimatedLocation = new Point(conf.LastCapturedRegion.X + (conf.LastCapturedRegion.Width / 2), conf.LastCapturedRegion.Y + (conf.LastCapturedRegion.Height / 2)); if (window.Contains(estimatedLocation)) { _selectedCaptureWindow = window; _capture.CaptureDetails.Title = _selectedCaptureWindow.Text; @@ -718,7 +718,7 @@ namespace Greenshot.Helpers { return false; } // Fix for Bug #3430560 - RuntimeConfig.LastCapturedRegion = _selectedCaptureWindow.WindowRectangle; + conf.LastCapturedRegion = _selectedCaptureWindow.WindowRectangle; bool returnValue = CaptureWindow(_selectedCaptureWindow, _capture, conf.WindowCaptureMode) != null; return returnValue; } @@ -970,7 +970,7 @@ namespace Greenshot.Helpers { // Important here is that the location needs to be offsetted back to screen coordinates! Rectangle tmpRectangle = _captureRect; tmpRectangle.Offset(_capture.ScreenBounds.Location.X, _capture.ScreenBounds.Location.Y); - RuntimeConfig.LastCapturedRegion = tmpRectangle; + conf.LastCapturedRegion = tmpRectangle; HandleCapture(); } } diff --git a/Greenshot/releases/additional_files/readme.txt.template b/Greenshot/releases/additional_files/readme.txt.template index 8eaeb9cff..18acc3324 100644 --- a/Greenshot/releases/additional_files/readme.txt.template +++ b/Greenshot/releases/additional_files/readme.txt.template @@ -10,9 +10,11 @@ CHANGE LOG: Features: * Due to BUG-1667 we had to remove the horizontal text alignment, this afflicts the textbox and the speech bubble. * Added the possibility to select the region to capture by using the keyboard, use the cursor keys to move the cursor (ctrl-key speeds up the movement) and the enter key to mark the start and ending. +* FEATURE-757: Greenshot will now store the last used region in the greenshot.ini, which makes it also available after a restart. Changes: * JIRA: With JIRA 6.x using the SOAP (Webservice) API the access has gotten really slow, we improved the performance slightly by loading some information parallel. (In Greenshot 2.x we will move to another API.) +* Editor: Due to the amount of high DPI screens, we are testing the possibility to change the icon size. Look for the ButtonIconSize in the editor section of the greenshot.ini. Disadvantage: As the icons are bitmaps, enlarging them does look ugly. Bugs Resolved: * BUG-1667: removed horizontal alignment of textbox in input mode, as it caused problems with textbox focus and could not be implemented consistently anyway (no vertical alignment possible) diff --git a/GreenshotPlugin/Core/CoreConfiguration.cs b/GreenshotPlugin/Core/CoreConfiguration.cs index 4bd5e7172..51efd62f6 100644 --- a/GreenshotPlugin/Core/CoreConfiguration.cs +++ b/GreenshotPlugin/Core/CoreConfiguration.cs @@ -253,6 +253,9 @@ namespace GreenshotPlugin.Core { [IniProperty("ProcessEXIFOrientation", Description = "When reading images from files or clipboard, use the EXIF information to correct the orientation", DefaultValue = "True")] public bool ProcessEXIFOrientation; + [IniProperty("LastCapturedRegion", Description = "The last used region, for reuse in the capture last region")] + public Rectangle LastCapturedRegion; + // Specifies what THIS build is public BuildStates BuildState = BuildStates.RELEASE_CANDIDATE; @@ -429,6 +432,10 @@ namespace GreenshotPlugin.Core { if (OutputFileReduceColorsTo > 256) { OutputFileReduceColorsTo = 256; } + + if (ContextMenuIconSize == Size.Empty) { + ContextMenuIconSize = new Size(16,16); + } } } } \ No newline at end of file