|
@@ -10,8 +10,6 @@ using ComPDFKitViewer.Layer;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
-using System.Text;
|
|
|
-using System.Threading.Tasks;
|
|
|
using System.Windows.Input;
|
|
|
using System.Windows;
|
|
|
using ComPDFKit.Import;
|
|
@@ -20,12 +18,9 @@ using System.Windows.Controls;
|
|
|
using System.Windows.Media;
|
|
|
using static ComPDFKit.PDFAnnotation.CTextAttribute.CFontNameHelper;
|
|
|
using ComPDFKitViewer.Helper;
|
|
|
-using Microsoft.SqlServer.Server;
|
|
|
using ComPDFKit.Tool.Help;
|
|
|
-using System.Xml.Linq;
|
|
|
using ComPDFKit.Tool.SettingParam;
|
|
|
using ComPDFKit.Tool.UndoManger;
|
|
|
-using System.Windows.Controls.Primitives;
|
|
|
using ComPDFKit.Measure;
|
|
|
using System.Dynamic;
|
|
|
|
|
@@ -53,13 +48,14 @@ namespace ComPDFKit.Tool
|
|
|
BaseAnnot caheMoveAnnot;
|
|
|
BaseAnnot cacheHitTestAnnot;
|
|
|
bool isCacheRedaction = false;
|
|
|
- int createAnnotTag = -1;
|
|
|
int selectedPageIndex = -1;
|
|
|
int selectedAnnotIndex = -1;
|
|
|
bool canSave = true;
|
|
|
bool isHitTestLink = false;
|
|
|
bool isHitTestRedact = false;
|
|
|
+
|
|
|
public event EventHandler<MeasureEventArgs> MeasureChanged;
|
|
|
+ internal int CreateAnnotTag { get; private set; } = -1;
|
|
|
|
|
|
public void InvokeMeasureChangeEvent(object sender, MeasureEventArgs e)
|
|
|
{
|
|
@@ -127,7 +123,7 @@ namespace ComPDFKit.Tool
|
|
|
|
|
|
protected bool AnnotHitTest()
|
|
|
{
|
|
|
- BaseAnnot baseAnnot = PDFViewer.AnnotHitTest(true);
|
|
|
+ BaseAnnot baseAnnot = PDFViewer.AnnotHitTest();
|
|
|
if (baseAnnot != null)
|
|
|
{
|
|
|
if ((baseAnnot as BaseWidget) != null)
|
|
@@ -135,11 +131,15 @@ namespace ComPDFKit.Tool
|
|
|
cacheHitTestAnnot = null;
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
cacheHitTestAnnot = baseAnnot;
|
|
|
return true;
|
|
|
}
|
|
|
- cacheHitTestAnnot = baseAnnot;
|
|
|
- return false;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ cacheHitTestAnnot = null;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void SelectedAnnotForIndex(int pageIndex, int annotIndex)
|
|
@@ -166,7 +166,7 @@ namespace ComPDFKit.Tool
|
|
|
CreateAnnotTool createAnnotTool = new CreateAnnotTool(GetMeasureSetting(), GetDefaultDrawParam(), GetDefaultSettingParam());
|
|
|
int annotViewindex = PDFViewer.GetMaxViewIndex();
|
|
|
PDFViewer.InsertView(annotViewindex, createAnnotTool);
|
|
|
- createAnnotTag = createAnnotTool.GetResTag();
|
|
|
+ CreateAnnotTag = createAnnotTool.GetResTag();
|
|
|
createAnnotTool.UpdateAnnotHandler += CreateAnnotTool_UpdateAnnotHandler;
|
|
|
createAnnotTool.CreateFreetextCanceled += CreateAnnotTool_CreateFreetextCanceled;
|
|
|
createAnnotTool.MeasureChanged += CreateAnnotTool_MeasureChanged;
|
|
@@ -206,7 +206,7 @@ namespace ComPDFKit.Tool
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
- BaseLayer baseLayer = PDFViewer.GetViewForTag(createAnnotTag);
|
|
|
+ BaseLayer baseLayer = PDFViewer.GetViewForTag(CreateAnnotTag);
|
|
|
(baseLayer as CreateAnnotTool).SetIsProportionalScaling(isProportionalScaling);
|
|
|
}
|
|
|
|
|
@@ -216,7 +216,7 @@ namespace ComPDFKit.Tool
|
|
|
{
|
|
|
return 0;
|
|
|
}
|
|
|
- BaseLayer baseLayer = PDFViewer.GetViewForTag(createAnnotTag);
|
|
|
+ BaseLayer baseLayer = PDFViewer.GetViewForTag(CreateAnnotTag);
|
|
|
return (baseLayer as CreateAnnotTool).GetMoveLength();
|
|
|
}
|
|
|
|
|
@@ -228,7 +228,7 @@ namespace ComPDFKit.Tool
|
|
|
}
|
|
|
|
|
|
Point point = Mouse.GetPosition(this);
|
|
|
- BaseLayer baseLayer = PDFViewer.GetViewForTag(createAnnotTag);
|
|
|
+ BaseLayer baseLayer = PDFViewer.GetViewForTag(CreateAnnotTag);
|
|
|
PDFViewer.GetPointPageInfo(point, out int index, out Rect paintRect, out Rect pageBound);
|
|
|
if (index < 0)
|
|
|
{
|
|
@@ -271,7 +271,7 @@ namespace ComPDFKit.Tool
|
|
|
return;
|
|
|
}
|
|
|
Point point = Mouse.GetPosition(this);
|
|
|
- BaseLayer baseLayer = PDFViewer.GetViewForTag(createAnnotTag);
|
|
|
+ BaseLayer baseLayer = PDFViewer.GetViewForTag(CreateAnnotTag);
|
|
|
PDFViewer.GetPointPageInfo(point, out int index, out Rect paintRect, out Rect pageBound);
|
|
|
if (index < 0)
|
|
|
{
|
|
@@ -309,7 +309,7 @@ namespace ComPDFKit.Tool
|
|
|
return;
|
|
|
}
|
|
|
Point point = Mouse.GetPosition(this);
|
|
|
- BaseLayer baseLayer = PDFViewer.GetViewForTag(createAnnotTag);
|
|
|
+ BaseLayer baseLayer = PDFViewer.GetViewForTag(CreateAnnotTag);
|
|
|
(baseLayer as CreateAnnotTool).MoveDraw(point, PDFViewer.GetZoom());
|
|
|
}
|
|
|
|
|
@@ -320,7 +320,7 @@ namespace ComPDFKit.Tool
|
|
|
return;
|
|
|
}
|
|
|
Point point = Mouse.GetPosition(this);
|
|
|
- BaseLayer baseLayer = PDFViewer.GetViewForTag(createAnnotTag);
|
|
|
+ BaseLayer baseLayer = PDFViewer.GetViewForTag(CreateAnnotTag);
|
|
|
(baseLayer as CreateAnnotTool).CreateTextBox();
|
|
|
}
|
|
|
|
|
@@ -330,7 +330,7 @@ namespace ComPDFKit.Tool
|
|
|
{
|
|
|
return new Rect();
|
|
|
}
|
|
|
- BaseLayer baseLayer = PDFViewer.GetViewForTag(createAnnotTag);
|
|
|
+ BaseLayer baseLayer = PDFViewer.GetViewForTag(CreateAnnotTag);
|
|
|
return (baseLayer as CreateAnnotTool).EndDraw();
|
|
|
}
|
|
|
|
|
@@ -539,25 +539,25 @@ namespace ComPDFKit.Tool
|
|
|
|
|
|
public Point GetStartPoint()
|
|
|
{
|
|
|
- BaseLayer baseLayer = PDFViewer.GetViewForTag(createAnnotTag);
|
|
|
+ BaseLayer baseLayer = PDFViewer.GetViewForTag(CreateAnnotTag);
|
|
|
return (baseLayer as CreateAnnotTool).GetStartPoint();
|
|
|
}
|
|
|
|
|
|
public Point GetEndPoint()
|
|
|
{
|
|
|
- BaseLayer baseLayer = PDFViewer.GetViewForTag(createAnnotTag);
|
|
|
+ BaseLayer baseLayer = PDFViewer.GetViewForTag(CreateAnnotTag);
|
|
|
return (baseLayer as CreateAnnotTool).GetEndPoint();
|
|
|
}
|
|
|
|
|
|
public List<Point> GetInkDrawPoints()
|
|
|
{
|
|
|
- BaseLayer baseLayer = PDFViewer.GetViewForTag(createAnnotTag);
|
|
|
+ BaseLayer baseLayer = PDFViewer.GetViewForTag(CreateAnnotTag);
|
|
|
return (baseLayer as CreateAnnotTool).GetInkDrawPoints();
|
|
|
}
|
|
|
|
|
|
public List<Point> GetMeasureDrawPoints()
|
|
|
{
|
|
|
- BaseLayer baseLayer = PDFViewer.GetViewForTag(createAnnotTag);
|
|
|
+ BaseLayer baseLayer = PDFViewer.GetViewForTag(CreateAnnotTag);
|
|
|
return (baseLayer as CreateAnnotTool).GetMeasureDrawPoints();
|
|
|
}
|
|
|
|
|
@@ -568,7 +568,7 @@ namespace ComPDFKit.Tool
|
|
|
return new Rect();
|
|
|
}
|
|
|
Point point = Mouse.GetPosition(this);
|
|
|
- BaseLayer baseLayer = PDFViewer.GetViewForTag(createAnnotTag);
|
|
|
+ BaseLayer baseLayer = PDFViewer.GetViewForTag(CreateAnnotTag);
|
|
|
return (baseLayer as CreateAnnotTool).GetMaxRect();
|
|
|
}
|
|
|
|
|
@@ -579,7 +579,7 @@ namespace ComPDFKit.Tool
|
|
|
return;
|
|
|
}
|
|
|
Point point = Mouse.GetPosition(this);
|
|
|
- BaseLayer baseLayer = PDFViewer.GetViewForTag(createAnnotTag);
|
|
|
+ BaseLayer baseLayer = PDFViewer.GetViewForTag(CreateAnnotTag);
|
|
|
(baseLayer as CreateAnnotTool).ClearDraw();
|
|
|
}
|
|
|
|
|
@@ -810,7 +810,7 @@ namespace ComPDFKit.Tool
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- BaseLayer createAnnotTool = PDFViewer?.GetView(createAnnotTag) as CreateAnnotTool;
|
|
|
+ BaseLayer createAnnotTool = PDFViewer?.GetView(CreateAnnotTag) as CreateAnnotTool;
|
|
|
if (createAnnotTool != null)
|
|
|
{
|
|
|
createAnnotTool.Children.Add(textBorder);
|
|
@@ -931,7 +931,7 @@ namespace ComPDFKit.Tool
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
- BaseLayer removeLayer = PDFViewer?.GetView(createAnnotTag) as CreateAnnotTool;
|
|
|
+ BaseLayer removeLayer = PDFViewer?.GetView(CreateAnnotTag) as CreateAnnotTool;
|
|
|
removeLayer.Children.Remove(textBorder);
|
|
|
}
|
|
|
|