mirror of
https://github.com/greenshot/greenshot
synced 2025-08-21 14:03:23 -07:00
FEATURE-863: Trying to get it working in 1.2.9
This commit is contained in:
parent
a80e4e2a26
commit
f2f37700b3
11 changed files with 77 additions and 14 deletions
|
@ -51,8 +51,9 @@ namespace Greenshot.Drawing.Fields
|
|||
public static readonly IFieldType PREPARED_FILTER_OBFUSCATE = new FieldType("PREPARED_FILTER_OBFUSCATE");
|
||||
public static readonly IFieldType PREPARED_FILTER_HIGHLIGHT = new FieldType("PREPARED_FILTER_HIGHLIGHT");
|
||||
public static readonly IFieldType FLAGS = new FieldType("FLAGS");
|
||||
|
||||
public static IFieldType[] Values = new IFieldType[]{
|
||||
public static readonly IFieldType COUNTER_START = new FieldType("COUNTER_START");
|
||||
|
||||
public static IFieldType[] Values = {
|
||||
ARROWHEADS,
|
||||
BLUR_RADIUS,
|
||||
BRIGHTNESS,
|
||||
|
@ -72,7 +73,8 @@ namespace Greenshot.Drawing.Fields
|
|||
SHADOW,
|
||||
PREPARED_FILTER_OBFUSCATE,
|
||||
PREPARED_FILTER_HIGHLIGHT,
|
||||
FLAGS
|
||||
FLAGS,
|
||||
COUNTER_START
|
||||
};
|
||||
|
||||
public string Name
|
||||
|
|
|
@ -25,7 +25,6 @@ using Greenshot.Drawing.Fields;
|
|||
using Greenshot.Plugin.Drawing;
|
||||
using GreenshotPlugin.Core;
|
||||
using System.Drawing.Drawing2D;
|
||||
using Greenshot.Core;
|
||||
using log4net;
|
||||
using System.Runtime.Serialization;
|
||||
using GreenshotPlugin.Effects;
|
||||
|
|
|
@ -27,6 +27,7 @@ using System.Drawing;
|
|||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Text;
|
||||
using System.Runtime.Serialization;
|
||||
using GreenshotPlugin.Interfaces.Drawing;
|
||||
|
||||
namespace Greenshot.Drawing {
|
||||
/// <summary>
|
||||
|
@ -48,9 +49,19 @@ namespace Greenshot.Drawing {
|
|||
Init();
|
||||
}
|
||||
|
||||
private void UpdateCounterOnFieldChanged(object sender, FieldChangedEventArgs fieldChangedEventArgs)
|
||||
{
|
||||
if (Equals(fieldChangedEventArgs.Field.FieldType, FieldType.COUNTER_START))
|
||||
{
|
||||
Parent.CounterStart = (int)fieldChangedEventArgs.Field.Value;
|
||||
}
|
||||
}
|
||||
|
||||
private void Init()
|
||||
{
|
||||
CreateDefaultAdorners();
|
||||
FieldChanged -= UpdateCounterOnFieldChanged;
|
||||
FieldChanged += UpdateCounterOnFieldChanged;
|
||||
}
|
||||
|
||||
#region Number serializing
|
||||
|
@ -102,9 +113,14 @@ namespace Greenshot.Drawing {
|
|||
}
|
||||
((Surface) Parent)?.RemoveStepLabel(this);
|
||||
base.SwitchParent(newParent);
|
||||
if (Parent != null)
|
||||
{
|
||||
Parent.CounterStart = GetFieldValueAsInt(FieldType.COUNTER_START);
|
||||
}
|
||||
if (newParent != null) {
|
||||
((Surface)Parent)?.AddStepLabel(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override Size DefaultSize => new Size(30, 30);
|
||||
|
@ -134,6 +150,7 @@ namespace Greenshot.Drawing {
|
|||
protected override void InitializeFields() {
|
||||
AddField(GetType(), FieldType.FILL_COLOR, Color.DarkRed);
|
||||
AddField(GetType(), FieldType.LINE_COLOR, Color.White);
|
||||
AddField(GetType(), FieldType.COUNTER_START, 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
*/
|
||||
|
||||
using Greenshot.Configuration;
|
||||
using Greenshot.Core;
|
||||
using Greenshot.Drawing.Fields;
|
||||
using Greenshot.Helpers;
|
||||
using Greenshot.IniFile;
|
||||
|
@ -87,6 +86,7 @@ namespace Greenshot.Drawing
|
|||
_movingElementChanged -= value;
|
||||
}
|
||||
}
|
||||
|
||||
[NonSerialized]
|
||||
private SurfaceDrawingModeEventHandler _drawingModeChanged;
|
||||
public event SurfaceDrawingModeEventHandler DrawingModeChanged
|
||||
|
@ -228,6 +228,11 @@ namespace Greenshot.Drawing
|
|||
/// </summary>
|
||||
private readonly List<StepLabelContainer> _stepLabels = new List<StepLabelContainer>();
|
||||
|
||||
/// <summary>
|
||||
/// This value is used to start counting the step labels
|
||||
/// </summary>
|
||||
private int _counterStart = 1;
|
||||
|
||||
public void AddStepLabel(StepLabelContainer stepLabel)
|
||||
{
|
||||
if (!_stepLabels.Contains(stepLabel))
|
||||
|
@ -235,11 +240,28 @@ namespace Greenshot.Drawing
|
|||
_stepLabels.Add(stepLabel);
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveStepLabel(StepLabelContainer stepLabel)
|
||||
{
|
||||
_stepLabels.Remove(stepLabel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The start value of the counter objects
|
||||
/// </summary>
|
||||
public int CounterStart
|
||||
{
|
||||
get { return _counterStart; }
|
||||
set
|
||||
{
|
||||
if (_counterStart != value)
|
||||
{
|
||||
_counterStart = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Count all the VISIBLE steplabels in the surface, up to the supplied one
|
||||
/// </summary>
|
||||
|
@ -247,7 +269,7 @@ namespace Greenshot.Drawing
|
|||
/// <returns>number of steplabels before the supplied container</returns>
|
||||
public int CountStepLabels(IDrawableContainer stopAtContainer)
|
||||
{
|
||||
int number = 1;
|
||||
int number = CounterStart;
|
||||
foreach (var possibleThis in _stepLabels)
|
||||
{
|
||||
if (possibleThis.Equals(stopAtContainer))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue