|
@@ -8,11 +8,15 @@ using ComPDFKitViewer.Annot;
|
|
using System;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
using System.IO.Ports;
|
|
using System.IO.Ports;
|
|
|
|
+using System.Linq;
|
|
using System.Windows;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media;
|
|
using Compdfkit_Tools.Helper;
|
|
using Compdfkit_Tools.Helper;
|
|
using ComPDFKit.PDFAnnotation;
|
|
using ComPDFKit.PDFAnnotation;
|
|
|
|
+using ComPDFKit.Tool.Help;
|
|
|
|
+using ComPDFKit.Tool.UndoManger;
|
|
|
|
+using ComPDFKitViewer.Helper;
|
|
|
|
|
|
namespace Compdfkit_Tools.PDFControlUI
|
|
namespace Compdfkit_Tools.PDFControlUI
|
|
{
|
|
{
|
|
@@ -41,6 +45,23 @@ namespace Compdfkit_Tools.PDFControlUI
|
|
CPDFAnnotationPreviewerControl.DrawShapePreview(GetShapeData());
|
|
CPDFAnnotationPreviewerControl.DrawShapePreview(GetShapeData());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private AnnotHistory GetHistory()
|
|
|
|
+ {
|
|
|
|
+ if (annotCore != null && annotCore.IsValid())
|
|
|
|
+ {
|
|
|
|
+ switch (annotCore.Type)
|
|
|
|
+ {
|
|
|
|
+ case C_ANNOTATION_TYPE.C_ANNOTATION_SQUARE:
|
|
|
|
+ return new SquareAnnotHistory();
|
|
|
|
+ case C_ANNOTATION_TYPE.C_ANNOTATION_CIRCLE:
|
|
|
|
+ return new CircleAnnotHistory();
|
|
|
|
+ case C_ANNOTATION_TYPE.C_ANNOTATION_LINE:
|
|
|
|
+ return new LineAnnotHistory();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return new AnnotHistory();
|
|
|
|
+ }
|
|
|
|
+
|
|
private void BorderColorPickerControl_ColorChanged(object sender, EventArgs e)
|
|
private void BorderColorPickerControl_ColorChanged(object sender, EventArgs e)
|
|
{
|
|
{
|
|
if (annotParam == null)
|
|
if (annotParam == null)
|
|
@@ -52,41 +73,46 @@ namespace Compdfkit_Tools.PDFControlUI
|
|
SolidColorBrush borderBrush=BorderColorPickerControl.Brush as SolidColorBrush;
|
|
SolidColorBrush borderBrush=BorderColorPickerControl.Brush as SolidColorBrush;
|
|
if(annotCore!=null && annotCore.IsValid() && borderBrush!=null)
|
|
if(annotCore!=null && annotCore.IsValid() && borderBrush!=null)
|
|
{
|
|
{
|
|
- if(annotCore.Type==C_ANNOTATION_TYPE.C_ANNOTATION_SQUARE)
|
|
|
|
|
|
+ byte[] color = new byte[3]
|
|
{
|
|
{
|
|
- CPDFSquareAnnotation squareAnnot = annotCore as CPDFSquareAnnotation;
|
|
|
|
- squareAnnot?.SetLineColor(new byte[3]
|
|
|
|
- {
|
|
|
|
- borderBrush.Color.R,
|
|
|
|
- borderBrush.Color.G,
|
|
|
|
- borderBrush.Color.B
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if(annotCore.Type==C_ANNOTATION_TYPE.C_ANNOTATION_CIRCLE)
|
|
|
|
|
|
+ borderBrush.Color.R,
|
|
|
|
+ borderBrush.Color.G,
|
|
|
|
+ borderBrush.Color.B
|
|
|
|
+ };
|
|
|
|
+ if (viewControl != null)
|
|
{
|
|
{
|
|
- CPDFCircleAnnotation circleAnnot= annotCore as CPDFCircleAnnotation;
|
|
|
|
- circleAnnot?.SetLineColor(new byte[3]
|
|
|
|
|
|
+ AnnotHistory history = GetHistory();
|
|
|
|
+ history.PDFDoc = viewControl.GetCPDFViewer().GetDocument();
|
|
|
|
+ history.Action = HistoryAction.Update;
|
|
|
|
+ if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_SQUARE)
|
|
{
|
|
{
|
|
- borderBrush.Color.R,
|
|
|
|
- borderBrush.Color.G,
|
|
|
|
- borderBrush.Color.B
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ CPDFSquareAnnotation squareAnnot = annotCore as CPDFSquareAnnotation;
|
|
|
|
+ if (squareAnnot == null || squareAnnot.LineColor.SequenceEqual(color)) return;
|
|
|
|
+ history.PreviousParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, squareAnnot);
|
|
|
|
+ squareAnnot?.SetLineColor(color);
|
|
|
|
+ history.CurrentParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, squareAnnot);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
- if(annotCore.Type==C_ANNOTATION_TYPE.C_ANNOTATION_LINE)
|
|
|
|
- {
|
|
|
|
- CPDFLineAnnotation lineAnnot = annotCore as CPDFLineAnnotation;
|
|
|
|
- lineAnnot?.SetLineColor(new byte[3]
|
|
|
|
|
|
+ if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_CIRCLE)
|
|
{
|
|
{
|
|
- borderBrush.Color.R,
|
|
|
|
- borderBrush.Color.G,
|
|
|
|
- borderBrush.Color.B
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ CPDFCircleAnnotation circleAnnot = annotCore as CPDFCircleAnnotation;
|
|
|
|
+ if (circleAnnot == null || circleAnnot.LineColor.SequenceEqual(color)) return;
|
|
|
|
+ history.PreviousParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, circleAnnot);
|
|
|
|
+ circleAnnot?.SetLineColor(color);
|
|
|
|
+ history.CurrentParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, circleAnnot);
|
|
|
|
+ }
|
|
|
|
|
|
- if (viewControl != null && viewControl.PDFViewTool != null)
|
|
|
|
- {
|
|
|
|
|
|
+ if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_LINE)
|
|
|
|
+ {
|
|
|
|
+ CPDFLineAnnotation lineAnnot = annotCore as CPDFLineAnnotation;
|
|
|
|
+ if (lineAnnot == null || lineAnnot.LineColor.SequenceEqual(color)) return;
|
|
|
|
+ history.PreviousParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, lineAnnot);
|
|
|
|
+ lineAnnot?.SetLineColor(color);
|
|
|
|
+ history.CurrentParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, lineAnnot);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ viewControl.GetCPDFViewer().UndoManager.AddHistory(history);
|
|
viewControl.UpdateAnnotFrame();
|
|
viewControl.UpdateAnnotFrame();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -105,41 +131,44 @@ namespace Compdfkit_Tools.PDFControlUI
|
|
SolidColorBrush fillBrush = FillColorPickerControl.Brush as SolidColorBrush;
|
|
SolidColorBrush fillBrush = FillColorPickerControl.Brush as SolidColorBrush;
|
|
if (annotCore != null && annotCore.IsValid() && fillBrush != null)
|
|
if (annotCore != null && annotCore.IsValid() && fillBrush != null)
|
|
{
|
|
{
|
|
- if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_SQUARE)
|
|
|
|
|
|
+ byte[] color = new byte[3]
|
|
{
|
|
{
|
|
- CPDFSquareAnnotation squareAnnot = annotCore as CPDFSquareAnnotation;
|
|
|
|
- squareAnnot?.SetBgColor(new byte[3]
|
|
|
|
- {
|
|
|
|
- fillBrush.Color.R,
|
|
|
|
- fillBrush.Color.G,
|
|
|
|
- fillBrush.Color.B
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_CIRCLE)
|
|
|
|
|
|
+ fillBrush.Color.R,
|
|
|
|
+ fillBrush.Color.G,
|
|
|
|
+ fillBrush.Color.B
|
|
|
|
+ };
|
|
|
|
+ if (viewControl != null && viewControl.PDFViewTool != null)
|
|
{
|
|
{
|
|
- CPDFCircleAnnotation circleAnnot = annotCore as CPDFCircleAnnotation;
|
|
|
|
- circleAnnot?.SetBgColor(new byte[3]
|
|
|
|
|
|
+ AnnotHistory history = GetHistory();
|
|
|
|
+ history.PDFDoc = viewControl.GetCPDFViewer().GetDocument();
|
|
|
|
+ history.Action = HistoryAction.Update;
|
|
|
|
+ if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_SQUARE)
|
|
{
|
|
{
|
|
- fillBrush.Color.R,
|
|
|
|
- fillBrush.Color.G,
|
|
|
|
- fillBrush.Color.B
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ CPDFSquareAnnotation squareAnnot = annotCore as CPDFSquareAnnotation;
|
|
|
|
+ if (squareAnnot == null || squareAnnot.BgColor.SequenceEqual(color)) return;
|
|
|
|
+ history.PreviousParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, squareAnnot);
|
|
|
|
+ squareAnnot?.SetBgColor(color);
|
|
|
|
+ history.CurrentParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, squareAnnot);
|
|
|
|
+ }
|
|
|
|
|
|
- if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_LINE)
|
|
|
|
- {
|
|
|
|
- CPDFLineAnnotation lineAnnot = annotCore as CPDFLineAnnotation;
|
|
|
|
- lineAnnot?.SetBgColor(new byte[3]
|
|
|
|
|
|
+ if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_CIRCLE)
|
|
{
|
|
{
|
|
- fillBrush.Color.R,
|
|
|
|
- fillBrush.Color.G,
|
|
|
|
- fillBrush.Color.B
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ CPDFCircleAnnotation circleAnnot = annotCore as CPDFCircleAnnotation;
|
|
|
|
+ if (circleAnnot == null || circleAnnot.BgColor.SequenceEqual(color)) return;
|
|
|
|
+ history.PreviousParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, circleAnnot);
|
|
|
|
+ circleAnnot?.SetBgColor(color);
|
|
|
|
+ history.CurrentParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, circleAnnot);
|
|
|
|
+ }
|
|
|
|
|
|
- if (viewControl != null && viewControl.PDFViewTool != null)
|
|
|
|
- {
|
|
|
|
|
|
+ if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_LINE)
|
|
|
|
+ {
|
|
|
|
+ CPDFLineAnnotation lineAnnot = annotCore as CPDFLineAnnotation;
|
|
|
|
+ if (lineAnnot == null || lineAnnot.BgColor.SequenceEqual(color)) return;
|
|
|
|
+ history.PreviousParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, lineAnnot);
|
|
|
|
+ lineAnnot?.SetBgColor(color);
|
|
|
|
+ history.CurrentParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, lineAnnot);
|
|
|
|
+ }
|
|
|
|
+ viewControl.GetCPDFViewer().UndoManager.AddHistory(history);
|
|
viewControl.UpdateAnnotFrame();
|
|
viewControl.UpdateAnnotFrame();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -155,30 +184,39 @@ namespace Compdfkit_Tools.PDFControlUI
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
-
|
|
|
|
if (annotCore != null && annotCore.IsValid())
|
|
if (annotCore != null && annotCore.IsValid())
|
|
{
|
|
{
|
|
- if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_SQUARE)
|
|
|
|
|
|
+ if (viewControl != null && Math.Abs(CPDFThicknessControl.Thickness - annotCore.GetBorderWidth()) > 0.01)
|
|
{
|
|
{
|
|
- CPDFSquareAnnotation squareAnnot = annotCore as CPDFSquareAnnotation;
|
|
|
|
- squareAnnot?.SetLineWidth(CPDFThicknessControl.Thickness);
|
|
|
|
- }
|
|
|
|
|
|
+ AnnotHistory history = GetHistory();
|
|
|
|
+ history.PDFDoc = viewControl.GetCPDFViewer().GetDocument();
|
|
|
|
+ history.Action = HistoryAction.Update;
|
|
|
|
|
|
- if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_CIRCLE)
|
|
|
|
- {
|
|
|
|
- CPDFCircleAnnotation circleAnnot = annotCore as CPDFCircleAnnotation;
|
|
|
|
- circleAnnot?.SetLineWidth(CPDFThicknessControl.Thickness);
|
|
|
|
|
|
+ if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_SQUARE)
|
|
|
|
+ {
|
|
|
|
+ CPDFSquareAnnotation squareAnnot = annotCore as CPDFSquareAnnotation;
|
|
|
|
+ history.PreviousParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, squareAnnot);
|
|
|
|
+ squareAnnot?.SetLineWidth(CPDFThicknessControl.Thickness);
|
|
|
|
+ history.CurrentParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, squareAnnot);
|
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_CIRCLE)
|
|
|
|
+ {
|
|
|
|
+ CPDFCircleAnnotation circleAnnot = annotCore as CPDFCircleAnnotation;
|
|
|
|
+ history.PreviousParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, circleAnnot);
|
|
|
|
+ circleAnnot?.SetLineWidth(CPDFThicknessControl.Thickness);
|
|
|
|
+ history.CurrentParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, circleAnnot);
|
|
|
|
|
|
- if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_LINE)
|
|
|
|
- {
|
|
|
|
- CPDFLineAnnotation lineAnnot = annotCore as CPDFLineAnnotation;
|
|
|
|
- lineAnnot?.SetLineWidth(CPDFThicknessControl.Thickness);
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- if (viewControl != null && viewControl.PDFViewTool != null)
|
|
|
|
- {
|
|
|
|
|
|
+ if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_LINE)
|
|
|
|
+ {
|
|
|
|
+ CPDFLineAnnotation lineAnnot = annotCore as CPDFLineAnnotation;
|
|
|
|
+ history.PreviousParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, lineAnnot);
|
|
|
|
+ lineAnnot?.SetLineWidth(CPDFThicknessControl.Thickness);
|
|
|
|
+ history.CurrentParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, lineAnnot);
|
|
|
|
+ }
|
|
|
|
+ viewControl.GetCPDFViewer().UndoManager.AddHistory(history);
|
|
viewControl.UpdateAnnotFrame();
|
|
viewControl.UpdateAnnotFrame();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -201,26 +239,35 @@ namespace Compdfkit_Tools.PDFControlUI
|
|
}
|
|
}
|
|
if (annotCore != null && annotCore.IsValid())
|
|
if (annotCore != null && annotCore.IsValid())
|
|
{
|
|
{
|
|
- if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_SQUARE)
|
|
|
|
|
|
+ if (viewControl != null && Math.Abs(opacity - annotCore.GetTransparency()) > 0.01)
|
|
{
|
|
{
|
|
- CPDFSquareAnnotation squareAnnot = annotCore as CPDFSquareAnnotation;
|
|
|
|
- squareAnnot?.SetTransparency((byte)opacity);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_CIRCLE)
|
|
|
|
- {
|
|
|
|
- CPDFCircleAnnotation circleAnnot = annotCore as CPDFCircleAnnotation;
|
|
|
|
- circleAnnot?.SetTransparency((byte)opacity);
|
|
|
|
- }
|
|
|
|
|
|
+ AnnotHistory history = GetHistory();
|
|
|
|
+ history.PDFDoc = viewControl.GetCPDFViewer().GetDocument();
|
|
|
|
+ history.Action = HistoryAction.Update;
|
|
|
|
+ if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_SQUARE)
|
|
|
|
+ {
|
|
|
|
+ CPDFSquareAnnotation squareAnnot = annotCore as CPDFSquareAnnotation;
|
|
|
|
+ history.PreviousParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, squareAnnot);
|
|
|
|
+ squareAnnot?.SetTransparency((byte)opacity);
|
|
|
|
+ history.CurrentParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, squareAnnot);
|
|
|
|
+ }
|
|
|
|
|
|
- if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_LINE)
|
|
|
|
- {
|
|
|
|
- CPDFLineAnnotation lineAnnot = annotCore as CPDFLineAnnotation;
|
|
|
|
- lineAnnot?.SetTransparency((byte)opacity);
|
|
|
|
- }
|
|
|
|
|
|
+ if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_CIRCLE)
|
|
|
|
+ {
|
|
|
|
+ CPDFCircleAnnotation circleAnnot = annotCore as CPDFCircleAnnotation;
|
|
|
|
+ history.PreviousParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, circleAnnot);
|
|
|
|
+ circleAnnot?.SetTransparency((byte)opacity);
|
|
|
|
+ history.CurrentParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, circleAnnot);
|
|
|
|
+ }
|
|
|
|
|
|
- if (viewControl != null && viewControl.PDFViewTool != null)
|
|
|
|
- {
|
|
|
|
|
|
+ if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_LINE)
|
|
|
|
+ {
|
|
|
|
+ CPDFLineAnnotation lineAnnot = annotCore as CPDFLineAnnotation;
|
|
|
|
+ history.PreviousParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, lineAnnot);
|
|
|
|
+ lineAnnot?.SetTransparency((byte)opacity);
|
|
|
|
+ history.CurrentParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, lineAnnot);
|
|
|
|
+ }
|
|
|
|
+ viewControl.GetCPDFViewer().UndoManager.AddHistory(history);
|
|
viewControl.UpdateAnnotFrame();
|
|
viewControl.UpdateAnnotFrame();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -256,30 +303,40 @@ namespace Compdfkit_Tools.PDFControlUI
|
|
borderStyle = C_BORDER_STYLE.BS_DASHDED;
|
|
borderStyle = C_BORDER_STYLE.BS_DASHDED;
|
|
}
|
|
}
|
|
|
|
|
|
- if (dashArray != null)
|
|
|
|
|
|
+ if (viewControl != null && viewControl.PDFViewTool != null)
|
|
{
|
|
{
|
|
|
|
+ AnnotHistory history = GetHistory();
|
|
|
|
+ history.PDFDoc = viewControl.GetCPDFViewer().GetDocument();
|
|
|
|
+ history.Action = HistoryAction.Update;
|
|
|
|
+
|
|
if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_SQUARE)
|
|
if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_SQUARE)
|
|
{
|
|
{
|
|
CPDFSquareAnnotation squareAnnot = annotCore as CPDFSquareAnnotation;
|
|
CPDFSquareAnnotation squareAnnot = annotCore as CPDFSquareAnnotation;
|
|
- squareAnnot?.SetBorderStyle(borderStyle, dashArray);
|
|
|
|
|
|
+ if(squareAnnot == null || squareAnnot.Dash.SequenceEqual(dashArray))return;
|
|
|
|
+ history.PreviousParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, squareAnnot);
|
|
|
|
+ squareAnnot.SetBorderStyle(borderStyle, dashArray);
|
|
|
|
+ history.CurrentParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, squareAnnot);
|
|
}
|
|
}
|
|
|
|
|
|
if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_CIRCLE)
|
|
if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_CIRCLE)
|
|
{
|
|
{
|
|
CPDFCircleAnnotation circleAnnot = annotCore as CPDFCircleAnnotation;
|
|
CPDFCircleAnnotation circleAnnot = annotCore as CPDFCircleAnnotation;
|
|
- circleAnnot?.SetBorderStyle(borderStyle, dashArray);
|
|
|
|
|
|
+ if (circleAnnot == null || circleAnnot.Dash.SequenceEqual(dashArray)) return;
|
|
|
|
+ history.PreviousParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, circleAnnot);
|
|
|
|
+ circleAnnot.SetBorderStyle(borderStyle, dashArray);
|
|
|
|
+ history.CurrentParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, circleAnnot);
|
|
}
|
|
}
|
|
|
|
|
|
if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_LINE)
|
|
if (annotCore.Type == C_ANNOTATION_TYPE.C_ANNOTATION_LINE)
|
|
{
|
|
{
|
|
CPDFLineAnnotation lineAnnot = annotCore as CPDFLineAnnotation;
|
|
CPDFLineAnnotation lineAnnot = annotCore as CPDFLineAnnotation;
|
|
- lineAnnot?.SetBorderStyle(borderStyle, dashArray);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (viewControl != null && viewControl.PDFViewTool != null)
|
|
|
|
- {
|
|
|
|
- viewControl.UpdateAnnotFrame();
|
|
|
|
|
|
+ if (lineAnnot == null || lineAnnot.Dash.SequenceEqual(dashArray)) return;
|
|
|
|
+ history.PreviousParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, lineAnnot);
|
|
|
|
+ lineAnnot.SetBorderStyle(borderStyle, dashArray);
|
|
|
|
+ history.CurrentParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, lineAnnot);
|
|
}
|
|
}
|
|
|
|
+ viewControl.UpdateAnnotFrame();
|
|
|
|
+ viewControl.GetCPDFViewer().UndoManager.AddHistory(history);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -299,11 +356,17 @@ namespace Compdfkit_Tools.PDFControlUI
|
|
if(annotCore.Type==C_ANNOTATION_TYPE.C_ANNOTATION_LINE)
|
|
if(annotCore.Type==C_ANNOTATION_TYPE.C_ANNOTATION_LINE)
|
|
{
|
|
{
|
|
CPDFLineAnnotation lineAnnot= annotCore as CPDFLineAnnotation;
|
|
CPDFLineAnnotation lineAnnot= annotCore as CPDFLineAnnotation;
|
|
- if(lineAnnot!=null)
|
|
|
|
|
|
+ if(lineAnnot!=null && viewControl != null)
|
|
{
|
|
{
|
|
- lineAnnot.SetLineType(CPDFArrowControl.LineType.HeadLineType, CPDFArrowControl.LineType.TailLineType);
|
|
|
|
- if (viewControl != null && viewControl.PDFViewTool != null)
|
|
|
|
|
|
+ if(lineAnnot.HeadLineType != CPDFArrowControl.LineType.HeadLineType || lineAnnot.TailLineType != CPDFArrowControl.LineType.TailLineType)
|
|
{
|
|
{
|
|
|
|
+ LineAnnotHistory history = new LineAnnotHistory();
|
|
|
|
+ history.PDFDoc = viewControl.GetCPDFViewer().GetDocument();
|
|
|
|
+ history.Action = HistoryAction.Update;
|
|
|
|
+ history.PreviousParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, lineAnnot);
|
|
|
|
+ lineAnnot.SetLineType(CPDFArrowControl.LineType.HeadLineType, CPDFArrowControl.LineType.TailLineType);
|
|
|
|
+ history.CurrentParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, lineAnnot);
|
|
|
|
+ viewControl.GetCPDFViewer().UndoManager.AddHistory(history);
|
|
viewControl.UpdateAnnotFrame();
|
|
viewControl.UpdateAnnotFrame();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -323,11 +386,16 @@ namespace Compdfkit_Tools.PDFControlUI
|
|
{
|
|
{
|
|
if (annotCore != null && annotCore.IsValid())
|
|
if (annotCore != null && annotCore.IsValid())
|
|
{
|
|
{
|
|
- annotCore.SetContent(NoteTextBox.Text);
|
|
|
|
-
|
|
|
|
- if (viewControl != null && viewControl.PDFViewTool != null)
|
|
|
|
|
|
+ if (viewControl != null && annotCore.GetContent()!=NoteTextBox.Text)
|
|
{
|
|
{
|
|
|
|
+ AnnotHistory history = GetHistory();
|
|
|
|
+ history.PDFDoc = viewControl.GetCPDFViewer().GetDocument();
|
|
|
|
+ history.Action = HistoryAction.Update;
|
|
|
|
+ history.PreviousParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, annotCore);
|
|
|
|
+ annotCore.SetContent(NoteTextBox.Text);
|
|
viewControl.UpdateAnnotFrame();
|
|
viewControl.UpdateAnnotFrame();
|
|
|
|
+ history.CurrentParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, annotCore.Page.PageIndex, annotCore);
|
|
|
|
+ viewControl.GetCPDFViewer().UndoManager.AddHistory(history);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|