diff --git a/Greenshot/Drawing/StepLabelContainer.cs b/Greenshot/Drawing/StepLabelContainer.cs index 8775e8d43..5994bf617 100644 --- a/Greenshot/Drawing/StepLabelContainer.cs +++ b/Greenshot/Drawing/StepLabelContainer.cs @@ -57,6 +57,8 @@ namespace Greenshot.Drawing { #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 private int _number; + // Used to store the counter start of the Surface, as the surface is NOT stored. + private int _counterStart = 1; public int Number { get { return _number; @@ -74,6 +76,7 @@ namespace Greenshot.Drawing { private void SetValuesOnSerializing(StreamingContext context) { if (Parent != null) { Number = ((Surface)Parent).CountStepLabels(this); + _counterStart = ((Surface) Parent).CounterStart; } } #endregion @@ -90,6 +93,7 @@ namespace Greenshot.Drawing { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }; + } /// @@ -103,10 +107,13 @@ namespace Greenshot.Drawing { } ((Surface) Parent)?.RemoveStepLabel(this); base.SwitchParent(newParent); - if (newParent != null) { - ((Surface)Parent)?.AddStepLabel(this); + if (newParent == null) + { + return; } - + // Make sure the counter start is restored (this unfortunately happens multiple times... -> hack) + newParent.CounterStart = _counterStart; + newParent.AddStepLabel(this); } public override Size DefaultSize => new Size(30, 30); diff --git a/Greenshot/Drawing/Surface.cs b/Greenshot/Drawing/Surface.cs index d12ae30bf..b24f26dab 100644 --- a/Greenshot/Drawing/Surface.cs +++ b/Greenshot/Drawing/Surface.cs @@ -269,12 +269,14 @@ namespace Greenshot.Drawing get { return _counterStart; } set { - if (_propertyChanged != null && _counterStart != value) + if (_counterStart == value) { - _counterStart = value; - _propertyChanged(this, new PropertyChangedEventArgs("CounterStart")); - Invalidate(); + return; } + + _counterStart = value; + Invalidate(); + _propertyChanged?.Invoke(this, new PropertyChangedEventArgs("CounterStart")); } } diff --git a/Greenshot/Forms/ImageEditorForm.cs b/Greenshot/Forms/ImageEditorForm.cs index 133112824..d64f9a863 100644 --- a/Greenshot/Forms/ImageEditorForm.cs +++ b/Greenshot/Forms/ImageEditorForm.cs @@ -207,6 +207,8 @@ namespace Greenshot { // Workaround: for the MouseWheel event which doesn't get to the panel MouseWheel += PanelMouseWheel; + // Make sure the value is set correctly when starting + counterUpDown.Value = Surface.CounterStart; ApplyLanguage(); } diff --git a/GreenshotJiraPlugin/GreenshotJiraPlugin.csproj b/GreenshotJiraPlugin/GreenshotJiraPlugin.csproj index af2e4453c..fe5838095 100644 --- a/GreenshotJiraPlugin/GreenshotJiraPlugin.csproj +++ b/GreenshotJiraPlugin/GreenshotJiraPlugin.csproj @@ -49,8 +49,8 @@ ..\Greenshot\Lib\log4net.dll - - ..\packages\Svg.2.2.1\lib\net35\Svg.dll + + ..\packages\Svg.2.2.2\lib\net35\Svg.dll True diff --git a/GreenshotJiraPlugin/packages.config b/GreenshotJiraPlugin/packages.config index bfe2a551d..fade6b5dd 100644 --- a/GreenshotJiraPlugin/packages.config +++ b/GreenshotJiraPlugin/packages.config @@ -4,5 +4,5 @@ - + \ No newline at end of file diff --git a/GreenshotPlugin/Interfaces/Generic.cs b/GreenshotPlugin/Interfaces/Generic.cs index 30dff7583..4fc2da7aa 100644 --- a/GreenshotPlugin/Interfaces/Generic.cs +++ b/GreenshotPlugin/Interfaces/Generic.cs @@ -111,6 +111,9 @@ namespace Greenshot.Plugin event SurfaceDrawingModeEventHandler DrawingModeChanged; event SurfaceElementEventHandler MovingElementChanged; + /// + /// Start valueof the step-labels (counts) + /// int CounterStart { get; set; } ///