mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 10:47:02 -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
|
@ -25,7 +25,6 @@ using System.Drawing;
|
|||
using Greenshot.Drawing.Fields;
|
||||
using GreenshotPlugin.UnmanagedHelpers;
|
||||
using Greenshot.IniFile;
|
||||
using Greenshot.Core;
|
||||
using GreenshotPlugin.Effects;
|
||||
using GreenshotPlugin.Interfaces.Drawing;
|
||||
|
||||
|
|
|
@ -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))
|
||||
|
|
27
Greenshot/Forms/ImageEditorForm.Designer.cs
generated
27
Greenshot/Forms/ImageEditorForm.Designer.cs
generated
|
@ -152,6 +152,8 @@ namespace Greenshot {
|
|||
this.btnLineColor = new Greenshot.Controls.ToolStripColorButton();
|
||||
this.lineThicknessLabel = new GreenshotPlugin.Controls.GreenshotToolStripLabel();
|
||||
this.lineThicknessUpDown = new Greenshot.Controls.ToolStripNumericUpDown();
|
||||
this.counterLabel = new GreenshotPlugin.Controls.GreenshotToolStripLabel();
|
||||
this.counterUpDown = new Greenshot.Controls.ToolStripNumericUpDown();
|
||||
this.fontFamilyComboBox = new Greenshot.Controls.FontFamilyComboBox();
|
||||
this.fontSizeLabel = new GreenshotPlugin.Controls.GreenshotToolStripLabel();
|
||||
this.fontSizeUpDown = new Greenshot.Controls.ToolStripNumericUpDown();
|
||||
|
@ -1053,7 +1055,9 @@ namespace Greenshot {
|
|||
this.toolStripSeparator,
|
||||
this.toolStripSeparator10,
|
||||
this.btnConfirm,
|
||||
this.btnCancel});
|
||||
this.btnCancel,
|
||||
this.counterLabel,
|
||||
this.counterUpDown});
|
||||
//
|
||||
// obfuscateModeButton
|
||||
//
|
||||
|
@ -1143,6 +1147,23 @@ namespace Greenshot {
|
|||
this.btnLineColor.Name = "btnLineColor";
|
||||
this.btnLineColor.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(203)))), ((int)(((byte)(222)))), ((int)(((byte)(250)))));
|
||||
//
|
||||
// counterLabel
|
||||
//
|
||||
this.counterLabel.LanguageKey = "editor_counter_startvalue";
|
||||
this.counterLabel.Name = "counterLabel";
|
||||
//
|
||||
// counterUpDown
|
||||
//
|
||||
this.counterUpDown.DecimalPlaces = 0;
|
||||
this.counterUpDown.Increment = 1;
|
||||
this.counterUpDown.Maximum = 100;
|
||||
this.counterUpDown.Minimum = 0;
|
||||
this.counterUpDown.Name = "counterUpDown";
|
||||
this.counterUpDown.Text = "1";
|
||||
this.counterUpDown.Value = 1;
|
||||
this.counterUpDown.GotFocus += new System.EventHandler(this.ToolBarFocusableElementGotFocus);
|
||||
this.counterUpDown.LostFocus += new System.EventHandler(this.ToolBarFocusableElementLostFocus);
|
||||
//
|
||||
// lineThicknessLabel
|
||||
//
|
||||
this.lineThicknessLabel.LanguageKey = "editor_thickness";
|
||||
|
@ -1691,6 +1712,8 @@ namespace Greenshot {
|
|||
private Greenshot.Controls.ToolStripEx propertiesToolStrip;
|
||||
private GreenshotPlugin.Controls.GreenshotToolStripLabel lineThicknessLabel;
|
||||
private Greenshot.Controls.ToolStripNumericUpDown lineThicknessUpDown;
|
||||
private GreenshotPlugin.Controls.GreenshotToolStripLabel counterLabel;
|
||||
private Greenshot.Controls.ToolStripNumericUpDown counterUpDown;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator14;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator15;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator16;
|
||||
|
@ -1736,7 +1759,7 @@ namespace Greenshot {
|
|||
private GreenshotPlugin.Controls.GreenshotToolStripMenuItem removeObjectToolStripMenuItem;
|
||||
private GreenshotPlugin.Controls.GreenshotToolStripMenuItem addTextBoxToolStripMenuItem;
|
||||
private GreenshotPlugin.Controls.GreenshotToolStripMenuItem addSpeechBubbleToolStripMenuItem;
|
||||
private GreenshotPlugin.Controls.GreenshotToolStripMenuItem addCounterToolStripMenuItem;
|
||||
private GreenshotPlugin.Controls.GreenshotToolStripMenuItem addCounterToolStripMenuItem;
|
||||
private GreenshotPlugin.Controls.GreenshotToolStripMenuItem addEllipseToolStripMenuItem;
|
||||
private GreenshotPlugin.Controls.GreenshotToolStripMenuItem addRectangleToolStripMenuItem;
|
||||
private GreenshotPlugin.Controls.GreenshotToolStripMenuItem objectToolStripMenuItem;
|
||||
|
|
|
@ -1033,8 +1033,9 @@ namespace Greenshot {
|
|||
new BidirectionalBinding(previewQualityUpDown, "Value", _surface.FieldAggregator.GetField(FieldType.PREVIEW_QUALITY), "Value", DecimalDoublePercentageConverter.GetInstance(), NotNullValidator.GetInstance());
|
||||
new BidirectionalBinding(obfuscateModeButton, "SelectedTag", _surface.FieldAggregator.GetField(FieldType.PREPARED_FILTER_OBFUSCATE), "Value");
|
||||
new BidirectionalBinding(highlightModeButton, "SelectedTag", _surface.FieldAggregator.GetField(FieldType.PREPARED_FILTER_HIGHLIGHT), "Value");
|
||||
new BidirectionalBinding(counterUpDown, "Value", _surface.FieldAggregator.GetField(FieldType.COUNTER_START), "Value", DecimalIntConverter.GetInstance(), NotNullValidator.GetInstance());
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// shows/hides field controls (2nd toolbar on top) depending on fields of selected elements
|
||||
/// </summary>
|
||||
|
@ -1058,6 +1059,7 @@ namespace Greenshot {
|
|||
textHorizontalAlignmentButton.Visible = props.HasFieldValue(FieldType.TEXT_HORIZONTAL_ALIGNMENT);
|
||||
textVerticalAlignmentButton.Visible = props.HasFieldValue(FieldType.TEXT_VERTICAL_ALIGNMENT);
|
||||
shadowButton.Visible = props.HasFieldValue(FieldType.SHADOW);
|
||||
counterLabel.Visible = counterUpDown.Visible = props.HasFieldValue(FieldType.COUNTER_START);
|
||||
btnConfirm.Visible = btnCancel.Visible = props.HasFieldValue(FieldType.FLAGS)
|
||||
&& ((FieldFlag)props.GetFieldValue(FieldType.FLAGS) & FieldFlag.CONFIRMABLE) == FieldFlag.CONFIRMABLE;
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ using System.Windows.Forms;
|
|||
using Greenshot.IniFile;
|
||||
using Greenshot.Plugin;
|
||||
using GreenshotPlugin.Core;
|
||||
using Greenshot.Core;
|
||||
using GreenshotPlugin.Effects;
|
||||
|
||||
//using Microsoft.Win32;
|
||||
|
|
|
@ -27,7 +27,6 @@ using System.Drawing.Imaging;
|
|||
using System.IO;
|
||||
using Greenshot.IniFile;
|
||||
using GreenshotPlugin.UnmanagedHelpers;
|
||||
using Greenshot.Core;
|
||||
using Greenshot.Plugin;
|
||||
using GreenshotPlugin.Effects;
|
||||
using log4net;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
using Greenshot.Core;
|
||||
|
||||
using Greenshot.Memento;
|
||||
using Greenshot.Plugin.Drawing;
|
||||
using System;
|
||||
|
@ -111,6 +111,8 @@ namespace Greenshot.Plugin
|
|||
event SurfaceDrawingModeEventHandler DrawingModeChanged;
|
||||
event SurfaceElementEventHandler MovingElementChanged;
|
||||
|
||||
int CounterStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Unique ID of the Surface
|
||||
/// </summary>
|
||||
|
|
|
@ -25,7 +25,6 @@ using System.Windows.Forms;
|
|||
|
||||
using GreenshotPlugin.Core;
|
||||
using Greenshot.IniFile;
|
||||
using Greenshot.Core;
|
||||
using GreenshotPlugin.Effects;
|
||||
|
||||
namespace Greenshot.Plugin {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue