mirror of
https://github.com/greenshot/greenshot
synced 2025-08-19 21:13:23 -07:00
BUG-1812 storing a windows placement and than using this later causes issues when the location is actually outside of the screen. This should fix it.
This commit is contained in:
parent
aa3df02e3f
commit
789334c193
2 changed files with 22 additions and 5 deletions
|
@ -119,6 +119,15 @@ namespace Greenshot.Configuration {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ResetEditorPlacement()
|
||||||
|
{
|
||||||
|
WindowNormalPosition = new Rectangle(100, 100, 400, 400);
|
||||||
|
WindowMaxPosition = new Point(-1,-1);
|
||||||
|
WindowMinPosition = new Point(-1, -1);
|
||||||
|
WindowPlacementFlags = 0;
|
||||||
|
ShowWindowCommand = ShowWindowCommand.Normal;
|
||||||
|
}
|
||||||
|
|
||||||
public WindowPlacement GetEditorPlacement() {
|
public WindowPlacement GetEditorPlacement() {
|
||||||
WindowPlacement placement = WindowPlacement.Default;
|
WindowPlacement placement = WindowPlacement.Default;
|
||||||
placement.NormalPosition = new RECT(WindowNormalPosition);
|
placement.NormalPosition = new RECT(WindowNormalPosition);
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace Greenshot {
|
||||||
get {
|
get {
|
||||||
try {
|
try {
|
||||||
EditorList.Sort(delegate(IImageEditor e1, IImageEditor e2) {
|
EditorList.Sort(delegate(IImageEditor e1, IImageEditor e2) {
|
||||||
return String.Compare(e1.Surface.CaptureDetails.Title, e2.Surface.CaptureDetails.Title, StringComparison.Ordinal);
|
return string.Compare(e1.Surface.CaptureDetails.Title, e2.Surface.CaptureDetails.Title, StringComparison.Ordinal);
|
||||||
});
|
});
|
||||||
} catch(Exception ex) {
|
} catch(Exception ex) {
|
||||||
LOG.Warn("Sorting of editors failed.", ex);
|
LOG.Warn("Sorting of editors failed.", ex);
|
||||||
|
@ -104,6 +104,14 @@ namespace Greenshot {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Make sure the editor is placed on the same location as the last editor was on close
|
// Make sure the editor is placed on the same location as the last editor was on close
|
||||||
|
// But only if this still exists, else it will be reset (BUG-1812
|
||||||
|
WindowPlacement editorWindowPlacement = EditorConfiguration.GetEditorPlacement();
|
||||||
|
Rectangle screenbounds = WindowCapture.GetScreenBounds();
|
||||||
|
if (!screenbounds.Contains(editorWindowPlacement.NormalPosition))
|
||||||
|
{
|
||||||
|
EditorConfiguration.ResetEditorPlacement();
|
||||||
|
}
|
||||||
|
// ReSharper disable once UnusedVariable
|
||||||
WindowDetails thisForm = new WindowDetails(Handle)
|
WindowDetails thisForm = new WindowDetails(Handle)
|
||||||
{
|
{
|
||||||
WindowPlacement = EditorConfiguration.GetEditorPlacement()
|
WindowPlacement = EditorConfiguration.GetEditorPlacement()
|
||||||
|
@ -145,7 +153,10 @@ namespace Greenshot {
|
||||||
panel1.Height = 10;
|
panel1.Height = 10;
|
||||||
panel1.Width = 10;
|
panel1.Width = 10;
|
||||||
_surface = newSurface as Surface;
|
_surface = newSurface as Surface;
|
||||||
panel1.Controls.Add(_surface);
|
if (_surface != null)
|
||||||
|
{
|
||||||
|
panel1.Controls.Add(_surface);
|
||||||
|
}
|
||||||
Image backgroundForTransparency = GreenshotResources.getImage("Checkerboard.Image");
|
Image backgroundForTransparency = GreenshotResources.getImage("Checkerboard.Image");
|
||||||
if (_surface != null)
|
if (_surface != null)
|
||||||
{
|
{
|
||||||
|
@ -375,9 +386,6 @@ namespace Greenshot {
|
||||||
// Change title
|
// Change title
|
||||||
Text = eventArgs.Surface.LastSaveFullPath + " - " + Language.GetString(LangKey.editor_title);
|
Text = eventArgs.Surface.LastSaveFullPath + " - " + Language.GetString(LangKey.editor_title);
|
||||||
break;
|
break;
|
||||||
case SurfaceMessageTyp.Error:
|
|
||||||
case SurfaceMessageTyp.Info:
|
|
||||||
case SurfaceMessageTyp.UploadedUri:
|
|
||||||
default:
|
default:
|
||||||
// Put the event message on the status label
|
// Put the event message on the status label
|
||||||
updateStatusLabel(dateTime + " - " + eventArgs.Message);
|
updateStatusLabel(dateTime + " - " + eventArgs.Message);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue